Add a sample to an order
Add a sample to an existing order and return the updated order.
Send the sample as a single sample form field containing the JSON-encoded
object described below. The sample must belong to the same industry as the
rest of the order.
Samples cannot be added to an order that has been canceled or completed;
those requests fail with invalid_order_status.
Sample fields
name(string) — product name for this sample.strain_name(string) — name of the sample strain. Optional for non-cannabis samples.type_id(int) — ID from the sample type enumeration.production_method_id(int) — ID from the production method enumeration. To submit a blank value, use the category's unnamed production method fromGET /sampleproductionmethods(99for cannabis plant samples; other categories have their own blank IDs).classification_id(int) — ID from the sample classification enumeration. Use1to submit a blank value.test_package_ids(list of int) — IDs of the test packages ordered for this sample.notes(string, optional) — additional notes about this sample.lims_id(string, optional) — internal tracking ID for this sample.production_date(date, optional) — date the sample or product was harvested or created.date_samples_collected(date, optional) — date the sample was collected.batch_id(string, optional) — batch identifier.batch_size(float, optional) — batch size.batch_size_unit(string, optional) —gfor grams,unitsfor units, orlbfor pounds. Defaults tog.lot_id(string, optional) — lot identifier.lot_size(float, optional) — lot size.lot_size_unit(string, optional) —gfor grams,unitsfor units, orlbfor pounds. Defaults tog.production_run_id(string, optional) — production run identifier.production_run_size(float, optional) — production run size.production_run_size_unit(string, optional) —gfor grams,unitsfor units, orlbfor pounds. Defaults tog.manifest_id(string, optional) — manifest identifier, often for seed-to-sale systems.harvest_id(string, optional) — harvest identifier, often for seed-to-sale systems.regulator_sample_id(string, optional) — seed-to-sale tracking ID for this sample.regulator_batch_id(string, optional) — seed-to-sale batch ID for this sample.regulator_lot_id(string, optional) — seed-to-sale lot ID for this sample.
The following fields are required to calculate mg/container values for edibles:
unit_description(string, optional) — describes the serving unit of the sample.unit_weight(float, optional) — weight of an individual unit.units_per_serving(float, optional) — how many units make up one serving.servings_per_container(float, optional) — how many servings are in a container.
The sample object also accepts:
send_client_email(boolean, optional) — iftruethe client receives email notifications for the order being edited. Defaults totrue.
Path parameters
Body parameters (application/x-www-form-urlencoded)
JSON-encoded sample object — see the field reference below.
Try it
Log in to send test requests to this endpoint straight from the docs.
Responses
200 Success
Show 33 child attributes Hide 33 child attributes
Order ID
Industry ID
Industry Name
Order lims ID
Client ID
Status ID
Status Name
Lab license number under which order was tested
Client license number under which order was placed
Order Date [when order was placed]
Verified Date [when order was verified]
Completed Date [when order was completed]
Time this order was last modified
Show 6 child attributes Hide 6 child attributes
Address ID
Street address line 1
Street address line 2
City
Two letter state abbreviation
Zipcode
Show 9 child attributes Hide 9 child attributes
Client ID
Organization Name
Whether this is a training client
Time this client was last modified
Organization Email
Organization Phone
Organization Website
Show 6 child attributes Hide 6 child attributes
Address ID
Street address line 1
Street address line 2
City
Two letter state abbreviation
Zipcode
Show 6 child attributes Hide 6 child attributes
License ID
License Number
License Code (some states only)
Human entered name for license
License Designation Name [changes by state]
License Type Name [changes by state]
Show 90 child attributes Hide 90 child attributes
Sample ID
Orders ID
Client ID
Lab
Show 2 child attributes Hide 2 child attributes
Lab ID
Lab Name
Order Status ID
Order Status Name
Name of Sample
Name of Sample Strain
Sample Industry ID
Sample Industry Name
Sample Category ID
Sample Category Name
Sample Type ID
Sample Type Name
Sample Classification ID
Sample Classification Name
Production Method name
Production Method ID
Unique ID from the state's seed-to-sale tracking system of the sample tested by the lab
Unique ID from the state's seed-to-sale tracking system of the client's batch from which the sample tested by the lab came
Unique ID from the client's inventory management system of the client's batch from which the sample tested by the lab came
Unique ID from the state's seed-to-sale tracking system of the client's harvest lot from which the sample tested by the lab came
Show 4 child attributes Hide 4 child attributes
Unique ID for Test Package
Test Package Name
Package Price - if 0, call for price
Minimum sample quantity required for testing
Time this sample was last modified
Published Date [when sample was published]
Sample weight at order verification
Unit type for Initial Weight
Show 3 child attributes Hide 3 child attributes
Unique ID for Test Type
Test Type Name
Test Type Abbreviation
Show 3 child attributes Hide 3 child attributes
Unique public key for file
Public URL to access file
Will also contain cover image
Show 3 child attributes Hide 3 child attributes
Unique public key for file
Public URL to access file
Notes about the sample
Size of the client's batch from which the sample tested by the lab came
Unit type for batch size (units, lb, or g)
Unique ID from the client's inventory management system of the client's lot from which the sample tested by the lab came
Size of the client's lot from which the sample tested by the lab came
Unit type for lot size (units, lb, or g)
Unique ID from the client's inventory management system of the client's production run from which the sample tested by the lab came
Size of the client's production run from which the sample tested by the lab came
Unit type for production run size (units, lb, or g)
Unique ID from the state's seed-to-sale tracking system of the sample manifest from which the sample tested by the lab came
Unique ID from the state's seed-to-sale tracking system of the client's lot from which the sample tested by the lab came
(for Leaf) Pre-Transfer Batch ID
(for Leaf) Pre-Transfer Inventory/Lot ID
Harvest/Production Date [when sample was produced]
Collection Date [when sample was collected]
Unique URL for viewing this sample or CoA without requiring a login. Should be added to CoAs and used for QR codes or other barcode images so end consumers can verify the integrity of the data
Serving Size
Number of Servings in one Container
Information describing what a "unit" means for this sample (i.e 1 Bottle)
Information describing what a "unit" means for this sample (i.e 1 Gummy)
Unique ID for sample's regulatory category
Information about the solvents used in testing
True if sample has a Certificate of Analysis
URL expires after one hour
Show 3 child attributes Hide 3 child attributes
Unique public key for file
Public URL to access file
URLs expire after one hour
Show 3 child attributes Hide 3 child attributes
Unique public key for file
Public URL to access file
Orders lims ID
Sample lims ID
Current weight on hand
Unit type for weight measurements (units, g, or ml)
True if sample has test results
True if sample has draft test results
True if sample has a draft Certificate of Analysis
URL expires after one hour
Show 3 child attributes Hide 3 child attributes
Unique public key for file
Public URL to access file
Show 4 child attributes Hide 4 child attributes
Name of user who added log
Unique ID for user who added log
Timestamp of log creation time
Log Content
Custom Field
Custom External Json Data
Custom data field
Custom data field
Custom data field
Custom data field
Custom data field
Custom data field
Custom data field
Custom data field
Custom data field
Custom data field
Custom data field for dates
Custom data field for dates
Custom data field for dates
Custom data field for dates
Custom data field for dates
Custom data field for yes/no fields
Custom data field for yes/no fields
Custom data field for yes/no fields
Custom data field for yes/no fields
Custom data field for yes/no fields
Total price of test packages with custom client pricing and discounts included
Due date
True if sample has rushed test types
List of rushed test type abbreviations
Show 4 child attributes Hide 4 child attributes
Name of user who added log
Unique ID for user who added log
Timestamp of log creation time
Log Content
URLs expire after one hour
Show 3 child attributes Hide 3 child attributes
Unique public key for file
Public URL to access file
Comments entered when placing the order
Message saved when rejecting the order
Message saved when verifying the order
Message saved when completing the order
Percent discount applied to order
Flat discount applied to end of order (pre-tax)
Sales tax rate applied to order
Sales tax applied to order (in cents)
Pre-tax cost for order (in cents)
Final invoice cost for order (in cents)
Whether this is a pickup or dropoff
Secondary client type ID
Secondary client name
Secondary client address
Secondary client license
400 Bad request
The request was malformed or failed validation. Validation failures include per-field messages in error_details.
Possible error_code values: invalid_request, request_too_old.
401 Unauthorized
Authentication failed.
Possible error_code values: missing_api_key, invalid_api_key, invalid_credentials_type, api_access_restricted, api_access_denied, missing_signature, missing_timestamp, invalid_timestamp, invalid_signature.
403 Permission denied
The API key is valid but does not have permission for this endpoint (for example, a client key calling a labs endpoint).
Possible error_code values: permission_denied.
404 Not found
The requested record does not exist or is not visible to this organization.
Possible error_code values: not_found.
# X-ConfidentLims-Signature: see the Request Signing guide - https://api.confidentcannabis.com/v0/docs/request-signing.md
curl -X POST 'https://api.confidentcannabis.com/v0/labs/order/{order_id}/samples' \
-H 'X-ConfidentLims-APIKey: YOUR_API_KEY' \
-H 'X-ConfidentLims-Timestamp: UNIX_TIMESTAMP' \
-H 'X-ConfidentLims-Signature: REQUEST_SIGNATURE' \
--data-urlencode 'sample={
"name": "Blue Dream - Cured Flower",
"strain_name": "Blue Dream",
"type_id": 1,
"production_method_id": 1,
"classification_id": 4,
"test_package_ids": [
4
],
"notes": "Collected from the north drying room.",
"lims_id": "LIMS-8841-1",
"production_date": "2025-02-18",
"date_samples_collected": "2025-03-13",
"batch_id": "BD-2503-01",
"batch_size": 4500.0,
"batch_size_unit": "g",
"harvest_id": "HARVEST-2503-BD",
"regulator_sample_id": "1A4060300003B01000001234",
"regulator_batch_id": "1A4060300003B01000000987",
"send_client_email": true
}'
import time import requests # sign_request() is defined in the Request Signing guide: # https://api.confidentcannabis.com/v0/docs/request-signing.md from sign_request import sign_request API_KEY = 'YOUR_API_KEY' API_SECRET = 'YOUR_API_SECRET' path = '/v0/labs/order/{order_id}/samples' data = { "sample": "{\n \"name\": \"Blue Dream - Cured Flower\",\n \"strain_name\": \"Blue Dream\",\n \"type_id\": 1,\n \"production_method_id\": 1,\n \"classification_id\": 4,\n \"test_package_ids\": [\n 4\n ],\n \"notes\": \"Collected from the north drying room.\",\n \"lims_id\": \"LIMS-8841-1\",\n \"production_date\": \"2025-02-18\",\n \"date_samples_collected\": \"2025-03-13\",\n \"batch_id\": \"BD-2503-01\",\n \"batch_size\": 4500.0,\n \"batch_size_unit\": \"g\",\n \"harvest_id\": \"HARVEST-2503-BD\",\n \"regulator_sample_id\": \"1A4060300003B01000001234\",\n \"regulator_batch_id\": \"1A4060300003B01000000987\",\n \"send_client_email\": true\n}", } headers = {'X-ConfidentLims-Timestamp': str(int(time.time()))} headers['X-ConfidentLims-Signature'] = sign_request( 'POST', path, headers, data, API_KEY, API_SECRET) headers['X-ConfidentLims-APIKey'] = API_KEY response = requests.post( 'https://api.confidentcannabis.com' + path, headers=headers, data=data, ) print(response.json())
// signRequest() is defined in the Request Signing guide: // https://api.confidentcannabis.com/v0/docs/request-signing.md import { signRequest } from './sign_request.js'; const API_KEY = 'YOUR_API_KEY'; const API_SECRET = 'YOUR_API_SECRET'; const path = "/v0/labs/order/{order_id}/samples"; const data = { "sample": "{\n \"name\": \"Blue Dream - Cured Flower\",\n \"strain_name\": \"Blue Dream\",\n \"type_id\": 1,\n \"production_method_id\": 1,\n \"classification_id\": 4,\n \"test_package_ids\": [\n 4\n ],\n \"notes\": \"Collected from the north drying room.\",\n \"lims_id\": \"LIMS-8841-1\",\n \"production_date\": \"2025-02-18\",\n \"date_samples_collected\": \"2025-03-13\",\n \"batch_id\": \"BD-2503-01\",\n \"batch_size\": 4500.0,\n \"batch_size_unit\": \"g\",\n \"harvest_id\": \"HARVEST-2503-BD\",\n \"regulator_sample_id\": \"1A4060300003B01000001234\",\n \"regulator_batch_id\": \"1A4060300003B01000000987\",\n \"send_client_email\": true\n}", }; const headers = { 'X-ConfidentLims-Timestamp': String(Math.floor(Date.now() / 1000)) }; headers['X-ConfidentLims-Signature'] = signRequest( "POST", path, headers, data, API_KEY, API_SECRET); headers['X-ConfidentLims-APIKey'] = API_KEY; const response = await fetch("https://api.confidentcannabis.com" + path, { method: "POST", headers, body: new URLSearchParams(data), }); console.log(await response.json());
{
"success": true,
"order": {
"id": "2503GLL0042",
"industry_id": 1,
"industry_name": "Cannabis",
"lims_id": "PO-8841",
"client_id": 318,
"status_id": 2,
"status_name": "Placed",
"lab_license_number": "C8-0000123-LIC",
"client_license_number": "CDPH-10003456",
"ordered_date": "2025-03-14T09:12:44",
"verified_date": null,
"completed_date": null,
"last_modified": "2025-03-14T09:12:44",
"address": {
"id": 771,
"address_line_1": "1400 Industrial Way",
"address_line_2": "Suite 4",
"city": "Sacramento",
"state_abbreviation": "CA",
"zipcode": "95811"
},
"client": {
"id": 318,
"name": "Sunrise Cultivation",
"training": false,
"last_modified": "2025-02-27T18:04:03",
"email": "orders@sunrisecultivation.com",
"phone": "9165550142",
"url": "https://sunrisecultivation.com",
"primary_address": {
"id": 902,
"address_line_1": "55 Orchard Road",
"address_line_2": null,
"city": "Woodland",
"state_abbreviation": "CA",
"zipcode": "95695"
},
"licenses": [
{
"id": 4410,
"license_number": "CDPH-10003456",
"license_code": null,
"nickname": "Woodland cultivation",
"license_designation_name": "Adult Use",
"license_type_name": "Cultivation - Small Indoor"
}
]
},
"samples": [
{
"id": "2503GLL0042.0001",
"order_id": "2503GLL0042",
"client_id": 318,
"lab": {
"id": 12,
"name": "Green Leaf Labs"
},
"order_status_id": 2,
"order_status_name": "Placed",
"sample_name": "Blue Dream - Cured Flower",
"strain_name": "Blue Dream",
"sample_industry_id": 1,
"sample_industry_name": "Cannabis",
"sample_category_id": 1,
"sample_category_name": "Plant",
"sample_type_id": 1,
"sample_type_name": "Flower, Cured",
"sample_classification_id": 4,
"sample_classification_name": "Hybrid",
"production_method_id": 1,
"production_method_name": "Indoor",
"regulator_sample_id": "1A4060300003B01000001234",
"regulator_batch_id": "1A4060300003B01000000987",
"batch_id": "BD-2503-01",
"harvest_id": "HARVEST-2503-BD",
"test_packages": [
{
"id": 4,
"name": "California Compliance - Flower",
"price": 275.0,
"minimum_quantity": 5.0
}
],
"last_modified": "2025-03-14T09:12:44",
"date_published": null,
"order_lims_id": "PO-8841",
"lims_id": "LIMS-8841-1",
"notes": "Collected from the north drying room.",
"batch_size": 4500.0,
"batch_size_unit": "g",
"production_date": "2025-02-18",
"date_samples_collected": "2025-03-13",
"public_url": "https://confidentcannabis.com/s/2503GLL0042.0001",
"weight_on_hand": 12.5,
"weight_on_hand_unit": "g",
"has_lab_data": false,
"has_coa": false,
"coa": null,
"coa_additions": []
}
],
"logs": [
{
"user_name": "Dana Reyes",
"user_id": 5501,
"log_time": "2025-03-14T09:12:44",
"message": "Order placed"
}
],
"files": [],
"comments": "Please prioritise potency.",
"rejected_message": null,
"verified_message": null,
"completed_message": null,
"discount": 0.0,
"lab_adjustment": -25.0,
"sales_tax_rate": 0.0,
"sales_tax_cents": 0,
"subtotal_cents": 27500,
"total_price_cents": 25000,
"pickup": false,
"secondary_client_type": 1,
"secondary_client_name": "Valley Distribution",
"secondary_client_address": "2100 Harbor Blvd, Oakland, CA 94607",
"secondary_client_license": "C11-0000456-LIC"
}
}