Resolve with Vendor Credit
POST/api/purchase-invoices/:purchaseInvoice/resolve-with-credit
Resolve an over-billed purchase invoice by issuing a vendor credit for the over-billed quantities and auto-allocating it against the bill.
purchase-orders:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Authentication: Requires Bearer token.
The credit is created in open status with restock_inventory=false (it's a billing correction, not a physical return). After the credit is allocated, the invoice's approval status is re-evaluated so the variance flag clears automatically when the credit fully offsets the over-bill.
Request body fields:
lines(required, min 1): array of{ purchase_order_line_id, quantity }. Eachquantitymust be > 0 and ≤ the over-billed quantity for that PO line.credit_date(optional, nullable, date): defaults to today.supplier_reference(optional, nullable, max 255): defaults to the invoice'ssupplier_invoice_number.reason(optional, nullable, max 2000): copied into the vendor credit's note.
Validation errors return 422 with a message for: invoice not linked to a PO, PO line not on this invoice, PO line not on this invoice's PO, requested quantity exceeds over-billed delta, or no over-billed quantities provided.
Returns the newly created VendorCredit (eager-loaded with supplier, currency, lines, and allocations).
Request
Responses
- 201
- 401
- 403
- 404
- 422
- 429
Created
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.
Unprocessable Entity
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.