Create, update or delete a batch
distru-mutate-batchWriteCreates, updates or deletes one batch (lot) of a batch-tracked product.
Inputs
Every tool also takes the common inputs.
| Field | Type | Required | Description |
|---|---|---|---|
| action | enumCREATEUPDATEDELETE | Yes | |
| id | string | No | Required for UPDATE and DELETE. Resolve via distru-search-batches. |
| productId | string | No | Required for CREATE; cannot change afterwards. A batch-tracked product. Resolve via distru-search-products. |
| batchNumber | string or null | No | Your lot number, e.g. LOT-1241291. Need not be unique. Send null to clear it. |
| description | string or null | No | Send null to clear it. |
| thc | string or null | No | Free-text label, e.g. "18.5%"; not a lab result (see primaryTestResult). Send null to clear it. |
| cbd | string or null | No | Free-text label, e.g. "0.3%"; not a lab result (see primaryTestResult). Send null to clear it. |
| expirationDate | string or null | No | ISO 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. |
| harvestDate | string or null | No | ISO 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. |
| manufacturedDate | string | No | Defaults 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. |
| ownerId | string or null | No | Owning user. Resolve via distru-search-users. Send null to clear it. |
| customFields | object[] | No | Only the fields listed change. Required custom fields must be set, on update too, while still blank. |
| customFields[]. | string | Yes | Resolve via distru-search-custom-fields (entityType BATCH). |
| customFields[]. | string or string[] | Yes | TEXT: 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
| Field | Type | Presence |
|---|---|---|
| batch | object | Always |
| batch. | string | Always |
| batch. | object[] | Always |
| batch. | object | Always |
| batch. | string | Always |
| batch. | string | Always |
| batch. | enumCHECKBOXDATEDROPDOWNTEXT | Always |
| batch. | string | Can be null |
| batch. | string | Always |
| batch. | string | Can be null |
| batch. | string | Can be null |
| batch. | string | Can be null |
| batch. | string | Can be null |
| batch. | string | Always |
| batch. | string | Always |
| batch. | string | Can be null |
| batch. | string | Can be null |
| batch. | string | Always |
| batch. | string | Can be null |
| batch. | object | Always |
| batch. | string | Always |
| batch. | string | Always |
| batch. | object | Can be null |
| batch. | string | Always |
| batch. | object | Always |
| batch. | string | Always |
| batch. | object | Can be null |
| batch. | string | Always |
| batch. | string | Always |
| batch. | string | Can be null |
| batch. | string | Can be null |
| batch. | string | Can be null |
Result with id
| Field | Type | Presence |
|---|---|---|
| id | string | Always |
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.