Skip to main content
Version: v1.0.0(int)

E117: Add item to purchase order

POST /api/purchase-orders/:id/items

Appends a new line to an existing PO. Triggered from the Purchase Order Detail items section. If the PO has already moved past Planning, the workflow also writes a matching ORDER ledger entry so on-order quantities stay accurate.

Authentication

Standard tenant route. Requires Authorization: Bearer <firebase-id-token> and X-Org-Id: <org-id>. Access: Member.

Request

{
"materialId": "uuid",
"skuId": null,
"quantity": 100,
"unitCost": 12.34
}

Exactly one of materialId / skuId is required, matching the PO's targetType.

Response — 201 Created

{
"id": "uuid",
"poId": "uuid",
"materialId": "uuid",
"skuId": null,
"quantity": 100,
"unitCost": 12.34
}

Errors

HTTPcodeCondition
404not_foundPO, material, or SKU does not exist.
409conflictA receipt exists against the PO — line items are locked.
422validation_failedmaterialId/skuId does not match targetType, or quantity/cost shape invalid.

Workflow

Calls W117 Add item to purchase order.