Batch
Information
The batch
resource type is used to set the amount of THC and CBD for products
. The information associated with this resource only includes THC and CBD; no other cannabinoids.
There are two ways to set the batch
information:
- Milligrams (mg) is denoted by the attribute
unit_type: milligrams
- Percentage (%) is denoted by the attribute
unit_type: percent
Currently, only a percentage-based Batch will be displayed in the UI.
Only products associated with Flower, Concentrates, and Vape Pens categories display batch
data on the frontend, though it can be applied to any product.
Below are batch
examples:
- 26.22% THC 0.47% CBD (per pack of flower)
- THC 689.3 mg / CBD 1.8 mg (per package for a 10-pack of prerolls)
If the unit_type
is percent
, the sum of CBD and THC must be greater than or equal to 0 and less than or equal to 99.9.
API Requests
The request types and routes available for this resource as well as details on how to structure your requests are below. See API Reference - Batch for examples on how the requests might look in various languages and to test the requests in the browser.
Request | Route | Description |
---|---|---|
POST | /catalogs/v1/batches | Create a new batch (see Note 1 below) |
GET | /catalogs/v1/batches | Request the information for all batches |
GET | /catalogs/v1/batches/:id | Request the information for a particular batch |
PATCH | /catalogs/v1/batches/:id | Update the information for an existing batch |
DELETE | /catalogs/v1/batches/:id | Delete an existing batch |
You cannot add a
batch
to aproduct
that has been discontinued.
POST
To create a Batch, send a payload with the below structure to
/catalog/v1/batches?scope_by[organization_id]=ORGANIZATION_ID
.
{
"data": {
"type": "batches",
"attributes": {
"thc_amount": "50",
"cbd_amount": "49.9",
"unit_type": "percent"
},
"relationships": {
"product": {
"data": {
"type": "products",
"id": "PRODUCT_ID"
}
},
"organization": {
"data": {
"type": "organizations",
"id": "ORGANIZATION_ID"
}
}
}
}
}
Path
scope_by[organization_id] string
Required. Organization UUID.
Attributes
id string
Optional. UUID for the resource.
cbd_amount float
Required. Defaults to 0.0. When present, the sum of CBD and THC must be ≥ 0.0 and ≤ 99.9 if the unit_type
is percent
.
thc_amount float
Required. Defaults to 0.0. When present, the sum of CBD and THC must be ≥ 0.0 and ≤ 99.9 if the unit_type
is percent
.
unit_type string
Required. Must be either milligrams
or percent
.
type string
Required. Must be batches
.
Relationships
Organization
organization_id string
Required. Related Organization UUID.
type string
Required. Must be organizations
.
Product
product_id string
Required. Related Product UUID.
type string
Required. Must be products
.
GET Index
To fetch all Batches, send a request to
/catalog/v1/batches?scope_by[organization_id]=ORGANIZATION_ID
. By default, we only return the first 10 results from the request. You can adjust the number of returned results with page[size]
, or adjust the returned page with page[page]
.
Path
scope_by[organization_id] string
Required. Organization UUID.
page[size] int32
Optional. Number of elements per page.
page[page] int32
Optional. Number of the page.
filter[product_id] string
Optional. Product UUID.
GET Show
To fetch a Batch, send a request to
/catalog/v1/batches/BATCH_ID?scope_by[organization_id]=ORGANIZATION_ID
.
Path
scope_by[organization_id] string
Required. Organization UUID.
batch_id string
Required. Batch UUID you want to fetch.
PATCH
To update a Batch, send a payload with the below structure to
/catalog/v1/batches/BATCH_ID?scope_by[organization_id]=ORGANIZATION_ID
{
"data": {
"type": "batches",
"id": "BATCH_ID",
"attributes": {
"thc_amount": "50",
"cbd_amount": "49.9",
"unit_type": "percent"
},
"relationships": {
"product": {
"data": {
"type": "products",
"id": "PRODUCT_ID"
}
},
"organization": {
"data": {
"type": "organizations",
"id": "ORGANIZATION_ID"
}
}
}
}
}
Path
scope_by[organization_id] string
Required. Organization UUID.
batch_id string
Required. Batch UUID you want to update.
Attributes
cbd_amount float
Optional. When present, the sum of CBD and THC must be >= 0.0 and <= 99.9 if the unit_type is 'percent'.
thc_amount float
Optional. When present, the sum of CBD and THC must be >= 0.0 and <= 99.9 if the unit_type is 'percent'.
unit_type string
Optional. Must be either 'milligrams' or 'percent'.
type string
Required. Must be batches
.
Relationships
Organization
organization_id string
Required. Related Organization UUID.
type string
Required. Must be organizations
.
Product
product_id string
Required. Related Product UUID.
type string
Required. Must be products
.
DELETE
To delete a Batch, send a request to
/catalog/v1/batches/BATCH_ID?scope_by[organization_id]=ORGANIZATION_ID
Path
scope_by[organization_id] string
Required. Organization UUID.
batch_id string
Required. Batch UUID you want to delete.
Updated 11 months ago