Create an assembly from a bill of materials
Create a PENDING assembly that makes quantity of a product from its
bill of materials, as GET /public/v1/products/{id}
returns it, without building the inputs yourself. The bill is read when you call this, so the
assembly follows the bill as it is now.
The assembly has one PENDING output: product_id, quantity at location_id. Each line of
the bill becomes one input at location_id in input_status, its quantity multiplied by
quantity:
• A product input uses its product.
• A dynamic input uses the product you pick for it in inputs. Otherwise it uses the product it
took the last time this product was made: the matching input of the latest output of
product_id in an assembly someone created, in Distru or through this API (not one Distru made
itself, such as a package split or an inline repackage), whatever its status or location, that
your teams can see. Each of that output's inputs fills at most one dynamic input: the one whose
quantity it had (scaled to that output's quantity) first, then the closest. product_id itself
is used only when you pick it. A product input or a pick is used even when it is inactive; last
time's product only when it is still active. Its quantity is
converted from the unit of the input's unit_type to that product's unit (they share a unit
category). How Distru picks a product may get better over time; pick it yourself to control it.
• A sub-recipe input is filled by its own product or rules like any other input; the other
bill it points to is not expanded.
The bill's costs are added to the output, each quantity multiplied by quantity, at the cost
type's cost per unit. They are added only when you may apply costs to assemblies (cost
accounting on and costs_permissions_apply_to_assemblies); otherwise the output has no costs.
Inventory: each DRAFT input reserves its quantity of its product at
location_id without claiming a batch or package, like a DRAFT input sent to
POST /public/v1/assemblies. Stock is not checked: an input is created
however little of its product is in stock. Nothing is consumed or produced until the assembly is
completed. To pick batches or packages, change costs or other fields, or complete it, update the
assembly with POST /public/v1/assemblies.
Nothing is created when the request is rejected with a 400:
• The product has no bill of materials, or its bill has costs only and no inputs (pointer
product_id). Create that assembly with its inputs through
POST /public/v1/assemblies.
• A product input's product is deleted (pointer product_id; the message names it). Remove it
from the bill.
• A product input's product is one your teams can't see (pointer product_id).
• A dynamic input you left out of inputs has no product from last time: the product was never
made before, its last assembly used no product matching the input's rules, or that product is
inactive now (pointer inputs; the message names the input by its place in the bill's
dynamic_inputs, as dynamic_inputs[i], and its rules). Pick a product for it in inputs.
• A pick names an input that is not one of the bill's dynamic inputs (pointer
inputs[i].bill_of_materials_input_id), a product that doesn't exist or your teams can't see,
or one the input's rules don't accept (pointer inputs[i].product_id).
• Two picks name the same input (pointer inputs).
• A required assembly custom field is missing (pointer custom_data).
Metrc and non-compliance (NONE) licenses only; BioTrack is not supported.
Required permission: assemblies_permissions_create, and assembly visibility other than
"Restrict access" on your teams (admins are always allowed).
BearerAuthorizationBearer <token>API token generated in Distru (Settings → Distru API). Send it on every request as Authorization: Bearer YOUR_API_TOKEN.
The product to make from its bill of materials
application/json- body
The product to make, how much, where, and optional picks for its dynamic inputs
custom_data?A map of custom field IDs to their values for the assembly, as POST /public/v1/assemblies takes it. Use GET /public/v1/custom-fields?parent_object=assembly to retrieve the available fields, their IDs, and their types. A required assembly custom field must be set here, or the request is rejected with a 400.
input_status*"DRAFT"The status every input is created in. Required, with no default.
• DRAFT: each input gets its product and quantity and reserves that quantity at location_id, with no batch or package. Pick batches or packages later with POST /public/v1/assemblies.
"DRAFT"inputs?array<>Your own picks for dynamic inputs; each wins over last time's product. At most one per dynamic input. Omit, or leave an input out, to use the product the input took the last time this product was made.
location_id*stringThe location ID the output is produced into and every input reserves from. Must be a location of your company.
product_id*stringThe product to make. Must have a bill of materials. A product that doesn't exist for your company, is deleted, or that your team restrictions hide is rejected with a 400.
quantity*numberHow much of the product to make, in its unit. Must be > 0. Every input and cost quantity of the bill is multiplied by it.
The created assembly
*/*- response
A single assembly
data?A production job that turns input inventory (ingredients/components) into one or more finished output products — for example packaging bulk flower into units or producing pre-rolls.
curl -X POST 'https://app.distru.com/public/v1/assemblies/from_bill_of_materials' \ -H 'Content-Type: application/json' \ -d '{ "custom_data": { "77": "V" }, "input_status": "DRAFT", "inputs": [ { "bill_of_materials_input_id": "00000000-0000-0000-0000-000000000065", "product_id": "prod_f3005577-a097-4ef5-a4ab-e37ba160a1e1" } ], "location_id": "loc_961", "product_id": "prod_ac85f292-f301-43d5-9d12-23dda4d870cf", "quantity": 4}'{ "data": { "assembly_number": "AS-0000002", "completion_datetime": null, "compliance_type": "NONE", "creation_source": "MANUALLY_CREATED", "creator": { "banned": false, "deleted_at": null, "email": "[email protected]", "full_name": "FirstName3460 LastName3461", "id": "00000000-0000-0000-0000-0000000010b0", "inserted_datetime": "2026-11-23T19:40:44.340424Z", "role": { "id": "00000000-0000-0000-0000-000000001259", "name": "Admin 1778" }, "updated_datetime": "2026-11-23T19:40:44.340424Z" }, "custom_data": [ { "id": 77, "name": "Custom Field 28", "value": "V" } ], "description": null, "estimated_start_date": null, "estimated_start_datetime": null, "estimated_work_hours": null, "estimated_work_minutes": null, "fulfilled": false, "id": "c9722c4e-57af-4fe6-af53-6e37292a17a9", "inserted_datetime": "2026-11-23T19:40:45.072208Z", "is_metrc_processing_job": false, "license": null, "metrc_processing_job": null, "metrc_processing_job_id": null, "metrc_processing_job_name": null, "metrc_processing_job_notes": null, "metrc_processing_job_type_id": null, "outputs": [ { "additional_costs": [ { "cost_per_unit": "2", "description": "CD", "id": "c5f88215-740a-49c8-b6ad-cdec065892db", "name": "CostType 20", "quantity": "6", "total_cost_actual": "12", "total_cost_default": "12", "unit_type": { "id": "00000000-0000-0000-0000-00000000839d", "name": "Unit Type 38" } } ], "batch": null, "batch_number": null, "bins": [], "compliance_label": null, "compliance_quantity": null, "copy_custom_data_from_input": null, "cost_per_unit": null, "cost_per_unit_default": null, "costs": [ { "cost_per_unit": "2", "description": "CD", "id": "c5f88215-740a-49c8-b6ad-cdec065892db", "name": "CostType 20", "quantity": "6", "total_cost_actual": "12", "total_cost_default": "12", "unit_type": { "id": "00000000-0000-0000-0000-00000000839d", "name": "Unit Type 38" } } ], "expiration_date": null, "expiration_datetime": null, "id": "0c9f96af-defd-4106-bcba-2c9accf86c46", "ingredients": [ { "batch": null, "compliance_quantity": null, "cost_per_unit": null, "cost_per_unit_default": null, "id": "6f3a459e-c5e0-454d-9ca8-626e23466081", "location": { "address": "123 Fake Street, Beverly Hills, CA 90210, US", "company_id": "00000000-0000-0000-0000-000000000a96", "id": "00000000-0000-0000-0000-0000000003c1", "license_id": null, "name": "Place 462" }, "package": null, "product": { "id": "64b9192c-f550-4aca-bea3-688eec748982", "name": "Product 648", "sku": "sku 649", "updated_datetime": "2026-11-23T19:40:44.510510Z" }, "quantity": "8", "status": "DRAFT", "total_cost_actual": null, "total_cost_default": null }, { "batch": null, "compliance_quantity": null, "cost_per_unit": null, "cost_per_unit_default": null, "id": "00084d42-71b7-469e-a83f-796b14046550", "location": { "address": "123 Fake Street, Beverly Hills, CA 90210, US", "company_id": "00000000-0000-0000-0000-000000000a96", "id": "00000000-0000-0000-0000-0000000003c1", "license_id": null, "name": "Place 462" }, "package": null, "product": { "id": "f3005577-a097-4ef5-a4ab-e37ba160a1e1", "name": "Product 654", "sku": "sku 655", "updated_datetime": "2026-11-23T19:40:44.551009Z" }, "quantity": "0.012", "status": "DRAFT", "total_cost_actual": null, "total_cost_default": null }, { "batch": null, "compliance_quantity": null, "cost_per_unit": null, "cost_per_unit_default": null, "id": "7cc3863f-2c66-420b-8ffb-01212a9e64ee", "location": { "address": "123 Fake Street, Beverly Hills, CA 90210, US", "company_id": "00000000-0000-0000-0000-000000000a96", "id": "00000000-0000-0000-0000-0000000003c1", "license_id": null, "name": "Place 462" }, "package": null, "product": { "id": "13aee0e2-dd4a-46e3-955b-a3cc90972297", "name": "Product 663", "sku": "sku 664", "updated_datetime": "2026-11-23T19:40:44.635758Z" }, "quantity": "4", "status": "DRAFT", "total_cost_actual": null, "total_cost_default": null } ], "inputs": [ { "batch": null, "compliance_quantity": null, "cost_per_unit": null, "cost_per_unit_default": null, "id": "6f3a459e-c5e0-454d-9ca8-626e23466081", "location": { "address": "123 Fake Street, Beverly Hills, CA 90210, US", "company_id": "00000000-0000-0000-0000-000000000a96", "id": "00000000-0000-0000-0000-0000000003c1", "license_id": null, "name": "Place 462" }, "package": null, "product": { "id": "64b9192c-f550-4aca-bea3-688eec748982", "name": "Product 648", "sku": "sku 649", "updated_datetime": "2026-11-23T19:40:44.510510Z" }, "quantity": "8", "status": "DRAFT", "total_cost_actual": null, "total_cost_default": null }, { "batch": null, "compliance_quantity": null, "cost_per_unit": null, "cost_per_unit_default": null, "id": "00084d42-71b7-469e-a83f-796b14046550", "location": { "address": "123 Fake Street, Beverly Hills, CA 90210, US", "company_id": "00000000-0000-0000-0000-000000000a96", "id": "00000000-0000-0000-0000-0000000003c1", "license_id": null, "name": "Place 462" }, "package": null, "product": { "id": "f3005577-a097-4ef5-a4ab-e37ba160a1e1", "name": "Product 654", "sku": "sku 655", "updated_datetime": "2026-11-23T19:40:44.551009Z" }, "quantity": "0.012", "status": "DRAFT", "total_cost_actual": null, "total_cost_default": null }, { "batch": null, "compliance_quantity": null, "cost_per_unit": null, "cost_per_unit_default": null, "id": "7cc3863f-2c66-420b-8ffb-01212a9e64ee", "location": { "address": "123 Fake Street, Beverly Hills, CA 90210, US", "company_id": "00000000-0000-0000-0000-000000000a96", "id": "00000000-0000-0000-0000-0000000003c1", "license_id": null, "name": "Place 462" }, "package": null, "product": { "id": "13aee0e2-dd4a-46e3-955b-a3cc90972297", "name": "Product 663", "sku": "sku 664", "updated_datetime": "2026-11-23T19:40:44.635758Z" }, "quantity": "4", "status": "DRAFT", "total_cost_actual": null, "total_cost_default": null } ], "is_donation": false, "is_finished_good": false, "is_production_batch": false, "is_test_sample": false, "is_trade_sample": null, "lab_test_batches": null, "location": { "address": "123 Fake Street, Beverly Hills, CA 90210, US", "company_id": "00000000-0000-0000-0000-000000000a96", "id": "00000000-0000-0000-0000-0000000003c1", "license_id": null, "name": "Place 462" }, "metrc_item_id": null, "metrc_location_id": null, "metrc_notes": null, "metrc_production_batch_number": null, "package": null, "package_date": null, "package_datetime": null, "package_unit_type": null, "product": { "id": "ac85f292-f301-43d5-9d12-23dda4d870cf", "name": "Product 643", "sku": "sku 644", "updated_datetime": "2026-11-23T19:40:44.695521Z" }, "quantity": "4", "status": "PENDING", "total_cost_actual": null, "total_cost_default": null, "use_same_item": false } ], "owner_id": "00000000-0000-0000-0000-0000000010b0", "status": "PENDING", "tasks": [], "updated_datetime": "2026-11-23T19:40:45.072208Z", "waste_count_quantity": null, "waste_count_unit_name": null, "waste_volume_quantity": null, "waste_volume_unit_name": null, "waste_weight_quantity": null, "waste_weight_unit_name": null }}