Upsert a test result
Create or update a single test result (lab result / Certificate of Analysis) for one package or batch. Omit id to create; pass an existing test result's id to update it. Same URL and request shape for both.
On create, attach the result to exactly one material by sending either package_id or batch_id (never both, and at least one is required). On update, send neither — the attachment is fixed once created, and passing package_id or batch_id on an update is rejected. Only non-compliance-tracked test results can be updated through this endpoint; results synced from Metrc or BioTrack are read-only here and any update attempt is rejected.
Updates are sparse: only the fields you send are changed, and any field you omit keeps its stored value. To clear an optional potency or lab field back to null, send it explicitly as null. Potency percentage fields accept at most 4 decimal places and must be between 0 and 100.
Results created or updated here are Distru-only records — this endpoint never pushes to Metrc or BioTrack. Compliance-tracked results only ever arrive by syncing from those systems, which is why they are read-only here.
Effects beyond the test result row: • Creating a result attaches it to the given package or batch and propagates it down to that material's child packages where applicable. • is_primary: true makes this the primary result for its package/batch: it unsets whatever result was previously primary there, propagates to child packages, and repoints those materials' inventory/stock records at this result (so it becomes the potency shown for that inventory). A material always keeps exactly one primary — the first result created for a material becomes primary automatically even if you send is_primary: false. • You cannot flip an existing primary result from is_primary: true to false directly; instead mark a different result on the same package/batch as primary, which demotes this one automatically.
Required permission: products_permissions_edit.
Request body
Response
A single test result
Changes
No recorded changes to this endpoint across all 1 revision of this API.