Skip to main content

Create Draft PO from Order Document

POST 

/api/purchase-orders/from-document/:id/create-purchase-order

A vendor's order sheet, a photo of it, or a trade-show market-app export becomes a reviewed DRAFT purchase order.

Required scope: purchase-orders:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Authentication: Requires Bearer token. Permission: purchase_orders.create. Token scope: purchase-orders:write.

Creates a DRAFT purchase order (origin: document) from the reviewed lines and marks the extraction confirmed. The vendor's order number is recorded in the PO's internal notes. With remember_vendor_skus (default true), each kept line's vendor SKU is saved on the supplier product when it has none and no other product of the supplier holds it, so the next sheet matches on SKU. A second create from the same document is refused with 422.

Body:

  • supplier_id (required)
  • destination_warehouse_id (optional; defaults to the upload's, then the purchasing default warehouse)
  • currency_code (optional; defaults to the document's, then the supplier's pricing-tier currency)
  • vendor_order_number, purchase_order_date, estimated_delivery_date (optional)
  • remember_vendor_skus (optional, boolean)
  • lines (required, 1–2000): product_id (required), quantity (> 0), unit_cost (>= 0), line_id (the extracted line it came from), description (optional)

Request​

Responses​

OK

Response Headers
    Content-Type