Variance Resolution Preview
GET/api/purchase-invoices/:purchaseInvoice/variance-resolution-preview
Preview over-billed quantities per PO line so the UI can prefill a 'Resolve with vendor credit' dialog.
purchase-orders:readGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Authentication: Requires Bearer token.
A line is considered over-billed when its effective invoiced quantity (quantity_invoiced minus quantity already credited on this bill via existing vendor credit allocations) exceeds the PO line's effective received quantity. Receipt sources match PurchaseOrderLine::getEffectiveReceivedQuantity (standard warehouse receipts, FBA/AWD ledgers, accounting for any active short-close event).
The suggested credit quantity is exactly the over-bill delta. The suggested credit amount is over_billed * unit_price (invoice unit price, falling back to PO amount).
Response fields:
invoice_id,purchase_order_id,supplier_id,currency_id,currency_codehas_over_bills: true if any line has over-billed quantitytotal_suggested_credit: sum ofsuggested_credit_amountacross over-billed lineslines[]: only includes lines with over-billed quantity. Each line haspurchase_invoice_line_id,purchase_order_line_id,product_id,sku,product_name,quantity_invoiced,received_quantity,already_credited,over_billed_quantity,suggested_credit_quantity,unit_price,suggested_credit_amount.
Request
Responses
- 200
- 401
- 403
- 404
- 429
OK
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.