Get a batch

distru-get-batchRead

Gets one inventory batch by ID: header detail with quantity, activeQuantityCost, dates, product, owner and primary test result.

Inputs

Every tool also takes the common inputs.

FieldTypeRequiredDescription
idstringYesResolve via distru-search-batches.
includeActiveQuantitiesByLocationbooleanNoActive quantity per location, in the product's unit type.
includeActiveQuantityCostItemsbooleanNoactiveQuantityCostItems: the costs that make up activeQuantityCost, oldest first; null when none is recorded or the caller cannot view cost details. Costs carry over from inputs, so recordedOn can be an upstream package, batch, product, harvest, plant or plant batch rather than this batch; MULTIPLE_PLANTS is a cost split over several plants or plant batches, NONE one tied to no inventory. quantity is the share that went into this batch, out of costQuantity; both in unitType. totalCost is quantity × costPerUnit; both null when no cost per unit is recorded or the caller cannot see it. costType is null for purchase costs and costs Distru records itself; origin.purchaseOrder and origin.assembly are null when team restrictions hide them.

Output

Presence on a nested field assumes its parent exists.

FieldTypePresence
batchobjectCan be null
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
batch.activeQuantitiesByLocationobject[]Can be absent
batch.activeQuantitiesByLocation[].locationobjectAlways
batch.activeQuantitiesByLocation[].location.idstringAlways
batch.activeQuantitiesByLocation[].location.namestringAlways
batch.activeQuantitiesByLocation[].quantitystringAlways
batch.activeQuantityCostItemsobject[]Null or absent
batch.activeQuantityCostItems[].namestringAlways
batch.activeQuantityCostItems[].descriptionstringCan be null
batch.activeQuantityCostItems[].costTypeobjectCan be null
batch.activeQuantityCostItems[].costType.idstringAlways
batch.activeQuantityCostItems[].costType.namestringAlways
batch.activeQuantityCostItems[].createdByobjectCan be null
batch.activeQuantityCostItems[].createdBy.idstringAlways
batch.activeQuantityCostItems[].createdBy.fullNamestringAlways
batch.activeQuantityCostItems[].insertedAtstringAlways
batch.activeQuantityCostItems[].originobjectAlways
batch.activeQuantityCostItems[].origin.typeenum
ASSEMBLYBIOTRACK_ADJUSTMENTBIOTRACK_MANIFEST_RECEIVEDBREAKDOWNCOST_ENTRYMETRC_ADJUSTMENTMETRC_TRANSFER_RECEIVEDOTHERPACKAGE_IMPORTPLANT_BATCH_PACKAGINGPURCHASE_ORDERSTOCK_ADJUSTMENT
Always
batch.activeQuantityCostItems[].origin.purchaseOrderobjectCan be null
batch.activeQuantityCostItems[].origin.purchaseOrder.idstringAlways
batch.activeQuantityCostItems[].origin.purchaseOrder.purchaseNumberstringAlways
batch.activeQuantityCostItems[].origin.assemblyobjectCan be null
batch.activeQuantityCostItems[].origin.assembly.idstringAlways
batch.activeQuantityCostItems[].origin.assembly.numberstringAlways
batch.activeQuantityCostItems[].origin.breakdownobjectCan be null
batch.activeQuantityCostItems[].origin.breakdown.breakdownNumberstringCan be null
batch.activeQuantityCostItems[].recordedOnobjectAlways
batch.activeQuantityCostItems[].recordedOn.typeenum
PACKAGEBATCHPRODUCTHARVESTPLANTPLANT_BATCHMULTIPLE_PLANTSNONE
Always
batch.activeQuantityCostItems[].recordedOn.productobjectCan be null
batch.activeQuantityCostItems[].recordedOn.product.idstringAlways
batch.activeQuantityCostItems[].recordedOn.product.namestringAlways
batch.activeQuantityCostItems[].recordedOn.product.skustringAlways
batch.activeQuantityCostItems[].recordedOn.packageobjectCan be null
batch.activeQuantityCostItems[].recordedOn.package.idstringAlways
batch.activeQuantityCostItems[].recordedOn.package.metrcLabelstringAlways
batch.activeQuantityCostItems[].recordedOn.batchobjectCan be null
batch.activeQuantityCostItems[].recordedOn.batch.idstringAlways
batch.activeQuantityCostItems[].recordedOn.batch.namestringAlways
batch.activeQuantityCostItems[].recordedOn.harvestobjectCan be null
batch.activeQuantityCostItems[].recordedOn.harvest.namestringAlways
batch.activeQuantityCostItems[].recordedOn.plantobjectCan be null
batch.activeQuantityCostItems[].recordedOn.plant.labelstringCan be null
batch.activeQuantityCostItems[].recordedOn.plant.strainNamestringCan be null
batch.activeQuantityCostItems[].recordedOn.plantBatchobjectCan be null
batch.activeQuantityCostItems[].recordedOn.plantBatch.namestringAlways
batch.activeQuantityCostItems[].recordedOn.plantBatch.strainNamestringCan be null
batch.activeQuantityCostItems[].recordedOn.multiplePlantsobjectCan be null
batch.activeQuantityCostItems[].recordedOn.multiplePlants.summarystringAlways
batch.activeQuantityCostItems[].recordedOn.multiplePlants.detailsstringAlways
batch.activeQuantityCostItems[].quantitystringAlways
batch.activeQuantityCostItems[].costQuantitystringAlways
batch.activeQuantityCostItems[].unitTypeobjectAlways
batch.activeQuantityCostItems[].unitType.idstringAlways
batch.activeQuantityCostItems[].unitType.namestringAlways
batch.activeQuantityCostItems[].costPerUnitstringCan be null
batch.activeQuantityCostItems[].totalCoststringCan be null
What the AI reads

Gets one inventory batch by ID: header detail with quantity, activeQuantityCost, dates, product, owner and primary test result. Active quantity per location and the cost breakdown are left out unless you pass includeActiveQuantitiesByLocation or includeActiveQuantityCostItems. Use for a specific batch after resolving its ID via distru-search-batches; to browse or search batches use distru-search-batches; to change one, distru-mutate-batch. thc and cbd are free-text labels typed on the batch, not lab results; lab potency is on primaryTestResult. activeQuantityCost is the total cost of the active quantity, not per unit; null when none is recorded or the caller cannot view costs. The cost breakdown is null for batches of product-tracked and package-tracked products; use distru-get-product or distru-get-package for those. Null if no batch matches the ID; a permission error if the caller can't view it.