Apply OCR Results to Vendor Credit
POST/api/vendor-credits/:vendorCredit/ocr-apply
Apply reviewed OCR extraction results onto an existing vendor credit (header values and/or lines).
accounting:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
IMPORTANT: the payload is FLAT — supplier_reference, credit_date, and vendor_credit_note are top-level fields. There is no header wrapper object.
Body fields:
- extraction_id: required integer, must exist in vendor_credit_ocr_extractions
- line_mode: optional string, append or replace (how extracted lines are merged into the credit's existing lines)
- supplier_reference: optional (sometimes) nullable string, max 255
- credit_date: optional (sometimes) nullable date
- vendor_credit_note: optional (sometimes) nullable string
- lines: optional array
Line fields (per element of lines):
- quantity: required, numeric, min 1
- amount: required, numeric, must be less than 100000
- purchase_order_line_id: optional integer (existing PO line)
- product_id: optional integer (existing product)
- description: optional string, max 255
- unit_cost: optional numeric
- nominal_code_id: optional integer (for non-product/financial lines)
- is_product: optional boolean
- restock_inventory: optional boolean
Returns 200 on success. Returns 422 with a message when the manager rejects the apply (e.g. invalid state).
Reference fields:
vendor_credit_number(string, max 255) — The supplier's credit memo number. On create it becomes the credit's number (falls back to the OCR-detectedcredit_number, auto-generatesVC-xxxxxif taken). On apply it renames the credit — skipped silently if another credit already uses that number.supplier_po_number(string, max 255) — The PO number printed on the supplier's memo, recorded as TEXT only (defaults from the OCR-detectedpo_numberon create). It does not link a purchase order; usepurchase_order_idfor an actual link.supplier_reference(string, max 255) — Any additional reference on the document (e.g. the vendor's internal credit-order number). No longer auto-filled with the memo number.
Request
Responses
- 200
- 401
- 403
- 404
- 422
- 429
OK
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 — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
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.