This API is part of the Track & Trace Tools platform. The API allows you to programmatically access all your Metrc data that is available on metrc.com
It is not related to the Metrc 3rd party API, does not use Metrc API keys, and is not affiliated with Metrc.
If you're looking for where to get started, check out the T3 Wiki API Getting Started guide.
The T3 API is subject to the Track & Trace Tools Terms of Use.
The T3 API features a limited number of free endpoints available to anyone with a Metrc login.
These can be found in the Free section.
There are two ways to get premium access to the T3 API:
- Subscribe to T3+
OR
- Use a provided T3 API key (consulting clients only. Reach out for more information.)
The T3 API uses JSON Web Tokens (JWT) for request authentication. To obtain a JWT, use one of the following:
- metrc.com login credentials:
- hostname: (The website you use to login to metrc:
ca.metrc.com,or.metrc.com, etc.) - username: Your Metrc username
- password: Your Metrc password
- otp: A one-time password used for 2-factor authentication (Only applies to Michigan users)
- hostname: (The website you use to login to metrc:
OR
- T3 API key
Refer to the Authentication endpoints below for more information.
Some endpoints support the use of secret key authentication. This allows you to use simple URLs to access your Metrc data.
Pass the secretKey returned from the request in the query string:
?secretKey=<yourSecretKeyGoesHere>
Refer to the /v2/auth/secretkey endpoint for information on generating secret keys.
The T3 API interacts with Metrc in a similar manner to the Track & Trace Tools Chrome extension. The API login process is designed with a strong emphasis on security. Your Metrc login details are never stored, and the API backend employs robust encryption methods to protect your temporary Metrc session.
-
Single-Use Login Credentials:
- The T3 API uses your login credentials only once to authenticate with Metrc.
- After the Metrc login process is complete, your login credentials are immediately deleted from the system.
- You are required to enter your login credentials each time you access the T3 API, ensuring that your credentials are never stored.
-
Secure Temporary Session Storage:
- The T3 API securely encrypts your logged-in Metrc session data. This data is only used when you make requests through the T3 API.
- The encrypted session data is automatically deleted after 24 hours, ensuring that your session information is not retained longer than necessary.
For any questions or concerns, please contact matt@trackandtrace.tools.
The T3 API privacy model follows the same principles as the Track & Trace Tools Chrome extension. The T3 API functions solely as a connector between you and Metrc, ensuring your privacy is protected.
-
No Data Collection:
- The T3 API does not record, save, harvest, inspect, or analyze any of your data.
- All data interactions are ephemeral and occur in real-time, without permanent storage.
-
Secure and Private Access:
- Your data is never shared with third parties. Unauthorized access to your login information or data is strictly prohibited.
- T3 employs industry-standard encryption protocols to safeguard all communications between the T3 API and Metrc.
-
User-Controlled Sessions:
- Your Metrc login credentials and session are used exclusively by you. The T3 API will never initiate Metrc traffic without your explicit authorization.
-
Compliance and Best Practices:
- T3's privacy practices are aligned with applicable data protection regulations, including GDPR and CCPA, ensuring that your data rights are respected.
The T3 API is subject to the Track & Trace Tools Privacy Policy. For any privacy-related inquiries, please contact matt@trackandtrace.tools.
Each Metrc account has different permissions based on several factors:
- Permissions granted by your Metrc admin
- Class of license (manufacturing, cultivation, etc)
- US state the license operates in
Use the Permissions endpoints to determine which actions are available to you.
View a list of all licenses available to the current user:
GET https://api.trackandtrace.tools/v2/licenses
Only one license can be queried per request. Specify the target license with the required licenseNumber query parameter:
GET https://api.trackandtrace.tools/v2/items?licenseNumber=LIC-00001
The API has a global default request rate limit of 600 requests/minute/user. Some routes have lower rate limits.
All data is queried as collections. There are no individual object endpoints. For example, you cannot find an individual object using an endpoint like /plants/{plantId}, individual objects must be queried by filtering the collection endpoint /plants for the exact plantId.
Collections are paginated, and can be filtered and sorted by individual object fields.
The JSON response object includes the following properties:
data: An array of objects, or any empty arraypage: The requested page indexpageSize: The requested page sizetotal: The total number of items in this collection. Use this to determine how many pages are required to return the entire collection.
Metrc data collections are queried as pages. Use the page and pageSize query parameters to indicate which page should be returned.
By default, page=1 and pageSize=100.
Example: Return page 3 with a page size of 500:
GET https://api.trackandtrace.tools/v2/items?licenseNumber=LIC-00001&page=3&pageSize=500
Metrc data collections can be sorted. Use the sort query parameter to indicate how the collection should be sorted.
Example: Sort items by name descending:
GET https://api.trackandtrace.tools/v2/items?licenseNumber=LIC-00001&sort=name:desc
Metrc data collections can be filtered. Use one or more filter query parameters to indicate how filters should be applied.
Example: Filter items that contain "flower" in the name field:
GET https://api.trackandtrace.tools/v2/items?licenseNumber=LIC-00001&filter:name__contains=flower
Multiple filters can be applied, and you can specify the logical operator (defaulting to "and"):
Example: Filter items that contain "flower" in the name field OR "kush" in the name field:
GET https://api.trackandtrace.tools/v2/items?licenseNumber=LIC-00001&filter=name__contains:flower&filter=name__contains:kush&filterLogic=or
String fields support the following filter operators:
containsdoesnotcontaineqneqstartswithendswith
Example ?filter=name__contains:flower
Note: all string filters are case-insensitive
Datetime fields support the following filter operators:
ltlteeqneqgtgte
Example: ?filter=harvestedDate__gte:2024-07-17T20:26:07.117Z
Note: all datetime filters use ISO8601 datetimes
Boolean fields support the following filter operators:
eq
Example: ?filter=finished__eq:true
pageSize is limited to 500 in most cases, so you may need to load multiple pages if a license has a large number of packages.
Refer to this example for how to load a full collection in a python script.
The API can be used in any way you like, but writing simple scripts to accomplish common tasks is an excellent way to take advantage of it.
The full OpenAPI spec, which can be imported into Postman, can be found here: /v2/spec/openapi.json
Lots of example scripts that show how the use the T3 API can be found here
- Responsible Organization: Class V LLC
- Responsible Developer: Matt Frisbie
- Email: matt@trackandtrace.tools
- URL: https://trackandtrace.tools
- Terms of Use: https://www.trackandtrace.tools/terms-of-use
This Python package is automatically generated by the OpenAPI Generator project:
- API version: v2
- Package version: 0.6.0
- Generator version: 7.13.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
Python 3.9+
If the python package is hosted on a repository, you can install directly using:
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)
Then import the package:
import t3apiInstall via Setuptools.
python setup.py install --user(or sudo python setup.py install to install the package for all users)
Then import the package:
import t3apiExecute pytest to run the tests.
Please follow the installation procedure and then run the following:
import t3api
from t3api.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.trackandtrace.tools
# See configuration.py for a list of all supported configuration parameters.
configuration = t3api.Configuration(
host = "https://api.trackandtrace.tools"
)
# Enter a context with an instance of the API client
with t3api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = t3api.AuthenticationApi(api_client)
v2_auth_apikey_post_request = t3api.V2AuthApikeyPostRequest() # V2AuthApikeyPostRequest | JSON object containing your API key authentication details
try:
# Authenticate with a T3 API key
api_response = api_instance.v2_auth_apikey_post(v2_auth_apikey_post_request)
print("The response of AuthenticationApi->v2_auth_apikey_post:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling AuthenticationApi->v2_auth_apikey_post: %s\n" % e)All URIs are relative to https://api.trackandtrace.tools
- EndpointId
- ExtractedLabResult
- IncomingTransferManifestReportResponse
- JWTData
- LabTestingStates
- MetrcCreatePackageInputsResponse
- MetrcCreateTransferInputsResponse
- MetrcCredentialAuthPayload
- MetrcDeliveryPackage
- MetrcDeliveryPackageListResponse
- MetrcDiscontinueItemPayload
- MetrcDiscontinueStrainPayload
- MetrcDriver
- MetrcFacility
- MetrcFacilityListResponse
- MetrcFacilityPhysicalAddress
- MetrcHarvest
- MetrcHarvestListResponse
- MetrcHarvestPackage
- MetrcHarvestPackageListResponse
- MetrcHarvestPlant
- MetrcHarvestPlantListResponse
- MetrcHarvestReportResponse
- MetrcHistory
- MetrcHistoryListResponse
- MetrcIncomingTransfer
- MetrcIncomingTransferListResponse
- MetrcItem
- MetrcItemListResponse
- MetrcItemPhoto
- MetrcItemPhotoListResponse
- MetrcLicense
- MetrcLocation
- MetrcOutgoingTransfer
- MetrcOutgoingTransferListResponse
- MetrcPackage
- MetrcPackageLabResult
- MetrcPackageLabResultBatch
- MetrcPackageLabResultBatchListResponse
- MetrcPackageLabResultListResponse
- MetrcPackageListResponse
- MetrcPackageReportResponse
- MetrcPackageSourceHarvest
- MetrcPackageSourceHarvestListResponse
- MetrcPlant
- MetrcPlantBatch
- MetrcPlantBatchListResponse
- MetrcPlantBatchReportResponse
- MetrcPlantListResponse
- MetrcPlantReportResponse
- MetrcRemediationMethod
- MetrcSalesReceipt
- MetrcSalesReceiptListResponse
- MetrcSalesReceiptReportResponse
- MetrcSessionAuthPayload
- MetrcSessionAuthPayloadFacilitiesInner
- MetrcState
- MetrcStrain
- MetrcStrainListResponse
- MetrcSuperpackage
- MetrcSuperpackageAllOfMetadata
- MetrcSuperpackageListResponse
- MetrcTag
- MetrcTransaction
- MetrcTransactionListResponse
- MetrcTransferDelivery
- MetrcTransferDeliveryListResponse
- MetrcTransferTransporter
- MetrcTransferTransporterDetails
- MetrcTransferTransporterDetailsListResponse
- MetrcTransferTransporterListResponse
- MetrcTransferredPackage
- MetrcTransferredPackageListResponse
- MetrcVehicle
- MetrcVoidSalesReceiptPayload
- OutgoingTransferManifestReportResponse
- Pagination
- SearchResponse
- T3GenerateLabelsPayload
- T3GenerateLabelsPayloadDEPRECATED
- T3IncomingTransferManifest
- T3LabelContentData
- T3LabelContentDataListResponse
- T3LabelContentLayoutConfig
- T3LabelContentLayoutElement
- T3LabelContentLayoutElementParagraphFontName
- T3LabelContentLayoutElementTextResizeStrategy
- T3LabelContentLayoutElementType
- T3LabelContentLayoutsResponse
- T3LabelRenderingOptions
- T3LabelTemplateLayoutConfig
- T3LabelTemplateLayoutsResponse
- T3OutgoingTransferManifest
- T3PackageLabelsPayload
- T3PackageLabelsPayloadDEPRECATED
- UnitOfMeasure
- UnitOfMeasureAbbreviation
- V2AuthApikeyPostRequest
- V2AuthCredentialsPost200Response
- V2AuthCredentialsPostRequest
- V2AuthSecretkeyPost200Response
- V2AuthSecretkeyPostRequest
- V2AuthWhoamiGet200Response
- V2FilesLabelsContentDataPackagesActivePost200Response
- V2FilesLabelsContentDataPackagesActivePostRequest
- V2FilesLabelsContentDataPackagesActivePostRequestRenderingOptions
- V2FilesLabelsGeneratePostRequest
- V2FilesLabelsGeneratePostRequestLabelContentDataInner
- V2FilesLabelsGeneratePostRequestRenderingOptions
- V2FilesLabelsLabelContentLayoutsGet200Response
- V2FilesLabelsLabelContentLayoutsGet200ResponseData
- V2FilesLabelsLabelContentLayoutsGet200ResponseDataDataInner
- V2FilesLabelsLabelContentLayoutsGet200ResponseDataDataInnerElementsInner
- V2FilesLabelsLabelTemplateLayoutsGet200Response
- V2FilesLabelsLabelTemplateLayoutsGet200ResponseData
- V2FilesLabelsLabelTemplateLayoutsGet200ResponseDataDataInner
- V2FilesLabelsLabelTemplateLayoutsGet200ResponseDataDataInnerLabelTemplateLayoutConfig
- V2HarvestsActiveGet200Response
- V2HarvestsActiveReportGet200Response
- V2HarvestsPlantsGet200Response
- V2ItemsDiscontinuePost200Response
- V2ItemsDiscontinuePost400Response
- V2ItemsDiscontinuePost400ResponseError
- V2ItemsDiscontinuePost500Response
- V2ItemsDiscontinuePost500ResponseError
- V2ItemsDiscontinuePost503Response
- V2ItemsDiscontinuePost503ResponseError
- V2ItemsDiscontinuePostRequest
- V2ItemsGet200Response
- V2ItemsHistoryGet200Response
- V2ItemsPhotosGet200Response
- V2ItemsReportGet200Response
- V2LabelsGeneratePostRequest
- V2LicensesGet200ResponseInner
- V2PackagesActiveGet200Response
- V2PackagesActiveReportGet200Response
- V2PackagesActiveSuperGet200Response
- V2PackagesCreateInputsGet200Response
- V2PackagesCreatePostRequestInner
- V2PackagesCreatePostRequestInnerIngredientsInner
- V2PackagesLabresultBatchesGet200Response
- V2PackagesLabresultsGet200Response
- V2PackagesNotesPostRequestInner
- V2PackagesSourceHarvestsGet200Response
- V2PackagesTransferredGet200Response
- V2PackagesTransferredReportGet200Response
- V2PackagesUnfinishPostRequestInner
- V2PlantbatchesActiveGet200Response
- V2PlantbatchesActiveReportGet200Response
- V2PlantsVegetativeGet200Response
- V2PlantsVegetativeReportGet200Response
- V2SalesActiveGet200Response
- V2SalesActiveReportGet200Response
- V2SalesTransactionsGet200Response
- V2SalesUnfinalizePostRequestInner
- V2SearchGet200Response
- V2SearchGet200ResponseDataInner
- V2StatesGet200ResponseInner
- V2StrainsCreatePostRequestInner
- V2StrainsDiscontinuePostRequest
- V2StrainsGet200Response
- V2StrainsReportGet200Response
- V2TransfersCreateDestinationsGet200Response
- V2TransfersCreateInputsGet200Response
- V2TransfersCreateInputsGet200ResponseTransferTypesInner
- V2TransfersCreateInputsGet200ResponseTransferTypesInnerFacilityTypesInner
- V2TransfersCreatePostRequestInner
- V2TransfersCreatePostRequestInnerDestinationsInner
- V2TransfersCreatePostRequestInnerDestinationsInnerPackagesInner
- V2TransfersCreatePostRequestInnerDestinationsInnerTransportersInner
- V2TransfersCreatePostRequestInnerDestinationsInnerTransportersInnerTransporterDetailsInner
- V2TransfersDeliveriesGet200Response
- V2TransfersIncomingActiveGet200Response
- V2TransfersIncomingManifestReportGet200Response
- V2TransfersOutgoingActiveGet200Response
- V2TransfersOutgoingManifestReportGet200Response
- V2TransfersTemplatesCreatePostRequestInner
- V2TransfersTemplatesCreatePostRequestInnerDestinationsInner
- V2TransfersTemplatesCreatePostRequestInnerDestinationsInnerPackagesInner
- V2TransfersTransporterDetailsGet200Response
- V2TransfersTransportersGet200Response
Authentication schemes defined for the API:
- Type: Bearer authentication (JWT)
