Create Purchase Order Invoice
POST/api/supplier-portal/purchase-orders/:purchaseOrder/invoices
Submit an invoice against one of your purchase orders — from its lines (flip) or as your own PDF without lines (upload). The invoice goes to the buyer's accounts-payable review and is never approved automatically. Send as JSON, or multipart/form-data when attaching a file.
Called by a B2B portal buyer with the bearer token POST /api/portal/auth/login returns (or the buyer's feed key) — not with a staff Personal Access Token.
Fields: mode (required: flip = invoice from the PO lines, upload = your PDF only, no lines), supplier_invoice_number (required, max 100, unique across all of the buyer's invoices for your supplier, case-insensitive), invoice_date (required, YYYY-MM-DD, not more than 1 day in the future), note (optional, max 2000; added as a note on the buyer's invoice), attachment (file: pdf, png, jpg, jpeg, max 10 MB; required for upload on create), stated_total (upload only, required, number >= 0.01 — the total on your PDF), lines (flip only, optional; omitted = every invoiceable line at its full invoiceable quantity and PO unit cost): lines[].purchase_order_line_id (required), lines[].quantity (required, >= 0; 0 = not on this invoice; repeated lines are summed), lines[].unit_cost (optional, >= 0; default the PO unit cost).
Caps: each line's quantity must not exceed what was received (warehouse orders) or shipped (dropship orders) and is not yet invoiced on any invoice; checked under a lock against the order's current state. Review flags (never blocking; returned as warnings and shown as under_review): price_variance when a unit cost differs from the PO cost; qty_variance when a line bills fewer units than were received/shipped and not yet invoiced at submit. Billing exactly the invoiceable quantity at PO cost is clean (submitted).
Errors: 422 validation (incl. quantity over the cap), 422 duplicate invoice number with existing_invoice (always one of your own invoices), 409 not_invoiceable (reason canceled | nothing_to_invoice), 404. Rate limited: 20 per minute.
Request
Responses
- 201
- 401
- 403
- 404
- 409
- 422
- 429
Created
Response Headers
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
Response Headers
Conflict
Response Headers
Unprocessable Entity
Response Headers
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.