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

E087: Create BOM

POST /api/boms

Creates the recipe linking input materials and input SKUs to an output SKU. Triggered from the BOM page or from BOM Detail for a SKU that doesn't yet have a recipe. The header and items are inserted atomically.

Authentication

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

Request

{
"outputSkuId": "uuid",
"items": [
{ "materialId": "uuid", "quantity": 2.0 },
{ "inputSkuId": "uuid", "quantity": 1 }
]
}

Each item is a material input (materialId) or a sub-assembly SKU input (inputSkuId) — exactly one, never both — with quantity > 0. Multi-level BOMs are supported: a sub-SKU input has its own BOM, which the cost cascade recurses through.

Response — 201 Created

{
"outputSkuId": "uuid",
"items": [ BomItem ]
}

Each BomItem is { "id", "orgId", "skuId", "materialId", "inputSkuId", "quantity", "createdAt" } (one of materialId / inputSkuId is null).

Errors

HTTPcodeCondition
404not_foundOutput SKU, or an input material/SKU, not found.
422validation_failedSKU already has a BOM (duplicate), or shape invalid (item not exactly one of materialId / inputSkuId, quantity <= 0, self-reference where input SKU equals output SKU).

Workflow

Calls W087 Create BOM.