Set a product's bill of materials
distru-set-product-bill-of-materialsWriteCreates, updates or removes a product's bill of materials: what one unit of the product takes, and the costs it adds.
Inputs
Every tool also takes the common inputs.
| Field | Type | Required | Description |
|---|---|---|---|
| productId | string | Yes | The product the bill makes. Resolve via distru-search-products. |
| name | string | No | Defaults to the product's name when creating the bill. |
| description | string or null | No | Send null to clear it. |
| inputs | object[] or null | No | What one unit of the product takes. Replaces the whole list when sent; required to create the bill. Send null, alone, to remove the bill with its costs. |
| inputs[]. | string or number | Yes | Per one unit of the product, in the input product's unit type, or in unitTypeId for anyProductMatching. |
| inputs[]. | string | No | A fixed product, active or inactive; not a deleted product nor the product itself. Resolve via distru-search-products. |
| inputs[]. | object | No | Any product meeting every listed condition (any entry within a list; {} sets none) whose unit type has the same measure (count, volume or weight) as unitTypeId; its quantity is converted to unitTypeId. |
| inputs[]. | string[] | No | Resolve via distru-search-lookups (type PRODUCT_CATEGORY). |
| inputs[]. | string[] | No | Each must belong to a category in oneOfProductCategoryIds. Resolve via distru-search-lookups (type PRODUCT_CATEGORY, each row's subcategories). |
| inputs[]. | string[] | No | Resolve via distru-search-lookups (type PRODUCT_GROUP). |
| inputs[]. | string[] | No | From the strain on distru-search-products rows. |
| inputs[]. | string[] | No | Resolve via distru-search-lookups (type PRODUCT_TAG). |
| inputs[]. | string | No | Required with anyProductMatching, refused with productId. Resolve via distru-search-lookups (type UNIT_TYPE). |
| costs | object[] | No | Replaces the whole list when sent; [] removes every cost. |
| costs[]. | string | Yes | Resolve via distru-search-lookups (type COST_TYPE). |
| costs[]. | string or number | Yes | Cost type units per one unit of the product. |
| costs[]. | string | No |
Output
Presence on a nested field assumes its parent exists.
| Field | Type | Presence |
|---|---|---|
| billOfMaterials | object | Can be null |
| billOfMaterials. | string | Always |
| billOfMaterials. | string | Can be null |
| billOfMaterials. | object[] | Always |
| billOfMaterials. | string | Always |
| billOfMaterials. | object | Can be null |
| billOfMaterials. | string | Always |
| billOfMaterials. | string | Always |
| billOfMaterials. | object | Can be null |
| billOfMaterials. | string | Always |
| billOfMaterials. | string | Always |
| billOfMaterials. | string | Can be null |
| billOfMaterials. | object | Can be null |
| billOfMaterials. | object[] | Can be absent |
| billOfMaterials. | string | Always |
| billOfMaterials. | string | Always |
| billOfMaterials. | object[] | Can be absent |
| billOfMaterials. | string | Always |
| billOfMaterials. | string | Always |
| billOfMaterials. | object[] | Can be absent |
| billOfMaterials. | string | Always |
| billOfMaterials. | string | Always |
| billOfMaterials. | object[] | Can be absent |
| billOfMaterials. | string | Always |
| billOfMaterials. | string | Always |
| billOfMaterials. | object[] | Can be absent |
| billOfMaterials. | string | Always |
| billOfMaterials. | string | Always |
| billOfMaterials. | object[] | Always |
| billOfMaterials. | object | Always |
| billOfMaterials. | string | Always |
| billOfMaterials. | string | Always |
| billOfMaterials. | string | Always |
| billOfMaterials. | string | Can be null |
What the AI reads
Creates, updates or removes a product's bill of materials: what one unit of the product takes, and the costs it adds. A product has at most one bill. Read the current bill with distru-get-product (includeBillOfMaterials). Sparse update: only the fields passed change and the rest stay as they are; inputs and costs, when passed, replace the whole list. inputs: null removes the bill with its costs. Returns the bill in distru-get-product's shape, or null after removal. The bill pre-fills new assemblies in the Distru web app; distru-create-assembly does not read it, and existing assemblies keep their inputs. It never changes the product's cost or inventory.