Product

Upsert a product bill of materials

Creates or updates the bill of materials of a product: the inputs and additional costs it takes to make one unit of it. A product has at most one bill, so there is no bill id to pass: the first call creates it, later calls update it. Returns the bill exactly as GET /public/v1/products/{id} shows it.

Creating needs at least one input (in product_inputs or dynamic_inputs); name defaults to the product's name. Updates are sparse: a field you omit keeps its stored value, and description: null clears the description. product_inputs, dynamic_inputs and costs each replace their whole list when sent and are left untouched when omitted. Within a sent list, an entry with the id of a stored row patches that row with only the fields it carries; an entry without id is added; a stored row whose id you leave out is deleted. The two input lists together must keep at least one input: to remove the bill, use DELETE /public/v1/products/{id}/bill-of-materials.

A product input names a product to consume; its quantity is in that product's unit type. Inactive products can be inputs; deleted products and the product itself cannot, and a product that is not package-tracked cannot take a package-tracked input. A dynamic input takes any product that meets every condition list you fill (any entry within a list) and whose unit type measures the same thing as unit_type_id (count, weight or volume); its quantity is in unit_type_id and is converted to the matching product's unit type. Every quantity is per one unit of this product. For BioTrack companies the inputs must also be valid ingredients for the product's BioTrack inventory type.

The bill is a recipe only. It pre-fills the inputs and additional costs of new manufacturing assemblies created in the Distru web app; assemblies created through the API do not read it, and existing assemblies keep their own inputs. It creates, reserves or consumes no inventory, never changes the product's cost, and syncs nothing to Metrc or BioTrack. The operation is all-or-nothing: if any entry is rejected, nothing is changed.

Requires the Core module (otherwise 403). Required permission: products_permissions_edit (plus access to the product under team restrictions).

post/public/v1/products/{id}/bill-of-materials

Path parameters

idstring required

ID of the product whose bill this is. An ID that doesn't exist for your company, or a deleted product, returns 404.

Request body

namestring

Name of the bill. Defaults to the product's name on create; omit to keep the stored name. Cannot be null.

descriptionstring

Free-text description. Omit to keep the stored one; send null to clear it.

Response

The product's bill of materials

Changes

Changed in 1 of the 9 revisions of this API.1