Skip to main content

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).

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).

Request

Responses

OK

Response Headers
    Content-Type