APIHarvest assembly

Upsert a harvest assembly

POST
/public/v1/harvest-assemblies

Creates or updates a harvest assembly: packages made from one Metrc harvest, the same way "Create Packages" on a harvest does in the Distru app. Find harvests and their remaining_weight with GET /public/v1/harvests.

Omit id to create; harvest_id, status and outputs are then required. Send the id of an existing harvest assembly to update it: an omitted field is left unchanged, and harvest_id can't be changed. outputs and each output's costs follow the collection rules: an entry with an id is patched, one without is added, and an existing one left out of a sent list is removed, releasing its tag and weight. Omit the list to keep it as is. Sending an output's product_id, metrc_item_id, quantity or metrc_quantity recalculates its item and quantities; a new product or Metrc item without a new quantity keeps the output's Metrc weight.

status sets where the harvest assembly is in its lifecycle: • PENDING — saved but not done. Each output's metrc_label is reserved and its weight is taken from the harvest, but no package exists yet (package is null). • COMPLETED — each output's package is created as active inventory at its location_id.

Update a PENDING harvest assembly to COMPLETED to create its packages. A COMPLETED one can't go back to PENDING, and the only change it takes is new costs on its outputs: its description and outputs, and the outputs' existing costs, can't be changed or removed. Resending a stored value is not a change.

The harvest's remaining weight counts the harvest assembly's own weight as free, so an update can resize its outputs up to what it already takes plus what the harvest has left.

The request is atomic: if any output is rejected, nothing is saved. Errors are checked in steps (the harvest, then each output's product, item and quantity, then the harvest's remaining weight, then tags, locations and costs); every error found in a step is returned together, so fix them and resend to see the next step's.

Each output sends exactly one of quantity, in the product's unit, or metrc_quantity, in the Metrc unit named by metrc_unit_name, which must be sent with it; Distru calculates the other. With quantity, metrc_unit_name defaults to the unit the output already has while its Metrc item and product stay the same, otherwise to the Metrc item's unit, as the Distru app does. A quantity is converted to the Metrc unit and rounded to 4 decimal places, then the output's quantity is recalculated from that, so it can differ slightly from what was sent. The weight taken from the harvest is the metrc_quantity in the harvest's unit, rounded to 4 decimal places like Metrc does. The harvest, the product and the Metrc item must all be measured by weight.

metrc_item_id picks the output's Metrc item. When omitted, Distru uses the Metrc item the product was last mapped to on the harvest's license, as the Distru app does. package_date defaults to today in your company's time zone. metrc_notes stay in Distru and are not sent to Metrc.

The harvest must be submitted to Metrc and not finished. Every metrc_label must be an available Metrc tag on the harvest's license.

Metrc sync is asynchronous. A 201 for a COMPLETED harvest assembly means its packages were saved in Distru; one Metrc job per package then creates it in Metrc. Read each output's package.metrc_status and package.metrc_id from GET /public/v1/packages to see when it is in Metrc. Problems with the license's Metrc connection show in metrc_push_status on GET /public/v1/licenses.

Retrying is safe: an output whose metrc_label was already used is rejected, so a request that was saved can't create its packages twice.

Required permissions: harvests_permissions_create_packages to create, harvests_permissions_update_packages to update or complete, plus costs_permissions_apply_to_assemblies when the request adds, changes or removes a cost, including by removing an output that has costs.

Authorization

Bearer
headerAuthorizationBearer <token>

API token generated in Distru (Settings → Distru API). Send it on every request as Authorization: Bearer YOUR_API_TOKEN.

Request Body

The harvest assembly to create or update

application/json
  1. body

A Metrc harvest and the packages to make from it

description?string

A note saved on the harvest assembly

harvest_id?string

Required on create. The harvest's ID, as returned by GET /public/v1/harvests. Metrc harvest IDs are not accepted. An ID that doesn't exist for your company returns 404. Can't be changed on update.

id?string

The ID of the harvest assembly to update. Omit to create one. An ID that doesn't exist for your company returns 404.

outputs?array<>

Required on create. The packages to make, between 1 and 50. On update, the full list: an output left out is removed.

status?string

Required on create. PENDING to save the harvest assembly without creating its packages, or COMPLETED to create them. A COMPLETED harvest assembly can't go back to PENDING.

