Create or update a batch
Changed onCreate or update a single batch. Omit id to create a new batch; pass the id of an existing batch to update it. Either way the whole operation is atomic — if any field is rejected, nothing is written and the batch is left unchanged.
A batch is Distru's lot for a batch-tracked product: it is the unit that inventory quantity, cost, test results, and (optionally) bins hang off of. You can only create a batch under a product whose inventory-tracking method is batch-tracked; pointing product_id at any other product is rejected. Products that track inventory as compliance packages are managed through their package endpoints, not here.
On create, the batch's inventory records are initialized so quantity and cost can begin accumulating against it (a brand-new batch starts with no on-hand quantity — receive a purchase, run an assembly, or adjust stock to add inventory). The write is recorded to the batch's activity history. This endpoint does not push to or pull from any state traceability system (Metrc / BioTrack); a 200 reflects the Distru batch record only.
Update is a targeted patch, not a full replace: only the fields you send are changed, and any field you omit keeps its current value. product_id is fixed after creation — a batch cannot be moved to a different product. See each field below for its create-time default and its null-vs-omit behavior (notably bin_ids).
Required permission: products_permissions_create to create, products_permissions_edit to update.
Request
- Base URLhttps://app.distru.com
- AuthHTTP bearer
Request body
Response
A single batch
Example response
{
"data": {
"product": {
"batches_with_active_quantity_by_location": [
{
"location": {
"address": "1234 Warehouse Street, Oakland, CA",
"company_id": "02c88a3f-d759-4973-88f9-60049d682524",
"id": "02c88a3f-d759-4973-88f9-60049d682524",
"license_id": "02c88a3f-d759-4973-88f9-60049d682524",
"name": "Warehouse 1"
}
}
],
"brand": {
"id": "3f128a34-cc59-4b49-8883-23bf10e59c6c",
"name": "Retailer 1"
},
"packages_with_active_quantity_by_location": [
{
"location": {
"address": "1234 Warehouse Street, Oakland, CA",
"company_id": "02c88a3f-d759-4973-88f9-60049d682524",
"id": "02c88a3f-d759-4973-88f9-60049d682524",
"license_id": "02c88a3f-d759-4973-88f9-60049d682524",
"name": "Warehouse 1"
}
}
],
"quantity_active_by_location": [
{
"location": {
"address": "1234 Warehouse Street, Oakland, CA",
"company_id": "02c88a3f-d759-4973-88f9-60049d682524",
"id": "02c88a3f-d759-4973-88f9-60049d682524",
"license_id": "02c88a3f-d759-4973-88f9-60049d682524",
"name": "Warehouse 1"
}
}
],
"vendor": {
"id": "3f128a34-cc59-4b49-8883-23bf10e59c6c",
"name": "Retailer 1"
}
},
"quantity_active_by_location": [
{
"location": {
"address": "1234 Warehouse Street, Oakland, CA",
"company_id": "02c88a3f-d759-4973-88f9-60049d682524",
"id": "02c88a3f-d759-4973-88f9-60049d682524",
"license_id": "02c88a3f-d759-4973-88f9-60049d682524",
"name": "Warehouse 1"
}
}
]
}
}Changes
- info
added the required property
//to the response with the status - info
added the required property
///to the response with the status - info
added the required property
///to the response with the status
- info
- warning
removed the request property
- warning