purchaseOrders
Módulo Procurement · 7 operaciones
List purchase order rows
GET/purchase-orders
A purchase order. Its creator cannot approve it; spend authority applies inside the approval RPC. Returns a cursor page of purchase order rows the caller may see. The default order is `created_at` ascending. Supports sparse fieldsets and the filter grammar.
Create a purchase order
POST/purchase-orders
A purchase order. Its creator cannot approve it; spend authority applies inside the approval RPC. Creates a purchase order. Requires `Idempotency-Key`; a replay returns the original response. The organization is derived from the credential or the parent row, never from the body.
Get a purchase order
GET/purchase-orders/{id}
A purchase order. Its creator cannot approve it; spend authority applies inside the approval RPC. Returns one purchase order with its `ETag`. A purchase order the caller may not see returns 404.
Update a purchase order
PATCH/purchase-orders/{id}
A purchase order. Its creator cannot approve it; spend authority applies inside the approval RPC. Updates the fields sent; omitted fields are unchanged. Requires `If-Match` with the current `ETag`: a stale tag returns 412 and a missing tag returns 428.
Approve a purchase order
POST/purchase-orders/{id}/approve
Records an approval through app.approve_purchase_order: finance.po.approve on the project, never by the order's creator (sod_po_creator), fully priced, within spend authority. Above the dual threshold the order stays Proposed until a second approver approves; a refusal returns 422 and names the rule. Requires `Idempotency-Key`; a replay returns the original response. A rule that refuses the request returns 422 with `refusal` and `reason`.
Transition the purchase order state
POST/purchase-orders/{id}/transitions
Moves the purchase order lifecycle to another state through its transition RPC, which writes the transition ledger. Uses compare-and-set on `expected_state`; a disallowed transition returns a 422 refusal. Requires `Idempotency-Key`; a replay returns the original response. A rule that refuses the request returns 422 with `refusal` and `reason`.
Acknowledge a purchase order
POST/purchase-orders/{id}/acknowledge
Records the vendor's acknowledgment of the purchase order. Requires `Idempotency-Key`; a replay returns the original response. A rule that refuses the request returns 422 with `refusal` and `reason`.