Create, update or delete a batch

distru-mutate-batchWrite

Creates, updates or deletes one batch (lot) of a batch-tracked product.

Inputs

Every tool also takes the common inputs.

FieldTypeRequiredDescription
actionenum
CREATEUPDATEDELETE
Yes
idstringNoRequired for UPDATE and DELETE. Resolve via distru-search-batches.
productIdstringNoRequired for CREATE; cannot change afterwards. A batch-tracked product. Resolve via distru-search-products.
batchNumberstring or nullNoYour lot number, e.g. LOT-1241291. Need not be unique. Send null to clear it.
descriptionstring or nullNoSend null to clear it.
thcstring or nullNoFree-text label, e.g. "18.5%"; not a lab result (see primaryTestResult). Send null to clear it.
cbdstring or nullNoFree-text label, e.g. "0.3%"; not a lab result (see primaryTestResult). Send null to clear it.
expirationDatestring or nullNoISO 8601 with a UTC offset, e.g. "2026-09-01T00:00:00-07:00"; the company timezone is on distru-get-me. Send null to clear it.
harvestDatestring or nullNoISO 8601 with a UTC offset, e.g. "2026-09-01T00:00:00-07:00"; the company timezone is on distru-get-me. Send null to clear it.
manufacturedDatestringNoDefaults to now on CREATE. Cannot be cleared. ISO 8601 with a UTC offset, e.g. "2026-09-01T00:00:00-07:00"; the company timezone is on distru-get-me.
ownerIdstring or nullNoOwning user. Resolve via distru-search-users. Send null to clear it.
customFieldsobject[]NoOnly the fields listed change. Required custom fields must be set, on update too, while still blank.
customFields[].customFieldIdstringYesResolve via distru-search-custom-fields (entityType BATCH).
customFields[].valuestring or string[]YesTEXT: the text. DROPDOWN: the option name. CHECKBOX: an array of option names. DATE: YYYY-MM-DD, company timezone. "" or [] clears the field.

Output

This tool returns one of 2 shapes, depending on its inputs.

Presence on a nested field assumes its parent exists.

Result with batch

FieldTypePresence
batchobjectAlways
batch.idstringAlways
batch.customFieldsobject[]Always
batch.customFields[].customFieldobjectAlways
batch.customFields[].customField.idstringAlways
batch.customFields[].customField.namestringAlways
batch.customFields[].customField.fieldTypeenum
CHECKBOXDATEDROPDOWNTEXT
Always
batch.customFields[].valuestringCan be null
batch.namestringAlways
batch.batchNumberstringCan be null
batch.descriptionstringCan be null
batch.thcstringCan be null
batch.cbdstringCan be null
batch.urlstringAlways
batch.manufacturedDatestringAlways
batch.harvestDatestringCan be null
batch.expirationDatestringCan be null
batch.quantitystringAlways
batch.activeQuantityCoststringCan be null
batch.productobjectAlways
batch.product.idstringAlways
batch.product.namestringAlways
batch.ownerobjectCan be null
batch.owner.idstringAlways
batch.owner.profileobjectAlways
batch.owner.profile.fullNamestringAlways
batch.primaryTestResultobjectCan be null
batch.primaryTestResult.idstringAlways
batch.primaryTestResult.namestringAlways
batch.primaryTestResult.thcPercentagestringCan be null
batch.primaryTestResult.cbdPercentagestringCan be null
batch.primaryTestResult.releaseDatestringCan be null

Result with id

FieldTypePresence
idstringAlways
What the AI reads

Creates, updates or deletes one batch (lot) of a batch-tracked product. CREATE makes an empty batch: add stock with distru-adjust-inventory. Pushes nothing to Metrc. Does not change stock, costs, bins or test results; apply the same change to many batches with distru-bulk-update-batches. Read current values with distru-get-batch. thc and cbd are free-text labels, not lab results. DELETE soft-deletes the batch for good; refused while it appears on any sales order, purchase, return, stock transfer or assembly. Stock left in a deleted batch is not adjusted but stops counting as active inventory. CREATE and UPDATE return the batch as distru-get-batch does; DELETE returns its id. Sparse update: on UPDATE only the fields passed change and the rest stay as they are; a field sent as null is cleared.