Create a test sample
Pull a quantity from an existing Metrc package into a new test sample package, ready to be sent to a testing lab.
Creates one already-completed assembly with a single input (the quantity drawn from the
source package) and a single test sample output — the assembly renders with
creation_source: LAB_TESTING and its output with is_test_sample: true. The drawn quantity is consumed from the
source package's inventory immediately, and the sample package is produced into inventory at
location_id. On success the sample is queued for creation in Metrc as a testing package and
synced asynchronously — the Metrc package identifiers are not present in the immediate
response, and the source and sample packages are briefly flagged as syncing. Poll
GET /public/v1/assemblies/{id} to observe the synced result.
Metrc licenses only, and the license's Metrc facility must be allowed to create test sample packages. The whole operation is atomic: if anything is rejected, nothing is changed.
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 source package and the test sample to create from it
application/json- body
A Metrc source package and the test sample package to create from it
batch_number?stringDistru batch number stored on the sample package. When omitted, copies the source package's batch number; pass null explicitly to leave the sample without one.
compliance_label*stringThe Metrc tag for the sample package. Must be an available tag in the source package's license.
expiration_date?stringExpiration date reported to Metrc, e.g. "2027-08-19". When omitted, copies the source package's expiration date; pass null explicitly to leave the sample without one.
input_compliance_quantity*numberAmount drawn from the source package, in the source package's compliance unit. Must be > 0.
lab_test_batches?array<string>The Metrc lab test batches to assign to the sample, by exact name. Valid names depend on the license and the sample item's Metrc product category — list them with GET /public/v1/metrc/lab-test-batches, which groups them by item category and marks the ones Metrc requires. Every required: true batch must be included; an unknown or disallowed name is rejected. Omit entirely when the license's facility does not use package sample lab test batches. At most 200 items.
location_id?stringThe location ID the sample package is produced into. Must be in the same Metrc license as the source package. Defaults to the source package's location when omitted or null.
metrc_item_id?integerThe Metrc item id for the sample. Required unless use_same_item is true, and must be omitted when it is. Must exist in the source package's Metrc license.
metrc_location_id?integerThe Metrc ID of the Metrc location the sample package will be created in. Only applicable if the license uses Metrc locations. Defaults to the source package's Metrc location when omitted or null.
metrc_notes?stringNotes sent to Metrc as the sample package's note when it is created (max 255 characters).
output_compliance_quantity?numberSize of the test sample package, in the sample's compliance unit (the source unit when use_same_item is true, otherwise the unit of metrc_item_id). Must be > 0. Defaults to input_compliance_quantity when omitted or null.
package_date?stringThe sample package's packaged date. Defaults to today when omitted.
product_id?stringThe sample's product ID. Must be package-tracked. Defaults to the source package's product when omitted or null.
source_package_id*stringThe package to pull the sample from. Must be package-tracked and in a Metrc license. An ID that doesn't exist for your company returns 404, and one your team restrictions hide returns 403.
use_same_item?booleanWhen true, the sample package reuses the source package's Metrc item and metrc_item_id must be omitted.
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/create_test_sample' \ -H 'Content-Type: application/json' \ -d '{ "batch_number": "TS-1", "compliance_label": "1A4010200001234000000004", "expiration_date": "2027-08-19", "input_compliance_quantity": 3, "lab_test_batches": [ "A", "B" ], "location_id": "00000000-0000-0000-0000-000000000046", "metrc_notes": "sample", "output_compliance_quantity": 3, "product_id": "e46c23e5-59d4-4513-b288-e68a12444698", "source_package_id": "00000000-0000-0000-0000-00000000000d", "use_same_item": true}'{ "data": { "assembly_number": "AS-0000001", "completion_datetime": "2026-10-13T15:03:27.961609Z", "compliance_type": "METRC", "creation_source": "LAB_TESTING", "creator": { "banned": false, "deleted_at": null, "email": "[email protected]", "full_name": "FirstName2338 LastName2339", "id": "00000000-0000-0000-0000-000000000493", "inserted_datetime": "2026-10-13T15:03:27.660519Z", "role": { "id": "00000000-0000-0000-0000-0000000004b6", "name": "Admin 1205" }, "updated_datetime": "2026-10-13T15:03:27.660519Z" }, "custom_data": [], "description": null, "estimated_start_date": null, "estimated_start_datetime": null, "estimated_work_hours": null, "estimated_work_minutes": null, "fulfilled": true, "id": "d8c3ced9-9a4f-4d3f-bb39-b67b35ec450d", "inserted_datetime": "2026-10-13T15:03:27.961609Z", "is_metrc_processing_job": false, "license": { "active": true, "expiry_datetime": "2026-11-13T15:03:27.674961Z", "id": "00000000-0000-0000-0000-000000000039", "inserted_datetime": "2026-10-13T15:03:27.675094Z", "issue_datetime": "2026-10-13T15:03:27.674958Z", "license_number": "CDPH-00000065", "license_type": "Medium Mixed-Light Tier 2" }, "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": [], "batch": { "batch_number": null, "id": "00000000-0000-0000-0000-000000000086", "name": "B439" }, "batch_number": "TS-1", "bins": [], "compliance_label": "1A4010200001234000000008", "compliance_quantity": "3", "copy_custom_data_from_input": null, "cost_per_unit": null, "cost_per_unit_default": null, "costs": [], "expiration_date": "2027-08-19T00:00:00.000000Z", "expiration_datetime": "2027-08-19T00:00:00.000000Z", "id": "4dae0d77-6dc1-488f-91f5-d78bafbb1aa7", "ingredients": [ { "batch": { "batch_number": null, "id": "00000000-0000-0000-0000-000000000087", "name": "B440" }, "compliance_quantity": "3", "cost_per_unit": null, "cost_per_unit_default": null, "id": "1f972a28-879f-40b3-bce8-96d9d94807dc", "location": { "address": "123 Fake Street, Beverly Hills, CA 90210, US", "company_id": "00000000-0000-0000-0000-000000000310", "id": "00000000-0000-0000-0000-0000000000eb", "license_id": "00000000-0000-0000-0000-000000000039", "name": "Place 234" }, "package": { "batch_number": "SRC-1", "compliance_label": "ABCDEF012345670000000032", "distru_status": "ACTIVE", "id": "00000000-0000-0000-0000-00000000000f", "license_id": "00000000-0000-0000-0000-000000000039", "location_id": "00000000-0000-0000-0000-0000000000eb", "metrc_id": 32, "metrc_label": "ABCDEF012345670000000032", "quantity": "7.000000000", "quantity_active": "7.000000000", "status": "active" }, "product": { "id": "db15fe64-c7ad-4f38-a1fb-8d96ba9d2bca", "name": "Product 437", "sku": "sku 438", "updated_datetime": "2026-10-13T15:03:27.735060Z" }, "quantity": "85.048477632", "status": "COMPLETED", "total_cost_actual": null, "total_cost_default": null } ], "inputs": [ { "batch": { "batch_number": null, "id": "00000000-0000-0000-0000-000000000087", "name": "B440" }, "compliance_quantity": "3", "cost_per_unit": null, "cost_per_unit_default": null, "id": "1f972a28-879f-40b3-bce8-96d9d94807dc", "location": { "address": "123 Fake Street, Beverly Hills, CA 90210, US", "company_id": "00000000-0000-0000-0000-000000000310", "id": "00000000-0000-0000-0000-0000000000eb", "license_id": "00000000-0000-0000-0000-000000000039", "name": "Place 234" }, "package": { "batch_number": "SRC-1", "compliance_label": "ABCDEF012345670000000032", "distru_status": "ACTIVE", "id": "00000000-0000-0000-0000-00000000000f", "license_id": "00000000-0000-0000-0000-000000000039", "location_id": "00000000-0000-0000-0000-0000000000eb", "metrc_id": 32, "metrc_label": "ABCDEF012345670000000032", "quantity": "7.000000000", "quantity_active": "7.000000000", "status": "active" }, "product": { "id": "db15fe64-c7ad-4f38-a1fb-8d96ba9d2bca", "name": "Product 437", "sku": "sku 438", "updated_datetime": "2026-10-13T15:03:27.735060Z" }, "quantity": "85.048477632", "status": "COMPLETED", "total_cost_actual": null, "total_cost_default": null } ], "is_donation": false, "is_finished_good": false, "is_production_batch": false, "is_test_sample": true, "is_trade_sample": false, "lab_test_batches": [ "A", "B" ], "location": { "address": "123 Fake Street, Beverly Hills, CA 90210, US", "company_id": "00000000-0000-0000-0000-000000000310", "id": "00000000-0000-0000-0000-0000000000eb", "license_id": "00000000-0000-0000-0000-000000000039", "name": "Place 234" }, "metrc_item_id": null, "metrc_location_id": null, "metrc_notes": "sample", "metrc_production_batch_number": null, "package": { "batch_number": "TS-1", "compliance_label": "1A4010200001234000000008", "distru_status": "ACTIVE", "id": "00000000-0000-0000-0000-000000000010", "license_id": "00000000-0000-0000-0000-000000000039", "location_id": "00000000-0000-0000-0000-0000000000eb", "metrc_id": null, "metrc_label": "1A4010200001234000000008", "quantity": "3.000000000", "quantity_active": "3.000000000", "status": "active" }, "package_date": "2026-10-13", "package_datetime": "2026-10-13", "package_unit_type": { "id": "00000000-0000-0000-0000-00000000258d", "name": "Ounce" }, "product": { "id": "db15fe64-c7ad-4f38-a1fb-8d96ba9d2bca", "name": "Product 437", "sku": "sku 438", "updated_datetime": "2026-10-13T15:03:27.735060Z" }, "quantity": "85.048477632", "status": "COMPLETED", "total_cost_actual": null, "total_cost_default": null, "use_same_item": true } ], "owner_id": "00000000-0000-0000-0000-000000000493", "status": "COMPLETED", "tasks": [], "updated_datetime": "2026-10-13T15:03:27.961609Z", "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 }}