Skip to main content

Sync PO Prices Bulk

POST 

/api/purchase-invoices/:purchaseInvoice/sync-po-prices

Sync PO line prices from many invoice lines on a single invoice in one request, then re-evaluate the invoice's approval status once at the end.

Required scope: purchase-orders:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Use this when several lines have confirmed price variances. Each invoice line is processed individually using the same logic as POST /api/purchase-invoices/:purchaseInvoice/lines/:purchaseInvoiceLine/sync-po-price, and the final results are returned keyed by purchase_invoice_line_id. Works on both open and closed POs.

Authentication: Requires Bearer token.

Request body fields:

  • purchase_invoice_line_ids (integer[], required, min 1): IDs of invoice lines to sync. Each must belong to this purchase invoice.
  • notes (string, optional, max 1000): free-text justification stored on each activity log entry.

Per-line result statuses (same as single endpoint):

  • updated: PO line amount changed; old_amount and new_amount are returned.
  • unchanged: PO line amount already matched invoice line unit price.
  • skipped: nothing was done; reason is one of 'invoice line not found on this invoice', 'invoice line not linked to a PO line', 'invoice line has no unit price'.

The top-level message summarises counts (e.g. 'Synced 2 line(s); 1 unchanged; 0 skipped.').

A sync re-evaluates the bill's approval, so it is refused with 422 when a person has already approved or rejected the bill (approval_status approved or rejected); the sync would otherwise replace that decision. For an approved bill, change the price on the purchase order itself; for a rejected bill, resubmit it for approval first. Bills that were approved automatically can still be synced.

Request​

Responses​

OK