Value in"PENDING""COMPLETED"

Response Body

The updated harvest assembly

*/*
  1. response

A single harvest assembly wrapped in a data envelope

data?

Packages made from one Metrc harvest, as saved by "Create Packages" on a harvest in the Distru app.

Example Request
curl -X POST 'https://app.distru.com/public/v1/harvest-assemblies' \  -H 'Content-Type: application/json' \  -d '{  "description": "D1",  "harvest_id": "harv_aaf45142-89a5-4ea4-9a41-2f3d67e5d623",  "outputs": [    {      "batch_number": "B1",      "costs": [        {          "cost_per_unit": "3",          "cost_type_id": "costtype_2843",          "quantity": "1"        }      ],      "expiration_date": "2027-01-02",      "location_id": "loc_59126",      "metrc_item_id": 1000021,      "metrc_label": "1A4010200001234000000046",      "metrc_notes": "N1",      "metrc_quantity": "0.1",      "metrc_unit_name": "Ounces",      "package_date": "2026-10-01",      "product_id": "prod_02c902fd-d0a1-45ad-8fcb-003174c8addf"    },    {      "location_id": "loc_59126",      "metrc_label": "1A4010200001234000000047",      "product_id": "prod_02c902fd-d0a1-45ad-8fcb-003174c8addf",      "quantity": "1.50004"    }  ],  "status": "COMPLETED"}'
Example Response
{  "data": {    "completion_datetime": "string",    "description": "string",    "harvest": {      "id": "string",      "metrc_id": 0,      "name": "Blue Dream 2026-01-15"    },    "harvest_assembly_number": "string",    "id": "string",    "inserted_datetime": "string",    "outputs": [      {        "batch_number": "string",        "costs": [          {            "cost_per_unit": "string",            "description": "string",            "id": "string",            "name": "string",            "quantity": "string",            "unit_type": {              "id": "string",              "name": "string"            }          }        ],        "expiration_date": "string",        "id": "string",        "location": {          "address": "1234 Warehouse Street, Oakland, CA",          "id": "02c88a3f-d759-4973-88f9-60049d682524",          "license_id": "02c88a3f-d759-4973-88f9-60049d682524",          "name": "Warehouse 1"        },        "metrc_item_id": 0,        "metrc_label": "string",        "metrc_notes": "string",        "metrc_production_batch_number": "string",        "metrc_quantity": "string",        "metrc_unit_name": "string",        "package": {          "batch_number": "string",          "bins": [            {              "id": "string",              "name": "string"            }          ],          "biotrack_id": 0,          "biotrack_inventory_type_id": 0,          "biotrack_net_quantity_per_unit": "string",          "biotrack_room_id": 0,          "biotrack_status": "ACTIVE",          "biotrack_usable_weight": "string",          "compliance_label": "string",          "compliance_product_name": "string",          "compliance_strain_name": "string",          "compliance_transferred_datetime": "string",          "compliance_type": "string",          "cost_per_unit_actual": "string",          "cost_per_unit_default": "string",          "creator": {            "banned": true,            "deleted_at": "string",            "email": "string",            "full_name": "string",            "id": "string",            "inserted_datetime": "string",            "role": {              "id": "string",              "name": "string"            },            "updated_datetime": "string"          },          "custom_data": [            {              "id": 0,              "name": "string",              "value": "string"            }          ],          "description": "string",          "distru_status": "ACTIVE",          "expiration_datetime": "string",          "finished_datetime": "string",          "harvest_date": "string",          "id": "string",          "inactivated_datetime": "string",          "inserted_datetime": "string",          "is_production_batch": true,          "is_test_sample": true,          "is_trade_sample": true,          "lab_testing_state": "string",          "license": {            "active": true,            "expiry_datetime": "string",            "id": "02c88a3f-d759-4973-88f9-60049d682524",            "inserted_datetime": "string",            "issue_datetime": "string",            "license_number": "C11-1234567890",            "license_type": "string"          },          "license_id": "string",          "location": {            "address": "1234 Warehouse Street, Oakland, CA",            "id": "02c88a3f-d759-4973-88f9-60049d682524",            "license_id": "02c88a3f-d759-4973-88f9-60049d682524",            "name": "Warehouse 1"          },          "location_id": "string",          "metrc_archived_date": "string",          "metrc_finished_date": "string",          "metrc_id": 0,          "metrc_production_batch_number": "string",          "metrc_received_datetime": "string",          "metrc_received_from_manifest_number": "string",          "metrc_source_harvest_names": "string",          "metrc_status": "ACTIVE",          "metrc_transfer_id": 0,          "metrc_unit_name": "string",          "owner": {            "banned": true,            "deleted_at": "string",            "email": "string",            "full_name": "string",            "id": "string",            "inserted_datetime": "string",            "role": {              "id": "string",              "name": "string"            },            "updated_datetime": "string"          },          "packaged_date": "string",          "primary_test_result": {            "cbd_mg_per_unit": "string",            "cbd_mg_per_unit_total": "string",            "cbd_percentage": "string",            "cbd_percentage_total": "string",            "coa_url": "string",            "mg_per_unit_type": "string",            "name": "string",            "thc_mg_per_unit": "string",            "thc_mg_per_unit_total": "string",            "thc_percentage": "string",            "thc_percentage_total": "string"          },          "product": {            "batches_with_active_quantity_by_location": [              {                "batches": [                  {                    "batch_number": "string",                    "id": "string",                    "name": "string",                    "quantity_active": "string"                  }                ],                "location": {                  "address": "1234 Warehouse Street, Oakland, CA",                  "id": "02c88a3f-d759-4973-88f9-60049d682524",                  "license_id": "02c88a3f-d759-4973-88f9-60049d682524",                  "name": "Warehouse 1"                }              }            ],            "bill_of_materials": {              "costs": [                {                  "cost_type": {                    "cost_per_unit": "string",                    "id": "string",                    "name": "string",                    "unit_type": {                      "id": "string",                      "name": "string"                    }                  },                  "description": "string",                  "id": "string",                  "quantity": "string"                }              ],              "description": "string",              "dynamic_inputs": [                {                  "id": "string",                  "product_categories": [                    {                      "id": "string",                      "name": "string",                      "official_product_category_id": "string"                    }                  ],                  "product_groups": [                    {                      "id": "string",                      "name": "string"                    }                  ],                  "product_subcategories": [                    {                      "id": "string",                      "name": "string"                    }                  ],                  "quantity": "string",                  "strains": [                    {                      "id": "string",                      "inserted_datetime": "string",                      "name": "string",                      "strain_type": "INDICA",                      "updated_datetime": "string"                    }                  ],                  "tags": [                    {                      "id": "string",                      "name": "string"                    }                  ],                  "unit_type": {                    "id": "string",                    "name": "string"                  }                }              ],              "id": "string",              "name": "string",              "product_inputs": [                {                  "id": "string",                  "product": {},                  "quantity": "string"                }              ]            },            "brand": {              "id": "3f128a34-cc59-4b49-8883-23bf10e59c6c",              "name": "Retailer 1",              "tasks": [                {                  "due_datetime": "string",                  "id": "string",                  "name": "string",                  "status": "ACTIVE"                }              ],              "updated_datetime": "string"            },            "category": {              "id": "string",              "name": "string",              "official_product_category_id": "string"            },            "creator": {              "banned": true,              "deleted_at": "string",              "email": "string",              "full_name": "string",              "id": "string",              "inserted_datetime": "string",              "role": {                "id": "string",                "name": "string"              },              "updated_datetime": "string"            },            "custom_data": [              {                "id": 0,                "name": "string",                "value": "string"              }            ],            "deleted_at": "string",            "description": "string",            "description_markdown": "string",            "external_name": "string",            "gross_weight": "string",            "gross_weight_unit_type": {              "id": "string",              "name": "string"            },            "id": "string",            "images": [              {                "id": "string",                "name": "string",                "rank": 0,                "url": "string"              }            ],            "inserted_datetime": "string",            "inventory_tracking_method": "PACKAGE",            "is_active": true,            "is_featured": true,            "leaflink_product_id": 0,            "menu_visibility": "DO_NOT_INCLUDE",            "menus": [              {                "id": "string",                "name": "string"              }            ],            "msrp": "string",            "name": "string",            "owner": {              "banned": true,              "deleted_at": "string",              "email": "string",              "full_name": "string",              "id": "string",              "inserted_datetime": "string",              "role": {                "id": "string",                "name": "string"              },              "updated_datetime": "string"            },            "packages_with_active_quantity_by_location": [              {                "location": {                  "address": "1234 Warehouse Street, Oakland, CA",                  "id": "02c88a3f-d759-4973-88f9-60049d682524",                  "license_id": "02c88a3f-d759-4973-88f9-60049d682524",                  "name": "Warehouse 1"                },                "packages": [                  {                    "batch_number": "string",                    "compliance_label": "string",                    "distru_status": "ACTIVE",                    "id": "string",                    "license_id": "string",                    "location_id": "string",                    "metrc_id": 0,                    "quantity": "string",                    "quantity_active": "string"                  }                ]              }            ],            "product_group": {              "id": "string",              "name": "string"            },            "quantity_active": "string",            "quantity_active_by_location": [              {                "location": {                  "address": "1234 Warehouse Street, Oakland, CA",                  "id": "02c88a3f-d759-4973-88f9-60049d682524",                  "license_id": "02c88a3f-d759-4973-88f9-60049d682524",                  "name": "Warehouse 1"                },                "quantity": "string"              }            ],            "quantity_available": "string",            "quantity_available_threshold_max": "string",            "quantity_available_threshold_min": "string",            "quantity_reserved": "string",            "sku": "string",            "strain": {              "id": "string",              "inserted_datetime": "string",              "name": "string",              "strain_type": "INDICA",              "updated_datetime": "string"            },            "subcategory": {              "id": "string",              "name": "string"            },            "tags": [              {                "id": "string",                "name": "string"              }            ],            "tasks": [              {                "due_datetime": "string",                "id": "string",                "name": "string",                "status": "ACTIVE"              }            ],            "total_cannabinoid_unit": "string",            "total_cbd": "string",            "total_thc": "string",            "treez_wholesale_price": "string",            "unit_cost": "string",            "unit_net_weight": "string",            "unit_net_weight_serving_size_unit_type": {              "id": "string",              "name": "string"            },            "unit_price": "string",            "unit_serving_size": "string",            "unit_type": {              "id": "string",              "name": "string"            },            "units_per_case": "string",            "upc": "string",            "updated_datetime": "string",            "vendor": {              "id": "3f128a34-cc59-4b49-8883-23bf10e59c6c",              "name": "Retailer 1",              "tasks": [                {                  "due_datetime": "string",                  "id": "string",                  "name": "string",                  "status": "ACTIVE"                }              ],              "updated_datetime": "string"            },            "wholesale_unit_price": 0          },          "product_id": "string",          "product_unit_quantity": "string",          "product_unit_type": {            "id": "string",            "name": "string"          },          "quantity": "string",          "quantity_active": "string",          "quantity_assembling": "string",          "total_cost_actual": "string",          "total_cost_default": "string",          "unit_type": {            "id": "string",            "name": "string"          }        },        "package_date": "string",        "product": {          "batches_with_active_quantity_by_location": [            {              "batches": [                {                  "batch_number": "string",                  "id": "string",                  "name": "string",                  "quantity_active": "string"                }              ],              "location": {                "address": "1234 Warehouse Street, Oakland, CA",                "id": "02c88a3f-d759-4973-88f9-60049d682524",                "license_id": "02c88a3f-d759-4973-88f9-60049d682524",                "name": "Warehouse 1"              }            }          ],          "bill_of_materials": {            "costs": [              {                "cost_type": {                  "cost_per_unit": "string",                  "id": "string",                  "name": "string",                  "unit_type": {                    "id": "string",                    "name": "string"                  }                },                "description": "string",                "id": "string",                "quantity": "string"              }            ],            "description": "string",            "dynamic_inputs": [              {                "id": "string",                "product_categories": [                  {                    "id": "string",                    "name": "string",                    "official_product_category_id": "string"                  }                ],                "product_groups": [                  {                    "id": "string",                    "name": "string"                  }                ],                "product_subcategories": [                  {                    "id": "string",                    "name": "string"                  }                ],                "quantity": "string",                "strains": [                  {                    "id": "string",                    "inserted_datetime": "string",                    "name": "string",                    "strain_type": "INDICA",                    "updated_datetime": "string"                  }                ],                "tags": [                  {                    "id": "string",                    "name": "string"                  }                ],                "unit_type": {                  "id": "string",                  "name": "string"                }              }            ],            "id": "string",            "name": "string",            "product_inputs": [              {                "id": "string",                "product": {},                "quantity": "string"              }            ]          },          "brand": {            "id": "3f128a34-cc59-4b49-8883-23bf10e59c6c",            "name": "Retailer 1",            "tasks": [              {                "due_datetime": "string",                "id": "string",                "name": "string",                "status": "ACTIVE"              }            ],            "updated_datetime": "string"          },          "category": {            "id": "string",            "name": "string",            "official_product_category_id": "string"          },          "creator": {            "banned": true,            "deleted_at": "string",            "email": "string",            "full_name": "string",            "id": "string",            "inserted_datetime": "string",            "role": {              "id": "string",              "name": "string"            },            "updated_datetime": "string"          },          "custom_data": [            {              "id": 0,              "name": "string",              "value": "string"            }          ],          "deleted_at": "string",          "description": "string",          "description_markdown": "string",          "external_name": "string",          "gross_weight": "string",          "gross_weight_unit_type": {            "id": "string",            "name": "string"          },          "id": "string",          "images": [            {              "id": "string",              "name": "string",              "rank": 0,              "url": "string"            }          ],          "inserted_datetime": "string",          "inventory_tracking_method": "PACKAGE",          "is_active": true,          "is_featured": true,          "leaflink_product_id": 0,          "menu_visibility": "DO_NOT_INCLUDE",          "menus": [            {              "id": "string",              "name": "string"            }          ],          "msrp": "string",          "name": "string",          "owner": {            "banned": true,            "deleted_at": "string",            "email": "string",            "full_name": "string",            "id": "string",            "inserted_datetime": "string",            "role": {              "id": "string",              "name": "string"            },            "updated_datetime": "string"          },          "packages_with_active_quantity_by_location": [            {              "location": {                "address": "1234 Warehouse Street, Oakland, CA",                "id": "02c88a3f-d759-4973-88f9-60049d682524",                "license_id": "02c88a3f-d759-4973-88f9-60049d682524",                "name": "Warehouse 1"              },              "packages": [                {                  "batch_number": "string",                  "compliance_label": "string",                  "distru_status": "ACTIVE",                  "id": "string",                  "license_id": "string",                  "location_id": "string",                  "metrc_id": 0,                  "quantity": "string",                  "quantity_active": "string"                }              ]            }          ],          "product_group": {            "id": "string",            "name": "string"          },          "quantity_active": "string",          "quantity_active_by_location": [            {              "location": {                "address": "1234 Warehouse Street, Oakland, CA",                "id": "02c88a3f-d759-4973-88f9-60049d682524",                "license_id": "02c88a3f-d759-4973-88f9-60049d682524",                "name": "Warehouse 1"              },              "quantity": "string"            }          ],          "quantity_available": "string",          "quantity_available_threshold_max": "string",          "quantity_available_threshold_min": "string",          "quantity_reserved": "string",          "sku": "string",          "strain": {            "id": "string",            "inserted_datetime": "string",            "name": "string",            "strain_type": "INDICA",            "updated_datetime": "string"          },          "subcategory": {            "id": "string",            "name": "string"          },          "tags": [            {              "id": "string",              "name": "string"            }          ],          "tasks": [            {              "due_datetime": "string",              "id": "string",              "name": "string",              "status": "ACTIVE"            }          ],          "total_cannabinoid_unit": "string",          "total_cbd": "string",          "total_thc": "string",          "treez_wholesale_price": "string",          "unit_cost": "string",          "unit_net_weight": "string",          "unit_net_weight_serving_size_unit_type": {            "id": "string",            "name": "string"          },          "unit_price": "string",          "unit_serving_size": "string",          "unit_type": {            "id": "string",            "name": "string"          },          "units_per_case": "string",          "upc": "string",          "updated_datetime": "string",          "vendor": {            "id": "3f128a34-cc59-4b49-8883-23bf10e59c6c",            "name": "Retailer 1",            "tasks": [              {                "due_datetime": "string",                "id": "string",                "name": "string",                "status": "ACTIVE"              }            ],            "updated_datetime": "string"          },          "wholesale_unit_price": 0        },        "quantity": "string"      }    ],    "status": "PENDING",    "updated_datetime": "string"  }}