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.
Use this from the 3-Way Match view 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 (validated via Rule::exists with where purchase_invoice_id).
- 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.').
Request
Responses
- 200
Successful response