# Track & Trace Tools Wiki > Documentation for Track & Trace Tools Track & Trace Tools (T3) is a set of tools for cannabis operators who use Metrc. T3 is not affiliated with Metrc. Every link below is a Markdown copy of a wiki page. For the T3 API's OpenAPI spec and the t3api-utils Python library, start at https://api.trackandtrace.tools/llms.txt # General # T3 Wiki Documentation for the [Track & Trace Tools (T3) platform](https://trackandtrace.tools), a set of tools for cannabis operators who use [Metrc](https://wiki.trackandtrace.tools/metrc/index.md). T3 is not affiliated with Metrc. ## T3 API HTTP access to metrc.com using a Metrc login. Performs any task available in the Metrc web interface, including tasks the Metrc API does not support. - [Getting Started](https://wiki.trackandtrace.tools/t3-api/getting-started/index.md) - [Authentication](https://wiki.trackandtrace.tools/t3-api/authentication/index.md) - [Setting Up Python](https://wiki.trackandtrace.tools/t3-api/setting-up-python/index.md) - [API Scripts](https://wiki.trackandtrace.tools/t3-api/api-scripts/index.md) - [Creating Packages](https://wiki.trackandtrace.tools/t3-api/creating-packages/index.md) - [Spreadsheet Sync](https://wiki.trackandtrace.tools/t3-api/spreadsheet-sync/index.md) - [Search](https://wiki.trackandtrace.tools/t3-api/search/index.md) - [OpenAPI Spec](https://wiki.trackandtrace.tools/t3-api/openapi/index.md) [All T3 API pages](https://wiki.trackandtrace.tools/t3-api/index.md) ## T3 Labels Label templates, layouts, and PDF generation populated with live Metrc data, for inkjet and thermal printers. - [Getting Started](https://wiki.trackandtrace.tools/t3-labels/getting-started/index.md) - [Tutorial](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md) - [Label Studio](https://wiki.trackandtrace.tools/t3-labels/label-studio/index.md) - [Label Templates](https://wiki.trackandtrace.tools/t3-labels/label-templates/index.md) - [Label Layouts](https://wiki.trackandtrace.tools/t3-labels/label-layouts/index.md) - [Generating Label PDFs](https://wiki.trackandtrace.tools/t3-labels/generating-label-pdfs/index.md) - [Printing Label PDFs](https://wiki.trackandtrace.tools/t3-labels/printing-label-pdfs/index.md) - [Retail ID](https://wiki.trackandtrace.tools/t3-labels/retail-id/index.md) [All T3 Labels pages](https://wiki.trackandtrace.tools/t3-labels/index.md) ## T3 Chrome Extension Adds tooling to metrc.com pages in place: bulk grid search and select, CSV form fill, reports, and label generation. - [Getting Started](https://wiki.trackandtrace.tools/t3-chrome-extension/getting-started/index.md) - [Primary Features](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/index.md) - [T3+ Features](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/index.md) - [CSV Form Fill](https://wiki.trackandtrace.tools/t3-chrome-extension/csv-form-fill/index.md) - [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/index.md) - [Label Studio](https://wiki.trackandtrace.tools/t3-chrome-extension/label-studio/index.md) - [Scan Sheets](https://wiki.trackandtrace.tools/t3-chrome-extension/scan-sheets/index.md) [All T3 Chrome Extension pages](https://wiki.trackandtrace.tools/t3-chrome-extension/index.md) ## T3 Reports Return an entire Metrc dataset in a single request, already filtered, sorted, and formatted the way you asked for it. - [Report Endpoints](https://wiki.trackandtrace.tools/reports/endpoints/index.md) - [Shaping a Report](https://wiki.trackandtrace.tools/reports/shaping/index.md) - [Output Format](https://wiki.trackandtrace.tools/reports/output/index.md) - [Delivering a Report](https://wiki.trackandtrace.tools/reports/delivery/index.md) - [Super Reports](https://wiki.trackandtrace.tools/reports/super-reports/index.md) - [Examples](https://wiki.trackandtrace.tools/reports/examples/index.md) - [Limits and Troubleshooting](https://wiki.trackandtrace.tools/reports/limits/index.md) [All T3 Reports pages](https://wiki.trackandtrace.tools/reports/index.md) ## T3 OpenTag iOS and Android app for scanning Metrc tags against tag lists, for inventory checks and tag verification. Phones scan tag barcodes; RFID scanning runs on the Chainway C72 handheld. - [RFID](https://wiki.trackandtrace.tools/opentag/rfid/index.md) - [Tag Lists](https://wiki.trackandtrace.tools/opentag/tag-lists/index.md) [All T3 OpenTag pages](https://wiki.trackandtrace.tools/opentag/index.md) ## Background and reference - [FAQ](https://wiki.trackandtrace.tools/faq/index.md): common questions about T3 and T3+ - [Metrc](https://wiki.trackandtrace.tools/metrc/index.md): what Metrc is and how T3 relates to it - [Metrc Tags and RFID](https://wiki.trackandtrace.tools/metrc-tags/index.md): tag formats and RFID basics - [T3+](https://wiki.trackandtrace.tools/t3-plus/index.md): what a subscription unlocks - [Interactive API docs](https://api.trackandtrace.tools/v2/docs/) and the [OpenAPI specification](https://api.trackandtrace.tools/v2/spec/openapi.json) - [T3 API examples on GitHub](https://github.com/classvsoftware/t3-api-examples) # FAQ ## Track & Trace Tools (T3) ### What is T3? T3 is a group of software tools for cannabis operators who use [Metrc](https://wiki.trackandtrace.tools/metrc/index.md). T3 tools speed up Metrc workflows and transform your compliance data into business insights. T3 is not affiliated with Metrc. ### Who is T3 for? T3 has solutions for every step of the cannabis supply chain: - Cultivation - Distribution - Manufacturing - Testing Laboratories - Retail T3 supports every US state that uses Metrc. ### What are the different T3 tools? The primary components of the T3 platform are as follows: - [Track & Trace Tools Chrome Extension](https://chromewebstore.google.com/detail/track-trace-tools/dfljickgkbfaoiifheibjpejloipegcb) - [T3 API](https://api.trackandtrace.tools/v2/docs) - [OpenTag mobile app](https://trackandtrace.tools/scan) The Chrome Extension and OpenTag have free features, and some T3 API endpoints are free. [Subscribing to T3+](https://dash.trackandtrace.tools) unlocks premium features in each, including most of the T3 API. ### Who operates T3? T3 is operated by [Matt Frisbie](https://mattfriz.com) ### T3 uses lots of CSV files, where can I get CSV editing software? [Modern CSV](https://www.moderncsv.com/) is the recommended software for editing CSVs. The basic version is free to use. ______________________________________________________________________ ## T3+ ### Is T3 free? All T3 products offer a free basic version that does not require signup. You can [subscribe to T3+](https://wiki.trackandtrace.tools/t3-plus/index.md) to gain access to additional tools and features. ### What is T3+? [T3+](https://dash.trackandtrace.tools) is the paid subscription that unlocks the full T3 platform. T3 has some basic features that are free to use, but [T3+](https://dash.trackandtrace.tools) unlocks a much larger and more powerful set of tools. ### Why should I use T3? **The T3 platform makes Metrc useful instead of painful** - **Start using T3 instantly.** No signup flow: get started with T3 right away. - **Privacy and security are priorities.** T3 never sells or shares your Metrc data or activity. - **A vast community behind T3.** Thousands of businesses across the U.S. rely on T3 daily. - **Try T3 for free.** All T3 products offer free basic tiers. - **Simple, affordable pricing.** [T3+](https://wiki.trackandtrace.tools/t3-plus/index.md) offers a 30-day free trial with flexible, budget-friendly plans. Every plan unlocks the premium extension and OpenTag features; T3+ Basic includes the T3 API report endpoints, and Team and Enterprise include the full T3 API. - **Effortless to use.** T3 connects directly to [Metrc](https://wiki.trackandtrace.tools/metrc/index.md), eliminating syncing, API keys, and hassle. - **Seamless integration.** Keep using your current software. T3 fits in when you need it and stays out of the way when you don’t. ### How much does T3+ cost? T3+ is intended to be uncomplicated and affordable. - T3+ is a fixed-price subscription with no hidden add-ons. - T3+ can be a monthly or annual subscription. Annual subscriptions get extra savings. - With T3+, you only pay for the seats you need. [Find a T3+ plan for your business](https://dash.trackandtrace.tools/plans) ### What is included with T3+? Head over to [T3+ Features](https://wiki.trackandtrace.tools/t3-plus/index.md) to learn more about what is included with a T3+ subscription. ### How to sign up for T3+? Head over to the [T3+ Wiki Page](https://wiki.trackandtrace.tools/t3-plus/index.md) to learn more, or head over to to start your free trial. ______________________________________________________________________ ## T3 Chrome Extension ### What features does the T3 Chrome Extension have? - [List of basic features](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/index.md) - [List of T3+ features](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/index.md) ### How do I find out my current T3 Chrome Extension version? You can find the version of the currently installed T3 Chrome Extension in the extension popup. 1. Click the T3 icon at the top of the browser, to the right of the URL. If you don't see it, click Chrome's puzzle-piece **Extensions** icon there and choose Track & Trace Tools. 1. The T3 popup will open. Your version number is at the top, under **Track & Trace Tools**. The toolbox shows it too, at the foot of its menu. Finding your installed T3 Chrome Extension version ### How can I tell if my extension is out of date? The latest version of T3 is visible on the [Chrome Web Store page](https://trackandtrace.tools/extension). Finding the latest T3 Chrome Extension version If it doesn't match the version installed in your browser, your extension is out of date. ### How to get updates for the T3 Chrome Extension? The [T3 Chrome Extension](https://wiki.trackandtrace.tools/t3-chrome-extension/index.md) will update automatically. Once an update is pushed to the [Chrome Web Store](https://trackandtrace.tools/extension), most users will receive it within 24 hours, and usually faster than that. When T3 updates, Metrc tabs you already had open keep the old version, which stops working. Each of them shows a note at the bottom, "T3 updated to ‹version›. Reload this page to use it.": click **Reload page**, or reload the page yourself, to start using the new version. **NOTE: uninstalling/reinstalling is no longer the recommended way to force an update**. Doing so will work, but it will reset your T3 install. If you need to force your installed version to update, follow the following steps: 1. Access the **Manage Extensions** page via **⋮ > Extensions > Manage Extensions** Accessing the Extension Management page 1. If you haven't already, turn on the **Developer Mode** toggle in the top right. Enabling extension developer mode 1. With Developer Mode enabled, you will see additional buttons at the top left. Click **Update** to update your extensions. Triggering an extension update Chrome will check *all* your extensions for updates, so this may take a moment. 1. Chrome will show "Extension Updated" in the lower left corner of the screen once the update process completes. If a T3 update is available, you will see the version number increase. 1. Refresh Metrc to reload T3 and start using the latest version. ### What happens when T3 isn't responding? Metrc keeps working as usual: only T3's own features need T3's servers. While T3 is down or slow: - **Features say what happened.** You'll see a message such as "T3 isn't responding. Try again in a minute." Where it helps, there's a **Try again** button. - **T3 keeps what it already loaded.** Row menus, Filter's columns and the reports listed in the **Ctrl+K** box use the copy T3 saved last time. Your T3+ status stays as it was. - **T3 waits before trying again on its own.** Background checks pause for a while, from 30 seconds up to 5 minutes, and resume as soon as T3 answers. Anything you click is still sent right away. - **Submissions to Metrc are never sent twice by accident.** If Metrc or T3 doesn't answer a submission, T3 doesn't send it again on its own, because it may already have gone through. Check Metrc before you retry those rows. Some tools pause a submission that keeps getting no answer, saying "T3 stopped answering"; resume it once T3 is back. If it lasts more than a few minutes, [let me know](#how-to-report-problems-with-t3). ### What if T3 doesn't load on Metrc pages? First, reload the Metrc page. If T3's buttons still don't show, click the T3 icon in Chrome's toolbar, to the right of the URL (or find Track & Trace Tools under the puzzle-piece **Extensions** icon). The T3 popup works even when T3 doesn't load on Metrc. It shows: - **Your T3 version**, at the top. - **Whether you're signed in to T3.** It reads "Signed in as (your username) on (your Metrc site)" when you are, and "Open Metrc to sign in" when you aren't. - **Announcements:** the newest three. T3 posts news there, outages included. Click one to read it in full. - **Report a problem…**: when you're signed in, it opens a short form right in the popup: a title, a description of what happened, and your email, filled in for you. **Send report** sends it to T3 support, which replies to that email. When you're not signed in, it opens the [T3 problem form](https://docs.google.com/forms/d/e/1FAIpQLSd2hQFwtXyv1Bco9nHN9d4tEqkgbhe3w-WdbZAemBCTD_19VQ/viewform) in a new tab instead. If your sign-in runs out while you're writing, the popup says so, keeps what you wrote, and offers **Copy report** so you can paste it into that form. - **Links** to this wiki, the Community forum, the T3 API, T3+, and the extension's **Options**. ### I was provided a license key, how do I enter it? Instructions for entering license keys can be found [here](https://wiki.trackandtrace.tools/t3-chrome-extension/getting-started/#registering-a-license-key). ______________________________________________________________________ ## Privacy ### What are T3's privacy and data policies? - [T3 privacy policy](https://trackandtrace.tools/privacy-policy) - [T3 terms of use](https://trackandtrace.tools/terms-of-use) - [T3 EULA](https://trackandtrace.tools/eula) ### Does T3 collect analytics or save my Metrc data? T3 never sells or shares your Metrc data. It stores only what the features you use need: secret keys (your Metrc credentials, encrypted), saved reports and schedules, label templates and layouts, tag lists, support tickets, and COA PDFs read for lab results. Reports are cached for five minutes. A Google Sheet created by a report is not deleted, and anyone with its link can open it unless you ask for a private sheet. T3 collects usage analytics to find bugs, scrubbed of Metrc data. See the [T3 privacy policy](https://trackandtrace.tools/privacy-policy) for details. ______________________________________________________________________ ## Support ### How to report problems with T3? I do my best to keep T3 running smoothly, but problems are inevitable. Once I know about them, they can be fixed quickly. If you find an issue with any T3 product, there are three ways to get in touch so I can fix it: - **Fill out the [T3 problem form (preferred)](https://docs.google.com/forms/d/e/1FAIpQLSd2hQFwtXyv1Bco9nHN9d4tEqkgbhe3w-WdbZAemBCTD_19VQ/viewform).** This automatically sends me an email. - **Email me directly at [matt@trackandtrace.tools](mailto:matt@trackandtrace.tools)** - **Post on the [T3 forum](https://trackandtrace.tools/community)** In the T3 Chrome Extension, **Report a Problem** opens a ticket form inside the extension. Hover over the T3 button at the bottom right of Metrc and choose it in the menu that opens, or open the toolbox and choose **Help › Report a Problem**. Your page, license, T3 version and recent errors are attached automatically. Scripts can file the same tickets through the [Support Tickets API](https://wiki.trackandtrace.tools/t3-api/support-tickets/index.md). If T3 doesn't load on Metrc, use **Report a problem…** in the T3 popup instead: click the T3 icon in Chrome's toolbar (see [What if T3 doesn't load on Metrc pages?](#what-if-t3-doesnt-load-on-metrc-pages)). Bug report button ### How to contact support? Reach out to [matt@trackandtrace.tools](mailto:matt@trackandtrace.tools) with questions or concerns. ______________________________________________________________________ ## Next Steps - Get hands-on with the [T3 Chrome Extension](https://wiki.trackandtrace.tools/t3-chrome-extension/index.md), [T3 API](https://wiki.trackandtrace.tools/t3-api/index.md), [T3 Labels](https://wiki.trackandtrace.tools/t3-labels/index.md), or [OpenTag](https://wiki.trackandtrace.tools/opentag/index.md). - Background on [Metrc](https://wiki.trackandtrace.tools/metrc/index.md) and [RFID](https://wiki.trackandtrace.tools/opentag/rfid/index.md). - Learn more about [T3+](https://wiki.trackandtrace.tools/t3-plus/index.md) or [start a 30-day free trial](https://dash.trackandtrace.tools). # T3+ ## Introduction [T3+](https://trackandtrace.tools/plus) is the all-in-one paid subscription for the T3 platform. A T3+ subscription includes: - Full access to the [Track & Trace Tools](https://trackandtrace.tools/extension) Chrome Extension - Access to the [T3 API](https://trackandtrace.tools/api): T3+ Basic includes the report endpoints, and Team and Enterprise include every endpoint - Full access to the [OpenTag](https://trackandtrace.tools/scan) mobile app ______________________________________________________________________ ## Subscribing to T3+ T3+ offers a 30-day risk-free trial. You can cancel your subscription during the trial at any time with no penalty. When subscribing to T3+, you'll select a [tier](https://dash.trackandtrace.tools/plans). Each plan includes a fixed number of seats. Your seats determine how many Metrc usernames you can register on the [T3+ dashboard](https://dash.trackandtrace.tools). Once a Metrc username is registered, that account will automatically be given access to T3+ across the platform. ______________________________________________________________________ ## T3+ Seats Each T3+ seat corresponds to one Metrc username. T3+ does not restrict the number of licenses per username, and you can change usernames at any time. Some examples of seat allocations: - A business has one compliance person managing multiple licenses in one state. You would need one seat (T3+ Basic). - A business has three compliance people managing multiple licenses in one state. You would need three seats (T3+ Team, which has four). - A business has three compliance people managing licenses in two states. Since each state has its own login, each person has two usernames. You would need six total seats (T3+ Enterprise, which has ten). T3+ Basic includes the T3 API report endpoints, along with the endpoints that are free for everyone. The rest of the API, including writes to Metrc, needs a Team or Enterprise plan. ______________________________________________________________________ ## T3+ Tools and Features - [T3+ Chrome Extension Features](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/index.md) - [T3+ T3 API Endpoints](https://wiki.trackandtrace.tools/t3-api/index.md) - [T3+ OpenTag Features](https://wiki.trackandtrace.tools/opentag/index.md) ______________________________________________________________________ ## Registering a Metrc Username in T3+ T3+ is enabled on a per-username basis. Your username is what you use to log into Metrc. Example: How to find your Metrc username In this case, after registering the username `jdoe0101` in the [T3+ dashboard](https://dash.trackandtrace.tools), the premium T3+ features are enabled for that username across the T3 platform. The T3 Chrome Extension includes a quick script to easily copy your Metrc username: Copying your username with a T3 quick script In the T3 dashboard, here is what you will see when your username is registered: Registered Metrc username in T3+ dashboard Once registered, you will automatically be granted access to T3+ features across the T3 platform. **NOTE: The T3 Chrome Extension will require a page refresh for T3+ features to be enabled.** ______________________________________________________________________ ## Verifying Username Registration In the T3 Chrome Extension, open the toolbox and look beside the T3 logo at the top left of its header. "T3+" indicates successful registration. The foot of the toolbox's menu also shows **Manage T3+** in place of **Get T3+**, and the toolbox's [T3+ page](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/#the-t3-page) reads **You have T3+**. Indication of successful T3+ registration ______________________________________________________________________ ## Next Steps - Get started with the [T3 API](https://wiki.trackandtrace.tools/t3-api/index.md) and [T3 Labels](https://wiki.trackandtrace.tools/t3-labels/index.md) - Set up [OpenTag](https://wiki.trackandtrace.tools/opentag/index.md) to scan Metrc tags with your phone, or RFID tags with a Chainway C72 - Install the [T3 Chrome Extension](https://trackandtrace.tools/extension) and review its [T3+ features](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/index.md) # Metrc ## Overview Metrc (Marijuana Enforcement Tracking Reporting Compliance) is a state-mandated cannabis compliance system, required in various U.S. states to track cannabis cultivation, production, testing, and sales. Developed by Franwell, Metrc operates as a cloud-based platform intended to monitor cannabis products throughout the supply chain. ______________________________________________________________________ ## Which states use Metrc? - Alabama - [Partner Page](https://www.metrc.com/partner/alabama/) - [Login](https://al.metrc.com/log-in/) - Alaska - [Partner Page](https://www.metrc.com/partner/alaska/) - [Login](https://ak.metrc.com/log-in/) - [API Documentation](https://api-ak.metrc.com/Documentation/) - [API Onboarding](https://www.metrc.com/integration-and-api/alaska-integration-and-api/) - California - [Partner Page](https://www.metrc.com/partner/california/) - [Login](https://ca.metrc.com/log-in/) - [API Documentation](https://api-ca.metrc.com/Documentation/) - [API Onboarding](https://www.metrc.com/integration-and-api/california-integration-and-api/) - Colorado - [Partner Page](https://www.metrc.com/partner/colorado/) - [Login](https://co.metrc.com/log-in/) - [API Documentation](https://api-co.metrc.com/Documentation/) - [API Onboarding](https://www.metrc.com/integration-and-api/colorado-integration-and-api/) - Colorado Industrial Hemp - [Partner Page](https://www.metrc.com/partner/colorado-industrial-hemp/) - Connecticut - [Login](https://ct.metrc.com/log-in/) - District of Columbia - [Partner Page](https://www.metrc.com/partner/district-of-columbia/) - [Login](https://dc.metrc.com/log-in/) - [API Documentation](https://api-dc.metrc.com/Documentation/) - [API Onboarding](https://www.metrc.com/integration-and-api/district-of-columbia-integration-and-api/) - Guam - [Partner Page](https://www.metrc.com/partner/guam/) - Illinois - [Login](https://il.metrc.com/log-in/) - Kentucky - [Partner Page](https://www.metrc.com/partner/kentucky/) - [Login](https://ky.metrc.com/log-in/) - [API Documentation](https://api-ky.metrc.com/Documentation/) - [API Onboarding](https://www.metrc.com/integration-and-api/kentucky-integration-and-api/) - Louisiana - [Partner Page](https://www.metrc.com/partner/louisiana/) - Maine - [Partner Page](https://www.metrc.com/partner/maine/) - [Login](https://me.metrc.com/log-in/) - [API Documentation](https://api-me.metrc.com/Documentation/) - [API Onboarding](https://www.metrc.com/integration-and-api/maine-integration-and-api/) - Maryland - [Partner Page](https://www.metrc.com/partner/maryland/) - [Login](https://md.metrc.com/log-in/) - [API Documentation](https://api-md.metrc.com/Documentation/) - [API Onboarding](https://www.metrc.com/integration-and-api/maryland-integration-and-api/) - Massachusetts - [Partner Page](https://www.metrc.com/partner/massachusetts/) - [Login](https://ma.metrc.com/log-in/) - [API Documentation](https://api-ma.metrc.com/Documentation/) - [API Onboarding](https://www.metrc.com/integration-and-api/Massachusetts-integration-and-api/) - Michigan - [Partner Page](https://www.metrc.com/partner/michigan/) - [Login](https://mi.metrc.com/log-in/) - [API Documentation](https://api-mi.metrc.com/Documentation/) - [API Onboarding](https://www.metrc.com/integration-and-api/michigan-integration-and-api/) - Minnesota - [Partner Page](https://www.metrc.com/partner/minnesota/) - [Login](https://mn.metrc.com/log-in/) - [API Documentation](https://api-mn.metrc.com/Documentation/) - Mississippi - [Partner Page](https://www.metrc.com/partner/mississippi/) - [Login](https://ms.metrc.com/log-in/) - [API Documentation](https://api-ms.metrc.com/Documentation/) - Missouri - [Partner Page](https://www.metrc.com/partner/missouri/) - [Login](https://mo.metrc.com/log-in/) - [API Documentation](https://api-mo.metrc.com/Documentation/) - [API Onboarding](https://www.metrc.com/integration-and-api/missouri-integration-and-api/) - Montana - [Partner Page](https://www.metrc.com/partner/montana/) - [Login](https://mt.metrc.com/log-in/) - [API Documentation](https://api-mt.metrc.com/Documentation/) - [API Onboarding](https://www.metrc.com/integration-and-api/montana-integration-and-api/) - Nevada - [Partner Page](https://www.metrc.com/partner/nevada/) - [Login](https://nv.metrc.com/log-in/) - [API Documentation](https://api-nv.metrc.com/Documentation/) - [API Onboarding](https://www.metrc.com/integration-and-api/nevada-integration-and-api/) - New Jersey - [Partner Page](https://www.metrc.com/partner/new-jersey/) - [Login](https://nj.metrc.com/log-in/) - [API Documentation](https://api-nj.metrc.com/Documentation/) - New York - [Login](https://ny.metrc.com/log-in/) - Ohio - [Partner Page](https://www.metrc.com/partner/ohio/) - [Login](https://oh.metrc.com/log-in/) - [API Documentation](https://api-oh.metrc.com/Documentation/) - [API Onboarding](https://www.metrc.com/integration-and-api/ohio-integration-and-api/) - Oklahoma - [Partner Page](https://www.metrc.com/partner/oklahoma/) - [Login](https://ok.metrc.com/log-in/) - [API Documentation](https://api-ok.metrc.com/Documentation/) - [API Onboarding](https://www.metrc.com/integration-and-api/oklahoma-integration-and-api/) - Oregon - [Partner Page](https://www.metrc.com/partner/oregon/) - [Login](https://or.metrc.com/log-in/) - [API Documentation](https://api-or.metrc.com/Documentation/) - [API Onboarding](https://www.metrc.com/integration-and-api/oregon-integration-and-api/) - Rhode Island - [Partner Page](https://www.metrc.com/partner/rhode-island/) - [Login](https://ri.metrc.com/log-in/) - [API Documentation](https://api-ri.metrc.com/Documentation/) - South Dakota - [Partner Page](https://www.metrc.com/partner/south-dakota/) - [Login](https://sd.metrc.com/log-in/) - [API Documentation](https://api-sd.metrc.com/Documentation/) - [API Onboarding](https://www.metrc.com/integration-and-api/south-dakota-integration-and-api/) - US Virgin Islands - [Login](https://vi.metrc.com/log-in/) - Virginia - [Login](https://va.metrc.com/log-in/) - West Virginia - [Partner Page](https://www.metrc.com/partner/west-virginia/) - [Login](https://wv.metrc.com/log-in/) - [API Documentation](https://api-wv.metrc.com/Documentation/) - [API Onboarding](https://www.metrc.com/integration-and-api/west-virginia-integration-and-api/) ______________________________________________________________________ ## Metrc Key Components Metrc’s compliance ecosystem is built around several key components, each serving a unique role in ensuring cannabis industry compliance with state regulations: ### Web UI The Metrc platform's primary tool is its web-based user interface (Web UI). In states that have adopted Metrc as their compliance tracking system, all licensed cannabis businesses are required to use this interface to report essential compliance data. Key reportable events include: - **Cultivation Activities**: Planting, harvesting, and waste disposal. - **Manufacturing**: Processing raw cannabis into consumable products. - **Transportation**: Tracking the movement of products between licensed facilities. - **Testing**: Documenting results from state-mandated lab testing. - **Sales**: Recording transactions at dispensaries. Despite the availability of an API, many compliance actions must still be completed through the Web UI due to gaps in API coverage. ### Metrc API Metrc provides an API designed to enable licensed operators and third-party integrators to programmatically interact with its system. There are two versions of the API: - **v1 (Free)**: Available at no cost, this version provides basic functionality for interacting with Metrc’s compliance system. - **v2 ("Metrc Connect", Paid)**: A premium version with some additional features, requiring payment for access. ### RFID Tags Radio-frequency identification (RFID) tags are mandatory for tracking every plant and product within the Metrc system. These tags play a critical role in enabling accurate seed-to-sale tracking. States differ in how these tags are funded: - In some states, the government covers the cost of RFID tags. - In others, the expense is borne by the businesses themselves. ### State Agency Interface Metrc also provides tools for state agencies to monitor and audit cannabis license holders. This lesser-known component of Metrc's platform grants state regulators full visibility into the activity of licensed businesses, enabling enforcement of compliance standards. Features available to state agencies include: - **Audit Tools**: For detailed reviews of licensee data and activity. - **System-Wide Monitoring**: Allowing oversight of all cannabis operations within the state. These tools form an integral part of Metrc's value proposition to state governments, enhancing transparency and accountability across the regulated market. ______________________________________________________________________ ## Criticisms of the Metrc API The Metrc API is often criticized for its limitations and challenges. 1. **Dual API Key Requirement** The Metrc API operates in an unusual manner by requiring *two* API keys to function: - One API key is issued to the cannabis business itself. - The other API key is issued to an approved Metrc integrator. Becoming an approved integrator involves navigating a state-specific approval process, as each U.S. state mandates its own procedures. This effectively means: - Cannabis businesses cannot directly access their own data through the API unless they work with a state-approved integrator. - The added dependency on integrators creates barriers for businesses seeking full control of their data. 1. **Incomplete Compliance Support** Neither version of the Metrc API fully supports all required compliance actions. As a result: - Cannabis businesses must frequently rely on Metrc’s web-based user interface (Web UI) alongside the API. - This dual dependency increases operational inefficiencies and complexity. 1. **Cost of Access** - Access to the Metrc API v2 is not free. Businesses are charged for using it, effectively imposing a fee for accessing their own compliance data. - This pricing structure adds to the financial burden of regulatory compliance. 1. **Performance Issues** The Metrc API suffers from significant technical shortcomings: - **Slow Response Times**: The API often performs poorly under load, leading to delays. - **Lack of Usability**: Developers frequently report the API as difficult to use due to its unintuitive design. - **Poor Documentation**: Incomplete or unclear documentation makes implementation and troubleshooting unnecessarily challenging. - **Unhelpful Error Handling**: The API returns generic or unclear error codes, complicating error resolution for developers and users. ______________________________________________________________________ ## State-Specific Metrc Implementations Each state implements Metrc differently, based on specific regulations and requirements mandated by its regulatory bodies. This means Metrc operates as a slightly different system in each state, adding another layer of complexity for operators who must adapt to the unique requirements where they operate. For multi-state operators, these differences create significant operational challenges, as compliance processes may vary dramatically across state lines. ______________________________________________________________________ ## Next Steps - Metrc tags, UIDs, and RFID in practice: [Metrc Tags and RFID](https://wiki.trackandtrace.tools/metrc-tags/index.md). - Work around the Metrc API's limits with the [T3 API](https://wiki.trackandtrace.tools/t3-api/index.md). - Speed up Metrc itself with the [T3 Chrome Extension](https://wiki.trackandtrace.tools/t3-chrome-extension/index.md). # Metrc Tags and RFID ## Metrc RFID Tags Metrc "tags" are a cornerstone of Metrc's compliance system, enabling standardized tracking of cannabis plants and products from growth to sale. Each cannabis plant or product is assigned a unique identifier (UID) issued by Metrc, which allows items to be identified and monitored throughout the supply chain. Each tag is a 4"x1.5" rectangular piece of printed plastic linked to a UID in Metrc's database. The **UID** is a 24-character identifier that uniquely represents a plant batch, individual plant, or cannabis package. For example, `1A440000C030000000001234` is a UID. Front and back of Metrc tag A Metrc tag identifies the corresponding UID in three ways: - **Printed UID**: The UID is printed on the tag. - **Barcode**: A [Code 128](https://en.wikipedia.org/wiki/Code_128) barcode is included, which can be scanned with an optical barcode scanner. - **RFID Chip**: An embedded [UHF RFID chip](https://wiki.trackandtrace.tools/opentag/rfid/index.md) returns the UID when scanned with an RFID reader. Each UID can only be owned by one cannabis license at a time, and these UIDs are transferred between licenses using *transfers*. ### Types of Metrc Tags 1. **Plant Tags**: Applied to individual mature plants, and in some states, plant batches. 1. **Package Tags**: Applied post-harvest to any quantity of cannabis in any form that is not waste. ______________________________________________________________________ ## How RFID Readers (Scan Guns) Work in Metrc RFID readers ("scan guns") emit radio waves to locate and read tags within range, and can in principle read many tags at once. How the technology itself works, the frequency bands involved, and the kinds of reader available are covered in [What is RFID?](https://wiki.trackandtrace.tools/opentag/rfid/index.md). What follows is how that plays out specifically in Metrc. RFID Reader ### Criticisms of RFID in Metrc The use of RFID technology in Metrc presents several challenges: 1. **Interference and Environmental Factors**: UHF RFID readers are sensitive to interference from metal surfaces, water, and electronic devices, which are common in grow facilities. For example, humidity and metal shelving can interfere with signal transmission, making it difficult to read tags reliably. 1. **Read Range Variability**: While UHF RFID tags are theoretically scannable from distances up to 20-30 feet, real-world conditions often reduce this range. Operators frequently need to move closer to tags or perform multiple scans to capture all required data, undermining the intended efficiency of RFID tracking. 1. **Read Directionality**: UHF readers typically have directional antennas, making them more effective when pointed directly at a tag. In busy environments where tags may be stacked or positioned at awkward angles, directional limitations result in missed scans, requiring manual rescanning. 1. **Batch Scanning Issues**: Metrc promotes RFID for batch scanning, which should theoretically capture data from multiple tags simultaneously. However, inconsistent performance often results in partial reads, where only some tags are successfully captured. 1. **Missed Scans and Unreliable Data**: Due to interference, tag placement, and system limitations, missed scans and unreliable data capture are common. This often forces operators to conduct manual checks, which negates the intended benefits of RFID automation. ### Cost and Environmental Impact Metrc's RFID tags are costly and single-use, contributing significantly to operational expenses for cannabis businesses. Additionally, the disposal of RFID tags, which contain electronic components, generates considerable e-waste. Operators across the U.S. must purchase thousands of tags annually, only to dispose of them at the end of the year, which raises both financial and environmental concerns. ### Practical Use of RFID in Metrc Compliance In practice, the technology's inconsistent performance complicates inventory tracking and compliance processes. Many operators rely on manual data entry to supplement RFID tracking due to frequent read failures and interference. This hybrid approach increases the workload and diminishes the potential efficiency gains RFID was intended to provide. RFID in Metrc has become a double-edged sword for cannabis operators. While it was designed to streamline compliance, the technology often requires constant vigilance and manual intervention, leading to increased burdens on staff and less reliability in maintaining accurate records. ______________________________________________________________________ ## Next Steps - How RFID works as a technology: [What is RFID?](https://wiki.trackandtrace.tools/opentag/rfid/index.md). - Scan Metrc tags from a phone with [T3 OpenTag](https://wiki.trackandtrace.tools/opentag/index.md). - Back to [Metrc](https://wiki.trackandtrace.tools/metrc/index.md). # T3 API # T3 API ``` flowchart LR MA["Metrc API"] --> M1["metrc.com login"] MA --> M2["Metrc API key"] MA --> M3["Third party integrator key"] MA --> M4["Metrc Connect subscription"] MA -.-> MR(["Reaches a subset of what metrc.com can do"]) TA["T3 API"] --> T1["metrc.com login"] TA --> T2["T3+ subscription"] TA -.-> TR(["Reaches anything you can do on metrc.com"]) ``` ## Introduction The T3 API allows you to talk to metrc.com with HTTP requests. Using just a metrc.com login, you can load all your Metrc data or perform compliance tasks like creating harvests, transfers, or packages. The T3 API is completely separate from the Metrc API. ### Motivation **Empower Metrc users.** Metrc users should be able to easily load all their Metrc data and automate compliance tasks that otherwise would require a lot of clicking and typing. **Eliminate API restrictions.** The T3 API is capable of performing *any* task in Metrc, including tasks that the Metrc API does not support. **Offer the best documentation.** APIs are hard to use, so T3 publishes [high-quality interactive docs](https://api.trackandtrace.tools/v2/docs/) backed by a full [OpenAPI specification](https://wiki.trackandtrace.tools/t3-api/openapi/index.md) that any spec-aware tool can consume. **Offer beginners an on-ramp.** The T3 API has a [rich collection of examples](https://github.com/classvsoftware/t3-api-examples) showing how to use the API. ### Metrc API vs T3 API The diagram above is the whole comparison. The Metrc API needs a metrc.com login, a generated Metrc API key, a third party integrator key and a Metrc Connect subscription, and it cannot perform every compliance task or return everything the metrc.com web interface shows. The T3 API needs a metrc.com login and a T3+ subscription. ______________________________________________________________________ ## Getting Started [Getting started with the T3 API](https://wiki.trackandtrace.tools/t3-api/getting-started/index.md) ______________________________________________________________________ ## T3 API Reports Many T3 users wish to export entire Metrc datasets in a single request. This is possible with T3 API Reports. [Read more about T3 API Reports](https://wiki.trackandtrace.tools/reports/index.md) ______________________________________________________________________ ## T3 API Label Generation T3 enables you to easily generate printable PDF labels. Create custom label templates, automatically generate printable package labels, and print directly to inkjet and thermal printers. [Read more about T3 API Label Generation](https://wiki.trackandtrace.tools/t3-labels/getting-started/index.md) [T3 API Label Endpoints](https://api.trackandtrace.tools/v2/docs/#/Labels) ______________________________________________________________________ ## Tag Lists **Tag lists** are named sets of Metrc tags, used for inventory check-offs, manifest verification and membership lookups. The API creates, reads and edits them, and can resolve a list into the Metrc records its tags name. [Read more about Tag Lists](https://wiki.trackandtrace.tools/opentag/tag-lists/index.md) [T3 API Tag List Endpoints](https://api.trackandtrace.tools/v2/docs/#/Tag%20Lists) ______________________________________________________________________ ## Spreadsheet Sync T3 can sync an entire Metrc dataset to a spreadsheet (Excel or Google Sheets) with a simple URL. [Full documentation for Spreadsheet Sync](https://wiki.trackandtrace.tools/t3-api/spreadsheet-sync/index.md) ______________________________________________________________________ ## Next Steps - Work through [Getting Started](https://wiki.trackandtrace.tools/t3-api/getting-started/index.md), then [set up Python](https://wiki.trackandtrace.tools/t3-api/setting-up-python/index.md) and write [API scripts](https://wiki.trackandtrace.tools/t3-api/api-scripts/index.md). - Compare [Credential auth and Secret-key auth](https://wiki.trackandtrace.tools/t3-api/authentication/index.md) to pick the right format for your integration. - Learn about the [OpenAPI spec](https://wiki.trackandtrace.tools/t3-api/openapi/index.md): every path and schema is published, and the spec can be pruned for tools that only need a slice. - Use [Supercollections](https://wiki.trackandtrace.tools/t3-api/supercollections/index.md) to eagerly load metadata (lab results, history, manifest packages) in a single request. - Group Metrc tags into [Tag Lists](https://wiki.trackandtrace.tools/opentag/tag-lists/index.md) for inventory check-offs, manifest verification, and membership lookups. - You can find a list of the free endpoints [here](https://api.trackandtrace.tools/v2/docs/#/Free). - Refer to the [T3 API Documentation](https://trackandtrace.tools/api) and the [T3 API Examples](https://github.com/classvsoftware/t3-api-examples) to explore what else is possible with the T3 API. # AI & LLM Integration The T3 API is designed to be consumed by AI models and coding agents as easily as it is consumed by humans. This page is for users who want a programmatic solution, have access to an AI model (ChatGPT, Claude, Gemini, Cursor, Claude Code, Copilot, etc.), and want to know how to point it at the T3 API and get useful output. You do not need to know how the API works in detail. You just need to tell the model where to look. ## Why the T3 API works well with AI - **A published [OpenAPI spec](https://wiki.trackandtrace.tools/t3-api/openapi/index.md)** describes every endpoint, parameter, and response. An AI model can read this and write correct code against any endpoint without guessing. - **A spec-pruning endpoint** lets you (or the model) fetch only the slice of the spec that is relevant to the task, keeping prompts small and cheap. - **An `llms.txt` file** at a known URL gives any AI a one-page orientation to the API's conventions, authentication, and common pitfalls. - **This wiki, as Markdown.** Every page has a Markdown copy, indexed by the wiki's own `llms.txt`, so a model can read the docs without paying for HTML. - **A high-level Python library, [`t3api-utils`](#t3api-utils-the-high-level-python-helper),** that handles auth, license selection, pagination, and safe writes, meaning the model can write a 10-line script instead of a 200-line one. - **A public examples repository** that the model can browse for working patterns, with a style guide written for coding assistants as well as people. ## Which approach do you need? There are two common goals. The resources below serve both; the difference is in how you prompt the model. | Goal | Audience | Typical prompt | Best fit | | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | | **One-off Python script**, "dump all my active packages to CSV", "pull tomorrow's incoming transfers" | Operators, analysts, anyone who can run `uv run script.py` | "Write me a Python script that does X" | [`t3api-utils`](#t3api-utils-the-high-level-python-helper) + [`llms.txt`](#llmstxt-the-quickstart-for-agents) | | **Direct HTTP integration**, building an app, an internal service, or a workflow that talks to T3 from a non-Python stack | Developers, agents working in a real codebase (Cursor, Claude Code, etc.) | "Add a function that calls T3's `/v2/packages/active` endpoint" | [OpenAPI spec](#the-openapi-spec-the-source-of-truth) + [`llms.txt`](#llmstxt-the-quickstart-for-agents) | ______________________________________________________________________ ## Resources the API publishes for AI consumption ### `llms.txt`, the quickstart for agents **** `llms.txt` is an emerging convention (see [llmstxt.org](https://llmstxt.org/)) for giving AI agents a single plain-text orientation file. T3's `llms.txt` covers: - What the T3 API is (and what it is *not*; it's not the Metrc 3rd party API). - Rules for agents: fetch a pruned spec instead of guessing, authenticate, pass `licenseNumber`, and remember that writes are a dry run unless `submit=true`. - The spec's pruning filters. - A short Python script using [`t3api-utils`](#t3api-utils-the-high-level-python-helper) 2.1, and links to its guides. - Links into this wiki. This file is the single most useful URL to give an AI model that has never seen the T3 API before. Many agents will fetch and follow it automatically when you mention it. ### The wiki, as Markdown **** Every page of this wiki is also published as Markdown, which costs a model far fewer tokens than the HTML page. Add `index.md` to a page's URL to get it, for example . The wiki's `llms.txt` lists every page. [`llms-full.txt`](https://wiki.trackandtrace.tools/llms-full.txt) holds the whole wiki in one file, which is too large for most prompts. ### The OpenAPI spec, the source of truth **** The full spec describes every endpoint, every parameter, every request/response schema. It is large, feeding the entire document into an AI prompt wastes tokens and buries the signal. Instead, use the **pruning filters** to fetch just the slice you need: ``` ?path=/v2/packages/active Single endpoint + its referenced schemas ?tag=Packages Every endpoint with a given tag ?schema=MetrcPackage A specific data model + its dependencies ?parameter=LicenseNumber A specific reusable query parameter ``` Filters combine; `path` must match exactly, and the others ignore case. Full filter reference and examples are on the [OpenAPI Spec page](https://wiki.trackandtrace.tools/t3-api/openapi/#pruning-the-spec). When you prompt an AI, you can either: - **Hand it the URL** and let it fetch the pruned spec itself (works in Claude, ChatGPT with browsing, Cursor, Claude Code, etc.). - **Fetch it yourself with `curl` or `requests`** and paste the JSON into the prompt. ### `t3api-utils`, the high-level Python helper **Docs:** **Repo:** `t3api-utils` is the recommended library for AI-generated scripts. It handles the parts of the API that are tedious to write from scratch: - **Authentication**: `t3api login` saves a secret key once, and `t3.connect()` finds it and returns a client. - **License selection**: `client.pick_license()` shows an interactive picker, or `client.license` uses the saved default. - **Parallel loading**: `client.collect()` loads every page of any collection in parallel and returns the full list. - **Safe writes**: writes are a dry run unless `submit=True`, and `client.bulk()` checks every row before sending any. - **Reports**: `client.report()` downloads a server-side report, and `client.report_url()` builds a Google Sheets `IMPORTDATA()` URL. A typical AI-generated script ends up being ~10 lines because the library absorbs the boilerplate. Point the model at the docs URL above and it will pick up the patterns. Version 2 is a rewrite that shares no code with 1.x. A model trained on older examples may write 1.x calls such as `get_authenticated_client_or_error()`. Tell it to use 2.1 or later. ### `t3-api-examples`, a corpus of working scripts **** A public repo of working, runnable example scripts. Agents that can browse GitHub (Cursor, Claude Code, ChatGPT with browsing) will often find the closest example here and adapt it rather than writing from scratch. Useful to drop into a prompt as "here's a similar example, follow this pattern." **Style guide:** The repo's style guide is written for AI coding assistants as well as people. It sets the rules every example follows: standard flags such as `--license` and `--sandbox`, checking input before writing, a dry run and a confirmation before anything reaches Metrc, and a results log for every write. It ends with copy-ready templates. Give it to a model writing a script that other people will run or schedule. ______________________________________________________________________ ## Will the model load these URLs? A URL is only useful if the model can fetch it. **Rule of thumb:** if you are using a chat UI or a coding agent, paste the URL and ask the model to read it. If you are calling a model API directly in your own code, fetch the URL yourself with `curl` or `requests` and include the response body in the prompt. If a model refuses or fails to fetch a URL, the fallback is always the same: `curl` the URL into a file and paste the contents. ______________________________________________________________________ ## Sample prompts These are starting points. Adapt the bracketed parts. ### Track 1, "Write me a one-off Python script" For an operator who wants a single script to run with `uv run script.py`. > Read https://api.trackandtrace.tools/llms.txt and https://classvsoftware.github.io/t3api-python-utils/getting-started/ to learn how to use the T3 API and the `t3api-utils` 2.1 library. > > Write me a single Python script, using PEP 723 inline dependencies, that: > > 1. Authenticates to the T3 API. > 1. Lets me pick a license interactively. > 1. Loads all **[active packages]** for that license. > 1. **\[Writes them to a CSV file with columns `label`, `item.name`, `quantity`, `unitOfMeasureName`.\]** > > Use `t3api-utils` for the auth, license picker, and parallel data loading. Keep the script short. For a script that changes Metrc data, or that someone else will run or schedule, add: > Follow the conventions in https://github.com/classvsoftware/t3-api-examples/blob/master/STYLE_GUIDE.md, starting from its templates. Tighter variant (when you know the exact endpoint): > Read https://api.trackandtrace.tools/llms.txt and the pruned spec at https://api.trackandtrace.tools/v2/spec/openapi.json?path=/v2/transfers/incoming/active > > Write a `uv` script that pulls all incoming active transfers and prints the manifest number and ETA for each one. ### Track 2, "Integrate the T3 API into my app" For a developer adding T3 calls to an existing service. Best run inside a coding agent (Cursor, Claude Code, etc.) so the model can edit your codebase directly. > The T3 API is documented at https://api.trackandtrace.tools/v2/docs and the OpenAPI spec is at https://api.trackandtrace.tools/v2/spec/openapi.json. Read https://api.trackandtrace.tools/llms.txt for an overview of conventions and authentication. > > Add a function to **\[`src/integrations/t3_client.ts`\]** that: > > 1. Accepts a `licenseNumber` and an optional date range. > 1. Calls **\[`/v2/packages/active`\]** with the appropriate query parameters. > 1. Returns a typed list of packages. > > Before writing the function, fetch the pruned spec for just that endpoint: `https://api.trackandtrace.tools/v2/spec/openapi.json?path=/v2/packages/active` and use it to derive the exact parameter names and the response type. Spec-driven code generation: > Fetch https://api.trackandtrace.tools/v2/spec/openapi.json?tag=Packages and generate **[TypeScript]** type definitions for every schema referenced, plus a thin fetch wrapper for each `Packages` endpoint. ### Reusable system prompt / agent instructions Drop this into a Cursor `.cursorrules` file, a Claude Code `CLAUDE.md`, an OpenAI system prompt, or any equivalent, anywhere your agent reads project-level instructions. ``` This project integrates with the T3 API (https://api.trackandtrace.tools). Authoritative resources, in order of preference: 1. https://api.trackandtrace.tools/llms.txt One-page orientation: what the API is, auth model, conventions. 2. https://api.trackandtrace.tools/v2/spec/openapi.json Full OpenAPI 3.0.2 spec. Always fetch a PRUNED subset, not the whole document. Use ?path=, ?tag=, ?schema=, or ?parameter= filters. Filters are combinable. Example: ?path=/v2/packages/active¶meter=LicenseNumber 3. https://classvsoftware.github.io/t3api-python-utils/getting-started/ For Python scripts, use the `t3api-utils` library, version 2.1 or later; it handles auth, license selection, pagination, and safe writes. Do not write 1.x code. 4. https://github.com/classvsoftware/t3-api-examples/blob/master/STYLE_GUIDE.md How T3 example scripts are written: flags, input checks, dry run and confirmation before any write. The repo's scripts are working examples. 5. https://wiki.trackandtrace.tools/llms.txt Every T3 wiki page as Markdown: the API, reports, labels, and more. Rules: - Never guess endpoint paths, parameter names, or response shapes. Fetch the pruned OpenAPI spec for the endpoint first. - Almost every data endpoint requires a `licenseNumber` query parameter. - Writes to Metrc are a dry run unless `submit=true` is passed. - This is NOT the Metrc 3rd party API. Do not use Metrc API keys. ``` ______________________________________________________________________ ## Next Steps - Read the full [OpenAPI Spec](https://wiki.trackandtrace.tools/t3-api/openapi/index.md) page for the complete pruning filter reference. - Walk through [Getting Started](https://wiki.trackandtrace.tools/t3-api/getting-started/index.md) to understand authentication and the `licenseNumber` requirement. - See [API Scripts](https://wiki.trackandtrace.tools/t3-api/api-scripts/index.md) for running scripts with uv, trying them in the Metrc sandbox, and the example scripts. - Browse [Supercollections](https://wiki.trackandtrace.tools/t3-api/supercollections/index.md) and [Reports](https://wiki.trackandtrace.tools/reports/index.md); both are well-suited to AI-generated scripts because they collapse multi-step workflows into single calls. - If you're not subscribed to T3+, [start your 30-day free trial here](https://dash.trackandtrace.tools). # API Scripts T3 API scripts are written in Python with [`t3api-utils`](#t3api-utils), the T3 Python library, and run with [uv](https://docs.astral.sh/uv/). The [T3 API examples](#example-scripts) repository has ready-to-run scripts for common jobs. ## Running Python Scripts with UV T3 Scripts ### Inline Packages [Declaring script dependencies](https://docs.astral.sh/uv/guides/scripts/#declaring-script-dependencies) This lets you declare your dependencies at the top of the script using special comments. When run with `uv run example.py`, uv automatically resolves and installs those dependencies in an isolated environment. ``` #!/usr/bin/env python3 # /// script # requires-python = ">=3.12" # dependencies = ["t3api-utils>=2.1.0"] # /// ``` Use `"t3api-utils[tui]>=2.1.0"` instead when the script browses rows in the terminal with `t3.inspect()`. ### Virtual Environments You can install dependencies into a standard Python virtual environment managed by `uv venv`: ``` uv venv source .venv/bin/activate uv pip install t3api-utils python example.py ``` In a uv project, run `uv add t3api-utils` and run scripts with `uv run`. ## t3api-utils [`t3api-utils`](https://classvsoftware.github.io/t3api-python-utils/) is the T3 Python library and `t3api` command. It handles login and secret keys, loads entire collections in parallel, sends writes as a dry run unless you pass `submit=True`, and downloads server-side reports. - [Documentation](https://classvsoftware.github.io/t3api-python-utils/), starting with [Getting started](https://classvsoftware.github.io/t3api-python-utils/getting-started/) - [GitHub repository](https://github.com/classvsoftware/t3api-python-utils) Version 2 is a rewrite. A script written for 1.x needs the [migration guide](https://classvsoftware.github.io/t3api-python-utils/migration/), or `t3api-utils<2` in its dependencies. ### Logging In Log in once from the command line: ``` uvx --from t3api-utils t3api login ``` It asks for your Metrc login and creates a [secret key](https://wiki.trackandtrace.tools/t3-api/authentication/index.md), which it saves in your operating system's keyring. Your Metrc password is not stored. Scripts then connect without asking for anything. If you skip this step, the first `t3.connect()` in a terminal asks for your login instead. On a server or in a scheduled job, set the `T3_SECRET_KEY` environment variable. ### A First Script ``` #!/usr/bin/env python3 # /// script # requires-python = ">=3.12" # dependencies = ["t3api-utils>=2.1.0"] # /// import t3api_utils as t3 with t3.connect() as client: license = client.license or client.pick_license() packages = client.collect( "METRC_ACTIVE_PACKAGES", license=license, filter=["isOnHold__eq:false"], mask=["label", "item.name", "quantity", "unitOfMeasureAbbreviation"], ) print(f"Saved {len(packages):,} packages to {t3.to_csv(packages, 'output/')}") ``` - `client.license` is the default license saved with `t3api license pick`. Without one, `client.pick_license()` lists your licenses and asks. - `METRC_ACTIVE_PACKAGES` is a [T3 endpoint ID](https://wiki.trackandtrace.tools/t3-api/t3-endpoint-ids/index.md). The path `/v2/packages/active` works too. - `collect()` loads every page in parallel. `filter` and `mask` run on the server, so only the rows and fields you asked for come back. - `to_csv()` turns nested fields into columns such as `item.name`. Given a folder, it names the file after the data, the license and the time. - A license number your login doesn't have raises `t3.UnknownLicense` before any request is sent. ### Writing to Metrc Writes are a dry run unless you pass `submit=True`. A dry run checks the request's format. It does not check that the records you name exist. `bulk()` dry-runs every row, then submits them: ``` result = client.bulk( "/v2/packages/change-locations", [{"id": 1234567, "locationId": 8901, "actualDate": "2026-11-30"}], license=license, submit="ask", log_to="output/move-results.csv", ) print(result.summary()) ``` `submit="ask"` shows the dry run's results and asks before sending anything. `log_to` records every row's outcome, even when a run stops partway. ### Sandbox The Metrc sandbox is a separate copy of Metrc with test data. Pass `sandbox=True` to `connect()`, or set `T3_SANDBOX=1` to point any script at it without editing it: ``` with t3.connect(sandbox=True) as client: license = client.pick_license() ``` - **Licenses differ.** The sandbox has its own license numbers, such as `SF-SBX-1-101`. The saved default license is ignored there, so scripts ask you to pick one. - **Submits are real**, against test data. Try every write script in the sandbox before running it on a real license. - **Data is sparse.** Many sandbox licenses have no packages or transfers, so empty results are normal. - **Your Metrc account needs sandbox access.** - **`report_url()` doesn't work there.** It needs a secret key, and a sandbox session uses a JWT. ## Example Scripts The [T3 API examples](https://github.com/classvsoftware/t3-api-examples) repository holds scripts built on `t3api-utils`. Each one is a single file, so you can download just the one you need. Start with: ``` uv run getting-started/intro.py ``` | Folder | Scripts | | --------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | | [`getting-started/`](https://github.com/classvsoftware/t3-api-examples/tree/master/getting-started) | Log in, list your licenses, and export one license's active packages | | [`basics/`](https://github.com/classvsoftware/t3-api-examples/tree/master/basics) | One library feature each: filters, supercollections, reports, tag lists, search, dry runs, errors, scheduled jobs | | [`packages/`](https://github.com/classvsoftware/t3-api-examples/tree/master/packages) | Move, adjust, finish, note and split packages; export lab results and history | | [`items/`](https://github.com/classvsoftware/t3-api-examples/tree/master/items) | Create items and strains, discontinue items, upload and download item photos | | [`transfers/`](https://github.com/classvsoftware/t3-api-examples/tree/master/transfers) | Download manifest and COA PDFs, export and void outgoing transfers | | [`sales/`](https://github.com/classvsoftware/t3-api-examples/tree/master/sales) | Export sales receipts, and void them | | [`cultivation/`](https://github.com/classvsoftware/t3-api-examples/tree/master/cultivation) | Move plants, change growth phase, record plant waste, finish harvests, package a harvest | Every script: - runs with no arguments, and asks for what it needs, such as a license or an input file - takes the same flags for unattended runs: `-l` license, `-p` profile, `--sandbox`, `-i` input file, `-o` output, and `-y` to submit without asking - checks every row, then asks before changing Metrc data, with "No" as the default answer - writes its output, and a log of every row it submitted, to `output/` Each script driven by a CSV comes with a `.sample.csv` showing the columns it expects. To write your own in the same style, follow the repository's [style guide](https://github.com/classvsoftware/t3-api-examples/blob/master/STYLE_GUIDE.md). ______________________________________________________________________ ## Next Steps - Use [Supercollections](https://wiki.trackandtrace.tools/t3-api/supercollections/index.md) to load packages + lab results (or transfers + packages) in a single call. - Use [Reports](https://wiki.trackandtrace.tools/reports/index.md) to dump entire Metrc datasets without pagination. - Point an AI model at the library with [AI & LLM Integration](https://wiki.trackandtrace.tools/t3-api/ai-and-llms/index.md). - Learn about the [OpenAPI spec](https://wiki.trackandtrace.tools/t3-api/openapi/index.md), including how to feed a pruned subset to an LLM or code generator. - Refer to the [T3 API documentation](https://trackandtrace.tools/api) to explore all the available endpoints. # Authentication The T3 API supports two authentication formats for most endpoints: 1. **Credential authentication**: a short-lived JWT obtained by exchanging your Metrc credentials at `/v2/auth/credentials`. 1. **Secret key authentication**: a long-lived opaque key that you generate once and then pass on every request. Both formats produce the same effective access. Pick the one that matches how your integration runs. ______________________________________________________________________ ## Credential Authentication ### How it works 1. Your client sends your Metrc username, password, and hostname (plus an email or a one-time password in states that ask for one) to `POST /v2/auth/credentials`. 1. T3 signs in to Metrc on your behalf and returns a JWT bearer token. 1. Your client sends the JWT with every subsequent request: ``` Authorization: Bearer ``` 1. When the JWT expires, your client must repeat step 1 to get a new one. ``` import requests response = requests.post( "https://api.trackandtrace.tools/v2/auth/credentials", json={ "hostname": "ca.metrc.com", "username": "YOUR_METRC_USERNAME", "password": "YOUR_METRC_PASSWORD", }, ) response.raise_for_status() access_token = response.json()["accessToken"] ``` ### States that ask for more Some states' Metrc logins also ask for an email or a one-time password. `GET /v2/states` lists every state with `requiresEmail` and `requiresOtp`, and needs no authentication, so you can check before logging in: ``` import requests states = requests.get("https://api.trackandtrace.tools/v2/states").json() maryland = next(state for state in states if state["hostname"] == "md.metrc.com") print(maryland["requiresEmail"], maryland["requiresOtp"]) # True False ``` Send `email` when `requiresEmail` is true. When `requiresOtp` is true, send a current one-time password as `otp` to `POST /v2/auth/credentials`, or your multi-factor setup key as `otpSeed` when creating a secret key. ### Where to use it - **Interactive scripts** you run manually from a laptop and that finish in one session. - **Notebook-driven analysis** where you authenticate once at the top of the notebook and discard the token at the end. - **Postman / curl exploration** of the API. Credential authentication is the right default when you control the script end-to-end and don't want T3 to retain any version of your password. ______________________________________________________________________ ## Secret Key Authentication ### How it works 1. You generate a secret key once via `POST /v2/auth/secretkey`, supplying your Metrc credentials. 1. T3 checks the credentials with Metrc and returns an opaque secret-key UUID. 1. Your client sends the secret key on every request, either in a header (preferred) or as a query parameter: ``` X-T3-API-Key: ``` or ``` GET /v2/packages/active?secretKey=&licenseNumber=... ``` 1. T3 handles signing in to Metrc, so your integration never handles a token or a refresh. ### How your credentials are stored A secret key stores the Metrc credentials you submitted, encrypted. T3 decrypts them only to sign in to Metrc for you, and never logs them. Deleting the key deletes them. ### When your Metrc credentials change A secret key holds the credentials you submitted when you created it. If any of the following change in Metrc, the key starts returning `401 Unauthorized` with the code `METRC_LOGIN_FAILURE`: - Password - Email (states with `requiresEmail`) - Username - Multi-factor setup key (states with `requiresOtp`) To keep using the same key, send the new credentials to `PUT /v2/auth/secretkey/`. T3 checks them with Metrc before saving, and the key's value does not change, so nothing that uses it needs updating. The username and hostname must match the ones the key was created with; for a different Metrc user, create a new key. ``` import requests requests.put( f"https://api.trackandtrace.tools/v2/auth/secretkey/{SECRET_KEY}", json={ "hostname": "ca.metrc.com", "username": "YOUR_METRC_USERNAME", "password": "YOUR_NEW_METRC_PASSWORD", }, ).raise_for_status() ``` A [scheduled report](https://wiki.trackandtrace.tools/reports/scheduling/index.md) running on a key whose credentials stopped working pauses until you save its schedule again. ### Where to use it - **Long-running scripts** (data pipelines, scheduled reports) that should not have to handle JWT refresh. - **Server-to-server integrations** that benefit from one fixed credential rather than an in-memory token. - **Spreadsheet sync** and other tools that need a stable URL with auth embedded. Secret key authentication is the right default when your integration runs unattended or when re-authenticating periodically is a burden. ______________________________________________________________________ ## Comparing the Two ``` sequenceDiagram participant C as Your client participant T as T3 API participant M as Metrc rect rgba(126,87,194,.08) Note over C,M: Credential auth C->>T: POST /v2/auth/credentials with Metrc credentials T->>M: Sign in on your behalf T-->>C: Short lived JWT C->>T: Every request carries Authorization: Bearer jwt Note over C: When the JWT expires, the client repeats the exchange end rect rgba(126,87,194,.08) Note over C,M: Secret key auth C->>T: Every request carries X-T3-API-Key T->>M: Sign in on your behalf T-->>C: Response, no token handling in the client end ``` | Property | Credential Auth | Secret Key Auth | | ------------------------------------- | -------------------------------------------- | -------------------------------------------------- | | **Where credentials live** | Caller's environment only | Stored encrypted by T3 | | **What you send per request** | `Authorization: Bearer ` | `X-T3-API-Key: ` (or `?secretKey=`) | | **Lifetime** | JWT expires; client must re-auth | Until you delete it | | **Survives a Metrc password change?** | Yes, the next exchange uses the new password | Yes, once you send the new password with `PUT` | | **Best for** | Interactive scripts, ad-hoc analysis | Long-running scripts, automation, spreadsheet sync | | **Revocation** | Wait for JWT to expire | Delete the secret key | ______________________________________________________________________ ## Managing Secret Keys Create a key on the [secret-key page](https://api.trackandtrace.tools/v2/pages/secret-key), or with the endpoints below: | Action | Endpoint | | ------------------ | ---------------------------------- | | Generate | `POST /v2/auth/secretkey` | | List | `GET /v2/auth/secretkey` | | Update credentials | `PUT /v2/auth/secretkey/` | | Delete | `DELETE /v2/auth/secretkey/` | The list response includes each key's `createdAt`, `lastUsedAt` (so you can identify dormant keys), and `isEnabled` and `isManaged` flags. Each generate call creates a new, separate key, even for credentials you have used before. A Metrc account can hold **25** secret keys. Generating another returns a `409` with code `SECRET_KEY_LIMIT_EXCEEDED`; delete one first. Store your key and reuse it rather than generating one each time a script runs. When you delete a key, it stops authenticating immediately; there is no grace period. A managed key (`isManaged: true`) can't be deleted. Deleting one returns a `403` with code `SECRET_KEY_MANAGED`. ______________________________________________________________________ ## Next Steps - Generate your first secret key at the [secret-key page](https://api.trackandtrace.tools/v2/pages/secret-key). - Make your first request in [Getting Started](https://wiki.trackandtrace.tools/t3-api/getting-started/index.md). - [`t3api-utils`](https://wiki.trackandtrace.tools/t3-api/api-scripts/#t3api-utils) handles both. `t3api login` creates a secret key and saves it to your OS keyring, and `t3.connect()` uses it, or a key in the `T3_SECRET_KEY` environment variable. - Refer to the [authentication endpoints](https://api.trackandtrace.tools/v2/docs/#/Authentication) in the interactive API documentation. - Example scripts: [`basics/connect-and-whoami.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/basics/connect-and-whoami.py) (show which credential and Metrc host you're connected with), [`basics/scheduled-job.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/basics/scheduled-job.py) (run unattended with `T3_SECRET_KEY`). # Filterable Fields Most collections that have their own table in Metrc have a `/fields` endpoint beside them. It lists the fields Metrc's table offers one of your licenses, with the operators each field takes, in the order Metrc's table shows its columns. Use it to build a filter form. A collection route accepts a filter only on its own fields; see [Limits and Behavior](#limits-and-behavior). ``` GET /v2/plants/vegetative/fields?licenseNumber=LIC-00001 GET /v2/packages/active/fields?licenseNumber=LIC-00001 ``` A T3+ subscription is **not** required to use this endpoint. ## Listing Fields | Parameter | Required | Description | | --------------- | -------- | ------------------------------------------------------- | | `licenseNumber` | yes | The license to list fields for. One license per request | ``` import requests response = requests.get( "https://api.trackandtrace.tools/v2/packages/active/fields", params={"licenseNumber": "LIC-00001"}, headers={"Authorization": f"Bearer {access_token}"}, ).json() for field in response["fields"]: print(field.get("label", field["field"]), field["type"], field["operators"]) ``` ``` { "t3EndpointId": "METRC_ACTIVE_PACKAGES", "fields": [ { "field": "label", "metrcField": "Label", "label": "Tag", "type": "string", "operators": ["endswith", "startswith", "eq", "neq"], "sortable": true, "metrc": { "title": "Tag", "field": "Label", "filterable": { "operators": { "string": { "endswith": "Ends with", "startswith": "Starts with", "eq": "Equal to", "neq": "Not Equal to" } } }, "metrcHtmlField": true, "filterOperators": { "endswith": "Ends with", "startswith": "Starts with", "eq": "Equal to", "neq": "Not Equal to" } } }, { "field": "item.unitCbdPercent", "metrcField": "Item.UnitCbdPercent", "label": "Unit CBD Percent", "type": "number", "operators": ["eq", "neq", "gte", "gt", "lte", "lt"], "sortable": true, "metrc": { "field": "Item.UnitCbdPercent", "hidden": true, "title": "Unit CBD Percent", "abbreviation": "Unit CBD%", "schemaType": "number", "filterOperators": { "eq": "Equal to", "neq": "Not Equal to", "gte": "Greater than or Equal to", "gt": "Greater than", "lte": "Less than or Equal to", "lt": "Less than" } } } ] } ``` ## Field Properties | Property | Description | | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `field` | The name a `filter` takes, as in `filter=item.strainName__eq:Blue Dream`. Nested fields use dots | | `metrcField` | Metrc's name for the field | | `label` | The column's title in Metrc's table. Absent when Metrc gives the column none | | `type` | `string`, `number`, `date`, `datetime` or `boolean`. Filter values are always text; write dates as ISO 8601 | | `operators` | The operators Metrc's table offers on the field, its default first. Empty when Metrc does not let the column be filtered | | `sortable` | `false` when Metrc does not let the column be sorted | | `metrc` | Everything Metrc declares about the column, under Metrc's own names, such as `hidden` for a column Metrc hides until you show it, and `abbreviation` for its short header. `filterOperators` is Metrc's label for each operator | A column's own `filterable.operators`, as on `Tag` above, replaces the operators its type would otherwise get. The operators themselves are listed in [Shaping a Report](https://wiki.trackandtrace.tools/reports/shaping/#filtering-and-sorting). ## Building a Filter Look a field up by its label, then send its `field` and an operator from its `operators`: ``` import requests BASE = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {access_token}"} LICENSE = "LIC-00001" fields = requests.get( f"{BASE}/v2/plants/vegetative/fields", params={"licenseNumber": LICENSE}, headers=HEADERS, ).json()["fields"] by_label = {field["label"]: field for field in fields if "label" in field} location = by_label["Location"] planted = by_label["Plant Batch Date"] plants = requests.get( f"{BASE}/v2/plants/vegetative", params=[ ("licenseNumber", LICENSE), ("filter", f"{location['field']}__contains:Room A"), ("filter", f"{planted['field']}__gte:2026-01-01T00:00:00.000Z"), ], headers=HEADERS, ).json()["data"] ``` That sends `filter=locationName__contains:Room A` and `filter=plantedDate__gte:2026-01-01T00:00:00.000Z`. Repeated filters must all match unless you add `filterLogic=or`. ## Limits and Behavior - **One license per request.** `licenseNumber` must be one of your session's licenses, or the response is `403` with the code `FORBIDDEN`. Sending it twice is a `400`. - **Fields differ between licenses.** Metrc shows each license the columns that apply to it, so two licenses in the same state can get different lists for the same collection. Ask once per license. - **A license without the table gets a `403`** with the code `METRC_RESOURCE_UNAUTHORIZED`. California has no vegetative plants table, for example. - **Only collections with their own table.** A collection Metrc shows only inside another record, such as a package's history, has no `/fields`. Processing jobs, harvest schedules and data import templates have no `/fields` either. - **A collection accepts only its own fields.** A `filter` must name one of the collection's fields; packages also accept `item.name`, `item.strainName`, `item.productCategoryName` and `item.unitThcContent`. Any other field is a `400` that lists the accepted ones, even a column `/fields` lists, such as `item.unitCbdPercent` on packages. - **Free.** No T3+ subscription required. `/fields` has its own limit per Metrc user, separate from the limit your other requests share; a `429` with the code `RATE_LIMIT_EXCEEDED` means wait and retry. ## Next Steps - [Shaping a Report](https://wiki.trackandtrace.tools/reports/shaping/index.md): filter, sort and choose columns for a report - [Metrc Pages](https://wiki.trackandtrace.tools/t3-api/metrc-pages/index.md): link from your tool to the Metrc table a collection comes from - Example script: [`basics/filter-sort-mask.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/basics/filter-sort-mask.py) (filter, sort and mask a collection on the server). # Creating Packages A new package is cut from one or more **existing active packages**. There is no way to conjure one from nothing: every package traces back to material already in the license, which is why the payload is built around an `ingredients` list. | Step | Endpoint | Result | | ---- | -------------------------------------------------------- | ------------------------------------------------------------ | | 0 | `GET /v2/packages/create/inputs` and its companion lists | The ids the payload needs | | 1 | `POST /v2/packages/create` | Source packages are drawn down, a new tagged package appears | Like every mutation in this API, this is a **dry run by default**. Add `submit=true` to actually write to Metrc. See [Writing to Metrc](https://wiki.trackandtrace.tools/t3-api/getting-started/#writing-to-metrc). Permissions Creating a package requires the `new_packages` action on the packages page (listed as `packages/active:new_packages`). Check before you call: ``` permissions = requests.get( f"{API}/v2/permissions", params={"licenseNumber": "CUL00001", "view": "packages"}, headers=HEADERS, ).json() assert any(p.partition(":")[2] == "new_packages" for p in permissions) ``` See [Permissions](https://wiki.trackandtrace.tools/t3-api/permissions/index.md). ## Step 0, Fetch the input options `GET /v2/packages/create/inputs` returns the option lists for the create payload: ``` import requests API = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {ACCESS_TOKEN}"} inputs = requests.get( f"{API}/v2/packages/create/inputs", params={"licenseNumber": "CUL00001"}, headers=HEADERS, ).json() print([u["name"] for u in inputs["unitsOfMeasure"]]) print([loc["name"] for loc in inputs["locations"]]) ``` `tags`, `items`, and `packages` are not served here The inputs response declares `tags`, `items`, and `packages` keys, but they come back empty even on a license holding thousands of tags. Each is served from a companion endpoint instead: | You need | Call this, not `inputs` | | ------------------------- | ----------------------------------------- | | `tagId` | `GET /v2/packages/create/source-tags` | | `itemId` | `GET /v2/packages/create/source-items` | | `ingredients[].packageId` | `GET /v2/packages/create/source-packages` | All three are paginated, pass `pageSize`. ``` tags = requests.get( f"{API}/v2/packages/create/source-tags", params={"licenseNumber": "CUL00001", "pageSize": 100}, headers=HEADERS, ).json()["data"] items = requests.get( f"{API}/v2/packages/create/source-items", params={"licenseNumber": "CUL00001", "pageSize": 100}, headers=HEADERS, ).json()["data"] sources = requests.get( f"{API}/v2/packages/create/source-packages", params={"licenseNumber": "CUL00001", "pageSize": 100}, headers=HEADERS, ).json()["data"] ``` If `source-tags` returns nothing, no package can be created: tags must be assigned to the license in Metrc first. ## Step 1, Create the package The body is a **list**, so several packages can be created in one call. ``` import requests API = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {ACCESS_TOKEN}"} source = sources[0] # Match the source package's unit, falling back to the abbreviation: the id on # a package record does not always appear in unitsOfMeasure. unit = next( (u for u in inputs["unitsOfMeasure"] if u["id"] == source.get("unitOfMeasureId")), None, ) or next( u for u in inputs["unitsOfMeasure"] if u["abbreviation"] == source.get("unitOfMeasureAbbreviation") ) payload = { "actualDate": "2024-08-08", "ingredients": [ { "packageId": source["id"], "quantity": 5.0, "unitOfMeasureId": unit["id"], } ], "itemId": items[0]["id"], "quantity": 5.0, "tagId": tags[0]["id"], "unitOfMeasureId": unit["id"], "note": "Cut for retail", } response = requests.post( f"{API}/v2/packages/create", params={"licenseNumber": "CUL00001", "submit": "true"}, headers=HEADERS, json=[payload], ) response.raise_for_status() ``` Required fields are `actualDate`, `ingredients`, `itemId`, `quantity`, `tagId`, and `unitOfMeasureId`. Everything else is optional or state-dependent. A few worth knowing: - **`ingredients[].quantity` is what you take from the source**, and the top-level `quantity` is what the new package holds. They are usually equal, but need not be: a process that loses weight draws more than it yields. - **`ingredients[].finishDate`** finishes a source package you have fully consumed. Omit it to leave the remainder active. - **`useSameItem`** is for sublotting material this license does not own the item for. You must still send `itemId`, copied from the source package. - **Multiple ingredients** combine several sources into one package. Each entry needs its own `packageId`, `quantity`, and `unitOfMeasureId`. - **`productionBatchNumber`** marks the new package as a production batch. - **`remediationMethodId`**, **`remediationDate`** and **`remediationSteps`** remediate a production batch as it is created. Send all three, with `productionBatchNumber`. Methods are in `inputs["remediationMethods"]`. Metrc refuses it unless the source product failed lab testing. Not used in California. ### Fields that vary by state Unlike plant batch naming, none of these change the payload's *shape*; they are fields that exist in some states and are rejected in others. Send them only where they apply. | Field | Behavior | | ------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | | `locationId` | Required in most states, not required in some. `inputs["locations"]` is empty where it does not apply. | | `sublocationId` | Unused in some states, optional in others. | | `expirationDate`, `useByDate`, `sellByDate` | Only applicable in some states. | | `isDonation`, `isTradeSample` | Only applicable in some states. **Do not send them at all** where they do not apply: sending `false` is not the same as omitting. | The reliable test is the inputs response: if a list backing a field comes back empty or null, that field does not apply to the license you are writing to. ``` locations = inputs.get("locations") or [] if locations: payload["locationId"] = locations[0]["id"] ``` ## Splitting and merging Metrc has no separate split or merge. A split is one create call with an entry per new package, each drawing on the same source. A merge is one entry with several ingredients. Put a `finishDate` on the ingredient that empties a source to finish it: ``` # Split one package into two halves. The second draw empties it, so it finishes it. halves = [ { "actualDate": "2026-05-14", "tagId": tag["id"], "itemId": source["item"]["id"], "quantity": 1.0, "unitOfMeasureId": unit["id"], "locationId": inputs["locations"][0]["id"], "ingredients": [ { "packageId": source["id"], "quantity": 1.0, "unitOfMeasureId": unit["id"], **({"finishDate": "2026-05-14"} if i == 1 else {}), } ], } for i, tag in enumerate(tags[:2]) ] requests.post( f"{API}/v2/packages/create", params={"licenseNumber": "CUL00001", "submit": "true"}, headers=HEADERS, json=halves, ) ``` Merging the halves back is one entry whose `ingredients` lists both, each with a `finishDate`. ## Testing packages A testing package is a sample cut for a lab. Post it to `/v2/packages/create/testing` with the same fields plus `requiredLabTestBatches`. Send `useSameItem: true` with the source's `itemId`. ``` batches = requests.get( f"{API}/v2/packages/create/testing/lab-batches", params={"licenseNumber": "CUL00001", "productCategoryId": source["item"]["productCategoryId"]}, headers=HEADERS, ).json()["data"] requests.post( f"{API}/v2/packages/create/testing", params={"licenseNumber": "CUL00001", "submit": "true"}, headers=HEADERS, json=[ { "actualDate": "2026-05-14", "tagId": tag["id"], "itemId": source["item"]["id"], "useSameItem": True, "quantity": 0.5, "unitOfMeasureId": unit["id"], "locationId": inputs["locations"][0]["id"], "requiredLabTestBatches": [batches[0]["id"]], "ingredients": [ {"packageId": source["id"], "quantity": 0.5, "unitOfMeasureId": unit["id"]} ], } ], ) ``` The source then reads `labTestingStateName: "SubmittedForTesting"`, and Metrc refuses to transfer it to a facility that is not a lab. ## Finding the ids | Field | Where it comes from | | ------------------------- | --------------------------------------------------- | | `tagId` | `GET /v2/packages/create/source-tags` | | `itemId` | `GET /v2/packages/create/source-items` | | `ingredients[].packageId` | `GET /v2/packages/create/source-packages` | | `unitOfMeasureId` | `GET /v2/packages/create/inputs` → `unitsOfMeasure` | | `locationId` | `GET /v2/packages/create/inputs` → `locations` | ## Verifying the result The new package appears in `GET /v2/packages/active` under its tag label: ``` created = requests.get( f"{API}/v2/packages/active", params={"licenseNumber": "CUL00001", "filter": f"label__eq:{tags[0]['label']}"}, headers=HEADERS, ).json()["data"] assert len(created) == 1 print(created[0]["quantity"]) ``` The source package should have been drawn down by the ingredient quantity. Re-read it to confirm the write actually took effect: ``` remaining = requests.get( f"{API}/v2/packages/active", params={"licenseNumber": "CUL00001", "filter": f"label__eq:{source['label']}"}, headers=HEADERS, ).json()["data"] # A fully consumed source leaves the active list entirely if remaining: assert remaining[0]["quantity"] < source["quantity"] ``` A source that was fully consumed drops out of `/v2/packages/active` rather than showing a zero balance, so an empty result here is a correct outcome, not a failed write. ## Next Steps - [Managing Packages](https://wiki.trackandtrace.tools/t3-api/managing-packages/index.md): move, re-item, note or adjust it - [Creating Transfers](https://wiki.trackandtrace.tools/t3-api/creating-transfers/index.md): ship the package you just created - [Creating Plant Batches](https://wiki.trackandtrace.tools/t3-api/creating-plant-batches/index.md): the other direction, package to plants - [Permissions](https://wiki.trackandtrace.tools/t3-api/permissions/index.md): check what your account may do before calling - Example script: [`packages/split-package.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/packages/split-package.py) (split part of one package into a new package). # Creating Plant Batches Three endpoints cover the path from a package of seeds or clones to tracked plants in the Flowering state: | Step | Endpoint | Result | | ---- | -------------------------------------------- | ---------------------------------------------------------------- | | 1 | `POST /v2/plantbatches/create/from-packages` | A package becomes an **immature** plant batch | | 2 | `POST /v2/plantbatches/promote` | Immature plants become **tagged** Vegetative or Flowering plants | | 3 | `POST /v2/plants/changegrowthphase` | Vegetative plants become **Flowering** | You do not always need all three. Step 2 can promote straight to Flowering in states that allow it, in which case step 3 is unnecessary. California has no Vegetative phase: promote straight to Flowering there, because `POST /v2/plants/changegrowthphase` is not available in California. Like every mutation in this API, these are **dry runs by default**. Add `submit=true` to actually write to Metrc. See [Writing to Metrc](https://wiki.trackandtrace.tools/t3-api/getting-started/#writing-to-metrc). ## Step 0, Fetch the input options `GET /v2/plantbatches/create/from-packages/inputs` returns every option list needed to build the create payload: ``` import requests API = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {ACCESS_TOKEN}"} inputs = requests.get( f"{API}/v2/plantbatches/create/from-packages/inputs", params={"licenseNumber": "CUL00001"}, headers=HEADERS, ).json() print([t["name"] for t in inputs["plantBatchTypes"]]) # ['Clone', 'Seed'] print([s["name"] for s in inputs["strains"]]) ``` This is the **only** source for `plantBatchTypeId`. The value is state-specific and does not appear on the plant batch records returned by `GET /v2/plantbatches/active`, so there is no way to infer it from existing data. Filter locations on `forPlantBatches`, not every location can hold one: ``` locations = [loc for loc in inputs["locations"] if loc["forPlantBatches"]] ``` `tags` is populated in California and `null` everywhere else, which mirrors the naming rule described below. ## Step 1, Create a plant batch from a package Draws material from a package and creates an immature plant batch. ``` import requests API = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {ACCESS_TOKEN}"} response = requests.post( f"{API}/v2/plantbatches/create/from-packages", params={"licenseNumber": "CUL00001", "submit": "true"}, headers=HEADERS, json=[ { "actualDate": "2026-08-26", "plantedDate": "2026-08-26", "locationId": 12345, "packageId": 5077333, "plantBatchTypeId": 1, "plantsCount": 25, "quantity": 25, "strainId": 737, "unitOfMeasureId": 4, "plantBatchName": "Spring Batch A", } ], ) response.raise_for_status() ``` `plantsCount` is how many plants the new batch contains. How much of the source is drawn depends on the package: from a Plant Package, `plantsCount` is the draw and `quantity` is not used; from any other package, Metrc requires `quantity` and `unitOfMeasureId`. Sending both is always safe. ### Naming Send the batch's name as `plantBatchName`: - **California** identifies a plant batch by tag, so the name **is** a plant tag's label. Pick one from `GET /v2/tags/available`; creating the batch uses up that tag. - **Every other state** takes free text, such as `"Spring Batch A"`. ## Step 2, Promote immature plants Moves plants out of the batch into a tracked growth phase, assigning **one plant tag per plant**. ``` response = requests.post( f"{API}/v2/plantbatches/promote", params={"licenseNumber": "CUL00001", "submit": "true"}, headers=HEADERS, json=[ { "growthDate": "2026-09-15", "growthPhase": "Vegetative", "id": 987654, "newLocationId": 12345, "plantsCount": 25, "startingTagId": 1527333, "endingTagId": 1527357, } ], ) response.raise_for_status() ``` `startingTagId` and `endingTagId` bound a **contiguous** range of tags. Every tag from start to end inclusive is consumed, so `plantsCount` must equal the size of that range, 25 plants requires exactly 25 consecutive available tags. That constraint is the most common source of errors here. Tags returned by `GET /v2/tags/available` are not guaranteed to be contiguous, so pick a run of adjacent ids rather than the first 25 in the list: ``` tags = requests.get( f"{API}/v2/tags/available", params={"licenseNumber": "CUL00001", "pageSize": 500}, headers=HEADERS, ).json()["data"] ids = sorted(tag["id"] for tag in tags) # Find the first run of `needed` consecutive ids needed = 25 run_start = 0 for index in range(1, len(ids)): if ids[index] != ids[index - 1] + 1: run_start = index elif index - run_start + 1 == needed: starting_tag_id, ending_tag_id = ids[run_start], ids[index] break else: raise RuntimeError(f"No run of {needed} consecutive tags is available") ``` ## Step 3, Change growth phase Moves plants between phases, most commonly Vegetative to Flowering. ``` response = requests.post( f"{API}/v2/plants/changegrowthphase", params={"licenseNumber": "CUL00001", "submit": "true"}, headers=HEADERS, json=[ { "growthDate": "2026-10-01", "growthPhase": "Flowering", "id": 987654, "newLocationId": None, "newTagId": None, } ], ) response.raise_for_status() ``` `newLocationId` and `newTagId` must be **present** but may be `null`. Metrc expects to see both keys whether or not you are moving or retagging the plant. Omitting them is not the same as sending `null`. Pass a real `newLocationId` to move the plant into a flowering room in the same request, and a real `newTagId` to retag it at the same time. ## Finding the ids Every numeric id above comes from a list endpoint: | Field | Where it comes from | | ------------------------------------------------------------------------------ | ---------------------------------------------------------------------- | | `plantBatchTypeId` | `GET /v2/plantbatches/create/from-packages/inputs` → `plantBatchTypes` | | `strainId` | `GET /v2/plantbatches/create/from-packages/inputs` → `strains` | | `locationId`, `newLocationId` | `GET /v2/plantbatches/create/from-packages/inputs` → `locations` | | `unitOfMeasureId` | `GET /v2/plantbatches/create/from-packages/inputs` → `unitsOfMeasure` | | `packageId` | `GET /v2/plantbatches/create/from-packages/source-packages` | | `startingTagId`, `endingTagId`, `newTagId`, and `plantBatchName` in California | `GET /v2/tags/available` | | `id` (plant batch) | `GET /v2/plantbatches/active` | | `id` (plant) | `GET /v2/plants/vegetative` | ## Verifying the result Each step is visible in the corresponding list endpoint immediately: ``` batches = requests.get( f"{API}/v2/plantbatches/active", params={"licenseNumber": "CUL00001", "filter": "name__eq:Spring Batch A"}, headers=HEADERS, ).json()["data"] assert len(batches) == 1 print(batches[0]["untrackedCount"]) ``` After promoting, the promoted plants appear in `GET /v2/plants/vegetative` (or `/v2/plants/flowering`) and the batch's untracked count drops by `plantsCount`. ## Next Steps - Move, rename, split, adjust or package an existing batch with [Managing Plant Batches](https://wiki.trackandtrace.tools/t3-api/managing-plant-batches/index.md). - Move plants through their lifecycle with [The Harvest Lifecycle](https://wiki.trackandtrace.tools/t3-api/harvest-lifecycle/index.md). - Package what you harvest in [Creating Packages](https://wiki.trackandtrace.tools/t3-api/creating-packages/index.md). - Check what your account may do first with [Permissions](https://wiki.trackandtrace.tools/t3-api/permissions/index.md). # Creating Transfers A transfer moves packages from your license to another facility. The payload nests four levels deep; a shipment holds **destinations**, each destination holds **transporters** and **packages**, and each transporter holds **driver and vehicle details**. | Step | Endpoint | Result | | ---- | --------------------------------------------------------- | ------------------------------------------- | | 0 | `GET /v2/transfers/create/inputs` and its companion lists | Transfer types, destinations, transporters | | 1 | `POST /v2/transfers/create` | An outgoing transfer with a manifest number | Like every mutation in this API, this is a **dry run by default**. Add `submit=true` to actually write to Metrc. See [Writing to Metrc](https://wiki.trackandtrace.tools/t3-api/getting-started/#writing-to-metrc). Permissions Transfers are started from the **packages** page in Metrc, so the permission is the `new_transfer` action on the packages page (listed as `packages/active:new_transfer`), not something under `transfers`. You also need the `transfers/licensed` view to read the result back. ``` permissions = requests.get( f"{API}/v2/permissions", params={"licenseNumber": "CUL00001", "view": "packages"}, headers=HEADERS, ).json() assert any(p.partition(":")[2] == "new_transfer" for p in permissions) ``` See [Permissions](https://wiki.trackandtrace.tools/t3-api/permissions/index.md). ## Step 0, Fetch the input options ``` import requests API = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {ACCESS_TOKEN}"} inputs = requests.get( f"{API}/v2/transfers/create/inputs", params={"licenseNumber": "CUL00001"}, headers=HEADERS, ).json() print([t["name"] for t in inputs["transferTypes"]]) print(inputs["defaultPhoneNumberForQuestions"]) ``` Destinations and transporters come from companion endpoints, both paginated: ``` destinations = requests.get( f"{API}/v2/transfers/create/destinations", params={"licenseNumber": "CUL00001", "pageSize": 100}, headers=HEADERS, ).json()["data"] transporters = requests.get( f"{API}/v2/transfers/create/transporters", params={"licenseNumber": "CUL00001", "pageSize": 100}, headers=HEADERS, ).json()["data"] ``` A license with no eligible destination or transporter cannot create a transfer at all. That is a Metrc configuration matter, not something the payload can work around. The inputs response also carries `drivers` and `vehicles`, the facility's saved records. Use them to fill `transporterDetails` rather than retyping driver and plate values: ``` driver = inputs["drivers"][0] vehicle = inputs["vehicles"][0] ``` ### Choosing a transfer type **This is the decision that determines the rest of the payload.** Each entry in `inputs["transferTypes"]` carries flags saying which conditional fields become mandatory: | Flag on the transfer type | Makes this required | | ----------------------------------- | --------------------------------------------------------- | | `requiresDestinationGrossWeight` | `grossWeight` + `grossUnitOfWeightId` on the destination | | `requiresPackagesGrossWeight` | `grossWeight` + `grossUnitOfWeightId` on **each package** | | `transactionType == "Wholesale"` | `wholesalePrice` on **each package** | | `requiresInvoiceNumber` | `invoiceNumber` on the destination | | `requiresVehicleRegistrationNumber` | `vehicleRegistrationNumber` on **each driver entry** | `forLicensedShipments` tells you the type is valid for a standard licensed transfer. Wholesale types also carry `minimumWholesalePrice` and `maximumWholesalePrice`, which bound the `wholesalePrice` you may send. Which types exist, and which flags they carry, is **state-specific**; there is no fixed list to code against. Read the flags rather than matching on type names. The simplest possible transfer is one whose type demands none of the conditional fields: ``` def is_minimal(transfer_type): """A licensed type needing no weight, invoice, or price fields.""" return ( transfer_type.get("forLicensedShipments") and not transfer_type.get("requiresDestinationGrossWeight") and not transfer_type.get("requiresPackagesGrossWeight") and not transfer_type.get("requiresInvoiceNumber") and transfer_type.get("transactionType") != "Wholesale" ) transfer_type = next(t for t in inputs["transferTypes"] if is_minimal(t)) ``` If your license offers no such type, add whichever fields its flags demand; see [Conditional fields](#conditional-fields) below. ## Step 1, Create the transfer The body is a **list** of shipments, and each shipment's `destinations` is itself a list, so one call can create a multi-stop transfer. ``` import datetime as dt import requests API = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {ACCESS_TOKEN}"} departure = dt.datetime.now(dt.timezone.utc).replace(microsecond=0) arrival = departure + dt.timedelta(hours=1) payload = { "destinations": [ { "recipientId": destinations[0]["id"], "transferTypeId": transfer_type["id"], "plannedRoute": "I-70 west to the facility", "estimatedDepartureDateTime": departure.strftime("%Y-%m-%dT%H:%M:%S"), "estimatedArrivalDateTime": arrival.strftime("%Y-%m-%dT%H:%M:%S"), "transporters": [ { "transporterId": transporters[0]["id"], "phoneNumberForQuestions": inputs["defaultPhoneNumberForQuestions"], "transporterDetails": [ { "driverName": "Jane Doe", "driverOccupationalLicenseNumber": "LIC12345", "driverLicenseNumber": "D1234567", "vehicleMake": "Ford", "vehicleModel": "Transit", "vehicleLicensePlateNumber": "ABC1234", } ], } ], "packages": [{"id": package_id}], } ] } response = requests.post( f"{API}/v2/transfers/create", params={"licenseNumber": "CUL00001", "submit": "true"}, headers=HEADERS, json=[payload], ) response.raise_for_status() ``` Required on every destination: `recipientId`, `transferTypeId`, `plannedRoute`, `estimatedDepartureDateTime`, and `estimatedArrivalDateTime`. Required on every transporter: `transporterId`, `phoneNumberForQuestions`, and `transporterDetails`. Every field of `transporterDetails` is required: `driverName`, `driverOccupationalLicenseNumber`, `driverLicenseNumber`, `vehicleMake`, `vehicleModel`, and `vehicleLicensePlateNumber`. `driverLayoverLeg` and `vehicleRegistrationNumber` are optional. See [Layover transfers](https://wiki.trackandtrace.tools/t3-api/layover-transfers/#layover-transfers) and the conditional fields below. Oregon An Oregon transfer has one transporter, driver and vehicle for all of its destinations. Send at most one transporter with one `transporterDetails` entry, and repeat the same block on each destination that carries one. Anything else, including a layover, returns `400`. Datetime format `estimatedDepartureDateTime` and `estimatedArrivalDateTime` take `YYYY-MM-DDTHH:MM:SS` with **no timezone suffix**. Metrc interprets them in the license's local time. `packages[].id` is the Metrc package id from `GET /v2/packages/active`: the numeric `id`, not the tag label. `GET /v2/transfers/create/packages` lists the packages eligible for a transfer if you would rather filter server-side. ### Conditional fields Add these only when the chosen transfer type's flags call for them. Sending a field the type does not expect is rejected. When `requiresDestinationGrossWeight` is true: ``` { # ... other destination fields "grossWeight": 123.45, "grossUnitOfWeightId": 4, } ``` When `requiresPackagesGrossWeight` is true, every package entry carries its own weight: ``` { # ... other destination fields "packages": [ { "id": package_id, "grossWeight": 123.45, "grossUnitOfWeightId": 4, } ], } ``` When `transactionType` is `"Wholesale"`, each package carries its price: ``` { # ... other destination fields "packages": [ { "id": package_id, "wholesalePrice": 200.00, } ], } ``` When `requiresInvoiceNumber` is true: ``` { # ... other destination fields "invoiceNumber": "123456-ABC", } ``` When `requiresVehicleRegistrationNumber` is true, every driver entry carries it: ``` { # ... other transporter fields "transporterDetails": [ { # ... other driver fields "vehicleRegistrationNumber": "REG12345", } ], } ``` ## Finding the ids | Field | Where it comes from | | --------------------- | ----------------------------------------------------------------- | | `transferTypeId` | `GET /v2/transfers/create/inputs` → `transferTypes` | | `recipientId` | `GET /v2/transfers/create/destinations` | | `transporterId` | `GET /v2/transfers/create/transporters` | | `packages[].id` | `GET /v2/packages/active`, or `GET /v2/transfers/create/packages` | | `grossUnitOfWeightId` | `GET /v2/transfers/create/inputs` → `unitsOfMeasure` | ## Verifying the result The create response does not carry the new transfer's id, so find it by diffing the outgoing list around the call: ``` def outgoing_ids(): listing = requests.get( f"{API}/v2/transfers/outgoing/active", params={"licenseNumber": "CUL00001", "pageSize": 100}, headers=HEADERS, ).json()["data"] return {t["id"] for t in listing} before = outgoing_ids() # ... POST /v2/transfers/create ... new_ids = outgoing_ids() - before assert len(new_ids) == 1 transfer_id = new_ids.pop() ``` Read the manifest number off the listing once you have the id: ``` listing = requests.get( f"{API}/v2/transfers/outgoing/active", params={"licenseNumber": "CUL00001", "pageSize": 100}, headers=HEADERS, ).json()["data"] transfer = next(t for t in listing if t["id"] == transfer_id) print(transfer["manifestNumber"]) ``` Transferred packages leave `GET /v2/packages/active` and appear in `GET /v2/packages/intransit`. ## Undoing a transfer `POST /v2/transfers/void` reverses a transfer that has not yet been received. Note the body is a **single object**, not a list: ``` requests.post( f"{API}/v2/transfers/void", params={"licenseNumber": "CUL00001", "submit": "true"}, headers=HEADERS, json={"id": transfer_id}, ) ``` The voided transfer leaves `GET /v2/transfers/outgoing/active` and its packages return to active inventory. ## Next Steps - Send a transfer through an intermediate stop with [Layover Transfers](https://wiki.trackandtrace.tools/t3-api/layover-transfers/index.md). - What happens at the other end: [Receiving Transfers](https://wiki.trackandtrace.tools/t3-api/receiving-transfers/index.md). - Check what your account may do first with [Permissions](https://wiki.trackandtrace.tools/t3-api/permissions/index.md). - Example scripts: [`transfers/export-outgoing-transfers.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/transfers/export-outgoing-transfers.py) (export outgoing transfers in a date range), [`transfers/download-manifest-pdfs.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/transfers/download-manifest-pdfs.py) (download manifest PDFs), [`transfers/void-transfers-from-csv.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/transfers/void-transfers-from-csv.py) (void outgoing transfers by manifest number). # Getting Started with the T3 API The T3 API is plain HTTP. This page walks through authenticating, finding your license, loading data, and writing to Metrc. The examples use Python's `requests`; any HTTP client works. **Note:** most endpoints require a [T3+ subscription](https://dash.trackandtrace.tools). Basic plans with fewer than four seats can use the [report endpoints](https://wiki.trackandtrace.tools/reports/index.md) only. A few endpoints, such as `/v2/licenses`, are [free](https://api.trackandtrace.tools/v2/docs/#/Free). If you would rather not write code, [Spreadsheet Sync](https://wiki.trackandtrace.tools/t3-api/spreadsheet-sync/index.md) loads a whole dataset into Excel or Google Sheets from a single URL. ## 1. Authenticate Exchange your Metrc login for a token: ``` import requests API = "https://api.trackandtrace.tools" token = requests.post( f"{API}/v2/auth/credentials", json={ "hostname": "ca.metrc.com", "username": "YOUR_METRC_USERNAME", "password": "YOUR_METRC_PASSWORD", }, ).json()["accessToken"] HEADERS = {"Authorization": f"Bearer {token}"} ``` For scripts that run unattended, use a secret key instead and send it as `X-T3-API-Key`. See [Authentication](https://wiki.trackandtrace.tools/t3-api/authentication/index.md) for both formats. ## 2. Pick a license Almost every endpoint needs a `licenseNumber` query parameter, and each request covers one license. List the licenses your login can reach: ``` licenses = requests.get(f"{API}/v2/licenses", headers=HEADERS).json() for license in licenses: print(license["licenseNumber"], license["licenseName"]) LICENSE = licenses[0]["licenseNumber"] ``` ## 3. Load data Collection endpoints return one page at a time: ``` page = requests.get( f"{API}/v2/packages/active", params={"licenseNumber": LICENSE, "pageSize": 100, "page": 1}, headers=HEADERS, ).json() print(page["total"], "active packages") for package in page["data"]: print(package["label"], package["item"]["name"], package["quantity"]) ``` ``` { "data": [ { "id": 12345, "label": "1A4FF0100000022000000123", "...": "..." } ], "total": 1260, "page": 1, "pageSize": 100, "totalPages": 13 } ``` `pageSize` goes up to 500, or 50 on [supercollections](https://wiki.trackandtrace.tools/t3-api/supercollections/index.md). Narrow a page with `filter=field__operator:value` and order it with `sort=field:asc`; the operators are listed in [Shaping a Report](https://wiki.trackandtrace.tools/reports/shaping/#filtering-and-sorting), and the fields each collection can be filtered on in [Filterable Fields](https://wiki.trackandtrace.tools/t3-api/collection-fields/index.md). From here: - **The whole dataset in one request**: [Reports](https://wiki.trackandtrace.tools/reports/index.md). - **A record and its lab results, history or packages**: [Supercollections](https://wiki.trackandtrace.tools/t3-api/supercollections/index.md). - **One record by id**: [Loading One Record by ID](https://wiki.trackandtrace.tools/t3-api/object-lookup/index.md). - **Find something without knowing where it is**: [Search](https://wiki.trackandtrace.tools/t3-api/search/index.md). ## Writing to Metrc Every endpoint that changes Metrc data works the same way. **Writes are dry runs by default.** T3 validates the payload and returns `200` without sending anything to Metrc. Add `submit=true` to actually write: ``` note = [{"id": 12345, "note": "Moved to vault"}] # Dry run: checks the payload, writes nothing requests.post( f"{API}/v2/packages/notes", params={"licenseNumber": LICENSE}, headers=HEADERS, json=note, ).raise_for_status() # Real write requests.post( f"{API}/v2/packages/notes", params={"licenseNumber": LICENSE, "submit": "true"}, headers=HEADERS, json=note, ).raise_for_status() ``` **A write answers `201` when it makes new records,** such as packages, plants, plant batches, harvests, items, strains or transfers, and `200` otherwise. A dry run always answers `200`. Treat any `2xx` as success, as `raise_for_status()` does. The errors: - `400`: refused, with the reason in `detail`. Nothing was written. - `401`: sign in again. - `403`: the Metrc account doesn't have permission for this on the license. - `429`: too many requests. Wait, then send it again. - `502` or `504`: Metrc failed or didn't answer in time. The write may have landed, so read it back before sending it again. **Add `applyDynamicValidation=true` to check against your live data.** T3 then also confirms that the records your payload names exist and are eligible, and returns a `400` describing what is wrong instead of sending it. It is best-effort: a request that passes can still be refused by Metrc. To turn off one check while keeping the rest, add `skipDynamicValidationChecks=CHECK_KEY`; each endpoint's available keys are listed on its entry in the [interactive docs](https://api.trackandtrace.tools/v2/docs/). **Add `applyDynamicConfirmation=true` to have T3 confirm the outcome.** The status then says whether the write succeeded: `200`, or `201` for a create, if it did, and `400` with the code `METRC_WRITE_FAILED` if it failed. A `502` or `504` still means T3 isn't sure, so check Metrc before sending it again. A create also lists what it made under `created`, with the ids Metrc's own answer leaves out. Each endpoint's entry in the [interactive docs](https://api.trackandtrace.tools/v2/docs/) says whether it can confirm; one that can't answers `400` and sends nothing. ``` response = requests.post( f"{API}/v2/packages/finish", params={"licenseNumber": LICENSE, "submit": "true", "applyDynamicConfirmation": "true"}, headers=HEADERS, json=[{"id": 12345, "actualDate": "2026-12-01"}], ) response.raise_for_status() # a 400 METRC_WRITE_FAILED means nothing was applied ``` **Otherwise, read the result back.** Metrc sometimes answers `200` to a write it did not apply, so confirm the change with a read before relying on it. Each write page shows the read that verifies it. **Check permissions first.** What your account may do varies by license, state and Metrc role. See [Permissions](https://wiki.trackandtrace.tools/t3-api/permissions/index.md). The write guides: - [Plant Batches](https://wiki.trackandtrace.tools/t3-api/creating-plant-batches/index.md), [Managing Plant Batches](https://wiki.trackandtrace.tools/t3-api/managing-plant-batches/index.md), [Managing Plants](https://wiki.trackandtrace.tools/t3-api/managing-plants/index.md) - [Packages](https://wiki.trackandtrace.tools/t3-api/creating-packages/index.md), [Managing Packages](https://wiki.trackandtrace.tools/t3-api/managing-packages/index.md), [Retail ID Labels](https://wiki.trackandtrace.tools/t3-api/retail-id/index.md), [Lab Testing](https://wiki.trackandtrace.tools/t3-api/lab-testing/index.md) - [Harvest Lifecycle](https://wiki.trackandtrace.tools/t3-api/harvest-lifecycle/index.md) - [Transfers](https://wiki.trackandtrace.tools/t3-api/creating-transfers/index.md), [Layover Transfers](https://wiki.trackandtrace.tools/t3-api/layover-transfers/index.md), [Receiving Transfers](https://wiki.trackandtrace.tools/t3-api/receiving-transfers/index.md) ## Other ways to use the API - **Python library**: [`t3api-utils`](https://wiki.trackandtrace.tools/t3-api/api-scripts/#t3api-utils) handles authentication, license selection and loading every page for you. - **AI tools**: point a model at the API with [AI & LLM Integration](https://wiki.trackandtrace.tools/t3-api/ai-and-llms/index.md). ### Postman T3 has a public Postman workspace generated from the OpenAPI spec, along with an example Postman Flow that demonstrates authentication and reading data. See the [OpenAPI Spec page](https://wiki.trackandtrace.tools/t3-api/openapi/#postman) for links and import instructions. ______________________________________________________________________ ## Next Steps - Set up a [Python environment](https://wiki.trackandtrace.tools/t3-api/setting-up-python/index.md) and write [API scripts](https://wiki.trackandtrace.tools/t3-api/api-scripts/index.md). - Example script: [`getting-started/intro.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/getting-started/intro.py) (log in, list your licenses, export active packages). - Browse every endpoint in the [interactive API docs](https://api.trackandtrace.tools/v2/docs/). - Learn how to consume subsets of the [OpenAPI spec](https://wiki.trackandtrace.tools/t3-api/openapi/index.md). # The Harvest Lifecycle A harvest starts when plants are cut, accumulates waste and packages while it dries, and ends when it is finished. Every step in that arc has an endpoint. | Step | Endpoint | Result | | ------------ | ------------------------------------- | -------------------------------------------------- | | Create | `POST /v2/harvests/create` | Flowering plants are consumed, a harvest appears | | Manicure | `POST /v2/harvests/manicure` | Weight comes off a living plant, a harvest appears | | Rename | `POST /v2/harvests/rename` | The harvest's name changes | | Move | `POST /v2/harvests/change-locations` | The harvest's drying location changes | | Record waste | `POST /v2/harvests/waste` | Current weight drops by the waste amount | | Undo waste | `POST /v2/harvests/waste/discontinue` | A waste entry is reversed | | Package | `POST /v2/harvests/create/packages` | Harvest weight becomes tagged packages | | Finish | `POST /v2/harvests/finish` | The harvest closes out and moves to Inactive | | Reopen | `POST /v2/harvests/unfinish` | A finished harvest returns to Harvested | Like every mutation in this API, these are **dry runs by default**. Add `submit=true` to actually write to Metrc. See [Writing to Metrc](https://wiki.trackandtrace.tools/t3-api/getting-started/#writing-to-metrc). ## Two ways to start a harvest A harvest record can be opened either way, and everything below applies to both. The difference is what happens to the plant, and which plants are eligible: | | `POST /v2/harvests/create` | `POST /v2/harvests/manicure` | | ----------------------- | -------------------------- | -------------------------------------- | | The plant | is **consumed** | **survives**, in the same growth phase | | Eligible phases | **Flowering only** | **Flowering and Vegetative** | | Repeatable on one plant | no | yes | Only flowering plants can be harvested Metrc offers *Harvest* on the Flowering tab alone, in every state. To harvest a vegetative plant, advance it with `POST /v2/plants/changegrowthphase` first. Manicuring is more permissive: it accepts Flowering and Vegetative plants everywhere except **California**, which is flowering-only. No state allows manicuring a mother plant. The request body is the same for either phase, and so is `GET /v2/harvests/manicure/inputs`. The `growthPhase` that inputs response reports is always `Flowering` and is **not** a limit on what you may manicure. The payload for both takes one entry per plant: ``` requests.post( f"{API}/v2/harvests/manicure", params={"licenseNumber": "CUL00001", "submit": "true"}, headers=HEADERS, json=[ { "id": 28646, # a flowering OR vegetative plant "harvestName": "Batch-A-Trim", "weight": 12.5, "unitOfWeightId": 4, "dryingLocationId": 505, "actualDate": "2026-09-17", } ], ).raise_for_status() ``` Both draw their `dryingLocationId` and `unitOfWeightId` from an inputs endpoint: `GET /v2/harvests/create/inputs` and `GET /v2/harvests/manicure/inputs` respectively. The rest of this page picks up once the harvest exists. Permissions Harvest operations sit under the `plants` view. Metrc grants them per tab, so the harvest and manicure actions are qualified by the tab they appear on: ``` permissions = requests.get( f"{API}/v2/permissions", params={"licenseNumber": "CUL00001", "view": "plants"}, headers=HEADERS, ).json() # Harvesting lives on the flowering tab and nowhere else. assert "plants/plantsflowering:harvest_flowering_plants" in permissions # Manicuring has one action per eligible phase. assert "plants/plantsflowering:manicure_flowering_plant" in permissions assert "plants/plantsvegetative:manicure_vegetative_plant" in permissions # Everything after the harvest exists is granted on the harvested tab. assert "plants/harvested:report_waste" in permissions ``` The tab qualifier is why there is no single `plants:harvest` grant; see [the view/tab/action format](https://wiki.trackandtrace.tools/t3-api/permissions/#the-viewtabaction-format). See [Permissions](https://wiki.trackandtrace.tools/t3-api/permissions/index.md). ## Reading a harvest Three listings cover the lifecycle stages: ``` import requests API = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {ACCESS_TOKEN}"} PARAMS = {"licenseNumber": "CUL00001"} harvests = requests.get( f"{API}/v2/harvests/active", params=PARAMS, headers=HEADERS ).json()["data"] harvest = harvests[0] print(harvest["id"], harvest["name"], harvest["currentWeight"], harvest["unitOfWeightAbbreviation"]) ``` `/v2/harvests/onhold` and `/v2/harvests/inactive` return the same shape for held and finished harvests. Five sub-resources hang off a single harvest, all keyed on `harvestId`: | Endpoint | Returns | | ----------------------------- | ------------------------------------- | | `GET /v2/harvests/plants` | The plants that went into the harvest | | `GET /v2/harvests/packages` | The packages taken out of it | | `GET /v2/harvests/waste` | The waste recorded against it | | `GET /v2/harvests/labresults` | Lab test results for it | | `GET /v2/harvests/history` | Every change to it | ``` waste = requests.get( f"{API}/v2/harvests/waste", params={**PARAMS, "harvestId": harvest["id"]}, headers=HEADERS, ).json()["data"] ``` ## Recording waste Waste reduces the harvest's current weight. Fetch the waste types first; the list is per-license, and only entries with `forHarvests: true` can be used here: ``` inputs = requests.get( f"{API}/v2/harvests/waste/inputs", params=PARAMS, headers=HEADERS ).json() waste_types = [w for w in inputs["wasteTypes"] if w["forHarvests"]] ``` The unit is `unitOfWeightId`, not `unitOfMeasureId`. The harvest record already carries the right one, so read it off the harvest rather than guessing: ``` res = requests.post( f"{API}/v2/harvests/waste", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[ { "id": harvest["id"], "wasteWeight": 12.5, "unitOfWeightId": harvest["unitOfWeightId"], "wasteTypeId": waste_types[0]["id"], "actualDate": "2026-05-14", } ], ) res.raise_for_status() ``` Metrc confirms unusually large waste amounts Metrc's own UI asks for confirmation when the reported weight is large relative to the harvest. The API does not ask, but Metrc may still reject the write. ## Undoing a waste entry `POST /v2/harvests/waste/discontinue` takes the **waste entry's** id, not the harvest's. This is the easiest thing on this page to get wrong: both are integers, and passing the wrong one reverses an unrelated entry or fails outright. Read the id from `/v2/harvests/waste`: ``` waste = requests.get( f"{API}/v2/harvests/waste", params={**PARAMS, "harvestId": harvest["id"]}, headers=HEADERS, ).json()["data"] target = waste[0] requests.post( f"{API}/v2/harvests/waste/discontinue", params={**PARAMS, "submit": "true"}, headers=HEADERS, json={"id": target["id"]}, # the waste entry's id ).raise_for_status() ``` Discontinued entries disappear from the listing. Pass `includeDiscontinued=true` to see them again: ``` all_waste = requests.get( f"{API}/v2/harvests/waste", params={**PARAMS, "harvestId": harvest["id"], "includeDiscontinued": "true"}, headers=HEADERS, ).json()["data"] assert any(w["isArchived"] for w in all_waste) ``` `GET /v2/harvests/waste/history` is also keyed on `harvestWasteId` rather than the harvest id. ## Creating packages from a harvest This is the heaviest payload on this page. Four lookups feed it, and each returns Metrc's *eligible* set; the general listings are not a substitute: | Field | Where it comes from | | ------------------------------------------------------ | -------------------------------------------------- | | `tagId` | `GET /v2/harvests/create/packages/source-tags` | | `itemId` | `GET /v2/harvests/create/packages/source-items` | | `ingredients[].harvestId` | `GET /v2/harvests/create/packages/source-harvests` | | `unitOfMeasureId`, `locationId`, `remediationMethodId` | `GET /v2/harvests/create/packages/inputs` | ``` inputs = requests.get( f"{API}/v2/harvests/create/packages/inputs", params=PARAMS, headers=HEADERS ).json() tags = requests.get( f"{API}/v2/harvests/create/packages/source-tags", params=PARAMS, headers=HEADERS ).json()["data"] items = requests.get( f"{API}/v2/harvests/create/packages/source-items", params=PARAMS, headers=HEADERS ).json()["data"] sources = requests.get( f"{API}/v2/harvests/create/packages/source-harvests", params=PARAMS, headers=HEADERS ).json()["data"] payload = { "tagId": tags[0]["id"], "itemId": items[0]["id"], "unitOfMeasureId": inputs["unitsOfMeasure"][0]["id"], "actualDate": "2026-05-14", "ingredients": [ {"harvestId": sources[0]["id"], "quantity": 100.5}, ], } locations = inputs.get("locations") or [] if locations: payload["locationId"] = locations[0]["id"] requests.post( f"{API}/v2/harvests/create/packages", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[payload], ).raise_for_status() ``` `ingredients[].unitOfMeasureId` can be omitted; Metrc applies the package's own unit to every ingredient row, and the API fills it in to match. ### Fields that vary by state The request schema is a union across states. None of these change the payload's *shape*; they are fields that exist in some states and not others. | Field | Behavior | | -------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | | `locationId` | Required in most states. `inputs["locations"]` is empty where it does not apply. | | `sublocationId` | Only used by states that model sublocations. | | `remediateProduct`, `remediationMethodId`, `remediationDate`, `remediationSteps` | Only where the state offers remediation on package creation. `inputs["remediationMethods"]` is empty otherwise. | | `expirationDate`, `sellByDate`, `useByDate` | Required only where the selected item's configuration demands it. | | `isDonation`, `isTradeSample`, `productRequiresRemediation` | Only applicable in some states. **Do not send them at all** where they do not apply: sending `false` is not the same as omitting. | As with [creating packages](https://wiki.trackandtrace.tools/t3-api/creating-packages/index.md), the reliable test is the inputs response: if the list backing a field comes back empty or null, that field does not apply to the license you are writing to. ## Renaming, moving, finishing The four single-purpose writes all take an array and all key on the harvest's `id`. ``` # Rename requests.post(f"{API}/v2/harvests/rename", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{"id": harvest["id"], "name": "2026-05-14-Drying Room A-H"}]) # Move to another drying location locations = requests.get( f"{API}/v2/harvests/change-locations/inputs", params=PARAMS, headers=HEADERS ).json()["locations"] requests.post(f"{API}/v2/harvests/change-locations", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{"id": harvest["id"], "locationId": locations[0]["id"], "actualDate": "2026-05-14"}]) # Finish, and reopen requests.post(f"{API}/v2/harvests/finish", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{"id": harvest["id"], "actualDate": "2026-05-14"}]) requests.post(f"{API}/v2/harvests/unfinish", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{"id": harvest["id"]}]) ``` A finished harvest leaves `/v2/harvests/active` and appears in `/v2/harvests/inactive`. Unfinishing reverses that. ## Scheduling harvests, Missouri only Missouri's Metrc build has a harvest schedules page; no other state does. These endpoints exist for every license, but only Missouri will serve them. ``` locations = requests.get( f"{API}/v2/harvests/schedules/create/inputs", params=PARAMS, headers=HEADERS ).json()["locations"] requests.post(f"{API}/v2/harvests/schedules/create", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{"locationId": locations[0]["id"], "scheduledDate": "2026-05-14"}]) schedules = requests.get( f"{API}/v2/harvests/schedules", params=PARAMS, headers=HEADERS ).json()["data"] requests.post(f"{API}/v2/harvests/schedules/void", params={**PARAMS, "submit": "true"}, headers=HEADERS, json={"id": schedules[0]["id"]}) ``` Metrc rejects dates in the past. ## Next Steps - [Creating Packages](https://wiki.trackandtrace.tools/t3-api/creating-packages/index.md): packaging from existing packages rather than from a harvest - [Supercollections](https://wiki.trackandtrace.tools/t3-api/supercollections/index.md): pull a harvest and its plants, packages and history in one request - [Reports and Spreadsheet Sync](https://wiki.trackandtrace.tools/reports/index.md): harvest data into a spreadsheet - Example scripts: [`cultivation/finish-harvests-from-csv.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/cultivation/finish-harvests-from-csv.py) (finish harvests), [`cultivation/create-packages-from-harvest.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/cultivation/create-packages-from-harvest.py) (create one package from a harvest). # Lab Result Keys `metadata.indexedLabResults` gives every lab result one key, the same in every state however the lab spelled the test. `Total THC` and `Total Delta-9 THC` are both `totalTHC`. `THCa`, `THC-A` and `Delta-9 THCA` are all `THCA`. In a label template: ``` {{ package.metadata.indexedLabResults.totalTHC.full }} → "Total THC: 22.5 %" ``` As a report column: ``` &columns=label,metadata.indexedLabResults.totalTHC.value ``` In Python: ``` indexed = package["metadata"]["indexedLabResults"] if "totalTHC" in indexed: print(indexed["totalTHC"]["full"]) ``` `name` and `full` keep the lab's own spelling. Only the key is shared. Each entry also has `byUnit`, one result per unit the test was reported in, for tests reported both per serving and per package: ``` {{ package.metadata.indexedLabResults.totalTHC.byUnit.mgPerServing.full }} ``` See [Supercollection Includes](https://wiki.trackandtrace.tools/t3-api/supercollection-includes/index.md) for which result an entry holds when a test is reported more than once. ## How keys are formed A key is the test name in camelCase, with acronyms kept in capitals: `Moisture Content` is `moistureContent`, `Total THC` is `totalTHC`, and `CBG` stays `CBG`. Greek letters are spelled out: `β-Myrcene` is `betaMyrcene`. A key that would start with a digit starts with `_`: `1,2-Dichloroethane` is `_12Dichloroethane`. Spellings that differ only in case, spacing, punctuation or Greek letters always share a key, so the tables list only the names that differ in words. A test that is not listed is still indexed, under its name in lowercase with everything but letters and digits removed: `Novel Analyte-X` is `novelanalytex`. In label templates and report columns, a key in the wrong case, or an older key such as `totalDelta9THC` or `Total_THC`, is corrected automatically. Code that reads the JSON must use the key exactly as listed. `topTerpene1`, `topTerpene2` and so on are not tests. They rank a package's individual terpenes; see [Supercollection Includes](https://wiki.trackandtrace.tools/t3-api/supercollection-includes/index.md). ## Cannabinoids | Key | Test | Also matches | | ------------------- | ------------------ | ------------------ | | `totalTHC` | Total THC | Total Delta-9 THC | | `totalCBD` | Total CBD | | | `totalCBG` | Total CBG | | | `totalCannabinoids` | Total Cannabinoids | | | `potency` | Potency | | | `THCA` | THCA | Delta-9 THCA | | `delta9THC` | Delta-9 THC | THC, D9-THC, 9-THC | | `delta8THC` | Delta-8 THC | D8-THC, 8-THC | | `delta10THC9R` | Delta-10 THC (9R) | (6aR,9R)-d10-THC | | `delta10THC9S` | Delta-10 THC (9S) | (6aR,9S)-d10-THC | | `exoTHC` | Exo-THC | | | `THCV` | THCV | | | `THCVA` | THCVA | | | `CBD` | CBD | | | `CBDA` | CBDA | | | `CBDV` | CBDV | | | `CBDVA` | CBDVA | | | `CBG` | CBG | | | `CBGA` | CBGA | | | `CBN` | CBN | | | `CBNA` | CBNA | | | `CBC` | CBC | | | `CBCA` | CBCA | | | `CBL` | CBL | | | `CBT` | CBT | | ## Terpenes | Key | Test | Also matches | | -------------------- | -------------------- | ------------------------------------- | | `totalTerpenes` | Total Terpenes | | | `otherTerpenes` | Other Terpenes | | | `alphaBisabolol` | Alpha-Bisabolol | | | `alphaCedrene` | Alpha-Cedrene | | | `alphaHumulene` | Alpha-Humulene | | | `betaHumulene` | Beta-Humulene | | | `alphaMyrcene` | Alpha-Myrcene | | | `betaMyrcene` | Beta-Myrcene | | | `alphaOcimene` | Alpha-Ocimene | | | `betaOcimene` | Beta-Ocimene | | | `ocimene` | Ocimene | | | `cisBetaOcimene` | cis-Beta-Ocimene | cis-Ocimene | | `transBetaOcimene` | trans-Beta-Ocimene | trans-Ocimene | | `alphaPhellandrene` | Alpha-Phellandrene | | | `alphaPinene` | Alpha-Pinene | | | `betaPinene` | Beta-Pinene | | | `alphaTerpinene` | Alpha-Terpinene | | | `gammaTerpinene` | Gamma-Terpinene | | | `terpineol` | Terpineol | | | `alphaTerpineol` | Alpha-Terpineol | | | `gammaTerpineol` | Gamma-Terpineol | | | `terpinen4ol` | Terpinen-4-ol | | | `alphaThujone` | Alpha-Thujone | | | `betaCaryophyllene` | Beta-Caryophyllene | Caryophyllene | | `caryophylleneOxide` | Caryophyllene Oxide | | | `betaFarnesene` | Beta-Farnesene | | | `transBetaFarnesene` | trans-Beta-Farnesene | | | `borneol` | Borneol | | | `isoborneol` | Isoborneol | | | `camphene` | Camphene | | | `camphor` | Camphor | | | `delta3Carene` | Delta-3-Carene | 3-Carene | | `carvacrol` | Carvacrol | | | `carvone` | Carvone | | | `cedrol` | Cedrol | | | `citronellol` | Citronellol | | | `pCymene` | p-Cymene | p-Isopropyltoluene, Cymene | | `mCymene` | m-Cymene | | | `oCymene` | o-Cymene | | | `eucalyptol` | Eucalyptol | | | `fenchol` | Fenchol | Fenchyl Alcohol, Endo-Fenchyl Alcohol | | `fenchone` | Fenchone | | | `geraniol` | Geraniol | | | `geranylAcetate` | Geranyl Acetate | | | `guaiol` | Guaiol | | | `isobornylAcetate` | Isobornyl Acetate | | | `isopulegol` | Isopulegol | | | `limonene` | Limonene | d-Limonene, δ-Limonene | | `linalool` | Linalool | | | `menthol` | Menthol | | | `menthone` | Menthone | | | `nerol` | Nerol | | | `nerolidol` | Nerolidol | | | `cisNerolidol` | cis-Nerolidol | | | `transNerolidol` | trans-Nerolidol | | | `nootkatone` | Nootkatone | | | `octylAcetate` | Octyl Acetate | | | `phytane` | Phytane | | | `phytol` | Phytol | | | `cisPhytol` | cis-Phytol | | | `transPhytol` | trans-Phytol | | | `piperitone` | Piperitone | | | `pulegone` | Pulegone | | | `sabinene` | Sabinene | | | `sabineneHydrate` | Sabinene Hydrate | | | `terpinolene` | Terpinolene | | | `thymol` | Thymol | | | `valencene` | Valencene | | | `verbenone` | Verbenone | | ## Residual Solvents | Key | Test | Also matches | | ------------------- | ------------------ | --------------------------------------------- | | `solvents` | Solvents | | | `_12Dichloroethane` | 1,2-Dichloroethane | | | `_14Dioxane` | 1,4-Dioxane | | | `_2Butanol` | 2-Butanol | | | `_2Ethoxyethanol` | 2-Ethoxyethanol | | | `_22Dimethylbutane` | 2,2-Dimethylbutane | | | `_23Dimethylbutane` | 2,3-Dimethylbutane | | | `_2Methylbutane` | 2-Methylbutane | | | `_2Methylpentane` | 2-Methylpentane | | | `_3Methylpentane` | 3-Methylpentane | | | `acetone` | Acetone | | | `acetonitrile` | Acetonitrile | | | `benzene` | Benzene | | | `butane` | Butane | | | `butanes` | Butanes | Butanes (all isomers), Butane & All Isomers | | `isobutane` | Isobutane | | | `neopentane` | Neopentane | | | `pentane` | Pentane | | | `pentanes` | Pentanes | Pentanes (all isomers), Pentane & All Isomers | | `hexane` | Hexane | | | `hexanes` | Hexanes | Hexanes (all isomers), Hexane & All Isomers | | `heptane` | Heptane | | | `heptanes` | Heptanes | Heptanes (all isomers), Heptane & All Isomers | | `chloroform` | Chloroform | | | `cumene` | Cumene | | | `cyclohexane` | Cyclohexane | | | `ethanol` | Ethanol | | | `ethylAcetate` | Ethyl Acetate | | | `ethylEther` | Ethyl Ether | | | `ethyleneGlycol` | Ethylene Glycol | | | `ethyleneOxide` | Ethylene Oxide | | | `isopropylAcetate` | Isopropyl Acetate | | | `isopropylAlcohol` | Isopropyl Alcohol | Isopropanol, 2-Propanol, 2-Propanol [IPA] | | `methanol` | Methanol | | | `methyleneChloride` | Methylene Chloride | Dichloromethane | | `propane` | Propane | | | `tetrahydrofuran` | Tetrahydrofuran | | | `toluene` | Toluene | | | `trichloroethylene` | Trichloroethylene | Total Trichloroethylene | | `totalXylenes` | Total Xylenes | Xylenes | | `oXylene` | o-Xylene | | | `pAndMXylene` | p- and m-Xylene | | ## Pesticides | Key | Test | Also matches | | --------------------- | -------------------- | ----------------------- | | `pesticides` | Pesticides | | | `abamectin` | Abamectin | | | `acephate` | Acephate | | | `acequinocyl` | Acequinocyl | | | `acetamiprid` | Acetamiprid | | | `aldicarb` | Aldicarb | | | `ancymidol` | Ancymidol | | | `azoxystrobin` | Azoxystrobin | | | `bifenazate` | Bifenazate | Bifenzate | | `bifenthrin` | Bifenthrin | | | `boscalid` | Boscalid | | | `carbaryl` | Carbaryl | | | `carbofuran` | Carbofuran | | | `chlorantraniliprole` | Chlorantraniliprole | | | `chlorfenapyr` | Chlorfenapyr | | | `chlormequatChloride` | Chlormequat Chloride | Chlormequat Cl | | `chlorpyrifos` | Chlorpyrifos | | | `clofentezine` | Clofentezine | | | `cyfluthrin` | Cyfluthrin | | | `cypermethrin` | Cypermethrin | | | `daminozide` | Daminozide | | | `diazinon` | Diazinon | | | `dichlorvos` | Dichlorvos | DDVP, DDVP (Dichlorvos) | | `dimethoate` | Dimethoate | | | `ethephon` | Ethephon | | | `ethoprophos` | Ethoprophos | | | `etofenprox` | Etofenprox | | | `etoxazole` | Etoxazole | | | `fenoxycarb` | Fenoxycarb | | | `fenpyroximate` | Fenpyroximate | | | `fipronil` | Fipronil | | | `flonicamid` | Flonicamid | | | `fludioxonil` | Fludioxonil | Fludioxionil | | `flurprimidol` | Flurprimidol | | | `hexythiazox` | Hexythiazox | | | `imazalil` | Imazalil | | | `imidacloprid` | Imidacloprid | | | `kresoximMethyl` | Kresoxim-methyl | | | `malathion` | Malathion | | | `metalaxyl` | Metalaxyl | | | `methiocarb` | Methiocarb | | | `methomyl` | Methomyl | | | `methylParathion` | Methyl Parathion | | | `MGK264` | MGK-264 | | | `myclobutanil` | Myclobutanil | | | `naled` | Naled | | | `oxamyl` | Oxamyl | | | `paclobutrazol` | Paclobutrazol | | | `permethrin` | Permethrin | Permethrins | | `permethrinCis` | Permethrin (cis) | | | `permethrinTrans` | Permethrin (trans) | | | `phosmet` | Phosmet | | | `piperonylButoxide` | Piperonyl Butoxide | | | `prallethrin` | Prallethrin | | | `propiconazole` | Propiconazole | | | `propoxur` | Propoxur | | | `pyrethrins` | Pyrethrins | | | `cinerinI` | Cinerin I | Pyrethrins Cinerin I | | `jasmolinI` | Jasmolin I | Pyrethrins Jasmolin I | | `pyrethrinI` | Pyrethrin I | Pyrethrins Pyrethrin I | | `pyridaben` | Pyridaben | Pyradiben | | `spinosad` | Spinosad | | | `spinosadA` | Spinosad A | | | `spinosadD` | Spinosad D | | | `spiromesifen` | Spiromesifen | | | `spirotetramat` | Spirotetramat | | | `spiroxamine` | Spiroxamine | | | `tebuconazole` | Tebuconazole | | | `thiacloprid` | Thiacloprid | | | `thiamethoxam` | Thiamethoxam | | | `trifloxystrobin` | Trifloxystrobin | Trioxystrobin | ## Heavy Metals | Key | Test | Also matches | | ------------- | ------------ | -------------- | | `heavyMetals` | Heavy Metals | | | `antimony` | Antimony | | | `arsenic` | Arsenic | Total Arsenic | | `cadmium` | Cadmium | | | `chromium` | Chromium | Total Chromium | | `copper` | Copper | | | `iron` | Iron | | | `lead` | Lead | | | `manganese` | Manganese | | | `mercury` | Mercury | | | `nickel` | Nickel | | | `selenium` | Selenium | | | `zinc` | Zinc | | ## Microbials | Key | Test | Also matches | | ----------------------------- | ----------------------------- | ------------------------------------------------------------------- | | `microbiologicalContaminants` | Microbiological Contaminants | | | `aspergillus` | Aspergillus | Aspergillus spp. | | `aspergillusFlavus` | Aspergillus flavus | | | `aspergillusFumigatus` | Aspergillus fumigatus | | | `aspergillusNiger` | Aspergillus niger | | | `aspergillusTerreus` | Aspergillus terreus | | | `eColi` | E. coli | | | `enterobacteriaceae` | Enterobacteriaceae | Enterobacteriacaea | | `salmonella` | Salmonella | Salmonella spp. | | `STEC` | STEC | Shiga toxin-producing E. coli, Shiga toxin-producing E. coli (STEC) | | `totalAerobicMicrobialCount` | Total Aerobic Microbial Count | Total Aerobic Count | | `totalColiforms` | Total Coliforms | Total Coliform, Coliforms | | `totalYeastAndMold` | Total Yeast and Mold | Total Yeast & Mold Count, Yeast & Mold | ## Mycotoxins | Key | Test | Also matches | | ----------------- | ---------------- | -------------------------------------------------------------------------------------- | | `aflatoxinB1` | Aflatoxin B1 | | | `aflatoxinB2` | Aflatoxin B2 | | | `aflatoxinG1` | Aflatoxin G1 | | | `aflatoxinG2` | Aflatoxin G2 | | | `totalAflatoxins` | Total Aflatoxins | Aflatoxins, Total Aflatoxins (B1, B2, G1, & G2), Total of Aflatoxin B1, B2, G1, and G2 | | `ochratoxinA` | Ochratoxin A | | | `ochratoxins` | Ochratoxins | | | `totalMycotoxins` | Total Mycotoxins | Mycotoxins, Total Mycotoxins (Aflatoxin B1, B2, G1, G2, & Ochratoxin A) | ## Other Tests | Key | Test | Also matches | | ------------------------ | ---------------------------- | --------------------- | | `waterActivity` | Water Activity | | | `moistureContent` | Moisture Content | Moisture | | `foreignMatter` | Foreign Matter | | | `foreignMatterOther` | Foreign Matter - Other | | | `foreignMatterStems3mm` | Foreign Matter - Stems >3 mm | | | `filthForeignMaterials` | Filth & Foreign Materials | | | `homogeneity` | Homogeneity | | | `vitaminEAcetate` | Vitamin E Acetate | | | `MCTOil` | MCT Oil | | | `glycerolTricapronateC6` | Glycerol Tricapronate (C6) | Glycerol Tricapronate | | `glycerolTricaprylateC8` | Glycerol Tricaprylate (C8) | Glycerol Tricaprylate | | `glycerolTricaprateC10` | Glycerol Tricaprate (C10) | Glycerol Tricaprate | | `glycerolTrilaurateC12` | Glycerol Trilaurate (C12) | Glycerol Trilaurate | | `retest` | Retest | | # Lab Testing These endpoints are for **testing labs**. Only a license whose facility type is a testing laboratory can see the Lab Samples grid or record results, and Metrc offers them in Maine and Missouri. To read results as a grower or processor, use `GET /v2/packages/labresults?packageId=` instead. | Endpoint | What it does | | --------------------------------------------------------------- | --------------------------------------------------------- | | `GET /v2/packages/lab-samples` | One row per recorded test on each sample the lab holds | | `GET /v2/packages/labresults/record/inputs` | The test types the lab can record, and what each requires | | `GET /v2/packages/labresults/record/source-packages` | Packages Metrc will record results for | | `POST /v2/packages/labresults/document/file` | Store a result PDF (Missouri) | | `POST /v2/packages/labresults/record` | Record results for sample packages | | `GET /v2/packages/labresults/document/history?labTestResultId=` | The documents uploaded for one result | Recording and uploading are **dry runs by default**. Add `submit=true` to write to Metrc. ## Recording results Each result names a test type from the inputs endpoint. A test type whose `requiresTestResult` is true also needs a `quantity`. ``` import requests API = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {ACCESS_TOKEN}"} PARAMS = {"licenseNumber": "LAB00001"} test_types = requests.get( f"{API}/v2/packages/labresults/record/inputs", params=PARAMS, headers=HEADERS ).json()["labTestTypes"] thc = next(t for t in test_types if t["name"].startswith("THC")) requests.post( f"{API}/v2/packages/labresults/record", params={**PARAMS, "submit": "true"}, json=[ { "packageId": 12345, "resultDate": "2026-10-23", "results": [{"labTestTypeId": thc["id"], "quantity": 21.5, "passed": True}], } ], headers=HEADERS, ) ``` Record a result for every test in the lab test batches the sample requires. Once recorded, the sample and the package it was cut from both read `TestPassed` or `TestFailed` in `labTestingStateName`. Tests that are informational only, such as Missouri's "R&D/Voluntary Testing" batches, leave both reading `NotSubmitted`. ## Attaching a document (Missouri) Upload the PDF first, then send the `documentFileId` it answers with alongside the results. ``` with open("coa.pdf", "rb") as pdf: document_file_id = requests.post( f"{API}/v2/packages/labresults/document/file", params={**PARAMS, "submit": "true"}, files={"file": ("coa.pdf", pdf, "application/pdf")}, headers=HEADERS, ).json()["documentFileId"] ``` Each result in `GET /v2/packages/labresults?packageId=` carries a `labTestResultId`. Pass it to the document history endpoint to list every document uploaded for that result, then download one with `GET /v2/packages/labresults/document?packageId=&labTestResultDocumentFileId=`, using the history row's `documentFileId`. ______________________________________________________________________ ## Next Steps - Load packages with their lab results in one request with [Supercollections](https://wiki.trackandtrace.tools/t3-api/supercollections/index.md). - Example scripts: [`packages/export-lab-results.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/packages/export-lab-results.py) (one row per lab test for every active package), [`transfers/download-transfer-coa-pdfs.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/transfers/download-transfer-coa-pdfs.py) (download the COA PDFs for a transfer's packages). # Layover Transfers A **layover** is a leg that stops part-way, where the shipment is held before continuing to the destination. Set `isLayover` on the transporter and it gains two of its own timestamps, and each of its drivers has to say which leg they cover. Oregon has no layovers. T3 returns `400` for `isLayover: true` on an Oregon license. ``` flowchart LR O["Origin"] -->|"driverLayoverLeg:
ToLayover"| L["Layover point"] L -->|"driverLayoverLeg:
FromLayover"| D["Recipient"] O -.-> OW(["On the destination:
estimatedDepartureDateTime
2026-09-18 08:00"]) L -.-> LW(["On the transporter:
estimatedArrivalDateTime 2026-09-18 18:00
estimatedDepartureDateTime 2026-09-19 07:00"]) D -.-> DW(["On the destination:
estimatedArrivalDateTime
2026-09-19 17:00"]) ``` ``` payload = { "destinations": [ { "recipientId": destinations[0]["id"], "transferTypeId": transfer_type["id"], "plannedRoute": "I-70 west, overnight in Columbia", # The destination window: leaving the origin, arriving at the recipient. "estimatedDepartureDateTime": "2026-09-18T08:00:00", "estimatedArrivalDateTime": "2026-09-19T17:00:00", "transporters": [ { "transporterId": transporters[0]["id"], "phoneNumberForQuestions": inputs["defaultPhoneNumberForQuestions"], "isLayover": True, # The layover window: checking in at the layover point, # then checking back out of it. "estimatedArrivalDateTime": "2026-09-18T18:00:00", "estimatedDepartureDateTime": "2026-09-19T07:00:00", "transporterDetails": [ { "driverName": "Jane Doe", "driverOccupationalLicenseNumber": "LIC12345", "driverLicenseNumber": "D1234567", "driverLayoverLeg": "ToLayover", "vehicleMake": "Ford", "vehicleModel": "Transit", "vehicleLicensePlateNumber": "ABC1234", }, { "driverName": "John Roe", "driverOccupationalLicenseNumber": "LIC67890", "driverLicenseNumber": "D7654321", "driverLayoverLeg": "FromLayover", "vehicleMake": "Ram", "vehicleModel": "ProMaster", "vehicleLicensePlateNumber": "XYZ9876", }, ], } ], "packages": [{"id": package_id}], } ] } ``` Two different windows, four similar names The transporter's `estimatedArrivalDateTime` and `estimatedDepartureDateTime` are the estimated **check-in at** and **check-out from the layover point**, not the origin and not the recipient. The destination carries its own pair with the same two names for the journey as a whole. Metrc labels the transporter pair *Est. Check-In* and *Est. Check-Out* for exactly this reason. They apply **only** to a layover leg. On an ordinary transporter they are ignored. ## Layover legs Each driver names the leg they cover in `driverLayoverLeg`: | Value | Leg | | ------------------ | -------------------------------- | | `ToLayover` | Origin to the layover point | | `FromLayover` | Layover point to the destination | | `FromAndToLayover` | Both legs, one driver | The example above is a **driver swap**: one driver runs the shipment to the layover point, another takes it onward. For one driver running the whole route, send a single entry with `FromAndToLayover`. ## What gets rejected Metrc answers an incomplete layover with a `200` and quietly drops the layover, leaving a manifest that says something you did not ask for. **Add `applyDynamicValidation=true`** and T3 checks the leg is fully described before sending anything: ``` response = requests.post( f"{API}/v2/transfers/create", params={ "licenseNumber": "CUL00001", "submit": "true", "applyDynamicValidation": "true", }, headers=HEADERS, json=[payload], ) ``` | Mistake | Response | | ------------------------------------------------------------------------- | ----------------------------------------------------------------- | | No transporter `estimatedArrivalDateTime` or `estimatedDepartureDateTime` | `400` naming the missing field | | A driver with no `driverLayoverLeg` | `400` naming the `transporterDetails` index | | A `driverLayoverLeg` outside the three values above | `400` listing the valid ones | | `driverLayoverLeg` set while `isLayover` is not | `400`; Metrc would ignore the leg and create an ordinary transfer | Without the flag, none of this runs Dynamic validation is opt-in. Omit `applyDynamicValidation` and an incomplete layover goes to Metrc as written, which is the case worth guarding: Metrc accepts it, returns `200`, and the layover is simply not there. This is the `TRANSFER_LAYOVER_LEGS_COMPLETE` check, so `skipDynamicValidationChecks=TRANSFER_LAYOVER_LEGS_COMPLETE` turns it off on its own if you need to send something unusual while keeping the rest. ## Tracking the layover Once a layover transfer is under way the transporter checks it in and out from the transfer hub: `POST /v2/transfers/hub/check-in` on arrival at the layover point and `POST /v2/transfers/hub/check-out` on departure. The times land on the delivery as `transporterActualArrivalDateTime` and `transporterActualDepartureDateTime`, which stay null on a direct run. Layover fields work the same way on `POST /v2/transfers/update` and on transfer templates, so a regular layover route can be saved once and reused. ## Next Steps - Back to the standard flow: [Creating Transfers](https://wiki.trackandtrace.tools/t3-api/creating-transfers/index.md). - What the receiving license sees: [Receiving Transfers](https://wiki.trackandtrace.tools/t3-api/receiving-transfers/index.md). # Managing Packages [Creating Packages](https://wiki.trackandtrace.tools/t3-api/creating-packages/index.md) covers cutting a new package. This page covers what you can do to a package once it exists: move it, change its item, change which lab tests it requires, note it, adjust it, finish and unfinish it, return quantity to the package it was cut from, remediate it, flag it as a trade sample or for donation, and discontinue it. | Endpoint | What it does | | --------------------------------------------------- | ------------------------------------------------------------- | | `POST /v2/packages/change-locations` | Move packages to a different location | | `POST /v2/packages/change-items` | Reassign packages to a different item | | `POST /v2/packages/change-required-labtest-batches` | Replace the lab test batches packages must pass | | `POST /v2/packages/notes` | Add a note to packages | | `POST /v2/packages/adjust` | Correct a package's quantity | | `POST /v2/packages/finish` | Finish packages | | `POST /v2/packages/unfinish` | Return finished packages to active | | `POST /v2/packages/return` | Return quantity from a package to the package it was cut from | | `POST /v2/packages/remediate` | Remediate packages that failed lab testing | | `POST /v2/packages/discontinue` | Discontinue one package | | `POST /v2/packages/trade-sample/flag`, `/unflag` | Mark or clear packages as trade samples | | `POST /v2/packages/donation/flag`, `/unflag` | Mark or clear packages for donation | Like every mutation in this API, these are **dry runs by default**. Add `submit=true` to actually write to Metrc. See [Writing to Metrc](https://wiki.trackandtrace.tools/t3-api/getting-started/#writing-to-metrc). Add `applyDynamicValidation=true` to have T3 check the rules below before Metrc does: an adjusted package's item cannot change, and only a sample package's required lab test batches can. ## Every write has a companion lookup Metrc decides which packages are eligible for each operation, and the eligible set differs per operation. Use the general listing to browse, and the write's own lookup to confirm a package is eligible: | Write | Packages | Other ids | | --------------------------------- | ------------------------------------------------------------------------------- | -------------------------------------------------------------------- | | `change-locations` | `GET /v2/packages/change-locations/source-packages` | `locationId`: `GET /v2/packages/change-locations/inputs` | | `change-items` | `GET /v2/packages/change-items/source-packages` | `itemId`: `GET /v2/packages/change-items/source-items` | | `change-required-labtest-batches` | `GET /v2/packages/active` | batch ids: `GET /v2/packages/change-required-labtest-batches/inputs` | | `notes` | `GET /v2/packages/notes/source-packages` | none | | `adjust` | `GET /v2/packages/adjust/source-packages` | reasons and units: `GET /v2/packages/adjust/inputs` | | `finish` | `GET /v2/packages/active` | none | | `unfinish` | `GET /v2/packages/inactive` | none | | `return` | `GET /v2/packages/active` | source package: `GET /v2/packages/return/inputs?packageId=` | | `remediate` | `GET /v2/packages/remediate/source-packages` | methods: `GET /v2/packages/remediate/inputs` | | `discontinue` | `GET /v2/packages/active` | none | | `trade-sample/flag`, `/unflag` | `GET /v2/packages/trade-sample/flag/source-packages`, `/unflag/source-packages` | none | | `donation/flag`, `/unflag` | `GET /v2/packages/donation/flag/source-packages`, `/unflag/source-packages` | none | Most writes also have an `/inputs` endpoint, for example `GET /v2/packages/notes/inputs` (`discontinue` has none). Some operations are offered only to some license types; their `/inputs` endpoint answers `403` where the license cannot use them. ``` import requests API = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {ACCESS_TOKEN}"} PARAMS = {"licenseNumber": "CUL00001"} eligible = requests.get( f"{API}/v2/packages/change-locations/source-packages", params={**PARAMS, "filter": "label__contains:0003"}, headers=HEADERS, ).json()["data"] print([p["label"] for p in eligible]) ``` ## Moving ``` locations = requests.get( f"{API}/v2/packages/change-locations/inputs", params=PARAMS, headers=HEADERS ).json()["locations"] requests.post( f"{API}/v2/packages/change-locations", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{"id": 12345, "locationId": locations[0]["id"], "actualDate": "2026-05-14"}], ) ``` `currentLocationId` is optional: T3 fills it in when you omit it. `sublocationId` and `currentSublocationId` are accepted in Maine and Michigan only. ## Changing the item Metrc refuses to change the item of a package that has been adjusted, even though the change-items lookup still lists it. Change the item first. ``` items = requests.get( f"{API}/v2/packages/change-items/source-items", params={**PARAMS, "filter": "name__contains:Flower"}, headers=HEADERS, ).json()["data"] requests.post( f"{API}/v2/packages/change-items", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{"id": 12345, "itemId": items[0]["id"]}], ) ``` ## Required lab test batches Only a testing package, one created with `POST /v2/packages/create/testing`, can have its required batches changed. Metrc refuses any other package. The list you send **replaces** the package's set. Read the current set first. Name the package on the inputs call too: Metrc lists no batches without one. ``` current = requests.get( f"{API}/v2/packages/required-labtest-batches", params={**PARAMS, "packageId": 12345}, headers=HEADERS, ).json()["data"] batches = requests.get( f"{API}/v2/packages/change-required-labtest-batches/inputs", params={**PARAMS, "packageId": 12345}, headers=HEADERS, ).json()["labTestBatches"] wanted = {row["labTestBatchId"] for row in current} | {batches[0]["id"]} requests.post( f"{API}/v2/packages/change-required-labtest-batches", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{"id": 12345, "requiredLabTestBatches": sorted(wanted)}], ) ``` `GET /v2/packages/labresult-batches` takes the same filters Metrc's package page uses: `requiredOnly=true`, `selectedOnly=true` or `voluntaryOnly=true`, one at a time. ## Adjusting and finishing ``` inputs = requests.get( f"{API}/v2/packages/adjust/inputs", params=PARAMS, headers=HEADERS ).json() requests.post( f"{API}/v2/packages/adjust", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[ { "id": 12345, "adjustmentQuantity": -2.5, "adjustmentUnitOfMeasureId": inputs["unitsOfMeasure"][0]["id"], "newQuantity": 0, "adjustmentReasonId": inputs["actionReasons"][0]["id"], "reasonNote": "Recount after inventory audit", "adjustmentDate": "2026-05-14", "finishDate": "2026-05-14", } ], ) ``` Sending `finishDate` also finishes the package on that date. Leave it out to keep the package active. To finish a package without adjusting it: ``` requests.post( f"{API}/v2/packages/finish", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{"id": 12345, "actualDate": "2026-05-14"}], ) ``` `POST /v2/packages/unfinish` takes `[{"id": 12345}]` and returns it to active. ## Returning quantity to the source A package cut from a single source can give quantity back to it. Name the package on the inputs call to read its source and the most it can return: ``` row = requests.get( f"{API}/v2/packages/return/inputs", params={**PARAMS, "packageId": 12345}, headers=HEADERS, ).json()["details"][0] requests.post( f"{API}/v2/packages/return", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[ { "sourcePackageId": row["sourcePackage"]["id"], "childPackageId": 12345, "returnQuantity": 0.5, } ], ) ``` An empty `details` with `isAnySelectedPackageInvalid: true` means Metrc will not return from that package. ## Remediating Metrc remediates only product that failed lab testing. ``` methods = requests.get( f"{API}/v2/packages/remediate/inputs", params=PARAMS, headers=HEADERS ).json()["remediationMethods"] requests.post( f"{API}/v2/packages/remediate", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[ { "id": 12345, "remediationMethodId": methods[0]["id"], "remediationDate": "2026-05-14", "remediationSteps": "Dried and cured for an additional week.", } ], ) ``` ## Trade samples and donations Each flag has a flag and an unflag write, and each write its own lookup: the flag lookup offers packages that are not flagged, the unflag lookup packages that are. The package record reads `isTradeSample` or `isDonation`. ``` requests.post( f"{API}/v2/packages/trade-sample/flag", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{"id": 12345}], ) ``` | Flag | Available in | | ------------ | --------------------------- | | Trade sample | California, Maine, Michigan | | Donation | California, Michigan | ## Discontinuing Discontinue takes one package, as an object rather than a list: ``` requests.post( f"{API}/v2/packages/discontinue", params={**PARAMS, "submit": "true"}, headers=HEADERS, json={"id": 12345}, ) ``` ## Notes ``` requests.post( f"{API}/v2/packages/notes", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{"id": 12345, "note": "Moved to vault"}], ) ``` ## Verifying the result Read the package back rather than trusting the `200` ([why](https://wiki.trackandtrace.tools/t3-api/getting-started/#writing-to-metrc)): ``` package = requests.get( f"{API}/v2/packages/active", params={**PARAMS, "filter": "label__eq:1A4000000000022000000003"}, headers=HEADERS, ).json()["data"][0] print(package["locationName"], package["item"]["name"], package["note"]) ``` ## Next Steps - Cut a new package with [Creating Packages](https://wiki.trackandtrace.tools/t3-api/creating-packages/index.md). - Ship it with [Creating Transfers](https://wiki.trackandtrace.tools/t3-api/creating-transfers/index.md). - Look up one eligible package by id with [Loading One Record by ID](https://wiki.trackandtrace.tools/t3-api/object-lookup/index.md). - Example scripts: [`packages/move-packages-from-csv.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/packages/move-packages-from-csv.py) (move packages to new locations), [`packages/adjust-packages-from-csv.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/packages/adjust-packages-from-csv.py) (adjust quantities, with a reason), [`packages/finish-packages-from-csv.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/packages/finish-packages-from-csv.py) (finish empty packages), [`packages/add-package-notes-from-csv.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/packages/add-package-notes-from-csv.py) (add a note to each package). # Managing Plant Batches [Creating Plant Batches](https://wiki.trackandtrace.tools/t3-api/creating-plant-batches/index.md) covers getting plants into the system. This page covers what you can do to a plant batch once it exists: move it, change its strain, rename it, split it, adjust its count, destroy plants from it, and package it. | Endpoint | What it does | | ------------------------------------------------ | --------------------------------------- | | `POST /v2/plantbatches/change-locations` | Move batches to a different location | | `POST /v2/plantbatches/change-strains` | Reassign batches to a different strain | | `POST /v2/plantbatches/rename` | Rename batches | | `POST /v2/plantbatches/adjust` | Correct a batch's plant count | | `POST /v2/plantbatches/split` | Split plants out into a new batch | | `POST /v2/plantbatches/create/from-plantbatches` | Create a new batch from an existing one | | `POST /v2/plantbatches/destroy` | Destroy immature plants from a batch | | `POST /v2/plantbatches/create/packages` | Package immature plants | Like every mutation in this API, these are **dry runs by default**. Add `submit=true` to actually write to Metrc. See [Writing to Metrc](https://wiki.trackandtrace.tools/t3-api/getting-started/#writing-to-metrc). ## Not every endpoint exists in every state Metrc's own interface differs by state, and these endpoints mirror it exactly. | Endpoint | Available in | | -------------- | ---------------------------- | | `rename` | Everywhere except California | | `adjust` | Everywhere except Missouri | | `replace-tags` | California only | Calling one where the state does not offer it returns an error. The rest of the endpoints on this page are available everywhere. ## Every write has a companion lookup Metrc decides which batches are eligible for each operation **on its own server**, and the eligible set is different for each one. A batch that can be renamed is not necessarily one that can be adjusted. That is why most writes have their own `source-plantbatches` endpoint rather than sharing `GET /v2/plantbatches/active` (`create/from-plantbatches` is the exception): ``` import requests API = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {ACCESS_TOKEN}"} PARAMS = {"licenseNumber": "CUL00001"} eligible = requests.get( f"{API}/v2/plantbatches/destroy/source-plantbatches", params={**PARAMS, "filter": "name__contains:Spring"}, headers=HEADERS, ).json()["data"] print([b["name"] for b in eligible]) ``` Use the general listing to browse, and the `source-plantbatches` endpoint to confirm a batch is eligible for the specific write you are about to make. ## Every write has an inputs endpoint `GET /v2/plantbatches//inputs` returns the option lists that operation needs. This is the only reliable source for ids like `wasteReasonId` and `adjustmentReasonId`, which are state-specific and appear on no record. ``` inputs = requests.get( f"{API}/v2/plantbatches/destroy/inputs", params=PARAMS, headers=HEADERS ).json() for reason in inputs["actionReasons"]: print(reason["id"], reason["name"], reason.get("requiresWasteWeight")) ``` ## Moving and changing strain Both take a list, so you can move or change the strain of many batches in one call. ``` requests.post( f"{API}/v2/plantbatches/change-locations", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{"id": 8891, "locationId": 12345, "actualDate": "2026-05-14"}], ) ``` `sublocationId` is accepted in Maine and Michigan, the only states that model sublocations. Omit it elsewhere. Changing strain is the same shape, and takes no date: ``` requests.post( f"{API}/v2/plantbatches/change-strains", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{"id": 8891, "strainId": 737}], ) ``` Both change fields you may be **searching on**. `GET /v2/plantbatches/active` cannot filter by `id`, so if you find batches by name or strain, do that first and keep the ids. ## Destroying immature plants Four of the fields are required only for some waste reasons. Metrc reveals `wasteWeight`, `wasteUnitOfMeasureId`, `plantWasteMethodId` and `materialMixed` only when the chosen reason demands a weight, which is why they are not required by the schema. Read `requiresWasteWeight` off the inputs response to know which case you are in. ``` requests.post( f"{API}/v2/plantbatches/destroy", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{ "id": 8891, "countToDestroy": 5, "wasteReasonId": 3, "reasonNote": "Failed phenotype", "actualDate": "2026-05-14", }], ) ``` ## Adjusting a count `newQuantity` is what the batch should hold afterwards, and `adjustmentQuantity` is the difference applied. Send both. ``` requests.post( f"{API}/v2/plantbatches/adjust", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{ "plantBatchId": 8891, "adjustmentQuantity": -5, "newQuantity": 95, "adjustmentReasonId": 12, "reasonNote": "Miscount at intake", "adjustmentDate": "2026-05-14", }], ) ``` ## Splitting and creating Both create a new batch, so both need to name it, and **how a new batch is named differs by state**. California identifies a plant batch by tag, so send `tagId`. Maine, Michigan and Missouri use a free-text name, so send `plantBatchName`. This is unlike `POST /v2/plantbatches/create/from-packages`, where a single `plantBatchName` string serves every state. ``` requests.post( f"{API}/v2/plantbatches/split", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{ "sourcePlantBatchId": 8891, "plantsCount": 10, "strainId": 737, "locationId": 12345, "plantBatchName": "Spring Batch A-2", "actualDate": "2026-05-14", }], ) ``` Splitting consumes a tag in California. Tags cannot be replenished through the API, so plan for that before scripting a loop. ### A plant batch name can never be reused Metrc reserves a plant batch name permanently. Once a name has been used it is refused forever, **even after that batch has been emptied and has left the active grid**: ``` A Plant Batch with name "Spring Batch A-2" already exists and cannot be used again. ``` So you cannot pick a name by checking what is free. `GET /v2/plantbatches/active` will not show you the reserved names, and neither will `GET /v2/plantbatches/inactive`, because the reservation outlives whatever either listing holds. Generate names that are unique by construction instead, for example by including a timestamp: ``` from datetime import datetime, timezone stamp = datetime.now(timezone.utc).strftime("%Y%m%d-%H%M%S") name = f"Spring Batch-{stamp}" ``` ## Packaging immature plants ``` requests.post( f"{API}/v2/plantbatches/create/packages", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{ "plantBatchId": 8891, "count": 25, "itemId": 7316223, "tagId": 442199, "locationId": 12345, "actualDate": "2026-05-14", }], ) ``` Three endpoints back this one, because the ids come from three places: | Field | Source | | -------------- | ---------------------------------------------------------- | | `plantBatchId` | `GET /v2/plantbatches/create/packages/source-plantbatches` | | `itemId` | `GET /v2/plantbatches/create/packages/source-items` | | `tagId` | `GET /v2/plantbatches/create/packages/source-tags` | | `locationId` | `GET /v2/plantbatches/create/packages/inputs` | `isDonation`, `isTradeSample` and `isFromMotherPlant` are checkboxes. Send `true` to set one, and **omit it otherwise**: sending `false` is not the same as omitting it. `isFromMotherPlant` is what marks a package as cut from a mother plant batch rather than an ordinary immature batch. It is accepted in California. ## Verifying the result Read the state back rather than trusting the `200` ([why](https://wiki.trackandtrace.tools/t3-api/getting-started/#writing-to-metrc)): ``` batches = requests.get( f"{API}/v2/plantbatches/active", params={**PARAMS, "filter": "name__eq:Spring Batch A"}, headers=HEADERS, ).json()["data"] print(batches[0]["untrackedCount"], batches[0]["locationName"]) ``` `GET /v2/plantbatches/active` does not support filtering by `id`, so match on `name` or `strainName`. ## Next Steps - Get plants into the system with [Creating Plant Batches](https://wiki.trackandtrace.tools/t3-api/creating-plant-batches/index.md). - Move plants through their lifecycle with [The Harvest Lifecycle](https://wiki.trackandtrace.tools/t3-api/harvest-lifecycle/index.md). - Check what your account may do first with [Permissions](https://wiki.trackandtrace.tools/t3-api/permissions/index.md). # Managing Plants Once a plant is tracked, these endpoints cover what you can do to it: move it, change its strain, take clones off it, retag it, package it, and destroy it. | Endpoint | What it does | | ------------------------------------------------ | ---------------------------------------------- | | `POST /v2/plants/change-locations` | Move plants to a different location | | `POST /v2/plants/change-strains` | Reassign plants to a different strain | | `POST /v2/plants/changes-by-location/flowering` | Page-level location and growth phase changes | | `POST /v2/plants/changes-by-location/vegetative` | The same, for vegetative plants | | `POST /v2/plants/create/plantings` | Take clones off a plant into a new plant batch | | `POST /v2/plants/replace-tags` | Move plants onto replacement tags | | `POST /v2/plants/create/packages` | Package vegetative plants | | `POST /v2/plants/create/from-packages` | Unpack a package of plants | | `POST /v2/plants/assign-tags` | Assign a run of tags to untagged plants | | `POST /v2/plants/destroy` | Destroy plants | | `POST /v2/plants/merge` | Merge one plant group into another | | `POST /v2/plants/split` | Split a plant group in two | Like every mutation in this API, these are **dry runs by default**. Add `submit=true` to actually write to Metrc. See [Writing to Metrc](https://wiki.trackandtrace.tools/t3-api/getting-started/#writing-to-metrc). ## Not every endpoint exists in every state These mirror Metrc's own interface, which differs by state. | Endpoint | Available in | | -------------------------------------------------------- | ---------------------------- | | `merge`, `split` | Maine only | | `create/packages`, `assign-tags`, `create/from-packages` | Everywhere except California | | `changes-by-location/vegetative` | Everywhere except California | | `changegrowthphase` | Everywhere except California | California has no vegetative plant grid and no mother plant grid, which is why the vegetative-only operations are absent there. ## Growth phase decides which inputs you get Each write has **one** `/inputs` endpoint, whatever phase the plant is in. Changing growth phase is the exception, and it has three: | Endpoint | Offers | | ---------------------------------------------------- | ----------------------------- | | `GET /v2/plants/changegrowthphase/inputs/vegetative` | Vegetative, Flowering, Mother | | `GET /v2/plants/changegrowthphase/inputs/flowering` | Vegetative, Flowering | | `GET /v2/plants/changegrowthphase/inputs/mother` | Vegetative, Flowering | Read the variant matching the phase your plant is in rather than assuming the lists agree. Although the vegetative list offers Mother, `POST /v2/plants/changegrowthphase` accepts only `Vegetative` and `Flowering`. Promoting immature plants out of a batch has a single `GET /v2/plantbatches/promote/inputs`. ## Every write has an inputs endpoint ``` import requests API = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {ACCESS_TOKEN}"} PARAMS = {"licenseNumber": "CUL00001"} inputs = requests.get( f"{API}/v2/plants/destroy/inputs", params=PARAMS, headers=HEADERS ).json() for reason in inputs["actionReasons"]: print(reason["id"], reason["name"], reason.get("requiresWasteWeight")) ``` This is the only reliable source for ids like `wasteReasonId`, which are state-specific and appear on no plant record. ## Most writes have their own eligibility lookup Metrc decides which plants are eligible for each operation, and the eligible set differs per operation. Use the `source-plants` endpoint belonging to the write you are about to make, not the general plant listing. `change-locations` and `change-strains` have none: ``` eligible = requests.get( f"{API}/v2/plants/destroy/source-plants", params={**PARAMS, "filter": "label__contains:1A40"}, headers=HEADERS, ).json()["data"] ``` ## Moving and changing strain ``` requests.post( f"{API}/v2/plants/change-locations", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{"id": 90210, "locationId": 12345, "actualDate": "2026-05-14"}], ) ``` `sublocationId` is accepted in Maine and Michigan only. Changing strain takes no date: ``` requests.post( f"{API}/v2/plants/change-strains", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{"id": 90210, "strainId": 737}], ) ``` ### A harvested plant cannot change strain A manicure takes product off a plant and leaves it flowering, so a plant that has already given a harvest sits in `GET /v2/plants/flowering` looking like any other. Metrc refuses a strain change on it: ``` Cannot change the Plant Strain because the Plant has been Harvested. ``` There is no eligibility endpoint to ask. Read `harvestCount` off the plant instead, and only send plants where it is `0`: ``` plants = requests.get( f"{API}/v2/plants/flowering", params=PARAMS, headers=HEADERS ).json()["data"] restrainable = [p for p in plants if p["harvestCount"] == 0] ``` Moving a harvested plant is still allowed. This restriction is specific to changing its strain. ## Changes by location This one is unusual: it is not tied to a selection of plants. Every change column is optional, so send only what changes. ``` requests.post( f"{API}/v2/plants/changes-by-location/flowering", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{ "id": 90210, "changeDate": "2026-05-14", "newLocationId": 12345, "newGrowthPhase": "Flowering", }], ) ``` ## Destroying `wasteWeight`, `wasteUnitOfMeasureId`, `plantWasteMethodId` and `materialMixed` are required only for waste reasons that demand a weight. **A reason carries two flags, not one.** `requiresMatureWasteWeight` governs tracked plants and `requiresImmatureWasteWeight` governs plants inside a plant batch. Read the one matching what you are destroying: ``` inputs = requests.get( f"{API}/v2/plants/destroy/inputs", params=PARAMS, headers=HEADERS ).json() for reason in inputs["actionReasons"]: print(reason["name"], reason["requiresMatureWasteWeight"]) ``` In some states every reason requires a weight for a tracked plant, so there may be no weight-free option. **Omitting the weight is not rejected**: Metrc answers `200` and does not perform the destruction, so always read the plant back. ``` requests.post( f"{API}/v2/plants/destroy", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{ "id": 90210, "wasteReasonId": 3, "reasonNote": "Failed phenotype", "actualDate": "2026-05-14", }], ) ``` `countToDestroy` is carried by Maine alone. Everywhere else the whole plant goes. ## Packaging plants Packages are cut from a list of plants, so the payload nests them under `ingredients`: ``` requests.post( f"{API}/v2/plants/create/packages", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{ "tagId": 442199, "itemId": 7316223, "locationId": 12345, "ingredients": [{"plantId": 90210}, {"plantId": 90211}], "actualDate": "2026-05-14", }], ) ``` `quantity` inside an ingredient is carried by Maine alone. `isDonation`, `isTradeSample` and `isFromMotherPlant` are checkboxes: send `true` to set one and **omit it otherwise**. Sending `false` is not the same as omitting it. ## Unpacking plants The reverse of [packaging plants](#packaging-plants): vegetative plants come back out of a package made by `POST /v2/plants/create/packages`. A package of immature plants cut from a plant batch cannot be unpacked. Find the package with `GET /v2/plants/create/from-packages/source-packages`, and the type, strain and location ids on `GET /v2/plants/create/from-packages/inputs`: ``` inputs = requests.get( f"{API}/v2/plants/create/from-packages/inputs", params=PARAMS, headers=HEADERS ).json() requests.post( f"{API}/v2/plants/create/from-packages", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{ "packageId": 12345, "plantBatchTypeId": inputs["plantBatchTypes"][0]["id"], "plantsCount": 1, "strainId": inputs["strains"][0]["id"], "locationId": inputs["locations"][0]["id"], "plantedDate": "2026-05-14", "vegetativeDate": "2026-05-14", "actualDate": "2026-05-14", }], ) ``` `startingTagId` and `endingTagId` tag the plants from `GET /v2/plants/create/from-packages/source-tags`. Maine also requires `tagTypeId`, from `inputs["tagTypes"]`, and Maine and Michigan accept a `sublocationId`. ## Recording waste Recording waste is **not** destruction. The plants stay in the grid; only the waste is recorded. There are three endpoints, differing in what the waste is attributed to: | Endpoint | Attributed to | | ------------------------------------------ | ------------------------- | | `POST /v2/plants/waste/record` | named plants | | `POST /v2/plantbatches/waste/record` | a plant batch | | `POST /v2/plants/waste/record-by-location` | every plant in a location | **Every waste field is required here**, unlike the destroy endpoints where the four waste fields are revealed only for reasons that demand a weight. Note the note field: these endpoints call it `wasteReasonNote`, where destroy calls the same idea `reasonNote`. ``` requests.post( f"{API}/v2/plants/waste/record", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{ "plants": [{"id": 90210}], "plantWasteMethodId": 1, "materialMixed": "Soil", "wasteWeight": 1.5, "wasteUnitOfMeasureId": 4, "wasteReasonId": 22, "wasteReasonNote": "Routine pruning", "actualDate": "2026-05-14", }], ) ``` ### Reading waste back ``` waste = requests.get( f"{API}/v2/plants/waste", params=PARAMS, headers=HEADERS ).json()["data"] plants = requests.get( f"{API}/v2/plants/waste/plants", params={**PARAMS, "plantWasteId": waste[0]["id"]}, headers=HEADERS, ).json()["data"] ``` The sub-resources are addressed by `plantWasteId`, not `id`. The same shape applies to additives, addressed by `plantAdditiveId`: | Endpoint | Returns | | --------------------------------------------- | ---------------------------------- | | `GET /v2/plants/waste` | every waste record | | `GET /v2/plants/waste/plants` | the plants in one record | | `GET /v2/plants/waste/packages` | packages produced by one record | | `GET /v2/plants/additives` | every additive application | | `GET /v2/plants/additives/plants` | the plants one application covered | | `GET /v2/plants/additives/active-ingredients` | its declared active ingredients | Recording an additive application is not yet available through the API; the read endpoints above are. ## Assigning a run of tags `startingTag` and `endingTag` bound a contiguous run, and the plants in `plants` consume it in order. The run must be exactly as long as that list. ``` requests.post( f"{API}/v2/plants/assign-tags", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{ "startingTag": 442199, "endingTag": 442201, "plants": [{"id": 90210}, {"id": 90211}, {"id": 90212}], "actualDate": "2026-05-14", }], ) ``` ## Verifying the result Read the state back rather than trusting the `200` ([why](https://wiki.trackandtrace.tools/t3-api/getting-started/#writing-to-metrc)). Unlike plant batches, **a plant can be fetched by id**: ``` plant = requests.get( f"{API}/v2/plants/flowering/90210", params=PARAMS, headers=HEADERS ).json() print(plant["locationName"], plant["strainName"]) ``` That matters after a tag replacement in particular: the plant keeps its id, so reading by id is the only lookup the write does not move. ## Next Steps - Get plants into the system with [Creating Plant Batches](https://wiki.trackandtrace.tools/t3-api/creating-plant-batches/index.md). - Work with plant batches in [Managing Plant Batches](https://wiki.trackandtrace.tools/t3-api/managing-plant-batches/index.md). - Harvest what you grow with [The Harvest Lifecycle](https://wiki.trackandtrace.tools/t3-api/harvest-lifecycle/index.md). - Example scripts: [`cultivation/move-plants-from-csv.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/cultivation/move-plants-from-csv.py) (move plants to new locations), [`cultivation/change-growth-phase-from-csv.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/cultivation/change-growth-phase-from-csv.py) (change growth phase), [`cultivation/record-plant-waste-from-csv.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/cultivation/record-plant-waste-from-csv.py) (record plant waste). # Metrc Pages `GET /v2/metrc/pages` lists the pages of the Metrc web app and the tables on each one, with links that open them for one of your licenses. Use it to link from your own tool into Metrc, such as from a search result to the table it came from. A T3+ subscription is **not** required to use this endpoint. ## Listing Pages | Parameter | Required | Description | | --------------- | -------- | -------------------------- | | `licenseNumber` | yes | The license the links open | ``` import requests response = requests.get( "https://api.trackandtrace.tools/v2/metrc/pages", params={"licenseNumber": "LIC-00001"}, headers={"Authorization": f"Bearer {access_token}"}, ).json() for page in response["pages"]: print(page["group"], ">", page["title"], page["url"]) ``` ``` { "hostname": "ca.metrc.com", "licenseNumber": "LIC-00001", "pages": [ { "key": "plants", "group": "Plants", "title": "Plants", "path": "/industry/LIC-00001/plants", "url": "https://ca.metrc.com/industry/LIC-00001/plants", "tables": [ { "key": "plantbatchesonhold", "title": "Immature On Hold", "label": "On Hold", "gridSelector": "#plantbatchesonhold-grid", "hasTab": true, "t3EndpointId": "METRC_ONHOLD_PLANTBATCHES" } ] } ] } ``` Pages are in the order of Metrc's navigation menu, and tables in the order of the page's tabs. **Every page is listed for every license**, including pages your state, license type or Metrc permissions do not let you open. Check access with [Permissions](https://wiki.trackandtrace.tools/t3-api/permissions/index.md). Links use your session's Metrc hostname, so a sandbox session gets sandbox links. ## Page Fields | Field | Description | | -------- | --------------------------------------------------------- | | `key` | A stable identifier, e.g. `transfers-licensed-templates` | | `group` | The Metrc menu the page is listed under, e.g. `Transfers` | | `title` | The page's link text in that menu, e.g. `Templates` | | `path` | The path that opens the page for the license | | `url` | The full URL that opens the page for the license | | `tables` | The tables on the page. Empty for a page with none | ## Table Fields | Field | Description | | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `key` | The table's name, unique within its page. Also its sub-view name in [Permissions](https://wiki.trackandtrace.tools/t3-api/permissions/index.md), e.g. `plants/plantbatchesonhold` | | `title` | A name unique within the page. Metrc's own tab labels repeat: the plants page has four "On Hold" tabs | | `label` | The text of the table's tab in Metrc, or `null` when Metrc renders no tab for it | | `gridSelector` | Identifies the table's tab on the Metrc page | | `hasTab` | Whether the table has its own tab. When `false`, link to the page | | `t3EndpointId` | The [T3 endpoint id](https://wiki.trackandtrace.tools/t3-api/t3-endpoint-ids/index.md) of the collection the table lists, matching the `t3EndpointId` of a [search](https://wiki.trackandtrace.tools/t3-api/search/index.md) result. `null` when T3 does not serve it | ## Linking a Search Result to Its Table Index the tables by `t3EndpointId`, then look up each search result: ``` import requests BASE = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {access_token}"} LICENSE = "LIC-00001" pages = requests.get( f"{BASE}/v2/metrc/pages", params={"licenseNumber": LICENSE}, headers=HEADERS, ).json()["pages"] tables = { table["t3EndpointId"]: (page, table) for page in pages for table in page["tables"] if table["t3EndpointId"] } results = requests.get( f"{BASE}/v2/search", params={"licenseNumber": LICENSE, "query": "0000123"}, headers=HEADERS, ).json()["data"] for result in results: match = tables.get(result["t3EndpointId"]) if match: page, table = match print(f"{page['title']} > {table['title']}: {page['url']}") ``` ## Limits and Behavior - **One license per request.** `licenseNumber` must be one of your session's licenses, or the response is `403` with the code `FORBIDDEN`. - **Static.** The list does not depend on your Metrc data, so it answers immediately. - **Free.** No T3+ subscription required. ## Next Steps - [Permissions](https://wiki.trackandtrace.tools/t3-api/permissions/index.md): check which pages and tabs your account can open - [Search](https://wiki.trackandtrace.tools/t3-api/search/index.md): find records across collections # Loading One Record by ID Every T3 collection endpoint has a matching **object endpoint**: append the record's `id` to the collection path and you get that one record back, with no pagination envelope around it. ``` GET https://api.trackandtrace.tools/v2/packages/active/12345?licenseNumber=LIC-00001 ``` ``` { "id": 12345, "label": "1A4FF0100000022000000123", "quantity": 4.5, "unitOfMeasureAbbreviation": "g", "item": { "name": "Blue Dream Buds", "...": "..." }, "licenseNumber": "LIC-00001", "dataModel": "MetrcPackage", "retrievedAt": "2026-09-22T17:42:11.482Z" } ``` Compare that to the collection form, which returns the same record wrapped in a page: ``` { "data": [ { "id": 12345, "...": "..." } ], "total": 1, "page": 1, "pageSize": 1, "totalPages": 1 } ``` An object request is as fast as a collection request, however many records the license has. ## Why Use It - **You already have the id.** [`/v2/search`](https://wiki.trackandtrace.tools/t3-api/search/index.md) hands back ids, as does every collection response and every report row. The object endpoint is where you spend one. - **You want one hydrated record.** `/v2/packages/active/super/12345?include=labResults` loads a single package with its lab results attached, far faster than loading includes for a whole [supercollection](https://wiki.trackandtrace.tools/t3-api/supercollections/index.md) page. - **You want a real 404.** An id that does not exist is a `404`, not a `200` with an empty list you have to check for. ## Request | Part | Notes | | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `id` in the path | The record's Metrc `id`, an integer. Non-numeric paths are not object lookups, so `/v2/packages/active/super` is still the supercollection. | | `licenseNumber` | Required, exactly as on the collection. | | `include` | Supported on `/super` paths, with the same values the supercollection accepts. See [Supercollection Includes](https://wiki.trackandtrace.tools/t3-api/supercollection-includes/index.md). | | `collectionMask` | Supported, and shapes the returned record. | `page`, `pageSize`, `sort`, `filter`, `filterLogic` and `strictPagination` are **rejected with a `400`**. The response is a single record, so there is nothing for them to act on; use the collection endpoint when you want a page. ## Responses | Status | Meaning | | ------ | -------------------------------------------------------------------------------- | | `200` | The record, as a bare JSON object. | | `400` | A paging, sorting or filtering parameter was sent, or an unrecognized `include`. | | `404` | No record with that id exists in this collection for this license. | A `404` means "not in **this** collection". A package that has moved to inactive is a `404` on `/v2/packages/active/{id}` and a `200` on `/v2/packages/inactive/{id}`. If you do not know which state a record is in, try each in turn, or use [`/v2/search`](https://wiki.trackandtrace.tools/t3-api/search/index.md) to find it first. ## Example ``` #!/usr/bin/env python3 # /// script # requires-python = ">=3.12" # dependencies = ["t3api-utils>=2.1.0"] # /// import sys import t3api_utils as t3 with t3.connect() as client: license = client.license or client.pick_license() # One package, with its lab results, in a single call. try: package = client.get( "METRC_ACTIVE_SUPERPACKAGES", object_id=12345, license=license, include=["labResults"], ) except t3.NotFound: sys.exit(f"No active package with id 12345 on {license}") print(package["label"], package["quantity"], package["unitOfMeasureAbbreviation"]) for result in package["labResults"]: print(" ", result["testTypeName"], result["testResultLevel"]) ``` `METRC_ACTIVE_SUPERPACKAGES` names both `/v2/packages/active/super` and `/v2/packages/active/super/{id}`. Passing `object_id` picks the object endpoint. Going the other way, from a search hit to the full record: the hit's `t3EndpointId` names the collection, and its object endpoint shares that id. [T3 Endpoint IDs](https://wiki.trackandtrace.tools/t3-api/t3-endpoint-ids/index.md) lists every collection's id and path. `t3api-utils` takes the id directly: ``` hit = client.get( "/v2/search", license=license, params={"query": "1A4FF0100000022000000123"}, )["data"][0] package = client.get(hit["t3EndpointId"], object_id=hit["matchedEntry"]["id"], license=license) ``` ## Every Object Endpoint | Collection | Object | Super object | | --------------------------- | ----------------------------------------- | ----------------------------------------------- | | Active Packages | `/v2/packages/active/{id}` | `/v2/packages/active/super/{id}` | | Inactive Packages | `/v2/packages/inactive/{id}` | `/v2/packages/inactive/super/{id}` | | In Transit Packages | `/v2/packages/intransit/{id}` | `/v2/packages/intransit/super/{id}` | | On Hold Packages | `/v2/packages/onhold/{id}` | `/v2/packages/onhold/super/{id}` | | Transferred Packages | `/v2/packages/transferred/{id}` | `/v2/packages/transferred/super/{id}` | | Product Labels | `/v2/packages/product-labels/{id}` | `/v2/packages/product-labels/super/{id}` | | Staged Product Labels | `/v2/packages/staged-product-labels/{id}` | `/v2/packages/staged-product-labels/super/{id}` | | Lab Samples | `/v2/packages/lab-samples/{id}` | `/v2/packages/lab-samples/super/{id}` | | Items | `/v2/items/{id}` | `/v2/items/super/{id}` | | Strains | `/v2/strains/{id}` | `/v2/strains/super/{id}` | | Active Locations | `/v2/locations/active/{id}` | `/v2/locations/active/super/{id}` | | Active Harvests | `/v2/harvests/active/{id}` | `/v2/harvests/active/super/{id}` | | Inactive Harvests | `/v2/harvests/inactive/{id}` | `/v2/harvests/inactive/super/{id}` | | On Hold Harvests | `/v2/harvests/onhold/{id}` | `/v2/harvests/onhold/super/{id}` | | Harvest Schedules | `/v2/harvests/schedules/{id}` | *(none)* | | Vegetative Plants | `/v2/plants/vegetative/{id}` | `/v2/plants/vegetative/super/{id}` | | Flowering Plants | `/v2/plants/flowering/{id}` | `/v2/plants/flowering/super/{id}` | | On Hold Plants | `/v2/plants/onhold/{id}` | `/v2/plants/onhold/super/{id}` | | Inactive Plants | `/v2/plants/inactive/{id}` | `/v2/plants/inactive/super/{id}` | | Active Mother Plants | `/v2/plants/mother/active/{id}` | `/v2/plants/mother/active/super/{id}` | | On Hold Mother Plants | `/v2/plants/mother/onhold/{id}` | `/v2/plants/mother/onhold/super/{id}` | | Inactive Mother Plants | `/v2/plants/mother/inactive/{id}` | `/v2/plants/mother/inactive/super/{id}` | | Plant Waste | `/v2/plants/waste/{id}` | `/v2/plants/waste/super/{id}` | | Plant Additives | `/v2/plants/additives/{id}` | `/v2/plants/additives/super/{id}` | | On Hold Plant Batches | `/v2/plantbatches/onhold/{id}` | `/v2/plantbatches/onhold/super/{id}` | | Active Sales | `/v2/sales/active/{id}` | `/v2/sales/active/super/{id}` | | Inactive Sales | `/v2/sales/inactive/{id}` | `/v2/sales/inactive/super/{id}` | | Available Tags | `/v2/tags/available/{id}` | `/v2/tags/available/super/{id}` | | Used Tags | `/v2/tags/used/{id}` | `/v2/tags/used/super/{id}` | | Voided Tags | `/v2/tags/voided/{id}` | `/v2/tags/voided/super/{id}` | | Current Tag Orders | `/v2/tagorders/current/{id}` | `/v2/tagorders/current/super/{id}` | | Historical Tag Orders | `/v2/tagorders/history/{id}` | `/v2/tagorders/history/super/{id}` | | Active Processing Jobs | `/v2/processingjobs/active/{id}` | `/v2/processingjobs/active/super/{id}` | | Inactive Processing Jobs | `/v2/processingjobs/inactive/{id}` | `/v2/processingjobs/inactive/super/{id}` | | Incoming Active Transfers | `/v2/transfers/incoming/active/{id}` | `/v2/transfers/incoming/active/super/{id}` | | Incoming Inactive Transfers | `/v2/transfers/incoming/inactive/{id}` | `/v2/transfers/incoming/inactive/super/{id}` | | Outgoing Active Transfers | `/v2/transfers/outgoing/active/{id}` | `/v2/transfers/outgoing/active/super/{id}` | | Outgoing Inactive Transfers | `/v2/transfers/outgoing/inactive/{id}` | `/v2/transfers/outgoing/inactive/super/{id}` | | Rejected Transfers | `/v2/transfers/rejected/{id}` | `/v2/transfers/rejected/super/{id}` | | Hub Transfers | `/v2/transfers/hub/{id}` | `/v2/transfers/hub/super/{id}` | | Transfer Templates | `/v2/transfers/templates/{id}` | *(none)* | The eligibility lookups that feed each write follow the same rule: every `source-*` collection, such as `/v2/packages/create/source-packages` or `/v2/plants/destroy/source-plants`, also answers `/{id}` with one record. The [interactive docs](https://api.trackandtrace.tools/v2/docs/) list every one. ## Four Exceptions **Plant batches.** `/v2/plantbatches/active` and `/v2/plantbatches/inactive` have no object endpoint, because those two collections cannot be filtered by id. On hold plant batches are unaffected. To find one active plant batch, page `/v2/plantbatches/active` and match on `id` yourself, or filter by `name`. **Data import templates.** `/v2/dataimport/templates` has no object endpoint, because Metrc ignores an id filter on that collection and returns every template. Page `/v2/dataimport/templates` and match on `id` yourself. **Transferred packages.** On `/v2/packages/transferred`, a row's `id` is the id of the *manifest* it travelled on, shared by every package on that manifest. The id in the path is therefore the `packageId`, which is the package's own identity. A package transferred more than once has one row per manifest; the object endpoint returns the first. Use `/v2/packages/transferred?filter=packageId__eq:12345` when you need all of them. **Lab samples.** `/v2/packages/lab-samples` lists a sample once per test, and every row carries the sample's package `id`. The id in the path is therefore the row's `labTestDetailId`, which names one test on one sample. Use `/v2/packages/lab-samples?filter=id__eq:12345` for every test on a sample. ## Sub-Collections Are Different Endpoints that return records belonging to a parent record already take that parent's id as a query parameter, and keep doing so: ``` GET /v2/packages/history?packageId=12345&licenseNumber=LIC-00001 GET /v2/items/notes?itemId=987&licenseNumber=LIC-00001 GET /v2/transfers/deliveries?manifestNumber=0000123456&licenseNumber=LIC-00001 ``` These have no `/{id}` form: the id they need is the parent's, not the row's. ______________________________________________________________________ ## Next Steps - Find a record when you do not have its id: [Search](https://wiki.trackandtrace.tools/t3-api/search/index.md). - Attach related records to the one you loaded: [Supercollections](https://wiki.trackandtrace.tools/t3-api/supercollections/index.md) and [Supercollection Includes](https://wiki.trackandtrace.tools/t3-api/supercollection-includes/index.md). - Load many records at once: [Reports](https://wiki.trackandtrace.tools/reports/index.md). - Example script: [`basics/get-one-object.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/basics/get-one-object.py) (one package by id). # T3 API OpenAPI Spec The T3 API is described end-to-end by an [OpenAPI 3.0.2](https://spec.openapis.org/oas/v3.0.2) specification. Every path, parameter, and response shape is defined in that spec, and the spec itself is a first-class part of the API. This page is the reference for what the spec offers, where to find it, and how to get only the pieces you need. ## Why OpenAPI? OpenAPI is the standard schema format for HTTP APIs. Publishing a spec lets the T3 API support: - **Browseable, interactive documentation** with a "Try it out" button. - **Code generation**: any language that has an OpenAPI generator can produce a typed client. - **Postman import**: for users who prefer a GUI client to writing code. - **LLM / AI agent consumption**: an agent writing a one-off script can be handed just the relevant slice of the spec instead of a full reference manual. The spec is the source of truth. The interactive docs and the Postman workspace are generated from it. ______________________________________________________________________ ## Interactive Docs The Swagger UI lives at: **** This is where most users start. Every endpoint is listed, grouped by tag (Packages, Transfers, Labels, etc.), with: - Parameter descriptions and examples - Request body schemas - Response schemas with example payloads - A "Try it out" button that authenticates with your T3 session and sends a real request ______________________________________________________________________ ## The Raw Spec The full OpenAPI document is available as JSON at: **** This is a single self-contained file: every `$ref` resolves to a definition inside the same document, so tools can consume it without further network fetches. Individual YAML source files are also served under `/v2/spec/.yaml` if you'd rather read a single component (for example, `/v2/spec/components/schemas/MetrcPackage.yaml`). ______________________________________________________________________ ## Pruning the Spec The full spec is large. When you only care about a few endpoints or schemas, you can ask the API to return a **pruned** version that contains just what you requested, plus every schema and parameter those pieces transitively reference. The full spec is several megabytes, which is too much for an LLM prompt or a focused SDK. Every operation, tag, and schema in the [interactive docs](https://api.trackandtrace.tools/v2/docs/) has a small filter icon next to its name that opens the pruned spec for just that resource. All filters are applied on the same endpoint: ``` GET https://api.trackandtrace.tools/v2/spec/openapi.json?... ``` Filters are **repeatable**, and multiple filters combine as a **union**: the response contains everything matched by any filter. `schema`, `parameter` and `tag` ignore case; `path` must match exactly. If a requested name doesn't exist in the spec, the endpoint returns `404`. ### `?path`, filter by API path Returns the path definition(s) plus every schema and parameter reachable from them. The path must match exactly, including case: ``` GET /v2/spec/openapi.json?path=/v2/packages/active GET /v2/spec/openapi.json?path=/v2/packages/active&path=/v2/auth/credentials ``` ### `?schema`, filter by schema name Returns the named schema(s) plus any transitively-referenced schemas. No paths are included: ``` GET /v2/spec/openapi.json?schema=MetrcPackage GET /v2/spec/openapi.json?schema=MetrcPackage&schema=Pagination ``` ### `?parameter`, filter by parameter name Returns the named reusable parameter(s) plus any schemas they reference. No paths are included: ``` GET /v2/spec/openapi.json?parameter=LicenseNumber GET /v2/spec/openapi.json?parameter=CollectionFilter¶meter=CollectionSort ``` ### `?tag`, filter by tag Returns every path tagged with this tag (for example, `Packages`, `Items`, `Labels`) plus their transitively-referenced schemas and parameters: ``` GET /v2/spec/openapi.json?tag=Items GET /v2/spec/openapi.json?tag=Authentication&tag=Packages ``` ### Combining filters Filters can be mixed freely: ``` GET /v2/spec/openapi.json?path=/v2/auth/credentials&schema=MetrcPackage GET /v2/spec/openapi.json?tag=Items¶meter=LicenseNumber GET /v2/spec/openapi.json?path=/v2/packages/active&tag=Authentication&schema=Pagination ``` ______________________________________________________________________ ## Feeding Subsets to LLMs and Agents An agent writing a script that calls one or two endpoints only needs their slice of the spec. See [AI & LLM Integration](https://wiki.trackandtrace.tools/t3-api/ai-and-llms/index.md) for prompts and resources. To fetch the slice yourself: ``` import requests response = requests.get( "https://api.trackandtrace.tools/v2/spec/openapi.json", params={"path": "/v2/packages/active"}, timeout=10, ) subset_spec = response.json() ``` Pass `params=[("path", ...), ("path", ...)]` to include several endpoints. The response is still a valid OpenAPI 3.0.2 document, so any tool that consumes the full spec can consume a pruned one. ______________________________________________________________________ ## Postman [Postman](https://www.postman.com/) is a GUI API client. The T3 team maintains a public Postman workspace generated from the OpenAPI spec: **** Inside that workspace is an example Postman Flow that demonstrates the authentication handshake and a simple data read: **** You can also import the spec yourself: in Postman, **File → Import → Link**, paste `https://api.trackandtrace.tools/v2/spec/openapi.json`, and you'll get a collection that mirrors the current API. ______________________________________________________________________ ## Next Steps - Explore the [interactive docs](https://api.trackandtrace.tools/v2/docs/). - Learn how to [write and execute a Python script](https://wiki.trackandtrace.tools/t3-api/api-scripts/index.md) against the T3 API. - Check out [Supercollections](https://wiki.trackandtrace.tools/t3-api/supercollections/index.md) for endpoints that eagerly load related metadata. - Check out [Reports](https://wiki.trackandtrace.tools/reports/index.md) for bulk dataset exports. - If you're not subscribed to T3+, [start your 30-day free trial here](https://dash.trackandtrace.tools). # Permissions Two Metrc accounts pointed at the same license rarely see the same thing. The permissions endpoints tell you what *your* account can actually do, so you can check before you call rather than discovering it from a `403`. A T3+ subscription is **not** required to use these endpoints. ``` flowchart TB V["View: packages
a page you can open"] S["Sub-view: packages/active
a tab on that page you can read"] P["Permission: packages/active:remediate_packages
an action you can take"] V --> S --> P VE["GET /v2/permissions/views"] -.-> V SE["GET /v2/permissions?view=packages"] -.-> S SE -.-> P ``` ## Why Permissions Vary Metrc access is determined by several independent factors: - **Permissions granted by your Metrc admin.** Employee-level grants, set inside Metrc. - **Class of license.** A cultivator sees plant pages a manufacturer does not. - **US state.** Each state runs its own Metrc deployment with its own enabled modules. You cannot hardcode a permission list A script that works for one license may not work for the next one, even under the same login. Query the permissions instead. ## Views and Permissions T3 describes Metrc access at three granularities. | | What it is | Example | Endpoint | | -------------- | ----------------------------------- | ------------------------------------ | --------------------------- | | **View** | A page you can open | `packages` | `GET /v2/permissions/views` | | **Sub-view** | A tab within that page you can read | `packages/active` | `GET /v2/permissions` | | **Permission** | An action you can take | `packages/active:remediate_packages` | `GET /v2/permissions` | A view is a Metrc page path, and it may itself contain a slash: `transfers/licensed` and `admin/items` are both single views. A **sub-view** is one of the grid tabs the page renders: Active, On Hold, Inactive, In Transit. This is the only signal that a collection scoped to that tab can be read at all, and it varies by state: California renders no Vegetative plant tab, so `/v2/plants/vegetative` does not work on a California license no matter what your Metrc admin granted. Both endpoints return a **flat JSON array of strings**. There is no wrapper object. Both are scoped to one license, via the required `licenseNumber` query parameter. Permissions belong to the combination of *who you authenticated as* and *which license you asked about*, so you need one call per license. ## Listing Views `GET /v2/permissions/views` | Parameter | Required | Description | | --------------- | -------- | -------------------- | | `licenseNumber` | yes | The license to check | ``` import requests views = requests.get( "https://api.trackandtrace.tools/v2/permissions/views", params={"licenseNumber": "LIC-00001"}, headers={"Authorization": f"Bearer {access_token}"}, ).json() print(views) ``` ``` [ "admin/items", "admin/strains", "admin/tags", "packages", "plants", "transfers/hub", "transfers/licensed" ] ``` The list is sorted and deduplicated. **A view missing from this list means the account cannot open that page.** That is the check to make before assuming a collection endpoint will work. ## Listing Permissions Within a View `GET /v2/permissions` | Parameter | Required | Description | | --------------- | -------- | --------------------------------------------------- | | `licenseNumber` | yes | The license to check | | `view` | yes | A view name, as returned by `/v2/permissions/views` | ``` import requests permissions = requests.get( "https://api.trackandtrace.tools/v2/permissions", params={"licenseNumber": "LIC-00001", "view": "packages"}, headers={"Authorization": f"Bearer {access_token}"}, ).json() print(permissions) ``` ``` [ "packages/active", "packages/onhold", "packages/inactive", "packages/intransit", "packages/transferred", "packages:add_items", "packages/active:new_packages", "packages/active:remediate_packages", "packages/active:adjust_packages", "packages/active:change_notes" ] ``` Sub-views come first, then actions in the order the page defines them. `view` must be a view name, one or more slash-separated alphanumeric segments, such as `packages` or `transfers/licensed`. Anything else is rejected with a `400` and the code `INVALID_QUERY_PARAMETER`. A view the license does not have is refused with a `403` and the code `METRC_RESOURCE_UNAUTHORIZED`. List the views first with `/v2/permissions/views`. ## The `view[/tab][:action]` Format Every entry starts with the view you asked for. A tab and an action are each optional: ``` plants/plantsflowering:harvest_flowering_plants └──┬─┘ └──────┬──────┘ └───────────┬──────────┘ view tab action ``` Four shapes occur: | Entry | Meaning | | ------------------------------------------------- | ---------------------------------------------------------------- | | `plants/plantsflowering` | The Flowering tab exists and is readable | | `plants/plantsflowering:harvest_flowering_plants` | An action on that tab | | `plants:new_address` | An action on the page, not tied to any tab | | `plants` | The page itself, from `/v2/permissions/views`, not this endpoint | Because a view can contain slashes, **split on the colon, not on the slash**: ``` location, _, action = permission.partition(":") if not action: print(f"{location} is a readable tab") ``` **Tab names are stable ids, not the visible label.** The plants page shows "On Hold" three times (once each under Plant Batches, Plants and Harvests), so the labels cannot tell them apart. The ids can: `plantbatchesonhold`, `plantsonhold`, `harvestsonhold`. **Action names match the title of the window the action opens in Metrc**, lowercased with spaces replaced by underscores: *Harvest Flowering Plants* becomes `harvest_flowering_plants`. They do **not** match the button text, and this trips people up. The button on the plants toolbar reads simply **Harvest**; guessing `plants:harvest` from it matches nothing. Action names are descriptive, not a fixed vocabulary: the available actions differ by state and license class, which is the same reason the view list does. **Query them rather than guessing them.** ## Matching Actions Without Knowing the Tab Most actions are scoped to a tab, and usually you do not care which. Match on the action half: ``` def grants(permissions: list[str], action: str) -> bool: """True if any entry grants `action`, on any tab.""" return any(p.partition(":")[2] == action for p in permissions) print(grants(permissions, "harvest_flowering_plants")) ``` Compare the whole string only when you specifically mean *that action on that tab*. ## Checking Before You Act The two endpoints compose into a single check. Ask for the view first, then the action only if you need that level of detail: ``` import requests BASE = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {access_token}"} def can(*, license_number: str, permission: str) -> bool: """True if the account may perform `permission` on `license_number`. Accepts a view ("packages"), a sub-view ("packages/active"), or an action on a view, with or without its tab ("packages:adjust_packages", "packages/active:adjust_packages"). """ location, _, action = permission.partition(":") views = requests.get( f"{BASE}/v2/permissions/views", params={"licenseNumber": license_number}, headers=HEADERS, ).json() # A view may itself contain a slash, so prefer the longest match. view = next( (v for v in sorted(views, key=len, reverse=True) if location == v or location.startswith(f"{v}/")), None, ) if view is None: return False permissions = requests.get( f"{BASE}/v2/permissions", params={"licenseNumber": license_number, "view": view}, headers=HEADERS, ).json() if not action: # A bare view is granted; a sub-view has to appear in the list. return location == view or location in permissions return any( p.partition(":")[2] == action and p.partition(":")[0].startswith(location) for p in permissions ) print(can(license_number="LIC-00001", permission="packages")) print(can(license_number="LIC-00001", permission="packages/active")) print(can(license_number="LIC-00001", permission="packages:remediate_packages")) print(can(license_number="LIC-00001", permission="packages:new_transfer")) ``` If you are checking several actions on the same page, fetch the view's permissions once and test against the list rather than calling `can()` repeatedly. ## When Metrc Refuses a Form The `/inputs` endpoints load a Metrc form. If your account cannot open that form on the license, T3 answers `403` with the code `METRC_RESOURCE_UNAUTHORIZED`: ``` import requests response = requests.get( "https://api.trackandtrace.tools/v2/transfers/create/inputs", params={"licenseNumber": "LIC-00001"}, headers={"Authorization": f"Bearer {access_token}"}, ) if response.status_code == 403: print(response.json()["code"]) # METRC_RESOURCE_UNAUTHORIZED print(response.json()["detail"]) # names the license and the form ``` Having the page is not enough. The New Transfer form needs the `new_transfer` action on the packages page, so check it with `can()` above. A write sent with `applyDynamicValidation=true` is checked the same way, so it returns the same `403`. ## Limits and Behavior - **One license per request.** Both endpoints take exactly one `licenseNumber`. Checking a whole account means one views call per license. - **Detail costs one call per view.** `/v2/permissions` covers a single view, so enumerating everything is one request per view. Fetch only the views you care about. - **Results are live.** Each call reflects your permissions at that moment. A grant changed inside Metrc shows up on the next request, with no cache to wait out. - **Free.** No T3+ subscription required. ## Examples Substitute your API token and license number into each example. **A view containing a slash: URL-encode it, or quote the URL.** ``` curl 'https://api.trackandtrace.tools/v2/permissions?licenseNumber=LIC-00001&view=transfers/licensed' \ -H 'Authorization: Bearer ' ``` **Find every license that can create packages:** ``` import requests BASE = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {access_token}"} licenses = requests.get(f"{BASE}/v2/licenses", headers=HEADERS).json() for license in licenses: number = license["licenseNumber"] permissions = requests.get( f"{BASE}/v2/permissions", params={"licenseNumber": number, "view": "packages"}, headers=HEADERS, ).json() if any(p.endswith(":new_packages") for p in permissions): print(number) ``` ## Next Steps - [Getting Started](https://wiki.trackandtrace.tools/t3-api/getting-started/index.md): authenticate and make your first request - [Search](https://wiki.trackandtrace.tools/t3-api/search/index.md): query across collections without knowing which one to look in - [Supercollections](https://wiki.trackandtrace.tools/t3-api/supercollections/index.md): load a collection and its metadata in one request - Example script: [`basics/check-permissions.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/basics/check-permissions.py) (list what your login may do on a license). # Receiving Transfers [Creating Transfers](https://wiki.trackandtrace.tools/t3-api/creating-transfers/index.md) covers the shipper's side. This page covers everything after the manifest exists: the recipient accepting or refusing it, the transporter moving it, and the notes both sides leave along the way. | Step | Endpoint | Who does it | | ----------------------------------------------- | ------------------------------------- | ----------- | | Approve | `POST /v2/transfers/approve` | Recipient | | Reject | `POST /v2/transfers/reject` | Recipient | | Receive | `POST /v2/transfers/receive` | Recipient | | Take back a rejection | `POST /v2/transfers/rejected/receive` | Shipper | | Accept · Depart · Check-in · Check-out · Arrive | `POST /v2/transfers/hub/{action}` | Transporter | | Correct transport details | `POST /v2/transfers/hub/update` | Transporter | | Add a note | `POST /v2/transfers/notes/create` | Either | | Void a note | `POST /v2/transfers/notes/void` | Author | Like every mutation in this API, these are **dry runs by default**. Add `submit=true` to actually write to Metrc. See [Writing to Metrc](https://wiki.trackandtrace.tools/t3-api/getting-started/#writing-to-metrc). ``` import requests API = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {ACCESS_TOKEN}"} PARAMS = {"licenseNumber": "MAN000030"} ``` ## The two IDs, and why transfers are confusing Almost every mistake on this page is the wrong ID. A transfer is three nested things: ``` Transfer (id) : the manifest └─ Delivery (deliveryId) : one leg to one recipient └─ Package (id) : one package on that delivery ``` A transfer with one destination still has a delivery, and its `deliveryId` is usually **not** the same number as the transfer's `id`. Endpoints on this page want: - `id`: the transfer, from `/v2/transfers/incoming/active` or `/v2/transfers/rejected` - `shipmentDeliveryId`: the delivery, from `/v2/transfers/deliveries` - package `id`: from `/v2/transfers/packages`, **not** from `/v2/packages` Approving and receiving also take the transfer's `lastModified`, exactly as the transfer record reports it. Metrc refuses a stale or missing value with *"it has changed since the editing began"*, so read the transfer just before you write. The hub endpoints are the exception: they take `deliveryId` directly, read from the `deliveryId` field of `/v2/transfers/hub`. Package IDs are delivery-scoped The `id` on a package in `/v2/transfers/packages` identifies that package *on that delivery*. It is a different number from the package's own ID in `/v2/packages`, and sending the latter is the most common cause of a rejected receive payload. ## Approving, before you can receive Some states put an approval step in front of receiving: the transfer arrives pending approval and cannot be received until the recipient approves it. States that do not use the step never produce transfers in it, and you can skip straight to [Receive](#receiving). ``` transfer = requests.get( f"{API}/v2/transfers/incoming/active", params={**PARAMS, "filter": "manifestNumber__eq:0000123456"}, headers=HEADERS, ).json()["data"][0] requests.post( f"{API}/v2/transfers/approve", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{ "id": transfer["id"], "shipmentDeliveryId": 6789, "lastModified": transfer["lastModified"], }], ) ``` Set `autoApprove` to approve later transfers from the same shipper automatically, but only on a transfer whose record allows it, or Metrc refuses the whole call. ### Refusing the whole transfer ``` reasons = requests.get( f"{API}/v2/transfers/reject/inputs", params=PARAMS, headers=HEADERS ).json()["actionReasons"] reason = next(r for r in reasons if r["forRejectedTransferApprovals"]) requests.post( f"{API}/v2/transfers/reject", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{ "id": 12345, "shipmentDeliveryId": 6789, "rejectReasonId": reason["id"], "rejectReasonNote": "Manifest does not match the delivery", }], ) ``` `rejectReasonNote` is required whatever reason you pick, unlike elsewhere, where the reason's own `requiresNote` flag decides. **To refuse only some packages, do not use this endpoint.** Receive the transfer and mark those packages `rejected` instead; see [Rejecting individual packages](#rejecting-individual-packages). ## Receiving Receiving is one call that books every package on the delivery. **A package left out of `packages` is not left untouched**: Metrc receives the delivery as a whole, so omitting one is not a way to defer it. ### Step 0, fetch the inputs ``` inputs = requests.get( f"{API}/v2/transfers/receive/inputs", params=PARAMS, headers=HEADERS ).json() locations = inputs["locations"] unit_ids = {u["abbreviation"]: u["id"] for u in inputs["unitsOfMeasure"]} ``` ### Step 1, read the transfer and what is on the delivery ``` transfer = requests.get( f"{API}/v2/transfers/incoming/active", params={**PARAMS, "filter": "manifestNumber__eq:0000123456"}, headers=HEADERS, ).json()["data"][0] packages = requests.get( f"{API}/v2/transfers/packages", params={**PARAMS, "deliveryId": 6789}, headers=HEADERS, ).json()["data"] ``` ### Step 2, receive it ``` requests.post( f"{API}/v2/transfers/receive", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{ "id": transfer["id"], "shipmentDeliveryId": 6789, "lastModified": transfer["lastModified"], "packages": [ { "id": p["id"], "receivedQuantity": p["shippedQuantity"], "receivedUnitOfMeasureId": unit_ids[p["shippedUnitOfMeasureAbbreviation"]], "locationId": locations[0]["id"], } for p in packages ], }], ) ``` Receiving the shipped quantity unchanged is the simple case. Two things complicate it. ### Variances If `receivedQuantity` differs from what was shipped, that is a variance and Metrc refuses it unless you say so: ``` {"id": 222333, "receivedQuantity": 9.0, "receivedUnitOfMeasureId": 1, "locationId": 505, "confirmVariance": True} ``` ### Rejecting individual packages A rejected package needs a reason, and `locationId` / `receivedQuantity` stop being required for it; it is not entering your inventory. ``` reason = next( r for r in inputs["actionReasons"] if r["forRejectedTransferPackages"] ) {"id": 222333, "rejected": True, "rejectedReasonId": reason["id"], "reasonNote": "Seal broken in transit"} ``` `reasonNote` is required when the reason you picked has `requiresNote: true`. Check the flag rather than always sending one; an unexpected note is as rejectable as a missing one. ### Fields that vary by state | Field | Sent in | | --------------- | ---------------------------- | | `locationId` | everywhere except California | | `sublocationId` | Maine and Michigan only | | `rIdQrScanned` | California and Michigan only | T3 drops `locationId` and `sublocationId` where your state does not use them, so sending `locationId` from a California session is harmless. It does **not** invent the fields your state requires. ### `wholesalePrice` Required per-package only when the transfer type has `transactionType="Wholesale"`; see [Choosing a transfer type](https://wiki.trackandtrace.tools/t3-api/creating-transfers/#choosing-a-transfer-type). ## Taking back a rejection When a recipient rejects packages, they travel back and the **shipper** books them in. This is a different endpoint from receiving, with different field names. Read the transfer's delivery id, `lastModified` and package ids from its inputs first: ``` detail = requests.get( f"{API}/v2/transfers/rejected/receive/inputs", params={**PARAMS, "transferId": 12345}, headers=HEADERS, ).json()["details"][0] requests.post( f"{API}/v2/transfers/rejected/receive", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{ "id": 12345, "shipmentDeliveryId": detail["shipmentDeliveryId"], "lastModified": detail["lastModified"], "packages": [{ "id": 222333, "locationId": 505, "receiverRejectedReasonId": 9, "receiverReasonNote": "Seal broken in transit", }], }], ) ``` `receiverRejectedReasonId`, not `rejectedReasonId` The two payloads look alike, but taking back a rejection uses `receiverRejectedReasonId` and `receiverReasonNote`. A payload built for `/v2/transfers/receive` will not work here. There is also no `receivedQuantity`, `receivedUnitOfMeasureId`, `confirmVariance` or `wholesalePrice`; nothing is being accepted, only booked back in. ## The transporter's view, the hub A transporter carrying someone else's manifest works from the hub, not the transfer listing. Each leg moves through five states, each its own endpoint, all taking the same two fields: ``` delivery = requests.get(f"{API}/v2/transfers/hub", params=PARAMS, headers=HEADERS).json()["data"][0] body = { "deliveryId": delivery["deliveryId"], "direction": delivery["transporterDirectionName"], # "Outbound" or "Return" } for action in ["accept", "depart", "check-in", "check-out", "arrive"]: requests.post( f"{API}/v2/transfers/hub/{action}", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=body, ) ``` That loop is illustrative, not a recipe: each transition has preconditions, and Metrc rejects one taken out of order: | Action | Meaning | Requires | | ----------- | ----------------------------- | ---------- | | `accept` | The transporter takes the job | nothing | | `depart` | Left the origin | accepted | | `check-in` | Arrived at a layover | departed | | `check-out` | Left a layover | checked in | | `arrive` | Reached the destination | departed | `check-in` and `check-out` only apply to a layover. A direct run is `accept` → `depart` → `arrive`. Metrc's UI chains accept and depart Pressing **Depart** in Metrc on a delivery that has not been accepted quietly sends `accept` and then `depart`. The T3 endpoints are the primitives, so if you want that behaviour, send both. ### Correcting transport details Route, times, drivers and vehicles on a delivery already in flight: ``` requests.post( f"{API}/v2/transfers/hub/update", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{ "id": delivery["id"], "shipmentDeliveryId": delivery["deliveryId"], "transporterDirection": "Outbound", "estimatedDepartureDateTime": "2026-05-23T21:22:35", "estimatedArrivalDateTime": "2026-05-24T09:00:00", "plannedRoute": "I-70 west to Columbia, then US-63 north", "transporterDetails": [{ "driverName": "Jane Doe", "driverOccupationalLicenseNumber": "LIC12345", "driverLicenseNumber": "D1234567", "vehicleMake": "Ford", "vehicleModel": "Transit", "vehicleLicensePlateNumber": "ABC1234", }], }], ) ``` This cannot change what is being shipped; the shipper changes that with `POST /v2/transfers/update` (see the [interactive docs](https://api.trackandtrace.tools/v2/docs/#/Transfers)). Saved drivers and vehicles are available from `/v2/transfers/create/inputs`, but every field here is free text, so a driver who is not on file can still be entered. ## Notes A note is attached to a transfer, visible to both parties, and **cannot be edited**: correcting one means voiding it and adding a replacement. ``` reasons = requests.get( f"{API}/v2/transfers/notes/inputs", params=PARAMS, headers=HEADERS ).json()["actionReasons"] reason = next(r for r in reasons if r["forTransferNotes"]) requests.post( f"{API}/v2/transfers/notes/create", params={**PARAMS, "submit": "true"}, headers=HEADERS, json=[{ "shipmentPlanId": 12345, "reasonId": reason["id"], "note": "Driver rerouted around a road closure on I-70", }], ) ``` `shipmentPlanId` is the transfer's own `id`. Voiding takes the note's ID: ``` requests.post( f"{API}/v2/transfers/notes/void", params={**PARAMS, "submit": "true"}, headers=HEADERS, json={"id": 4321}, ) ``` ## Next Steps - [Creating Transfers](https://wiki.trackandtrace.tools/t3-api/creating-transfers/index.md): the shipper's side - [Supercollections](https://wiki.trackandtrace.tools/t3-api/supercollections/index.md): pull a transfer with its packages and transporters in one request - [Reports and Spreadsheet Sync](https://wiki.trackandtrace.tools/reports/index.md): transfer data into a spreadsheet - Example scripts: [`transfers/download-manifest-pdfs.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/transfers/download-manifest-pdfs.py) (download manifest PDFs), [`transfers/download-transfer-coa-pdfs.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/transfers/download-transfer-coa-pdfs.py) (download the COA PDFs for a transfer's packages). # Retail ID Labels Metrc's Retail ID program puts a QR code on each retail unit. You download a set of codes for a package, then print them as labels. This page covers doing that through the API. The API gives you the codes as CSV rows, which you can turn into labels with the [Label Studio](https://wiki.trackandtrace.tools/t3-labels/retail-id/index.md). | Endpoint | What it does | | -------------------------------------------------------------------------- | -------------------------------------------- | | `GET /v2/packages/product-labels/download/source-packages` | Packages you can download labels for | | `POST /v2/packages/product-labels/download` | Issue labels for packages | | `GET /v2/packages/product-labels/print/csv` | Read one issued set as CSV rows | | `GET /v2/packages/product-labels/print/worker` | Read one set issued with `"format": "pdf"` | | `GET /v2/packages/product-labels` | Packages that have labels | | `GET /v2/packages/product-labels/download-history?packageId=` | The sets issued for one package | | `POST /v2/packages/product-labels/redownload` | Fetch a set issued earlier | | `GET /v2/packages/product-labels/download/compliance-templates?packageId=` | California's label templates for one package | Downloading labels is a write: it is a **dry run by default**, and with `submit=true` Metrc issues the labels. Metrc offers no way to withdraw them. Avoid labelling bulk material: its child packages then cannot get labels of their own. ## Downloading and printing A download answers with Metrc's response under `metrcResponse`. Each entry in its `result` names one issued set. Pass its `issuanceId` and `labelSet` to the print endpoint for its `format`. ``` import requests API = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {ACCESS_TOKEN}"} PARAMS = {"licenseNumber": "RET00001"} answer = requests.post( f"{API}/v2/packages/product-labels/download", params={**PARAMS, "submit": "true"}, json=[{"packageId": 12345, "labelQuantity": 100, "format": "csv"}], headers=HEADERS, ).json() for issued in answer["metrcResponse"]["result"]: if not issued.get("issuanceId"): print("Metrc refused this entry:", issued) continue rows = requests.get( f"{API}/v2/packages/product-labels/print/csv", params={**PARAMS, "issuanceId": issued["issuanceId"], "labelSet": issued.get("labelSet")}, headers=HEADERS, ).json()["csv"] header, labels = rows[0], rows[1:] print(header, len(labels), "labels") ``` A `"message": "Success"` means Metrc accepted the request. Metrc can still refuse one entry inside it, so check each entry for an `issuanceId` as above. For `"format": "pdf"`, read the set from `/print/worker` instead. An entry whose `format` is `newPdf` reads the same way. ## Fetching labels again Each package on `GET /v2/packages/product-labels` keeps a download history, one row per set. Redownload fetches a set issued earlier, and answers the same way as a download. ``` history = requests.get( f"{API}/v2/packages/product-labels/download-history", params={**PARAMS, "packageId": 12345}, headers=HEADERS, ).json()["data"] answer = requests.post( f"{API}/v2/packages/product-labels/redownload", params={**PARAMS, "submit": "true"}, json={"id": 12345, "format": "csv", "labelSet": history[0]["labelSet"]}, headers=HEADERS, ).json() ``` Leave out `labelSet` to send none. ## Staged labels In California and Michigan, Metrc can issue labels for a tag before any package carries it. Every endpoint above has a staged twin under `/v2/packages/staged-product-labels`: `download`, `redownload`, `download-history?tagId=`, `download/source-tags`, `download/inputs` and `download/compliance-templates?tagId=`. Downloads, history and compliance templates take a `tagId` instead of a `packageId`; `redownload` takes `id`, as it does for packages. The print endpoints serve both. ## California compliance templates California's form offers label templates. Read a package's with `GET /v2/packages/product-labels/download/compliance-templates?packageId=12345`, then send the chosen template's `template` as `complianceLabelTemplate` and its `templateId` with the download. Both are optional. ## Next Steps - Turn the CSV rows into printable labels: [Retail ID QR Code Labels](https://wiki.trackandtrace.tools/t3-labels/retail-id/index.md). - Check what your account may do first with [Permissions](https://wiki.trackandtrace.tools/t3-api/permissions/index.md). # Scan Sheets A **scan sheet** is a reconciliation aid for a transfer manifest. Each row is one package. One column holds the tag Metrc says should be in the shipment; the column next to it is left empty for a warehouse worker to fill in with a barcode scanner as they physically scan each package. The sheet colours itself as they go, so a worker can see at a glance whether every expected tag was scanned exactly once, without leaving the spreadsheet and without anything being recalculated server-side. If you are looking for the version built into the Chrome Extension, see [Scan Sheets](https://wiki.trackandtrace.tools/t3-chrome-extension/scan-sheets/index.md). This page covers the API, which produces the same sheet from a single URL, so it can be scheduled, scripted, or emailed. ## Asking for one A scan sheet is not a separate endpoint. It is a `transform` applied to a transfer manifest report, because it loads exactly the same data that report already loads: ``` https://api.trackandtrace.tools/v2/transfers/incoming/manifest/report ?secretKey=YOUR_SECRET_KEY &licenseNumber=EX-00001 &transform=scanSheet &contentType=googleSheets ``` That returns a `302` redirect to a new Google Sheet. Swap `contentType=xlsx` to download a workbook instead. Those are the only two formats. See [Restrictions](#restrictions). One endpoint per transfer list: | Direction | Endpoint | | -------------------------- | ------------------------------------------------- | | Incoming | `/v2/transfers/incoming/manifest/report` | | Incoming, already received | `/v2/transfers/incoming/inactive/manifest/report` | | Outgoing | `/v2/transfers/outgoing/manifest/report` | | Outgoing, already received | `/v2/transfers/outgoing/inactive/manifest/report` | | Rejected | `/v2/transfers/rejected/manifest/report` | | Hub | `/v2/transfers/hub/manifest/report` | Each sheet covers one direction. The `Transfer Type` column is still there, so the layout is the same everywhere and you can stack exports, but within a single sheet it is constant. ## Filtering to the manifests you care about Without a filter you get every active transfer for the license, which is rarely what you want at a loading dock. Filter by manifest number, repeating `filter` once per manifest and setting `filterLogic=or`: ``` https://api.trackandtrace.tools/v2/transfers/incoming/manifest/report ?secretKey=YOUR_SECRET_KEY &licenseNumber=EX-00001 &transform=scanSheet &contentType=googleSheets &filter=manifestNumber__eq:0000123456 &filter=manifestNumber__eq:0000123457 &filterLogic=or ``` **`filterLogic=or` is required here.** The default is `and`, and no transfer has two different manifest numbers, so leaving it off returns an empty sheet rather than an error. **The filter selects transfers, not packages.** Every package on a matched manifest appears on the sheet; there is no way to filter within a manifest, and a field that belongs to a package rather than a transfer (`packagedDate`, say) is rejected with a 400 listing the fields you can filter on. In Python: ``` import requests MANIFESTS = ["0000123456", "0000123457"] response = requests.get( "https://api.trackandtrace.tools/v2/transfers/incoming/manifest/report", params=[ ("secretKey", SECRET_KEY), ("licenseNumber", "EX-00001"), ("transform", "scanSheet"), ("contentType", "googleSheets"), ("filterLogic", "or"), *[("filter", f"manifestNumber__eq:{m}") for m in MANIFESTS], ], allow_redirects=False, ) print(response.json()["sheetUrl"]) ``` The body carries the same URL as the `Location` header, so you do not have to follow the redirect to get the link. To download the workbook instead: ``` response = requests.get( "https://api.trackandtrace.tools/v2/transfers/incoming/manifest/report", params={ "secretKey": SECRET_KEY, "licenseNumber": "EX-00001", "transform": "scanSheet", "contentType": "xlsx", }, ) with open("scan-sheet.xlsx", "wb") as handle: handle.write(response.content) ``` Or have it emailed, which has no request timeout and is the right choice for a large sheet: ``` &delivery=email&email=warehouse@example.com ``` ## The columns | Column | Contents | | ------------------ | ------------------------------------------------- | | `License` | The license this transfer belongs to | | `Transfer Type` | `INCOMING`, `OUTGOING`, `REJECTED` or `HUB` | | `Manifest Number` | The manifest this package is on | | `Origin` | Shipping facility, as `NAME (LICENSE)` | | `Destination` | Receiving facility | | `Package Contents` | Quantity, unit and product name | | `Package Tag` | **The expected tag.** This is what gets checked. | | `Scanned Tags` | **Left empty.** This is what the worker fills in. | ## The colours All of it is driven by `COUNTIF` formulas comparing the two tag columns. Nothing is computed when the sheet is generated, it updates live as tags are typed or scanned in. | Colour | Where | Meaning | | --------- | -------------- | ----------------------------------------------------------- | | 🔴 Red | `Package Tag` | Not scanned yet | | 🟢 Green | `Package Tag` | Scanned exactly once, matched | | 🟡 Yellow | `Package Tag` | Scanned more than once | | 🟡 Yellow | `Scanned Tags` | You entered the same tag twice | | 🟠 Orange | `Scanned Tags` | You scanned a tag that is not on any manifest in this sheet | **An empty cell is never coloured**, so the untouched `Scanned Tags` column and the blank rows below the data stay plain until something is entered. So a fresh sheet is entirely red down the `Package Tag` column with a blank `Scanned Tags` column beside it, and a correctly received shipment ends up entirely green. Anything left red at the end is missing; anything orange arrived that should not have. The colouring extends about 200 rows past the last package, so a tag scanned into empty space below the data still turns orange rather than sitting there unremarked. ## Restrictions - **`contentType` must be `xlsx` or `googleSheets`.** `csv` and `json` return a `400`, because neither can carry the cell formatting the sheet depends on. - **`columns`, `columnHeaderOverrides` and `metadata` cannot be combined with `transform`.** The scan sheet defines its own columns. Sending any of them returns a `400`. - **`prependCsvMetadata=true` cannot be combined with `transform`.** The preamble is omitted automatically; only an explicit `true` is an error. - **10,000 rows maximum.** Rows are packages, not transfers. Filter by manifest number. ## Moving from Exports (Legacy) The extension's [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/index.md) builder produces its scan sheets through this API, so what it generates matches this page exactly. Compared with the older [Exports (Legacy)](https://wiki.trackandtrace.tools/t3-chrome-extension/exports/index.md) tool: - **One sheet per direction.** To reconcile more than one direction, generate more than one sheet. - **Manifest numbers keep their leading zeros**, so they match what Metrc shows. ## Speed and limits A scan sheet shares a cached result with the manifest report it is built from, so running the report and then the scan sheet with the same filters returns the second one immediately. Manifest reports load packages and transporters for every transfer, so they are slower than other reports and reach their size limit sooner. See [Transfer manifest reports](https://wiki.trackandtrace.tools/reports/endpoints/#transfer-manifest-reports-work-differently-from-every-other-report). ## Next Steps - Generate one from the browser instead: [Scan Sheets in the Chrome Extension](https://wiki.trackandtrace.tools/t3-chrome-extension/scan-sheets/index.md). - Build the underlying manifest report with [T3 API Reports](https://wiki.trackandtrace.tools/reports/index.md). - [Start your free 30-day T3+ trial](https://dash.trackandtrace.tools) # Tuning Search Results ## Tuning Result Volume with `pageSize` The `pageSize` parameter controls how many matches each collection may return. It defaults to **10** and is capped at **100**. Use a larger `pageSize` when the default isn't enough; for example, when a license has many similarly-named items and the top 10 from each endpoint isn't covering the matches you're looking for. Use a smaller `pageSize` when the request is purely a "did anything match" check. ``` curl 'https://api.trackandtrace.tools/v2/search?licenseNumber=LIC-00001&query=Blue%20Dream&pageSize=50' \ -H 'Authorization: Bearer ' ``` `pageSize` applies uniformly to every queried endpoint. Out-of-range values (`< 1` or `> 100`) return `400 Bad Request`. If you're not sure whether a higher `pageSize` would yield more results, look at `endpoints` in the response: any entry with `truncated: true` had more matches available than your `pageSize` returned, and `totalAvailable` reports Metrc's count. ## Scores A result's `score` is in `[0, 1]` and comes from the field that matched best. Every field is scored the same way, by how close the query falls to either end of the value: | Where the query falls | Score | Example, for the query `Blue Dream` | | --------------------- | ---------------------------------------------------------------- | ----------------------------------------------------- | | The whole value | `1.0` | the strain `Blue Dream` | | Touching either end | `0.8` | the items `Blue Dream 3.5g` and `Gelato x Blue Dream` | | Further in | `0.05` less per character from the nearer end, never below `0.2` | `Organic Blue Dream Pre-Roll`: 8 characters in, `0.4` | So a tag tail ranks high however the tag starts, and a tail still being typed stays close behind: typing `12345` for a package whose label ends `123456` scores it `0.75`, one character short of the end. Case and surrounding spaces are ignored, but zero padding is part of the value: `123456` touches the end of manifest `0000123456` (`0.8`); all ten digits are an exact match. **Secondary fields count for less.** The score is multiplied by the field's weight. A package's label and item name count fully; a match on its production batch, strain, source tags, harvests, location or category counts progressively less, so an object's own identifier outranks a coincidental match elsewhere. The same applies to a transfer's facility. **Tier 1 wins equal matches.** Scores from tier 2 and tier 3 collections are multiplied by `0.9`. When `54321` ends a label that is an active package on one license, a transferred package on another and a used tag on a third, the active package ranks first (`0.8`, against `0.72` for the other two), whichever order you named the licenses in. A clearly better match still wins: an exact strain name (`0.9`) outranks an item name that only starts with the query (`0.8`). Within one collection, equal scores go to the value the query covers more of, so `Blue Dream 3.5g` comes before `Blue Dream Cartridge 1g`. `matchedFields` lists every field that matched, best first, with its weighted `score` and its `matchType`: `EXACT`, `PREFIX`, `SUFFIX` or `PARTIAL`. Use it to highlight the match or say why a result appeared. A row in which the query matches no searched field is never returned. ``` for match in body["data"]: best = match["matchedFields"][0] print(match["t3EndpointId"], f"{best['matchType']} on {best['field']}", match["score"]) ``` Every match is returned, best first, up to `pageSize` per collection. `minScore` was removed; sending it is a `400`. ## Streaming Responses (SSE) For interactive UIs that want to render results as soon as each collection answers (instead of waiting for the slowest one), `/search` can stream Server-Sent Events. There are two equivalent ways to opt in: - Add `?stream=true` to the URL (easy to test from `curl`, easy to document). - Send `Accept: text/event-stream` (what `EventSource` does natively). The response is a `text/event-stream` body with these events, in order: - **`event: start`**: first. Every endpoint the search covers, as `pending` or `skipped`, with `detectedQueryFormats` and the resolved `request`. - **`event: result`**: one per sent endpoint, in completion order (fastest first). The endpoint's entry from `endpoints` (status, reason, totals) plus its `results`, each shaped like an entry of `data`, best first. - **`event: done`**: last. Every endpoint's final state in `endpoints`. - **`event: error`**: instead of `done`, when the search cannot finish. The problem details a JSON request would get, plus `endpoints`. `code: METRC_SESSION_EXPIRED` means authenticate again. When nothing new has arrived for about 250 ms, the server writes a comment line (`:`). Clients ignore it. Closing the connection cancels the rest of the search, so drop a stale search as soon as the query changes. Sample stream: ``` event: start data: {"endpoints":[{"t3EndpointId":"METRC_ACTIVE_PACKAGES","status":"pending",...},{"t3EndpointId":"METRC_ACTIVE_ITEMS","status":"skipped","reason":"format",...}],"detectedQueryFormats":["HEX_STRING"],"request":{"query":"1A4FF0100000022000000123","licenseNumber":"LIC-00001","licenseNumbers":["LIC-00001"],"pageSize":10,"t3EndpointIds":["METRC_ACTIVE_PACKAGES","METRC_ACTIVE_ITEMS"],"tiers":null}} : event: result data: {"t3EndpointId":"METRC_ACTIVE_PACKAGES","licenseNumber":"LIC-00001","status":"answered","reason":null,"resultCount":1,"truncated":false,"totalAvailable":1,"results":[{"t3EndpointId":"METRC_ACTIVE_PACKAGES","licenseNumber":"LIC-00001","tier":1,"objectType":"PACKAGE","score":1.0,"isExactMatch":true,"matchedFields":[{"field":"label","score":1.0,"matchType":"EXACT"}],"matchedEntry":{"...":"..."}}],...} event: done data: {"endpoints":[{"t3EndpointId":"METRC_ACTIVE_PACKAGES","status":"answered",...},{"t3EndpointId":"METRC_ACTIVE_ITEMS","status":"skipped","reason":"format",...}]} ``` Python usage: ``` import json import requests with requests.get( "https://api.trackandtrace.tools/v2/search", params={"licenseNumber": "LIC-00001", "query": "Blue Dream", "stream": "true"}, headers={"Authorization": "Bearer "}, stream=True, ) as response: event = None for line in response.iter_lines(decode_unicode=True): if line.startswith("event: "): event = line[len("event: "):] elif line.startswith("data: ") and event == "result": result = json.loads(line[len("data: "):]) print(result["t3EndpointId"], result["status"], len(result["results"])) ``` Browser usage with `EventSource`. `EventSource` cannot send an `Authorization` header, so pass a [secret key](https://wiki.trackandtrace.tools/t3-api/authentication/#secret-key-authentication) in the URL, and only from code you control: ``` const params = new URLSearchParams({ licenseNumber: 'LIC-00001', query: 'Blue Dream', secretKey: SECRET_KEY, }); const source = new EventSource(`https://api.trackandtrace.tools/v2/search?${params}`); source.addEventListener('result', (e) => { const { t3EndpointId, status, results } = JSON.parse(e.data); // Render incrementally }); source.addEventListener('done', () => source.close()); source.addEventListener('error', () => source.close()); ``` curl usage: ``` curl -N 'https://api.trackandtrace.tools/v2/search?licenseNumber=LIC-00001&query=Blue%20Dream&stream=true' \ -H 'Authorization: Bearer ' ``` (`-N` disables curl's output buffering so events appear as they arrive.) Note The SSE stream emits results in **completion order**, not score order. Each event's own `results` array is sorted by score, but the global ranking that JSON mode produces requires the client to merge events as they arrive. To match it, sort the merged results by `score` descending, then by their endpoint's position in the `start` event's `endpoints`, keeping each event's own order for the rest. ## Limits and Behavior - **Per-endpoint cap of `pageSize` matches.** Each endpoint returns at most `pageSize` results (default 10, max 100). Watch `truncated` in `endpoints` to know when raising `pageSize` would yield more. - **10 second deadline.** Every endpoint must answer within 10 seconds of the search starting, so one slow endpoint can't hold up the rest. An endpoint that misses it is `failed` with reason `timeout`. In SSE mode its `result` event still fires. - **Latency varies by endpoint.** Tag, item, location, and strain searches typically return in well under a second. Package, plant, and especially transfer searches can take several seconds. SSE mode delivers fast endpoints' results first. - **Rate limit.** Search has its own budget per Metrc user, separate from the limit your other requests share: 5,000 license and collection pairs a minute by default. A search costs its licenses times its collections, so `tiers=1` on one license costs 6, and every collection costs 39. Over the budget, the response is `429`. - **Narrow scope for speed.** `tiers=1` searches only the six collections most searches are answered by. If you know the kind of object you're after, pass `t3EndpointIds` to drop everything else: a query against `t3EndpointIds=METRC_AVAILABLE_TAGS,METRC_USED_TAGS` is much faster than the default tiers. - **Several licenses in one request.** Repeat `licenseNumber` to search several licenses at once, up to 60 license and collection pairs. See [Searching Several Licenses](https://wiki.trackandtrace.tools/t3-api/search/#searching-several-licenses). - **Free.** No T3+ subscription required. ## Next Steps - Back to the endpoint catalog and response shape: [Search](https://wiki.trackandtrace.tools/t3-api/search/index.md). - Check what your account may query first with [Permissions](https://wiki.trackandtrace.tools/t3-api/permissions/index.md). # Search The `/v2/search` endpoint provides a single text-search entry point across the most commonly searched Metrc collections. Hand it a tag, a manifest number, an item name, or a partial label, and it returns a ranked list of every matching object across the relevant Metrc collections, without you having to know which collection to look in. A T3+ subscription is **not** required to use this endpoint. ``` flowchart LR Q["query=1A4FF01..."] --> D["Detected format:
HEX_STRING"] D --> C["Every collection with a field
that holds that kind of value"] D -.-> SK(["Other collections:
skipped, reason format"]) C --> R["One list,
sorted by score"] ``` ## How a Search Works 1. **The query's format decides where it is looked for.** The query is classified as one or more of `DATETIME`, `HEX_STRING`, `INTEGER` and `BASIC_STRING`; `"12345"` is both `INTEGER` and `HEX_STRING`. Each field is searched only for the formats it can hold, so `"Blue Dream"` (`BASIC_STRING`) skips the tag and sales receipt collections. A skipped collection is reported in `endpoints` as `skipped` with reason `format`. 1. **The default set covers tiers 1 and 2, the 17 most-used collections.** Pass `tiers` to choose how deep to search, or `t3EndpointIds` to search exactly the collections you name. See [Choosing What to Search](#choosing-what-to-search). Each collection is named by the [T3 endpoint id](https://wiki.trackandtrace.tools/t3-api/t3-endpoint-ids/index.md) of its list endpoint: `METRC_ACTIVE_PACKAGES` for `/v2/packages/active`. 1. **Each collection returns up to `pageSize` matches** (default 10, max 100). A partial tag or number ranks values that **end with** it first, so `0042` finds labels ending in `0042` before labels that merely contain it. A complete 24-character tag is matched exactly, along with the packages made from it (`sourcePackageLabels`). 1. **Results come back as one list.** Each match is scored on every field it was searched on, its `score` is the best of them, and the list is sorted by `score` descending. See [Tuning Search Results](https://wiki.trackandtrace.tools/t3-api/search-tuning/#scores). ## Query Formats Format detection determines which endpoints are eligible. The detection is greedy; a single query can satisfy multiple formats simultaneously, in which case it unlocks the union of their endpoints. | Format | Detection rule | Example | | -------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- | | `DATETIME` | ISO 8601 date or datetime: `^\d{4}-\d{2}-\d{2}(T...)?$` | `2024-07-17` | | `HEX_STRING` | Only hex characters (`0-9a-fA-F`), with at least one digit | `1A4FF0100000022000000123`, `0042`, `B52` | | `INTEGER` | Only digits | `12345` | | `BASIC_STRING` | Anything that is neither only digits nor tag-like. A hex query is tag-like when it starts with `1A` or is 8 or more characters long | `Blue Dream`, `ACDC`, `B52` | A word that happens to be hex, such as `ACDC` or `Cafe`, has no digit, so it is searched as a name. A short hex query with a digit, such as `B52`, could be the end of a tag or a strain name, so it is both `HEX_STRING` and `BASIC_STRING`. Note No endpoint searches date fields. A pure `DATETIME` query (e.g. `2024-07-17`) is rejected with a `400`. Use a tag, label, manifest number, or name instead. ## Endpoint Catalog The 39 endpoints `/search` can query, by [T3 endpoint id](https://wiki.trackandtrace.tools/t3-api/t3-endpoint-ids/index.md), with the kind of object each holds, its tier, and the fields it searches. Tag fields (`label`, `packageLabel`, `sourcePackageLabels`) are searched for `HEX_STRING` and `INTEGER` queries, number fields (`manifestNumber`, `receiptNumber`, `batchNumber`, `number`) for `INTEGER` queries, code fields (`productionBatchNumber` and the tag order numbers) for every query except a complete 24-character tag, and name fields for `BASIC_STRING` queries. | T3 endpoint id | Object type | Tier | Tag, number or code fields | Name fields | | ----------------------------------- | ------------------- | ---- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | | `METRC_ACTIVE_PACKAGES` | `PACKAGE` | 1 | `label`, `sourcePackageLabels`, `productionBatchNumber` | `item.name`, `item.strainName`, `sourceHarvestNames`, `locationName`, `item.productCategoryName` | | `METRC_INTRANSIT_PACKAGES` | `PACKAGE` | 2 | `label`, `sourcePackageLabels`, `productionBatchNumber` | `item.name`, `item.strainName`, `sourceHarvestNames`, `locationName`, `item.productCategoryName` | | `METRC_ONHOLD_PACKAGES` | `PACKAGE` | 3 | `label`, `sourcePackageLabels`, `productionBatchNumber` | `item.name`, `item.strainName`, `sourceHarvestNames`, `locationName`, `item.productCategoryName` | | `METRC_INACTIVE_PACKAGES` | `PACKAGE` | 3 | `label`, `sourcePackageLabels`, `productionBatchNumber` | `item.name`, `item.strainName`, `sourceHarvestNames`, `locationName`, `item.productCategoryName` | | `METRC_TRANSFERRED_PACKAGES` | `PACKAGE` | 2 | `packageLabel`, `sourcePackageLabels` | `productName`, `itemStrainName`, `sourceHarvestNames`, `productCategoryName` | | `METRC_LAB_SAMPLE_PACKAGES` | `PACKAGE` | 3 | `label`, `sourcePackageLabels`, `productionBatchNumber` | `item.name`, `item.strainName`, `sourceHarvestNames`, `locationName`, `item.productCategoryName` | | `METRC_VEGETATIVE_PLANTS` | `PLANT` | 1 | `label` | `strainName`, `locationName` | | `METRC_FLOWERING_PLANTS` | `PLANT` | 1 | `label` | `strainName`, `locationName` | | `METRC_ONHOLD_PLANTS` | `PLANT` | 3 | `label` | `strainName`, `locationName` | | `METRC_INACTIVE_PLANTS` | `PLANT` | 3 | `label` | `strainName`, `locationName` | | `METRC_ACTIVE_MOTHER_PLANTS` | `PLANT` | 2 | `label` | `strainName`, `locationName` | | `METRC_ONHOLD_MOTHER_PLANTS` | `PLANT` | 3 | `label` | `strainName`, `locationName` | | `METRC_INACTIVE_MOTHER_PLANTS` | `PLANT` | 3 | `label` | `strainName`, `locationName` | | `METRC_ACTIVE_PLANTBATCHES` | `PLANT_BATCH` | 1 | | `name`, `strainName`, `locationName` | | `METRC_ONHOLD_PLANTBATCHES` | `PLANT_BATCH` | 3 | | `name`, `strainName`, `locationName` | | `METRC_INACTIVE_PLANTBATCHES` | `PLANT_BATCH` | 3 | | `name`, `strainName`, `locationName` | | `METRC_ACTIVE_HARVESTS` | `HARVEST` | 1 | | `name` | | `METRC_ONHOLD_HARVESTS` | `HARVEST` | 3 | | `name` | | `METRC_INACTIVE_HARVESTS` | `HARVEST` | 3 | | `name` | | `METRC_HARVEST_SCHEDULES` | `HARVEST_SCHEDULE` | 3 | `batchNumber` | `locationName` | | `METRC_INCOMING_ACTIVE_TRANSFERS` | `TRANSFER` | 2 | `manifestNumber` | `shipperFacilityInfo` | | `METRC_INCOMING_INACTIVE_TRANSFERS` | `TRANSFER` | 3 | `manifestNumber` | `shipperFacilityInfo` | | `METRC_OUTGOING_ACTIVE_TRANSFERS` | `TRANSFER` | 2 | `manifestNumber` | `deliveryFacilities` | | `METRC_OUTGOING_REJECTED_TRANSFERS` | `TRANSFER` | 2 | `manifestNumber` | `deliveryFacilities` | | `METRC_OUTGOING_INACTIVE_TRANSFERS` | `TRANSFER` | 3 | `manifestNumber` | `deliveryFacilities` | | `METRC_HUB_TRANSFERS` | `TRANSFER` | 3 | `manifestNumber` | | | `METRC_TRANSFER_TEMPLATES` | `TRANSFER_TEMPLATE` | 3 | | `name`, `deliveryFacilities` | | `METRC_ACTIVE_SALES` | `SALES_RECEIPT` | 2 | `receiptNumber` | | | `METRC_INACTIVE_SALES` | `SALES_RECEIPT` | 3 | `receiptNumber` | | | `METRC_ACTIVE_PROCESSING_JOBS` | `PROCESSING_JOB` | 3 | `number` | `name`, `jobTypeName` | | `METRC_INACTIVE_PROCESSING_JOBS` | `PROCESSING_JOB` | 3 | `number` | `name`, `jobTypeName` | | `METRC_ACTIVE_ITEMS` | `ITEM` | 1 | | `name`, `strainName` | | `METRC_ACTIVE_STRAINS` | `STRAIN` | 2 | | `name` | | `METRC_ACTIVE_LOCATIONS` | `LOCATION` | 2 | | `name` | | `METRC_AVAILABLE_TAGS` | `TAG` | 2 | `label` | | | `METRC_USED_TAGS` | `TAG` | 2 | `label` | | | `METRC_VOIDED_TAGS` | `TAG` | 3 | `label` | | | `METRC_CURRENT_TAG_ORDERS` | `TAG_ORDER` | 3 | `orderNumber`, `trackingNumber`, `purchaseOrderNumber` | | | `METRC_HISTORY_TAG_ORDERS` | `TAG_ORDER` | 3 | `orderNumber`, `trackingNumber`, `purchaseOrderNumber` | | `METRC_HUB_TRANSFERS` is in tier 3 because a license that both ships and transports would otherwise get the same manifest twice. `METRC_LAB_SAMPLE_PACKAGES` returns one result per lab test, so a package with several tests appears once for each. ## Choosing What to Search Tier 1 holds the collections most searches are answered by, tier 2 the remaining active collections and transferred packages, and tier 3 on-hold, inactive and the rest. Choose how deep to search with `tiers`, or name exact collections with `t3EndpointIds`: | Request | Searches | | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | | Neither | Tiers 1 and 2, 17 collections | | `tiers=1` | Tier 1: active packages, vegetative and flowering plants, active plant batches, active harvests, items | | `tiers=3` | Tier 3 only | | `tiers=1,2,3` | All 39 collections | | `t3EndpointIds=METRC_ACTIVE_PACKAGES,METRC_INACTIVE_PACKAGES` | Exactly those two | Every collection selected is searched. Sending both `tiers` and `t3EndpointIds` is a `400`. Every result and every entry in `endpoints` carries its `tier` and `objectType`, so results can be grouped by kind of object whatever their state: ``` import requests response = requests.get( "https://api.trackandtrace.tools/v2/search", params={"licenseNumber": "LIC-00001", "query": "0000123", "tiers": "1,2,3"}, headers={"Authorization": "Bearer "}, ) for match in response.json()["data"]: print(match["objectType"], match["tier"], match["t3EndpointId"], match["score"]) ``` ## Searching Several Licenses Repeat `licenseNumber` to search several licenses in one request. Every collection is searched on every license: ``` import requests response = requests.get( "https://api.trackandtrace.tools/v2/search", params={ "licenseNumber": ["LIC-00001", "LIC-00002"], "query": "1A4FF0100000022000000123", }, headers={"Authorization": "Bearer "}, ) for match in response.json()["data"]: print(match["licenseNumber"], match["t3EndpointId"], match["score"]) ``` - Every result and every entry in `endpoints` carries its `licenseNumber`. - `endpoints` lists the licenses in the order you named them, and that order breaks ties between equal scores. - A comma-joined value (`licenseNumber=LIC-00001,LIC-00002`) is a `400`, and so is naming the same license twice. - **A search covers at most 60 license and collection pairs**: licenses times the collections searched on each. Three licenses fit the 17 default collections. To search more licenses, name fewer collections with `t3EndpointIds`: ten licenses fit six collections. ## Validation Rules `/search` rejects requests that can't produce useful results, with a `400 Bad Request`. The most common rejections: - **Empty `query`** (or whitespace-only). Provide a real query string. - **Pure ISO 8601 date/datetime `query`** (e.g. `2024-07-17`, `2024-07-17T20:26:07`): no endpoint searches date fields, so the request would silently return empty. Use a tag, label, manifest number, or name instead. - **Unknown `t3EndpointIds`**: the error message names the specific unrecognized IDs (not the whole list you sent) and says why each was refused. A supercollection id, such as `METRC_ACTIVE_SUPERPACKAGES`, names the collection to search instead. Empty entries, such as the one a trailing comma leaves, are ignored. - **A `tiers` value other than `1`, `2` or `3`**, or **both `tiers` and `t3EndpointIds`**. - **Out-of-range `pageSize`**: must be an integer in `[1, 100]`. - **`minScore`**: it was removed. Every match is returned, best first. - **A repeated or comma-joined `licenseNumber`**: name each license once, repeating the parameter. - **More than 60 license and collection pairs**: the error gives the count. Name fewer licenses, or fewer collections with `t3EndpointIds`. ## Response Shape Every successful response has the same four top-level keys. ``` { "data": [ { "t3EndpointId": "METRC_ACTIVE_PACKAGES", "licenseNumber": "LIC-00001", "tier": 1, "objectType": "PACKAGE", "score": 1.0, "isExactMatch": true, "matchedFields": [{ "field": "label", "score": 1.0, "matchType": "EXACT" }], "matchedEntry": { "...": "..." } }, { "t3EndpointId": "METRC_USED_TAGS", "licenseNumber": "LIC-00001", "tier": 2, "objectType": "TAG", "score": 0.9, "isExactMatch": true, "matchedFields": [{ "field": "label", "score": 0.9, "matchType": "EXACT" }], "matchedEntry": { "...": "..." } } ], "endpoints": [ { "t3EndpointId": "METRC_ACTIVE_PACKAGES", "licenseNumber": "LIC-00001", "tier": 1, "objectType": "PACKAGE", "status": "answered", "reason": null, "metrcStatusCode": null, "resultCount": 1, "truncated": false, "totalAvailable": 1 }, { "t3EndpointId": "METRC_INTRANSIT_PACKAGES", "licenseNumber": "LIC-00001", "tier": 2, "objectType": "PACKAGE", "status": "failed", "reason": "timeout", "metrcStatusCode": null, "resultCount": 0, "truncated": false, "totalAvailable": null }, { "t3EndpointId": "METRC_USED_TAGS", "licenseNumber": "LIC-00001", "tier": 2, "objectType": "TAG", "status": "answered", "reason": null, "metrcStatusCode": null, "resultCount": 1, "truncated": false, "totalAvailable": 1 }, { "t3EndpointId": "METRC_ACTIVE_ITEMS", "licenseNumber": "LIC-00001", "tier": 1, "objectType": "ITEM", "status": "skipped", "reason": "format", "metrcStatusCode": null, "resultCount": 0, "truncated": false, "totalAvailable": null } ], "detectedQueryFormats": ["HEX_STRING"], "request": { "query": "1A4FF0100000022000000123", "licenseNumber": "LIC-00001", "licenseNumbers": ["LIC-00001"], "pageSize": 10, "t3EndpointIds": ["METRC_ACTIVE_PACKAGES", "METRC_INTRANSIT_PACKAGES", "METRC_USED_TAGS", "METRC_ACTIVE_ITEMS"], "tiers": null } } ``` ### `data` Every result, sorted by `score` descending. Equal scores follow the order you named the licenses in, then the catalog order above, so a package comes before the used tag with the same label. The shape of `matchedEntry` depends on `t3EndpointId`: a match from `METRC_ACTIVE_PACKAGES` is a Metrc package, a match from `METRC_INCOMING_ACTIVE_TRANSFERS` is a Metrc transfer. | Field | Meaning | | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `tier` | The tier of the collection the result came from: `1`, `2` or `3`. | | `objectType` | The kind of object, whatever its state: `PACKAGE` for active, inactive and on-hold packages alike. See the catalog above. | | `score` | In `[0, 1]`. The best score among the fields that matched, times `0.9` outside tier 1. | | `isExactMatch` | The result's own identifier (its tag, its manifest, receipt, batch or order number, or its name) equals the query, ignoring case. Zero padding counts: `123456` is not manifest `0000123456`. | | `matchedFields` | Every field that matched, highest score first, each with its `score` and `matchType` (`EXACT`, `PREFIX`, `SUFFIX` or `PARTIAL`). Use it to highlight the match. See [Scores](https://wiki.trackandtrace.tools/t3-api/search-tuning/#scores). | ### `endpoints` Every endpoint the request covered, with how it ended: license by license in the order you named them, and in catalog order within each. | `status` | Meaning | | ---------- | ------------------------------------------ | | `answered` | Metrc answered. Its results are in `data`. | | `skipped` | Not sent. `reason` says why. | | `failed` | Sent but not answered. `reason` says why. | | `reason` | Meaning | | ------------- | ------------------------------------------------------------------------------------------------------------------------------------ | | `format` | The query's format fits none of the endpoint's fields. | | `forbidden` | The account cannot read this collection on this license. When T3 already knows this, the endpoint is `skipped` rather than `failed`. | | `timeout` | Metrc did not answer in time. | | `metrc_error` | Metrc answered with an error, or could not be reached. `metrcStatusCode` has Metrc's status when it answered. | | `session` | The Metrc session expired. Authenticate again. | | `internal` | The server failed to handle Metrc's answer. | `truncated` is `true` when Metrc had more matches than `pageSize` returned, and `totalAvailable` is Metrc's count. Raise `pageSize` or narrow the query to see the rest. ### `request` Echo The `request` object echoes the **resolved** request: values after defaults and trimming, and `t3EndpointIds` as the full set covered, whether named or default. `licenseNumbers` lists every license searched, in order; `licenseNumber` is the first of them. `tiers` is the tiers searched, `[1, 2]` when you named neither tiers nor ids, and `null` when you named `t3EndpointIds`. Useful for matching responses to requests when a client runs several searches at once. ### Errors Errors are RFC 7807 problem details, with `title`, `status`, `detail` and a machine-readable `code`. Besides the `400`s above: - `401` with `code: METRC_SESSION_EXPIRED`: the Metrc session expired during the search. Authenticate again and retry. - `403` with `code: FORBIDDEN`: a `licenseNumber` is not one of your session's licenses. The error names every such license. - `429` with `code: RATE_LIMIT_EXCEEDED`: search has its own budget per Metrc user, separate from the limit your other requests share. It is counted in license and collection pairs, 5,000 a minute by default: one license at the 17 default collections costs 17, three licenses cost 51. The error says what this search would have cost. ## Examples Substitute your API token (`Authorization: Bearer ...`) and license number into each example. **Python, list where a tag appears:** ``` import requests response = requests.get( "https://api.trackandtrace.tools/v2/search", params={"licenseNumber": "LIC-00001", "query": "1A4FF0100000022000000123"}, headers={"Authorization": "Bearer "}, ) body = response.json() for match in body["data"]: print(match["t3EndpointId"], match["score"], match["isExactMatch"]) for endpoint in body["endpoints"]: if endpoint["status"] == "failed": print("not searched:", endpoint["t3EndpointId"], endpoint["reason"]) ``` **Tag scan, find every collection a tag appears in:** ``` curl 'https://api.trackandtrace.tools/v2/search?licenseNumber=LIC-00001&query=1A4FF0100000022000000123' \ -H 'Authorization: Bearer ' ``` **Manifest number lookup, find a transfer by its manifest number:** ``` curl 'https://api.trackandtrace.tools/v2/search?licenseNumber=LIC-00001&query=1234566' \ -H 'Authorization: Bearer ' ``` This query is detected as `HEX_STRING` and `INTEGER`, so it searches every endpoint in the default tiers that accepts either: packages, plants, tags, transfers, and so on. **Item or strain name search, narrowed to items and strains for speed:** ``` curl 'https://api.trackandtrace.tools/v2/search?licenseNumber=LIC-00001&query=Blue%20Dream&t3EndpointIds=METRC_ACTIVE_ITEMS,METRC_ACTIVE_STRAINS' \ -H 'Authorization: Bearer ' ``` **Include inactive packages in a label search:** ``` curl 'https://api.trackandtrace.tools/v2/search?licenseNumber=LIC-00001&query=0000123&t3EndpointIds=METRC_ACTIVE_PACKAGES,METRC_INTRANSIT_PACKAGES,METRC_INACTIVE_PACKAGES' \ -H 'Authorization: Bearer ' ``` ## Next Steps - Control result volume and stream results with [Tuning Search Results](https://wiki.trackandtrace.tools/t3-api/search-tuning/index.md). - Load a full record once you have found it, by the id `/search` returned: [Loading One Record by ID](https://wiki.trackandtrace.tools/t3-api/object-lookup/index.md). - Load full records in bulk: [Supercollections](https://wiki.trackandtrace.tools/t3-api/supercollections/index.md). - Check what your account may query with [Permissions](https://wiki.trackandtrace.tools/t3-api/permissions/index.md). - Example script: [`basics/search.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/basics/search.py) (search one or more licenses and save the hits). # Setting Up Python You only need a basic knowledge of using the command line to run T3 API Python scripts. This knowledge can be picked up very quickly. ______________________________________________________________________ ### TL;DR 1. Open the command line 1. Install [UV](https://docs.astral.sh/uv/getting-started/) 1. Install Python: `uv python install` 1. Log in to T3 once: `uvx --from t3api-utils t3api login` (see [Logging In](https://wiki.trackandtrace.tools/t3-api/api-scripts/#logging-in)) ______________________________________________________________________ ### Learning to use the Command Line #### What is the Command Line? The command line, also called the terminal or shell, is an interface that lets you interact with your computer using text commands. It’s especially useful for running programs like Python scripts without needing a graphical interface. #### Opening the Command Line To open the command line: - **Windows**: - Press `Win + R`, type `cmd`, and hit Enter for Command Prompt. - Or search for "PowerShell" or "Windows Terminal". - **macOS**: - Press `Command + Space`, type "Terminal", and press Enter. - **Linux**: - Press `Ctrl + Alt + T` or search for "Terminal" in your application menu. ______________________________________________________________________ #### Navigating Directories The command line is always "inside" a specific folder on your computer. To run a script, you need to open the terminal in the same folder or navigate to it manually using the `cd` command. ##### Open a terminal in the current folder: - **Windows**: - **Option 1**: Shift + Right-click inside a folder → “Open PowerShell window here” - **Option 2**: Type `cmd` or `powershell` in File Explorer’s address bar - **Option 3**: Use Windows Terminal from the Microsoft Store - **macOS**: - **Option 1**: Right-click in Finder → “New Terminal at Folder” - **Option 2**: In Terminal, type `cd` and drag the folder into the window - **Linux**: - **Option 1**: Right-click in file manager → “Open in Terminal” - **Option 2**: Navigate to folder, press `Ctrl + Alt + T` ______________________________________________________________________ ### Setting Up Your Environment For beginners, we recommend using [Python](https://www.python.org/) and [UV](https://docs.astral.sh/uv/getting-started/) to interact with the T3 API. All [T3 example scripts](https://github.com/classvsoftware/t3-api-examples) are written in Python. ______________________________________________________________________ #### Installing UV UV is a Python package and environment manager. It simplifies dependency handling, virtual environments, and even installs Python itself. - Use the [standalone installer](https://docs.astral.sh/uv/getting-started/installation/#standalone-installer) - This method does **not** require Python to already be installed ______________________________________________________________________ #### Installing Python With UV installed, run: ``` uv python install ``` This installs the latest Python version automatically. ______________________________________________________________________ ### Set Your Terminal Location Before running scripts, make sure your terminal is "in" the folder where the script lives. See [Navigating Directories](#navigating-directories) above. ### Troubleshooting - **Run scripts with `uv run`**: `uv run example.py` installs the script's dependencies and runs it with the right Python. You do not need to call `python` directly. - **“uv is not recognized…”**: the installer finished but your terminal has not picked up the new PATH. Close the terminal and open a new one. - **“No such file or directory”**: your terminal is in a different folder from the script. See [Navigating Directories](#navigating-directories). - **A package is not found**: the script's dependency header is missing it. See [Inline Packages](https://wiki.trackandtrace.tools/t3-api/api-scripts/#inline-packages). ______________________________________________________________________ ## Next Steps - Learn how to [write and execute a Python script](https://wiki.trackandtrace.tools/t3-api/api-scripts/index.md) - Browse the [OpenAPI spec](https://wiki.trackandtrace.tools/t3-api/openapi/index.md) for the exact shape of each endpoint - Load entire datasets at once with [Reports](https://wiki.trackandtrace.tools/reports/index.md) or bring back related metadata in one pass with [Supercollections](https://wiki.trackandtrace.tools/t3-api/supercollections/index.md) - Refer to the [T3 API documentation](https://trackandtrace.tools/api) to explore all the available endpoints. # Spreadsheet Sync **Spreadsheet Sync** uses [T3 API Reports](https://wiki.trackandtrace.tools/reports/index.md) to import entire Metrc datasets into a spreadsheet with a single cell formula. The spreadsheet will stay up-to-date with Metrc (updating at least once per hour). Demo of Spreadsheet Sync ## How does it work? T3 API Reports capture snapshots of your Metrc data all in a single request. Spreadsheet Sync allows you to form a single **Sync Link** that loads your report data. This Sync Link can then be passed to either Power Query in Microsoft Excel or the `IMPORTDATA()` formula in Google Sheets. ## How to get started with Spreadsheet Sync? ### 1. Generate your secret key - Generate your secret key [here](https://api.trackandtrace.tools/v2/pages/secret-key). - Store this secret key somewhere secure and treat it like a password. You can list your keys later with `GET /v2/auth/secretkey`. - ***Do not share this secret key!** It allows access to your Metrc data* Secret key generation interface ### 2. Create your Spreadsheet Sync Link [Use this tool to help you build your sync link](https://api.trackandtrace.tools/v2/pages/sync-link) All the information needed to generate the report is included in the Sync Link. At minimum, you will need: - The path of the report you wish to generate (see [Available Report Endpoints](https://wiki.trackandtrace.tools/reports/endpoints/index.md), or the [API docs](https://api.trackandtrace.tools/v2/docs)) - The license number for the data that should appear in the report - Your secret key For example, let's say you want to create an [Active Packages report](https://api.trackandtrace.tools/v2/docs/#/Reports/get_v2_packages_active_report) for the EX-00001 license. - Report path (taken from the API docs): `/v2/packages/active/report` - License number: `EX-00001` - Secret key: `1234-1234-1234-1234-1234-1234` Your Sync Link would be: `https://api.trackandtrace.tools/v2/packages/active/report?`**`secretKey=1234-1234-1234-1234-1234-1234&licenseNumber=EX-00001&contentType=csv`** **Note: `contentType=csv` is required** **Note: Do not share this Sync Link! Anyone who has it can load all your Metrc Data** ### 3. Import Data into your Spreadsheet #### For Google Sheets: Pass your Sync Link to the `IMPORTDATA()` function. Every hour, this function will load the report data using your Sync Link and insert it into the sheet. In your spreadsheet, in Cell A1, you would paste `=IMPORTDATA("https://api.trackandtrace.tools/v2/packages/active/report?secretKey=1234-1234-1234-1234-1234-1234&licenseNumber=EX-00001&contentType=csv")` **Tip:** add `&prependCsvMetadata=false` to your Sync Link so the column headers land in row 1 instead of row 9. See [The Metadata Preamble](https://wiki.trackandtrace.tools/reports/output/#the-metadata-preamble). **Note:** `IMPORTDATA` is a Google Sheets function and is not available in Excel. Excel users should use Power Query (see below). #### For Microsoft Excel: Excel requires the use of Power Query to import data from the web. Follow the instructions [here](https://support.microsoft.com/en-us/office/import-data-from-the-web-b13eed81-33fe-410d-9247-1747269c28e4), using your sync link as the data source URL. ### 4. Allow Spreadsheet to Load Data Loading your data usually takes 15-20 seconds. - The `IMPORTDATA` function automatically refreshes the information about once per hour. - Power Query will refresh the data based on how you configure your data source. - A request waits up to 240 seconds. If your report is large enough to hit that, see [Caching and Timing](https://wiki.trackandtrace.tools/reports/limits/#caching-and-timing). Example output (redacted): Example output ## Demo of Advanced Spreadsheet Sync Usage Spreadsheet Sync allows for advanced filtering options: Demo of Advanced Spreadsheet Sync ______________________________________________________________________ ## Next Steps - Pick the report path you want to sync from [Report Endpoints](https://wiki.trackandtrace.tools/reports/endpoints/index.md). - Trim the columns before they reach the sheet with [Shaping a Report](https://wiki.trackandtrace.tools/reports/shaping/index.md). - For a one-off export instead of a live link, see [T3 API Reports](https://wiki.trackandtrace.tools/reports/index.md). - [Start your free 30-day T3+ trial](https://dash.trackandtrace.tools) # Supercollection Includes The `include` parameter controls which additional data is fetched and attached to each object in the response. Without it, a supercollection request behaves like a regular collection request. ``` flowchart LR P["Superpackages"] --> PA["labResults"] P --> PB["labResultBatches"] P --> PC["sourceHarvests"] P --> PD["history"] P --> PE["coaResults"] H["Superharvests"] --> HA["history"] H --> HB["plants"] H --> HC["packages"] T["Supertransfers:
incoming, outgoing, rejected"] --> TA["packages"] T --> TB["transporters"] T --> TC["history
(outgoing and rejected)"] TH["Hub supertransfers"] --> THA["packages"] TH --> THB["history"] I["Superitems"] --> IA["notes"] I --> IB["history"] I --> IC["ingredients"] I --> ID["images"] PL["Superplants and
superplantbatches"] --> PLA["history"] SA["Supersales"] --> SAA["transactions"] PJ["Superprocessingjobs"] --> PJA["createdPackages"] PJ --> PJB["sourcePackages"] PJ --> PJC["history"] PW["Super plant waste"] --> PWA["plants"] PW --> PWB["packages"] PA["Super plant additives"] --> PAA["plants"] PA --> PAB["activeIngredients"] ``` Each `include` value does two things: 1. **Attaches raw Metrc data** as a new array on each object (e.g. `labResults`, `sourceHarvests`). 1. **Populates fields on the `metadata` object** with extracted, cleaned-up values derived from that raw data. You can combine multiple `include` values by repeating the parameter: `include=labResults&include=sourceHarvests`. A comma-joined list is **not** supported, `include=labResults,sourceHarvests` is one value, not two. An `include` value the endpoint does not accept returns `400 Invalid Include`, and the response lists the values it does accept: ``` GET /v2/packages/active/super?licenseNumber=EX-00001&include=labresults 400 Invalid Include Unrecognized include `labresults`. This endpoint accepts: history, sourceHarvests, labResultBatches, labResults, coaResults. ``` Include values are case-sensitive, so `labresults` above is rejected while `labResults` is accepted. The valid values for each endpoint are also published as an enum in the [OpenAPI spec](https://api.trackandtrace.tools/v2/docs/), so an API client can read them programmatically rather than copying them from this page. The same `include` values work on **super reports**, which return the whole enriched dataset in one request instead of paging through it, useful for spreadsheet exports. See [Super Reports](https://wiki.trackandtrace.tools/reports/super-reports/index.md). A few metadata fields are populated **unconditionally** (no `include` required), when the underlying data is available: - **Superpackages**: `summary`, `description`, `netWeightOrVolume`, `netWeightOrVolumeUnitOfMeasure` - **Superitems**: `approvalNumber`, `itemImages` ## History references On every supercollection with a `history` include, `include=history` also fills `metadata.historyReferences`: the packages, plants, plant batches, harvests and transfers the history names, each pointing back at the line that names it. The line `- Took 150 plants from Package 1A4000000000000000019963` gives: ``` { "historyIndex": 0, "descriptionIndex": 1, "objectType": "package", "field": "label", "value": "1A4000000000000000019963" } ``` | Field | Meaning | | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | | `historyIndex` | Position of the entry in `history[]` | | `descriptionIndex` | Position of the line in that entry's `descriptions[]` | | `objectType` | `package`, `plant`, `plantBatch`, `harvest` or `transfer` | | `field` | The field that identifies the object: `label` for packages and plants, `name` for plant batches and harvests, `manifestNumber` for transfers | | `value` | The identifier as the line writes it, without quotes or parentheses | References follow history order, then line order, then position in the line. - A reference is read from the history text, so it carries no license. The named object can belong to another license, such as the package a transfer arrived from. - An object's own identifier can appear: a plant's history names its own tag. - A name can be one the object no longer has, if it was renamed later. - More `objectType` values may be added. Skip the ones you don't recognize. `filter={field}__eq:{value}` finds a named object on that type's collections. This prints the line naming each package, then looks the packages up in one request: ``` import requests headers = {"Authorization": f"Bearer {access_token}"} response = requests.get( "https://api.trackandtrace.tools/v2/packages/active/super", headers=headers, params={"licenseNumber": "LIC-00001", "include": "history"}, ) package = response.json()["data"][0] filters = [] for reference in package["metadata"]["historyReferences"]: if reference["objectType"] != "package": continue entry = package["history"][reference["historyIndex"]] print(entry["descriptions"][reference["descriptionIndex"]]) filters.append(f"{reference['field']}__eq:{reference['value']}") named = requests.get( "https://api.trackandtrace.tools/v2/packages/inactive", headers=headers, params={"licenseNumber": "LIC-00001", "filter": filters, "filterLogic": "or"}, ) ``` ## Superpackage includes | `include` | Raw data attached | `metadata` fields populated | | ------------------ | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `labResults` | `labResults[]` | `extractedLabResults`, `testSamplePackageLabels`, `labResultPdfs`, `indexedLabResults`, `hasTerpeneResults` | | `labResultBatches` | `labResultBatches[]` | `extractedLabResults`, `testSamplePackageLabels`, `labResultPdfs`, `indexedLabResults`, `hasTerpeneResults` | | `sourceHarvests` | `sourceHarvests[]` | `harvestDates` | | `history` | `history[]` | `initialQuantity`, `initialQuantityUnitOfMeasure`, `quantityLedger`, `historyReferences`, `manifestNumber`², `destinationFacilityLicenseNumber`², `destinationFacilityName`², `transferType`² | | `coaResults` | `coaResults[]`, `labResults[]` | `indexedCoaResults`, `coaDocuments`, and everything `labResults` populates | ² Only present for in-transit packages. `indexedLabResults` is a simplified dictionary intended for templating (e.g. on a label). Example access: ``` {{ package.metadata.indexedLabResults.totalTHC.name }} → "Total THC" {{ package.metadata.indexedLabResults.totalTHC.value }} → 12.5 {{ package.metadata.indexedLabResults.totalTHC.unit }} → "%" {{ package.metadata.indexedLabResults.totalTHC.full }} → "Total THC: 12.5 %" ``` Each test has one key in every state, however the lab spelled it: `Total THC` and `Total Delta-9 THC` are both `totalTHC`, and `THCa` is `THCA`. `name` and `full` keep the lab's own spelling. [Lab Result Keys](https://wiki.trackandtrace.tools/t3-api/lab-result-keys/index.md) lists every key and the names it covers. Keys from before this naming, such as `totalDelta9THC` or `Total_THC`, still work in label templates and report columns. When a package reports a test more than once, the entry holds one result: a real result over a lab quality-control figure, then `%` over any other unit, then a nonzero value over zero, then the most recent test. `byUnit` keeps one result per unit, so an edible's per-serving and per-package values are both available: ``` {{ package.metadata.indexedLabResults.totalTHC.byUnit.mgPerServing.full }} → "Total THC: 10.0 mg/serving" {{ package.metadata.indexedLabResults.totalTHC.byUnit.mgPerPackage.full }} → "Total THC: 100.0 mg/package" ``` Unit keys are the unit in camelCase: `%` is `percent`, `mg/g` is `mgPerG`, `mg/serving` is `mgPerServing`. Also indexed: `topTerpene1`, `topTerpene2`, etc. `topTerpene1` and its siblings rank the package's **individual** terpenes by descending value. Rollup results a lab reports alongside them (`Total Terpenes`, `Other Terpenes`) are excluded, since they summarize the individual terpenes rather than being one. Those rollups are still indexed under their own keys, `totalTerpenes` and `otherTerpenes`. Because the `topTerpeneN` keys only exist when the package actually has terpene results, `metadata.hasTerpeneResults` tells you whether any are there. Use it to toggle a whole terpene section rather than probing for `topTerpene1`: ``` {% if package.metadata.hasTerpeneResults %} Terpenes {{ package.metadata.indexedLabResults.topTerpene1.full }} → "Limonene: 1.2 %" {{ package.metadata.indexedLabResults.topTerpene2.full }} → "Myrcene: 0.8 %" {% endif %} ``` `hasTerpeneResults` is always present, and is `true` exactly when `topTerpene1` is. A package whose terpenes were all measured at zero still reports `true`: those results were reported and are indexed, so the section has rows to show. ### COA results `coaResults` reads results out of the packages' COA PDFs. COAs are read ahead of time from a tag list; see [Extracting COA Results](https://wiki.trackandtrace.tools/opentag/tag-lists/#extracting-coa-results). If any package on the page has a COA that has not been read yet, the request fails with `409 COA_EXTRACTION_REQUIRED` and returns nothing. ``` {{ package.metadata.indexedCoaResults.totalTHC.full }} → "Total THC: 25.32 %" {{ package.metadata.indexedCoaResults.delta9THC.byUnit.mgPerG.value }} → 4.106 {{ package.metadata.coaDocuments[0].publicPdfUrl }} → "https://api.trackandtrace.tools/v2/coa/3f9c2a1e-....pdf" ``` Keys, `byUnit` and the top-level result work exactly as in `indexedLabResults`, so a template can switch between the two by changing one word. When a package has several COAs, the most recently tested one wins each result and older ones fill in what it lacks. A non-detect has `value` 0 and a `qualifier` such as `ND`, which `full` shows in place of the value: `"Lead: ND ppm"`. `coaDocuments` lists each COA behind the results with its `status` (`READY` or `FAILED`) and a `publicPdfUrl` that needs no login. In a CSV report, `coaResults[]` gives one row per result. ### Quantity ledger `include=history` also fills `metadata.quantityLedger`: how the package's quantity changed over time, read from its history. It has one entry per history line that states or changes the quantity, oldest first. Moves, manifests, lab results and finishes are left out. ``` [ { "historyIndex": 0, "kind": "created", "actualDate": "2025-09-15", "recordedDateTime": "2025-09-15T16:44:14.6429877Z", "quantityChange": 24, "quantityAfter": 24, "unitOfMeasureAbbreviation": "ea" }, { "historyIndex": 2, "kind": "accepted", "actualDate": null, "recordedDateTime": "2025-09-16T18:01:15.532948Z", "quantityChange": 0, "quantityAfter": 24, "unitOfMeasureAbbreviation": "ea" }, { "historyIndex": 4, "kind": "sold", "actualDate": "2025-09-23", "recordedDateTime": "2025-09-23T18:50:42.826531Z", "quantityChange": -1, "quantityAfter": 23, "unitOfMeasureAbbreviation": "ea" } ] ``` | Field | Meaning | | --------------------------- | -------------------------------------------------------------------------------------------------------------------------- | | `historyIndex` | Position of the source entry in `history[]`. Use it to read the full text, the user, a manifest or a receipt. | | `kind` | `created`, `used`, `restored`, `adjusted`, `unpacked`, `sold`, `saleRemoved`, `saleReturned`, `accepted` or `unrecognized` | | `actualDate` | The date the user gave. Null for `accepted`. | | `recordedDateTime` | When Metrc recorded it | | `quantityChange` | How much the quantity moved. Negative for a decrease. | | `quantityAfter` | The quantity once this entry was recorded | | `unitOfMeasureAbbreviation` | The unit of both quantities | Entries are in the order Metrc recorded them, so `quantityAfter` is what Metrc showed at that moment. The last entry's `quantityAfter` is the package's `quantity`. - `accepted` restates the quantity when a transfer is received, so its change is normally 0. - An entry can be recorded later than its `actualDate`. Sort by `actualDate` for a dated view. - `quantityAfter` can be negative. Metrc lets more be taken from a package than it holds. - A package's history follows it between licenses, so the ledger includes changes made before your license received it. - `unrecognized` is a history line that could not be read. Its change and balance are null, and later balances do not account for it. This prints the quantity each package had when 2025-10-10 began, UTC: ``` import requests response = requests.get( "https://api.trackandtrace.tools/v2/packages/active/super", headers={"Authorization": f"Bearer {access_token}"}, params={"licenseNumber": "LIC-00001", "include": "history"}, ) for package in response.json()["data"]: ledger = package["metadata"].get("quantityLedger", []) earlier = [entry for entry in ledger if entry["recordedDateTime"] < "2025-10-10"] quantity = earlier[-1]["quantityAfter"] if earlier else 0 print(package["label"], quantity, package["unitOfMeasureAbbreviation"]) ``` The ledger is a nested list, so it is meant for JSON responses. ## Superitem includes | `include` | Raw data attached | `metadata` fields populated | | ------------- | ----------------- | --------------------------- | | `notes` | `notes[]` | *(none)* | | `history` | `history[]` | `historyReferences` | | `ingredients` | `ingredients[]` | *(none)* | | `images` | `images[]` | `itemImages` | `approvalNumber` and `itemImages` are populated on every superitem when the data is available, you don't need `include=images` to get image metadata, only the raw base64/image records themselves. ## Supertransfer includes | `include` | Raw data attached | `metadata` fields populated | | -------------- | ----------------- | --------------------------- | | `packages` | `packages[]` | *(none)* | | `transporters` | `transporters[]` | *(none)* | | `history` | `history[]` | `historyReferences` | `history` is offered on outgoing and rejected supertransfers only. Incoming transfers have no history of their own; the history of the packages they carried is on the [superpackages](#superpackage-includes). ## Hub supertransfer includes Hub transfers (the ones your license *transports*) take a different include set: | `include` | Raw data attached | `metadata` fields populated | | ---------- | ----------------- | --------------------------- | | `packages` | `packages[]` | *(none)* | | `history` | `history[]` | `historyReferences` | There is **no `transporterDetails` include**: the driver legs are already on every hub record as `shipmentTransporterDetails`: ``` import requests response = requests.get( "https://api.trackandtrace.tools/v2/transfers/hub/super", headers={"Authorization": f"Bearer {access_token}"}, params={ "licenseNumber": "LIC-00001", "pageSize": 20, "include": ["packages", "history"], }, ) for transfer in response.json()["data"]: # Already present; no include was needed for this for leg in transfer["shipmentTransporterDetails"]: print(transfer["manifestNumber"], leg["lineNumber"], leg["driverName"]) # These two required the includes above print(f" {len(transfer['packages'])} packages, {len(transfer['history'])} history entries") ``` Note that `transporterFacilityName`, `driverName`, `vehicleMake` and friends are also flattened onto the transfer itself. When `multiVehicle` or `isLayover` is true those top-level fields describe only the first leg; read `shipmentTransporterDetails` for the rest. ## Superharvest includes | `include` | Raw data attached | `metadata` fields populated | | ---------- | ----------------- | --------------------------- | | `history` | `history[]` | `historyReferences` | | `plants` | `plants[]` | *(none)* | | `packages` | `packages[]` | *(none)* | ## Superplant includes | `include` | Raw data attached | `metadata` fields populated | | --------- | ----------------- | --------------------------- | | `history` | `history[]` | `historyReferences` | ## Supersales includes | `include` | Raw data attached | `metadata` fields populated | | -------------- | ----------------- | --------------------------- | | `transactions` | `transactions[]` | *(none)* | ## Super plant waste includes | `include` | Raw data attached | `metadata` fields populated | | ---------- | ----------------- | --------------------------- | | `plants` | `plants[]` | *(none)* | | `packages` | `packages[]` | *(none)* | ## Super plant additives includes | `include` | Raw data attached | `metadata` fields populated | | ------------------- | --------------------- | --------------------------- | | `plants` | `plants[]` | *(none)* | | `activeIngredients` | `activeIngredients[]` | *(none)* | ## Superprocessingjob includes Processing jobs are currently exposed by Metrc in Oregon only. | `include` | Raw data attached | `metadata` fields populated | | ----------------- | ------------------- | --------------------------- | | `createdPackages` | `createdPackages[]` | *(none)* | | `sourcePackages` | `sourcePackages[]` | *(none)* | | `history` | `history[]` | `historyReferences` | `createdPackages` are the packages the job produced; `sourcePackages` are the packages it consumed. Both return the same shape. A job record also arrives with a `packages` array already populated. It is a partial list of the source packages, and every entry in it carries `"processingJobId": 0` instead of the real job id, so it cannot be joined back to the job it came from. Use `include=sourcePackages` when you need those packages: ``` GET https://api.trackandtrace.tools/v2/processingjobs/active/super ?licenseNumber=LIC000001 &include=sourcePackages ``` ``` { "number": "0000000777", "jobTypeName": "Cannabis Extract Job", "totalQuantity": 237.36, "isFinished": false, "sourcePackages": [ { "processingJobId": 777, "label": "1A4000000000000000000777", "quantity": 18.35, "unitOfMeasureAbbreviation": "lb", "itemName": "Example Flower" } ], "metadata": { "summary": "0000000777 · In progress · Cannabis Extract Job", "description": "Processing job 0000000777. Type: Cannabis Extract Job. Consumed: 12 packages." } } ``` ## Next Steps - Back to the endpoint list: [Supercollections](https://wiki.trackandtrace.tools/t3-api/supercollections/index.md). - Use includes in a report instead: [Super Reports](https://wiki.trackandtrace.tools/reports/super-reports/index.md). # T3 API Supercollections With Metrc data, users frequently encounter these sorts of problems: - "I want to load my packages, but also need test results for each" - "I want to load my transfers, but also want all the packages" - "I want to load my items, but I also want all the images and ingredients" **Enter supercollections** ``` flowchart TB subgraph c["Collection: /v2/packages/active"] direction LR C1["One request"] --> C3["Packages,
no metadata"] --> C4["Fast, generous
rate limit"] end subgraph s["Supercollection: /v2/packages/active/super?include=labResults"] direction LR S1["One request"] --> S3["Packages with labResults
attached and metadata
fields populated"] --> S4["Slower, lower
rate limit"] end ``` ## What is a Supercollection? The best way to understand supercollections is to compare them to T3 collections: - T3 collection endpoints **return one page of records and nothing else**. - Examples: Active Packages, Incoming Transfers, Active Items. - This keeps them fast, with generous rate limits. - To load related data for a collection, you request it per row. - T3 supercollection endpoints are designed to **eagerly load all metadata for each collection object**. - Examples: Active Superpackages, Incoming Supertransfers, Superitems. - They extend existing collection endpoint behavior. - This allows the endpoint to efficiently load, organize, and analyze the metadata for you. - Endpoints have lower rate limits, and are slower to use. - Pages hold at most 50 records. `pageSize` defaults to 50, and a larger value returns `400`. - Metadata is loaded *declaratively*. For example, you'd specify you want lab results and history for an active superpackages request. ## Available Supercollection Endpoints | Supercollection | Path | `include` options | | -------------------------------- | ------------------------------------------ | --------------------------------------------------------------------------- | | Superitems | `/v2/items/super` | `notes`, `history`, `ingredients`, `images` | | Active Superpackages | `/v2/packages/active/super` | `labResults`, `labResultBatches`, `sourceHarvests`, `history`, `coaResults` | | Inactive Superpackages | `/v2/packages/inactive/super` | `labResults`, `labResultBatches`, `sourceHarvests`, `history`, `coaResults` | | In Transit Superpackages | `/v2/packages/intransit/super` | `labResults`, `labResultBatches`, `sourceHarvests`, `history`, `coaResults` | | On Hold Superpackages | `/v2/packages/onhold/super` | `labResults`, `labResultBatches`, `sourceHarvests`, `history`, `coaResults` | | Product Label Superpackages | `/v2/packages/product-labels/super` | `labResults`, `labResultBatches`, `sourceHarvests`, `history`, `coaResults` | | Super Lab Samples | `/v2/packages/lab-samples/super` | *(none)* | | Incoming Active Supertransfers | `/v2/transfers/incoming/active/super` | `packages`, `transporters` | | Incoming Inactive Supertransfers | `/v2/transfers/incoming/inactive/super` | `packages`, `transporters` | | Outgoing Active Supertransfers | `/v2/transfers/outgoing/active/super` | `packages`, `transporters`, `history` | | Outgoing Inactive Supertransfers | `/v2/transfers/outgoing/inactive/super` | `packages`, `transporters`, `history` | | Rejected Supertransfers | `/v2/transfers/rejected/super` | `packages`, `transporters`, `history` | | Hub Supertransfers | `/v2/transfers/hub/super` | `packages`, `history` | | Active Superharvests | `/v2/harvests/active/super` | `history`, `plants`, `packages` | | Inactive Superharvests | `/v2/harvests/inactive/super` | `history`, `plants`, `packages` | | On Hold Superharvests | `/v2/harvests/onhold/super` | `history`, `plants`, `packages` | | Vegetative Superplants | `/v2/plants/vegetative/super` | `history` | | Flowering Superplants | `/v2/plants/flowering/super` | `history` | | Inactive Superplants | `/v2/plants/inactive/super` | `history` | | On Hold Superplants | `/v2/plants/onhold/super` | `history` | | Active Mother Superplants | `/v2/plants/mother/active/super` | `history` | | Inactive Mother Superplants | `/v2/plants/mother/inactive/super` | `history` | | On Hold Mother Superplants | `/v2/plants/mother/onhold/super` | `history` | | Active Superplantbatches | `/v2/plantbatches/active/super` | `history` | | Inactive Superplantbatches | `/v2/plantbatches/inactive/super` | `history` | | On Hold Superplantbatches | `/v2/plantbatches/onhold/super` | `history` | | Super Plant Waste | `/v2/plants/waste/super` | `plants`, `packages` | | Transferred Superpackages | `/v2/packages/transferred/super` | *(none)* | | Super Plant Additives | `/v2/plants/additives/super` | `plants`, `activeIngredients` | | Active Supersales | `/v2/sales/active/super` | `transactions` | | Inactive Supersales | `/v2/sales/inactive/super` | `transactions` | | Available Supertags | `/v2/tags/available/super` | *(none)* | | Used Supertags | `/v2/tags/used/super` | *(none)* | | Voided Supertags | `/v2/tags/voided/super` | *(none)* | | Staged Product Label Supertags | `/v2/packages/staged-product-labels/super` | *(none)* | | Current Supertagorders | `/v2/tagorders/current/super` | *(none)* | | Historical Supertagorders | `/v2/tagorders/history/super` | *(none)* | | Active Superprocessingjobs | `/v2/processingjobs/active/super` | `createdPackages`, `sourcePackages`, `history` | | Inactive Superprocessingjobs | `/v2/processingjobs/inactive/super` | `createdPackages`, `sourcePackages`, `history` | | Active Superlocations | `/v2/locations/active/super` | *(none)* | | Superstrains | `/v2/strains/super` | *(none)* | The tag, tag order, location and strain rows have no `include` options and return the same records as their plain collections; they exist so every path follows the same pattern. A tag order's `details` line items are part of the order itself, so they are present on the plain collection too. ``` GET https://api.trackandtrace.tools/v2/tagorders/history/super?licenseNumber=LIC000001 ``` ``` { "orderNumber": "SBX-MO-2026-035-0594", "statusName": "Received", "details": [ { "tagType": "CannabisPackage", "quantity": 26, "unitPrice": 0.46 }, { "tagType": "CannabisPlant", "quantity": 56, "unitPrice": 0.46 } ], "metadata": { "summary": "SBX-MO-2026-035-0594 · Received · 82 tags", "description": "Tag order SBX-MO-2026-035-0594. Status: Received. Ordered: 82 tags." } } ``` ## Superpackages Example This is the most commonly used supercollection. Below is an example that loads all active superpackages with lab results for packages in the "Buds" product category: ``` #!/usr/bin/env python3 # /// script # requires-python = ">=3.12" # dependencies = ["t3api-utils[tui]>=2.1.0"] # /// import t3api_utils as t3 with t3.connect() as client: license = client.license or client.pick_license() packages = client.collect( "METRC_ACTIVE_SUPERPACKAGES", license=license, filter=["item.productCategoryName__eq:Buds"], include=["labResults"], page_size=50, ) t3.inspect(packages, title="Buds with lab results") ``` `METRC_ACTIVE_SUPERPACKAGES` is the [T3 endpoint ID](https://wiki.trackandtrace.tools/t3-api/t3-endpoint-ids/index.md) for `/v2/packages/active/super`. `include` takes a list, and the library sends each value as its own `include` parameter. Supercollections return at most 50 rows per page, so pass `page_size=50`. Each object in the response will contain: - All the standard package fields (label, item, quantity, etc.). - A `labResults` array with the raw Metrc lab result data. - A `metadata` object with `extractedLabResults`, `testSamplePackageLabels`, `labResultPdfs`, `indexedLabResults` and `hasTerpeneResults`, plus the always-present `summary`, `description`, `netWeightOrVolume` and `netWeightOrVolumeUnitOfMeasure`. ______________________________________________________________________ ## Next Steps - Example scripts: [`basics/super-collections.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/basics/super-collections.py) (packages with lab results and source harvests), [`packages/export-lab-results.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/packages/export-lab-results.py) (one row per lab test), [`packages/export-package-history.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/packages/export-package-history.py) (one row per history event). - Every include, per collection: [Supercollection Includes](https://wiki.trackandtrace.tools/t3-api/supercollection-includes/index.md). - Hydrate a single record instead of a page: [Loading One Record by ID](https://wiki.trackandtrace.tools/t3-api/object-lookup/index.md). - Export a whole supercollection at once with [Super Reports](https://wiki.trackandtrace.tools/reports/super-reports/index.md). - Find records to load with [Search](https://wiki.trackandtrace.tools/t3-api/search/index.md). # Support Tickets The `/v2/support/tickets` endpoints let you report a bug or issue to T3 support from your own code, and check back on what you reported. A T3+ subscription is **not** required. Anyone who can authenticate can file a ticket. ## What a Ticket Is A ticket is a bug report with your account attached to it. It carries a title and a description, optionally the page you were on and the version of the client you were using, an arbitrary bag of context you choose, and up to five files. Tickets are owned by the **Metrc account**, not by an individual credential. Any secret key or JWT for the same `username` and `hostname` sees the same tickets. Nobody else's tickets are ever visible to you. ## Filing a Ticket With no attachments, `POST` a JSON body: ``` import requests SECRET_KEY = "your-secret-key" response = requests.post( "https://api.trackandtrace.tools/v2/support/tickets", headers={"X-T3-API-Key": SECRET_KEY}, json={ "title": "Scanning a package tag opens the wrong package", "body": ( "Scanning tags on the Active Packages page opens the package " "above the one I scanned. Started this morning, happens every " "time, on two machines." ), "contactEmail": "grower@example.com", "pageUrl": "https://ca.metrc.com/industry/C11-0000001-LIC/packages", "licenseNumber": "C11-0000001-LIC", "clientVersion": "3.2.1", "stateContext": { "route": "/packages/active", }, }, ) ticket = response.json()["data"] print(ticket["publicId"]) # keep this to check back on the ticket print(ticket["status"]) # OPEN ``` `title`, `body` and `contactEmail` are required. Everything else is optional, but `pageUrl` and `licenseNumber` are the two most useful things you can include; they are usually the difference between a bug we can reproduce and one we cannot. `contactEmail` is how we reach you Your Metrc username identifies the account, but it is not a mailbox. Without an address there is no way for us to ask a follow-up question. It must be a single, well-formed address; a list is rejected. It is checked before the ticket is written, so a typo comes back as a `400` rather than as a reply you never receive. It is returned on your own tickets and is never visible to anyone else. `licenseNumber` is context, not a permission check It is stored exactly as you send it and is **not** checked against the licenses your account can reach, so "I cannot see license X" can still be reported. `stateContext` is yours to shape. Nothing in it is validated: put the active route, the last few console errors, whichever bits of client state you think will help. The only rule is that it must be a JSON object that serializes to at most 64 KB. ## Attaching Files To attach screenshots or logs, send `multipart/form-data` instead. The same JSON object goes in a part named `payload`, and each file goes in a part named `file`: ``` import json import requests payload = { "title": "Scanning a package tag opens the wrong package", "body": "Happens every time, on two machines.", "contactEmail": "grower@example.com", "pageUrl": "https://ca.metrc.com/industry/C11-0000001-LIC/packages", "clientVersion": "3.2.1", } with open("screenshot.png", "rb") as screenshot, open("console.log", "rb") as log: response = requests.post( "https://api.trackandtrace.tools/v2/support/tickets", headers={"X-T3-API-Key": SECRET_KEY}, data={"payload": json.dumps(payload)}, files=[ ("file", ("screenshot.png", screenshot, "image/png")), ("file", ("console.log", log, "text/plain")), ], ) ticket = response.json()["data"] for attachment in ticket["attachments"]: print(attachment["filename"], attachment["contentType"], attachment["byteSize"]) ``` Attachments cannot be downloaded again Attachments are stored privately for T3 support. Reading a ticket back tells you a file's name, type and size; there is no URL and no download endpoint. Keep your own copy of anything you might need. ## Attachment Limits | Limit | Value | | --------------------- | ------------------------------------------------ | | Files per ticket | 5 | | Size per file | 10 MB | | Total size per ticket | 25 MB | | Accepted types | PNG, JPEG, GIF, WEBP, PDF, plain text, CSV, JSON | **A file is checked by its contents**, not its name, so a renamed file of the wrong type is rejected. **Attachments are validated before anything is stored.** If one file is rejected, the whole request fails and no ticket is created; you will not end up with a half-filed ticket missing its screenshot. The error names the offending file: ``` { "title": "Attachment Rejected", "status": 400, "detail": "'screenshot.png' is a application/zip file, which attachments do not accept. Attach an image, a PDF, or a text, CSV or JSON file.", "code": "SUPPORT_TICKET_ATTACHMENT_REJECTED" } ``` ## Reading Your Tickets List everything you have filed, newest first: ``` response = requests.get( "https://api.trackandtrace.tools/v2/support/tickets", headers={"X-T3-API-Key": SECRET_KEY}, params={"status": "OPEN", "pageSize": 25}, ) for ticket in response.json()["data"]: print(ticket["status"], ticket["publicId"], ticket["title"]) ``` `status` accepts `OPEN` or `CLOSED`. The response is paginated with the usual `page`, `pageSize`, `total` and `totalPages` fields. Read one ticket by its `publicId`: ``` response = requests.get( f"https://api.trackandtrace.tools/v2/support/tickets/{public_id}", headers={"X-T3-API-Key": SECRET_KEY}, ) ticket = response.json()["data"] print(ticket["status"]) print(ticket["resolutionNote"]) ``` A `publicId` belonging to a different Metrc account returns `404`, the same as one that does not exist at all. ## Ticket Lifecycle Every ticket is created `OPEN`. T3 support works it and closes it. **There is no endpoint that changes a ticket**: no edit, no close, no delete. The reply comes back through `resolutionNote`, which is `null` until someone has something to say and is filled in when the ticket is worked. Reading the ticket is the whole feedback channel, so poll it, or check it when you notice `status` has become `CLOSED`. ``` ticket = requests.get( f"https://api.trackandtrace.tools/v2/support/tickets/{public_id}", headers={"X-T3-API-Key": SECRET_KEY}, ).json()["data"] if ticket["status"] == "CLOSED": print(ticket["resolutionNote"]) # "Fixed in extension 3.2.4. Update from the Chrome Web Store." ``` ## Limits and Behavior | Behavior | Detail | | ------------------------ | -------------------------------------------------------------- | | Subscription | Not required | | Ownership | The Metrc account (`username` + `hostname`) | | Open tickets per account | 25. Closing one restores the allowance. | | `title` | 1–200 characters, required | | `body` | 1–20,000 characters, required | | `contactEmail` | A single address, up to 254 characters, required and validated | | `pageUrl` | Up to 2,000 characters, optional | | `licenseNumber` | Up to 100 characters, optional, not validated | | `clientVersion` | Up to 50 characters, optional | | `stateContext` | Any JSON object, up to 64 KB serialized | | Unknown fields | Rejected; a misspelled field is an error, not silently ignored | Reaching the open ticket limit returns `409` with code `SUPPORT_TICKET_LIMIT_EXCEEDED`. If you genuinely have that many open issues, [get in touch](mailto:matt@trackandtrace.tools). ## Next Steps - [Authentication](https://wiki.trackandtrace.tools/t3-api/authentication/index.md): getting a secret key or a JWT - [OpenAPI Spec](https://wiki.trackandtrace.tools/t3-api/openapi/index.md): the full machine-readable definition # T3 Endpoint IDs Every T3 API endpoint that lists or reports Metrc data has a T3 endpoint id. It is the one name every feature uses for an endpoint: - [Search](https://wiki.trackandtrace.tools/t3-api/search/index.md) takes `t3EndpointIds` and labels every result with its `t3EndpointId`. - [Metrc Pages](https://wiki.trackandtrace.tools/t3-api/metrc-pages/index.md) gives each table's `t3EndpointId`. - [Filterable Fields](https://wiki.trackandtrace.tools/t3-api/collection-fields/index.md) answers with the `t3EndpointId` of the collection it describes. - [Tag lists](https://wiki.trackandtrace.tools/opentag/tag-lists/index.md) store a `t3EndpointId`, and resolve and COA extraction take one. - [Saved reports](https://wiki.trackandtrace.tools/reports/delivery/#saving-a-report) record the `t3EndpointId` of the report they run. The [interactive docs](https://api.trackandtrace.tools/v2/docs/) show each endpoint's id at the end of its summary. A collection's list endpoint and its object endpoint share an id: `METRC_ACTIVE_PACKAGES` names both `/v2/packages/active` and `/v2/packages/active/{id}`. Its `/super` endpoints have their own id, and each report has its own. So a search result says where to load the full record. [`t3api-utils`](https://wiki.trackandtrace.tools/t3-api/api-scripts/#t3api-utils) takes the id directly: ``` hit = client.get( "/v2/search", license=license, params={"query": "1A4FF0100000022000000123"}, )["data"][0] record = client.get(hit["t3EndpointId"], object_id=hit["matchedEntry"]["id"], license=license) ``` Every endpoint id is also in `client.spec.ids()`, and `t3api endpoints harvest --kind collection` searches them from the command line. The example script [`basics/find-endpoints.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/basics/find-endpoints.py) searches them by keyword and exports the collection you pick. Without the library, the OpenAPI spec carries every id as `x-t3-endpoint-id`, so the full mapping can be built from it: ``` import requests spec = requests.get("https://api.trackandtrace.tools/v2/spec/openapi.json").json() paths = { operation["x-t3-endpoint-id"]: path for path, operations in spec["paths"].items() for operation in operations.values() if "x-t3-endpoint-id" in operation and "{" not in path } ``` ## Collections The collections search, tag lists or COA extraction accept. ✅ marks the features that accept the id. Every other endpoint's id is in the [interactive docs](https://api.trackandtrace.tools/v2/docs/). | Path | T3 endpoint id | `/super` T3 endpoint id | Search | Tag lists | COA | | --------------------------------- | ----------------------------------- | ---------------------------------------- | ------ | --------- | --- | | `/v2/harvests/active` | `METRC_ACTIVE_HARVESTS` | `METRC_ACTIVE_SUPERHARVESTS` | ✅ | ✅ | ❌ | | `/v2/harvests/inactive` | `METRC_INACTIVE_HARVESTS` | `METRC_INACTIVE_SUPERHARVESTS` | ✅ | ✅ | ❌ | | `/v2/harvests/onhold` | `METRC_ONHOLD_HARVESTS` | `METRC_ONHOLD_SUPERHARVESTS` | ✅ | ✅ | ❌ | | `/v2/harvests/schedules` | `METRC_HARVEST_SCHEDULES` | | ✅ | ❌ | ❌ | | `/v2/items` | `METRC_ACTIVE_ITEMS` | `METRC_ACTIVE_SUPERITEMS` | ✅ | ✅ | ❌ | | `/v2/locations/active` | `METRC_ACTIVE_LOCATIONS` | `METRC_ACTIVE_SUPERLOCATIONS` | ✅ | ❌ | ❌ | | `/v2/packages/active` | `METRC_ACTIVE_PACKAGES` | `METRC_ACTIVE_SUPERPACKAGES` | ✅ | ✅ | ✅ | | `/v2/packages/inactive` | `METRC_INACTIVE_PACKAGES` | `METRC_INACTIVE_SUPERPACKAGES` | ✅ | ✅ | ✅ | | `/v2/packages/intransit` | `METRC_INTRANSIT_PACKAGES` | `METRC_INTRANSIT_SUPERPACKAGES` | ✅ | ✅ | ✅ | | `/v2/packages/lab-samples` | `METRC_LAB_SAMPLE_PACKAGES` | `METRC_SUPER_LAB_SAMPLE_PACKAGES` | ✅ | ❌ | ❌ | | `/v2/packages/onhold` | `METRC_ONHOLD_PACKAGES` | `METRC_ONHOLD_SUPERPACKAGES` | ✅ | ✅ | ✅ | | `/v2/packages/transferred` | `METRC_TRANSFERRED_PACKAGES` | `METRC_TRANSFERRED_SUPERPACKAGES` | ✅ | ✅ | ❌ | | `/v2/plantbatches/active` | `METRC_ACTIVE_PLANTBATCHES` | `METRC_ACTIVE_SUPERPLANTBATCHES` | ✅ | ✅ | ❌ | | `/v2/plantbatches/inactive` | `METRC_INACTIVE_PLANTBATCHES` | `METRC_INACTIVE_SUPERPLANTBATCHES` | ✅ | ✅ | ❌ | | `/v2/plantbatches/onhold` | `METRC_ONHOLD_PLANTBATCHES` | `METRC_ONHOLD_SUPERPLANTBATCHES` | ✅ | ✅ | ❌ | | `/v2/plants/flowering` | `METRC_FLOWERING_PLANTS` | `METRC_FLOWERING_SUPERPLANTS` | ✅ | ✅ | ❌ | | `/v2/plants/inactive` | `METRC_INACTIVE_PLANTS` | `METRC_INACTIVE_SUPERPLANTS` | ✅ | ✅ | ❌ | | `/v2/plants/mother/active` | `METRC_ACTIVE_MOTHER_PLANTS` | `METRC_ACTIVE_MOTHER_SUPERPLANTS` | ✅ | ✅ | ❌ | | `/v2/plants/mother/inactive` | `METRC_INACTIVE_MOTHER_PLANTS` | `METRC_INACTIVE_MOTHER_SUPERPLANTS` | ✅ | ✅ | ❌ | | `/v2/plants/mother/onhold` | `METRC_ONHOLD_MOTHER_PLANTS` | `METRC_ONHOLD_MOTHER_SUPERPLANTS` | ✅ | ✅ | ❌ | | `/v2/plants/onhold` | `METRC_ONHOLD_PLANTS` | `METRC_ONHOLD_SUPERPLANTS` | ✅ | ✅ | ❌ | | `/v2/plants/vegetative` | `METRC_VEGETATIVE_PLANTS` | `METRC_VEGETATIVE_SUPERPLANTS` | ✅ | ✅ | ❌ | | `/v2/processingjobs/active` | `METRC_ACTIVE_PROCESSING_JOBS` | `METRC_ACTIVE_SUPERPROCESSINGJOBS` | ✅ | ❌ | ❌ | | `/v2/processingjobs/inactive` | `METRC_INACTIVE_PROCESSING_JOBS` | `METRC_INACTIVE_SUPERPROCESSINGJOBS` | ✅ | ❌ | ❌ | | `/v2/sales/active` | `METRC_ACTIVE_SALES` | `METRC_ACTIVE_SUPERSALES` | ✅ | ❌ | ❌ | | `/v2/sales/inactive` | `METRC_INACTIVE_SALES` | `METRC_INACTIVE_SUPERSALES` | ✅ | ❌ | ❌ | | `/v2/strains` | `METRC_ACTIVE_STRAINS` | `METRC_ACTIVE_SUPERSTRAINS` | ✅ | ✅ | ❌ | | `/v2/tagorders/current` | `METRC_CURRENT_TAG_ORDERS` | `METRC_CURRENT_SUPERTAGORDERS` | ✅ | ❌ | ❌ | | `/v2/tagorders/history` | `METRC_HISTORY_TAG_ORDERS` | `METRC_HISTORY_SUPERTAGORDERS` | ✅ | ❌ | ❌ | | `/v2/tags/available` | `METRC_AVAILABLE_TAGS` | `METRC_AVAILABLE_SUPERTAGS` | ✅ | ✅ | ❌ | | `/v2/tags/used` | `METRC_USED_TAGS` | `METRC_USED_SUPERTAGS` | ✅ | ✅ | ❌ | | `/v2/tags/voided` | `METRC_VOIDED_TAGS` | `METRC_VOIDED_SUPERTAGS` | ✅ | ✅ | ❌ | | `/v2/transfers/hub` | `METRC_HUB_TRANSFERS` | `METRC_HUB_SUPERTRANSFERS` | ✅ | ✅ | ❌ | | `/v2/transfers/incoming/active` | `METRC_INCOMING_ACTIVE_TRANSFERS` | `METRC_INCOMING_ACTIVE_SUPERTRANSFERS` | ✅ | ✅ | ❌ | | `/v2/transfers/incoming/inactive` | `METRC_INCOMING_INACTIVE_TRANSFERS` | `METRC_INCOMING_INACTIVE_SUPERTRANSFERS` | ✅ | ✅ | ❌ | | `/v2/transfers/outgoing/active` | `METRC_OUTGOING_ACTIVE_TRANSFERS` | `METRC_OUTGOING_ACTIVE_SUPERTRANSFERS` | ✅ | ✅ | ❌ | | `/v2/transfers/outgoing/inactive` | `METRC_OUTGOING_INACTIVE_TRANSFERS` | `METRC_OUTGOING_INACTIVE_SUPERTRANSFERS` | ✅ | ✅ | ❌ | | `/v2/transfers/rejected` | `METRC_OUTGOING_REJECTED_TRANSFERS` | `METRC_OUTGOING_REJECTED_SUPERTRANSFERS` | ✅ | ✅ | ❌ | | `/v2/transfers/templates` | `METRC_TRANSFER_TEMPLATES` | | ✅ | ❌ | ❌ | # Reports # T3 API Reports A collection endpoint returns one page of records. A **report endpoint** returns the whole dataset in a single request (every active package, every harvest, every transfer manifest) already filtered, sorted, and formatted the way you asked for it. T3+ required Report endpoints are available to T3+ subscribers only. You can start a 30-day free trial at [dash.trackandtrace.tools](https://dash.trackandtrace.tools/). ## Your first report Every report is one authenticated `GET`. Paste this into a browser and it downloads every active package on a license as a CSV: ``` https://api.trackandtrace.tools/v2/packages/active/report?secretKey=YOUR_SECRET_KEY&licenseNumber=EX-00001&contentType=csv&columns=label,item.name,quantity,unitOfMeasureAbbreviation,locationName&columnHeaderOverrides=Tag,Item,Quantity,Unit,Room&prependCsvMetadata=false ``` Read it one piece at a time: | Piece | What it does | | -------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `https://api.trackandtrace.tools` | The T3 API host. | | `/v2/packages/active/report` | The report endpoint. This one returns active packages; every other report is a different path, listed in [Report Endpoints](https://wiki.trackandtrace.tools/reports/endpoints/index.md). | | `?secretKey=YOUR_SECRET_KEY` | Authentication. A URL carries the key as a parameter rather than a header because it is meant to be pasted somewhere: a browser, a spreadsheet formula, Power Query. | | `&licenseNumber=EX-00001` | Which license to pull. Repeat the parameter to cover several at once. See [Reporting Across Multiple Licenses](https://wiki.trackandtrace.tools/reports/output/#reporting-across-multiple-licenses). | | `&contentType=csv` | Return a CSV file. `json`, `xlsx` and `googleSheets` are the other choices. See [Output and Delivery Format](https://wiki.trackandtrace.tools/reports/output/index.md). | | `&columns=label,item.name,quantity,unitOfMeasureAbbreviation,locationName` | Which fields come back, in this order. Leave it off and you get the report's default columns. | | `&columnHeaderOverrides=Tag,Item,Quantity,Unit,Room` | The header names. Matched positionally against `columns`, so the first override names the first column. Without it the headers are title-cased from the field names, and `unitOfMeasureAbbreviation` arrives as `Unit Of Measure Abbreviation`. | | `&prependCsvMetadata=false` | Drop the eight-row preamble describing the request, so the headers land on row 1 and the first package on row 2. | The file that comes back: | Tag | Item | Quantity | Unit | Room | | ------------------------ | ------------------------ | -------- | ---- | ---------------- | | 1A4400000000000000001234 | Blue Dream | 1250 | g | Bulk Storage | | 1A4400000000000000001235 | Blue Dream Preroll 1g | 480 | ea | Packaging Room | | 1A4400000000000000001236 | GG4 Shake/Trim | 3400 | g | Bulk Storage | | 1A4400000000000000001237 | Sour Diesel Distillate | 215.5 | g | Extraction Vault | | 1A4400000000000000001238 | Wedding Cake Flower 3.5g | 96 | ea | Retail Vault | One row per active package, all of them, in a single request. A license holding twelve thousand packages returns twelve thousand rows here. Generate a secret key at the [secret-key page](https://api.trackandtrace.tools/v2/pages/secret-key). See [Authentication](https://wiki.trackandtrace.tools/t3-api/authentication/index.md) for the alternatives, and [Report Examples](https://wiki.trackandtrace.tools/reports/examples/index.md) for the same requests written as Python scripts, where the key belongs in an `X-T3-API-Key` header instead. ## Collection endpoint versus report endpoint The same data is reachable both ways, and the difference is how much of it you get per request. | | Returns | Use it when | | ---------------------------- | --------------------------- | ------------------------------------------------ | | `/v2/packages/active` | One page of active packages | You are paging through records in an application | | `/v2/packages/active/report` | **All** active packages | You want the dataset exported in one go | Because a report returns everything, the response can be very large. See [Limits and Troubleshooting](https://wiki.trackandtrace.tools/reports/limits/index.md) for the caps and how to stay under them. You do not have to build these URLs by hand [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/index.md) in the Chrome Extension is a form over everything in this section. It assembles the URL, explains each parameter as you set it, previews the first few rows, and hands you the finished link, including the `=IMPORTDATA()` formula for [Spreadsheet Sync](https://wiki.trackandtrace.tools/t3-api/spreadsheet-sync/index.md). A URL it produces is an ordinary report URL, and a URL you write yourself can be pasted back into it. ## Next Steps - Find the path you need in [Report Endpoints](https://wiki.trackandtrace.tools/reports/endpoints/index.md). - Narrow what comes back with [Shaping a Report](https://wiki.trackandtrace.tools/reports/shaping/index.md). - Choose a format and a destination in [Output and Delivery Format](https://wiki.trackandtrace.tools/reports/output/index.md) and [Delivering a Report](https://wiki.trackandtrace.tools/reports/delivery/index.md). - Attach related records with [Super Reports](https://wiki.trackandtrace.tools/reports/super-reports/index.md). - Copy a working script from [Report Examples](https://wiki.trackandtrace.tools/reports/examples/index.md). - Example script: [`basics/run-a-report.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/basics/run-a-report.py) (download an XLSX or CSV report with `t3api-utils`). # Delivering a Report ## Emailing a Report Add **`&delivery=email&email=you@example.com`** and the report is sent to that address instead of returned. The two parameters are required together: one without the other is a 400. (The exception is `contentType=googleSheets`, where `email` on its own names the account to share the sheet with; see [below](#the-googlesheets-format).) You get back a receipt straight away, before the report has been built: ``` { "status": "processing", "recipient": "you@example.com", "contentType": "xlsx" } ``` No 240-second wait A normal request gives up after 240 seconds and returns a `504`. With `delivery=email` nothing waits on the response, so a slow report still arrives. The report must still finish building within about five minutes: one that takes longer fails, and the email says so. `json`, `csv` and `xlsx` arrive as a file attached to an email. `googleSheets` creates a sheet, shares it with that address, and emails you the link. Google sends its own share notification too, so you get two messages carrying the same link. Errors arrive by email too Once you have the receipt there is no response left to fail into, so anything that goes wrong afterwards (`Report Request Too Large`, a Metrc permission problem, a report too big to attach) is emailed to the recipient with the same explanation an ordinary request would have returned. Your parameters are still checked before the receipt is sent, so a bad `columns`, `rowLimit`, `include` or `email` still comes back as an immediate 400. A few things to know: - One recipient per request; a comma-separated list is rejected. - Emailed reports are limited to 10 a minute per subscription, on top of the [report rate limits](https://wiki.trackandtrace.tools/reports/limits/#limits). - There is nothing to poll. The report arrives, or an explanation does. - **On a Spreadsheet Sync link, every refresh sends an email.** Sync links are polled on a schedule, so `delivery=email` on one produces a message per refresh rather than a one-off export. ## The `googleSheets` Format `contentType=googleSheets` writes the report into a new Google Sheet. It is the one format whose response is not the report; it is a way to reach the document. **Without `delivery=email`, you get a redirect.** The sheet is built during the request, and the response is a `302` pointing at it: ``` curl -i "https://api.trackandtrace.tools/v2/packages/active/report?secretKey=YOUR_SECRET_KEY&licenseNumber=EX-00001&contentType=googleSheets" ``` ``` HTTP/1.1 302 Found Location: https://docs.google.com/spreadsheets/d/1AbCdEf.../edit Content-Type: application/json {"sheetUrl": "https://docs.google.com/spreadsheets/d/1AbCdEf.../edit", "sheetId": "1AbCdEf..."} ``` Paste that URL into a browser and you land on the finished sheet. The link is repeated in the body so that a client which does not follow redirects can still read it: ``` # Follow the redirect and print where you ended up curl -sL -o /dev/null -w '%{url_effective}\n' \ "https://api.trackandtrace.tools/v2/packages/active/report?secretKey=YOUR_SECRET_KEY&licenseNumber=EX-00001&contentType=googleSheets" ``` ``` import requests response = requests.get( "https://api.trackandtrace.tools/v2/packages/active/report", params={ "licenseNumber": "EX-00001", "contentType": "googleSheets", }, headers={"Authorization": f"Bearer {access_token}"}, allow_redirects=False, ) print(response.json()["sheetUrl"]) ``` Anyone with the link can open and edit the sheet There is no Google account to grant access to on a plain request, so the URL is the credential. Treat it the way you would treat the report itself; it holds your Metrc data. To restrict it, add **`&sheetVisibility=private`** together with an `email`: ``` https://api.trackandtrace.tools/v2/packages/active/report?secretKey=YOUR_SECRET_KEY&licenseNumber=EX-00001&contentType=googleSheets&sheetVisibility=private&email=you@example.com ``` Now the sheet is shared only with that Google account. You still get the `302`, but you will only land on the sheet if your browser is signed into that account; anyone else sees Google's request-access page. `sheetVisibility=private` without an `email` is a 400, because the sheet would open for nobody. `sheetVisibility` works the same way with `delivery=email`, and defaults to `public` there too. Add `&sheetVisibility=private` if you want the emailed sheet restricted to its recipient. Three more things to know: - **A named `email` must be a Google account.** The sheet is granted to that address directly, and Google Drive may refuse an address it does not recognize. If it does, no sheet is left behind and you are told why. Use `contentType=xlsx` to receive a file instead. - **Use `delivery=email` for large reports.** Without it, the sheet is created and filled inside your request, on top of generating the report, so a report near the row cap can run out of time partway through. With `delivery=email` there is no 240-second wait. - **Every request creates a new sheet, and sheets are never deleted.** Use `csv` for anything recurring: a job that pulls `googleSheets` every five minutes leaves behind an abandoned sheet every five minutes. ## Saving a report Once you have a report URL configured the way you want it, you can save it under a name so you can find it again, and so it can [run on a schedule](https://wiki.trackandtrace.tools/reports/scheduling/index.md). A saved report is a **definition, not a shortcut**. Saving one does not run it: you save the URL, and later you retrieve it and request it exactly as you would have anyway. ### Saving one `POST` the URL you already have. Both a full URL and a bare path work: ``` # /// script # requires-python = ">=3.8" # dependencies = [ # "httpx", # ] # /// import httpx SECRET_KEY = "YOUR_SECRET_KEY" response = httpx.post( "https://api.trackandtrace.tools/v2/saved-reports", headers={"X-T3-API-Key": SECRET_KEY}, json={ "name": "Daily veg plant count", "description": "Feeds the cultivation team's morning dashboard", "reportUrl": ( "/v2/plants/vegetative/report" "?licenseNumber=EX-00001" "&contentType=csv" "&columns=label,strainName,plantedDate" "&prependCsvMetadata=false" ), }, ) saved = response.json()["data"] print(saved["publicId"]) print(saved["reportUrl"]) ``` **Your secret key is never stored.** If you paste a URL that still has `&secretKey=...` on the end (which is what you get by copying it out of your browser) it is stripped before the report is saved. A saved report is not a credential. **The URL is checked when you save it.** An unknown filter field, a bad `contentType`, a missing `licenseNumber`: all of these fail here, while you are looking at them, rather than the next time you go to use the report. ### Using one Retrieve it and request the `reportUrl` it gives you back. **Two things are yours to add.** `reportUrl` is a path, not a full address, and it carries no credential: - **Prepend the API origin**: `https://api.trackandtrace.tools`. The origin is left off on purpose, so one saved report is correct whatever host you read it from. - **Supply your secret key**: as `?secretKey=` or an `X-T3-API-Key` header. It was stripped when you saved, and is never stored. ``` saved = httpx.get( f"https://api.trackandtrace.tools/v2/saved-reports/{public_id}", headers={"X-T3-API-Key": SECRET_KEY}, ).json()["data"] report = httpx.get( f"https://api.trackandtrace.tools{saved['reportUrl']}", params={"secretKey": SECRET_KEY}, ) ``` The `reportUrl` you get back is not byte-identical to what you sent. The host is dropped, your secret key is removed, licenses are tidied up, and the query string is re-encoded. It is the same request, spelled canonically. To paste one into a browser, an `IMPORTDATA()` formula or Power Query, join the three parts yourself: ``` https://api.trackandtrace.tools + reportUrl + &secretKey=YOUR_SECRET_KEY ``` ### Managing them | Method | Path | What it does | | -------- | ------------------------------ | -------------------------------------------------------------------------- | | `GET` | `/v2/saved-reports` | List your saved reports. Filter with `?licenseNumber=` or `?t3EndpointId=` | | `POST` | `/v2/saved-reports` | Save a report URL | | `GET` | `/v2/saved-reports/{publicId}` | Retrieve one | | `PATCH` | `/v2/saved-reports/{publicId}` | Change the name, description or URL | | `DELETE` | `/v2/saved-reports/{publicId}` | Delete it permanently | An account can hold **100** saved reports. Saving another returns a `409` with code `SAVED_REPORT_LIMIT_EXCEEDED`; delete one first. Names are unique within an account: saving or renaming to a name already in use returns a `409` with code `SAVED_REPORT_NAME_CONFLICT`. Saved reports belong to your **Metrc account**, not to a single secret key. Anyone signing in as the same username on the same state's Metrc sees the same list, and rotating or revoking a secret key does not affect them. A [schedule](https://wiki.trackandtrace.tools/reports/scheduling/index.md) is the exception: it runs with one key, so deleting that key pauses it. ## Next Steps - Keep a spreadsheet permanently up to date with [Spreadsheet Sync](https://wiki.trackandtrace.tools/t3-api/spreadsheet-sync/index.md). - Have a saved report emailed to you on a schedule with [Scheduling a Report](https://wiki.trackandtrace.tools/reports/scheduling/index.md). - Choose the right format first in [Output Format](https://wiki.trackandtrace.tools/reports/output/index.md). - Copy a working delivery script from [Report Examples](https://wiki.trackandtrace.tools/reports/examples/index.md). - If a large report times out, see [Limits and Troubleshooting](https://wiki.trackandtrace.tools/reports/limits/index.md). # Report Endpoints Every collection with a report has a path ending in `/report`, and most also have a **super** form that attaches related records. See [Super Reports](https://wiki.trackandtrace.tools/reports/super-reports/index.md) for what that adds. The ones reached for most often: | Data | Report | Super report | | --------------------------- | ---------------------------------------- | ------------------------------------ | | Active Packages | `/v2/packages/active/report` | `/v2/packages/active/super/report` | | Inactive Packages | `/v2/packages/inactive/report` | `/v2/packages/inactive/super/report` | | Items | `/v2/items/report` | `/v2/items/super/report` | | Active Harvests | `/v2/harvests/active/report` | `/v2/harvests/active/super/report` | | Flowering Plants | `/v2/plants/flowering/report` | `/v2/plants/flowering/super/report` | | Active Sales | `/v2/sales/active/report` | `/v2/sales/active/super/report` | | Incoming Transfer Manifests | `/v2/transfers/incoming/manifest/report` | *(none)* | All 48 report endpoints | Data | Report | Super report | | ------------------------------------ | ------------------------------------------------- | ------------------------------------------------- | | Active Packages | `/v2/packages/active/report` | `/v2/packages/active/super/report` | | Inactive Packages | `/v2/packages/inactive/report` | `/v2/packages/inactive/super/report` | | In Transit Packages | `/v2/packages/intransit/report` | `/v2/packages/intransit/super/report` | | On Hold Packages | `/v2/packages/onhold/report` | `/v2/packages/onhold/super/report` | | Transferred Packages | `/v2/packages/transferred/report` | `/v2/packages/transferred/super/report` | | Point-in-Time Inventory | `/v2/packages/point-in-time/report` | *(none)* | | Product Labels | `/v2/packages/product-labels/report` | `/v2/packages/product-labels/super/report` | | Staged Product Labels | `/v2/packages/staged-product-labels/report` | `/v2/packages/staged-product-labels/super/report` | | Lab Samples | `/v2/packages/lab-samples/report` | `/v2/packages/lab-samples/super/report` | | Items | `/v2/items/report` | `/v2/items/super/report` | | Active Harvests | `/v2/harvests/active/report` | `/v2/harvests/active/super/report` | | Inactive Harvests | `/v2/harvests/inactive/report` | `/v2/harvests/inactive/super/report` | | On Hold Harvests | `/v2/harvests/onhold/report` | `/v2/harvests/onhold/super/report` | | Vegetative Plants | `/v2/plants/vegetative/report` | `/v2/plants/vegetative/super/report` | | Flowering Plants | `/v2/plants/flowering/report` | `/v2/plants/flowering/super/report` | | On Hold Plants | `/v2/plants/onhold/report` | `/v2/plants/onhold/super/report` | | Inactive Plants | `/v2/plants/inactive/report` | `/v2/plants/inactive/super/report` | | Active Mother Plants | `/v2/plants/mother/active/report` | `/v2/plants/mother/active/super/report` | | On Hold Mother Plants | `/v2/plants/mother/onhold/report` | `/v2/plants/mother/onhold/super/report` | | Inactive Mother Plants | `/v2/plants/mother/inactive/report` | `/v2/plants/mother/inactive/super/report` | | Active Plant Batches | `/v2/plantbatches/active/report` | `/v2/plantbatches/active/super/report` | | On Hold Plant Batches | `/v2/plantbatches/onhold/report` | `/v2/plantbatches/onhold/super/report` | | Inactive Plant Batches | `/v2/plantbatches/inactive/report` | `/v2/plantbatches/inactive/super/report` | | Plant Waste | `/v2/plants/waste/report` | `/v2/plants/waste/super/report` | | Plant Additives | `/v2/plants/additives/report` | `/v2/plants/additives/super/report` | | Active Sales | `/v2/sales/active/report` | `/v2/sales/active/super/report` | | Inactive Sales | `/v2/sales/inactive/report` | `/v2/sales/inactive/super/report` | | Available Tags | `/v2/tags/available/report` | `/v2/tags/available/super/report` | | Used Tags | `/v2/tags/used/report` | `/v2/tags/used/super/report` | | Voided Tags | `/v2/tags/voided/report` | `/v2/tags/voided/super/report` | | Current Tag Orders | `/v2/tagorders/current/report` | `/v2/tagorders/current/super/report` | | Historical Tag Orders | `/v2/tagorders/history/report` | `/v2/tagorders/history/super/report` | | Active Processing Jobs | `/v2/processingjobs/active/report` | `/v2/processingjobs/active/super/report` | | Inactive Processing Jobs | `/v2/processingjobs/inactive/report` | `/v2/processingjobs/inactive/super/report` | | Strains | `/v2/strains/report` | `/v2/strains/super/report` | | Active Locations | `/v2/locations/active/report` | `/v2/locations/active/super/report` | | Incoming Active Transfers | `/v2/transfers/incoming/active/report` | *(none)* | | Incoming Inactive Transfers | `/v2/transfers/incoming/inactive/report` | *(none)* | | Outgoing Active Transfers | `/v2/transfers/outgoing/active/report` | *(none)* | | Outgoing Inactive Transfers | `/v2/transfers/outgoing/inactive/report` | *(none)* | | Rejected Transfers | `/v2/transfers/rejected/report` | *(none)* | | Hub Transfers | `/v2/transfers/hub/report` | *(none)* | | Incoming Transfer Manifests | `/v2/transfers/incoming/manifest/report` | *(none)* | | Incoming Inactive Transfer Manifests | `/v2/transfers/incoming/inactive/manifest/report` | *(none)* | | Outgoing Transfer Manifests | `/v2/transfers/outgoing/manifest/report` | *(none)* | | Outgoing Inactive Transfer Manifests | `/v2/transfers/outgoing/inactive/manifest/report` | *(none)* | | Rejected Transfer Manifests | `/v2/transfers/rejected/manifest/report` | *(none)* | | Hub Transfer Manifests | `/v2/transfers/hub/manifest/report` | *(none)* | ## Notes on particular reports These reports do not behave like the rest. Read the one that covers the path you picked. ### The point-in-time report answers for a past date `/v2/packages/point-in-time/report` lists what one license held on a date up to 180 days back, worked out from each package's history. It takes a `date`, has no super form, and refuses filters, sort and `rowLimit`. See [Point-in-Time Inventory](https://wiki.trackandtrace.tools/reports/point-in-time/index.md). ### On hold and inactive plant reports exclude mother plants The pooled and mother-specific reports partition your plants rather than overlap, so there is no double-counting, but if you want *every* on hold plant, request both `/v2/plants/onhold/report` and `/v2/plants/mother/onhold/report` and combine them. ### Transfer reports have no super form They return one row per transfer, with no `include` support. If you need the packages or transporters on each transfer, use a transfer manifest report (below), or page through a [supercollection](https://wiki.trackandtrace.tools/t3-api/supercollections/index.md) such as `/v2/transfers/outgoing/active/super`. ### Transfer manifest reports work differently from every other report They load the packages and transporters for every transfer **automatically**, with no `include` to add and no way to switch it off. There is no super form. `json` returns one record per transfer with its packages and transporters nested inside it; `csv`, `xlsx` and `googleSheets` cross-join them into one row per package. Each column is prefixed by the object it came from: | Report | Column prefixes | | ------------------------------------------- | --------------------------------------------------------------------------- | | Incoming, active and inactive | `transfer.`, `transporter.`, `package.` | | Outgoing, active and inactive, and rejected | `transfer.`, `delivery.`, `transporter.`, `transporterDetails.`, `package.` | | Hub | `transfer.`, `transporterDetails.`, `package.` | Two things follow that surprise people: - **`filter` and `rowLimit` select transfers, not rows.** Both apply before the join, so `&rowLimit=100` can return several hundred rows, and every package on a matched transfer comes back. - **They reach the size limit early.** Loading the packages and transporters adds work for every transfer, so these reports are refused as [too large to build](https://wiki.trackandtrace.tools/reports/limits/#report-request-too-large) well before the 50,000 row cap: near **5,000 transfers** for incoming, **2,500** for outgoing and rejected, and **10,000** for hub. Filter to a date range, or set a `rowLimit` below those figures, such as `&rowLimit=2000`. The two `inactive` manifest reports cover transfers that are no longer active, chiefly ones already received. They hold every such transfer the license has ever had, so always filter them to a date range: `receivedDateTime` for incoming, `createdDateTime` for outgoing. Metrc lists outgoing transfers without a received date, because each delivery is received separately. See [Received transfer manifests](https://wiki.trackandtrace.tools/reports/examples/#received-transfer-manifests). ### Hub transfer reports cover the transfers you *transport* These are the rows on Metrc's "Transfers Hub" page, where your license is neither the shipper nor the recipient, so they appear in no other transfer report. Two things make them unusual: - **There is no active/inactive split.** Metrc serves the whole collection as one list, so there is a single `/v2/transfers/hub/report` rather than the active/inactive pair every other transfer collection has. - **The manifest form has no `delivery.` or `transporter.` group.** Those fields appear under `transfer.`. `transporterDetails.` shows the **first** driver leg only; when `transfer.multiVehicle` or `transfer.isLayover` is true, the remaining legs are in the JSON response but cannot be represented in a flat grid. Both flags are in the default columns so you can tell when that is happening. ### Tag orders use `current` and `history` rather than active/inactive Those are Metrc's own names for the two tabs on its tag orders page, and the paths mirror them. Note that `history` here is a *state* of the collection, unlike `/v2/packages/history`, which is one package's audit trail. Each tag order carries its line items in a `details` array, returned with the order itself rather than through an `include`. ### Processing jobs are currently Oregon-only Metrc exposes the Processing module in Oregon; licenses in other states get an empty report rather than an error. The super report takes `createdPackages`, `sourcePackages` and `history`. Use `include=sourcePackages` rather than the job's inline `packages` array, which is incomplete. See [Superprocessingjob includes](https://wiki.trackandtrace.tools/t3-api/supercollection-includes/#superprocessingjob-includes). ### Some super reports add nothing The tag, tag order, strain and location super reports return the same columns as their plain form, because Metrc has no related data to attach to those objects. ## Next Steps - Narrow what a report returns with [Shaping a Report](https://wiki.trackandtrace.tools/reports/shaping/index.md). - Attach related records with [Super Reports](https://wiki.trackandtrace.tools/reports/super-reports/index.md). - Check the caps before a large run in [Limits and Troubleshooting](https://wiki.trackandtrace.tools/reports/limits/index.md). # Delivery Examples Recipes for cutting a report down and sending it somewhere: a filtered export, an emailed Excel workbook, a live Google Sheet. Each uses the same preamble as the first script in [Report Examples](https://wiki.trackandtrace.tools/reports/examples/index.md): a uv script header, imports, and your `SECRET_KEY` and `LICENSE_NUMBER`. Scripts authenticate with the `X-T3-API-Key` header; the plain URLs carry `?secretKey=` because they are meant to be pasted somewhere. ## Narrowing a report with filters, columns and a row limit Reports return everything by default, which is rarely what you want while you are still building the request. These three parameters work together to cut a report down: - **`filter`** narrows which records come back. Repeat it for multiple conditions. - **`columns`** picks the columns, in the order you list them. - **`rowLimit`** caps how many records are loaded. Say you want the label and quantity of every active package in the Bulk Storage room holding more than 100 units: ``` https://api.trackandtrace.tools/v2/packages/active/report?secretKey=YOUR_SECRET_KEY&licenseNumber=EX-00001&filter=locationName__eq:Bulk Storage&filter=quantity__gte:100&filterLogic=and&columns=label,item.name,quantity,unitOfMeasureAbbreviation&sort=quantity:desc&rowLimit=10 ``` ``` # Same preamble as the first example: uv script header, # imports, SECRET_KEY and LICENSE_NUMBER. def main(): response = httpx.get( "https://api.trackandtrace.tools/v2/packages/active/report", params={ "licenseNumber": LICENSE_NUMBER, "filter": [ "locationName__eq:Bulk Storage", "quantity__gte:100", ], "filterLogic": "and", "columns": "label,item.name,quantity,unitOfMeasureAbbreviation", "sort": "quantity:desc", # Start small while you get the filters right, then remove this. "rowLimit": 10, "contentType": "json", }, headers={"X-T3-API-Key": SECRET_KEY}, # A report waits up to 240 seconds before giving up. timeout=250.0, ) response.raise_for_status() report = response.json() print(f"{len(report['data'])} packages") for package in report["data"]: print(package["label"], package["quantity"]) if __name__ == "__main__": main() ``` Build with a small `rowLimit`, then remove it. See [Limiting the Number of Rows](https://wiki.trackandtrace.tools/reports/shaping/#limiting-the-number-of-rows). Note that `sort` matters once `rowLimit` is in play: only the first *n* records are loaded, so `sort=quantity:desc&rowLimit=10` gives you the ten largest packages, not ten arbitrary ones. The column names available for a given report come from its **dataModel**, which is listed in the [metadata preamble](https://wiki.trackandtrace.tools/reports/output/#the-metadata-preamble) and documented under Schemas in the [API docs](https://api.trackandtrace.tools/v2/docs/). ## Emailing a large report as an Excel workbook **The problem:** your report is big enough that the request times out. A normal request waits 240 seconds and then returns [`Report Generation Timeout`](https://wiki.trackandtrace.tools/reports/limits/#report-generation-timeout). `&delivery=email` removes the wait: you get a receipt at once, and the report is sent when it is ready. It must still finish building within about five minutes. Pair it with `&contentType=xlsx` to get an Excel workbook attached to the email: ``` https://api.trackandtrace.tools/v2/packages/active/report?secretKey=YOUR_SECRET_KEY&licenseNumber=EX-00001&contentType=xlsx&delivery=email&email=you@example.com ``` ``` # Same preamble as the first example: uv script header, # imports, SECRET_KEY and LICENSE_NUMBER. def main(): response = httpx.get( "https://api.trackandtrace.tools/v2/packages/active/report", params={ "licenseNumber": LICENSE_NUMBER, "contentType": "xlsx", "delivery": "email", "email": "you@example.com", }, headers={"X-T3-API-Key": SECRET_KEY}, # A report waits up to 240 seconds before giving up. timeout=250.0, ) response.raise_for_status() # You get a receipt immediately. The report itself arrives by email. print(response.json()) if __name__ == "__main__": main() ``` The receipt, the errors that arrive by email, and why `delivery=email` never belongs on a Spreadsheet Sync link are covered in [Emailing a Report](https://wiki.trackandtrace.tools/reports/delivery/#emailing-a-report). ## Delivering a report to Google Sheets `&contentType=googleSheets` builds a Google Sheet. Add `&delivery=email` and the link is emailed to the account you name instead of returned, which suits a report too large to finish inside a request. (Without `delivery=email` you get a `302` straight to the sheet; see [The `googleSheets` Format](https://wiki.trackandtrace.tools/reports/delivery/#the-googlesheets-format).) ``` https://api.trackandtrace.tools/v2/packages/active/report?secretKey=YOUR_SECRET_KEY&licenseNumber=EX-00001&contentType=googleSheets&delivery=email&email=you@example.com ``` ``` # Same preamble as the first example: uv script header, # imports, SECRET_KEY and LICENSE_NUMBER. # Must be a Google account: the sheet is shared with it directly. GOOGLE_ACCOUNT = "you@example.com" def main(): response = httpx.get( "https://api.trackandtrace.tools/v2/packages/active/report", params={ "licenseNumber": LICENSE_NUMBER, "contentType": "googleSheets", "delivery": "email", "email": GOOGLE_ACCOUNT, # Without this, anyone with the sheet's link can open and edit it. "sheetVisibility": "private", }, headers={"X-T3-API-Key": SECRET_KEY}, # A report waits up to 240 seconds before giving up. timeout=250.0, ) response.raise_for_status() # The sheet link is emailed once the sheet has been created and shared. print(response.json()) if __name__ == "__main__": main() ``` The receipt carries no sheet URL, because the sheet does not exist yet. The recipient must be a Google account, the sheet is public unless you pass `sheetVisibility=private`, and every request creates a new sheet. See [The `googleSheets` Format](https://wiki.trackandtrace.tools/reports/delivery/#the-googlesheets-format). [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/index.md) in the Chrome Extension uses this endpoint, so a sheet it creates behaves the same way. ## Next Steps - Read the parameters these use in [Shaping a Report](https://wiki.trackandtrace.tools/reports/shaping/index.md) and [Output Format](https://wiki.trackandtrace.tools/reports/output/index.md). - Set up a permanently live sheet with [Spreadsheet Sync](https://wiki.trackandtrace.tools/t3-api/spreadsheet-sync/index.md). - If a large report times out, see [Limits and Troubleshooting](https://wiki.trackandtrace.tools/reports/limits/index.md). # Report Examples Every example below uses your [secret key](https://wiki.trackandtrace.tools/t3-api/spreadsheet-sync/#1-generate-your-secret-key) for authentication, which is the simplest way to call a report endpoint from a script. The scripts are written for [uv](https://wiki.trackandtrace.tools/t3-api/api-scripts/#running-python-scripts-with-uv): save one as `example.py` and run it with `uv run example.py`. Each example also shows the plain URL. A URL carries the key as `?secretKey=` rather than a header because it is meant to be pasted somewhere: a browser, an `IMPORTDATA()` formula, Power Query. In a script, prefer the `X-T3-API-Key` header, as every script below does. ## Packages from each harvest **The problem:** you want to know which packages came out of each harvest. Metrc keeps harvests and packages in separate places, so ordinarily you export a harvest report, export a package report, and try to match them up by hand. A **super report** does the join for you. `/v2/harvests/active/super/report` returns your harvests, and `&include=packages` attaches the packages created from each one: ``` https://api.trackandtrace.tools/v2/harvests/active/super/report?secretKey=YOUR_SECRET_KEY&licenseNumber=EX-00001&include=packages&contentType=json ``` ``` #!/usr/bin/env python3 # /// script # requires-python = ">=3.8" # dependencies = [ # "httpx", # ] # /// import httpx SECRET_KEY = "1234-1234-1234-1234-1234-1234" LICENSE_NUMBER = "EX-00001" def main(): response = httpx.get( "https://api.trackandtrace.tools/v2/harvests/active/super/report", params={ "licenseNumber": LICENSE_NUMBER, "include": "packages", "contentType": "json", }, headers={"X-T3-API-Key": SECRET_KEY}, # A report waits up to 240 seconds before giving up. timeout=250.0, ) response.raise_for_status() report = response.json() for harvest in report["data"]: packages = harvest.get("packages", []) print(f"{harvest['name']}: {len(packages)} packages") for package in packages: print(f" {package['label']}") if __name__ == "__main__": main() ``` Each harvest in `data` carries all the usual harvest fields (`name`, `harvestStartDate`, `plantCount`, `currentWeight`, `totalWetWeight`, and so on) plus a `packages` array holding the packages Metrc recorded against it. **In a spreadsheet.** Switch to `&contentType=csv` and the packages are flattened into the rows; you get one row per package, with the harvest columns repeated. That is exactly the shape you want for a pivot table summarizing yield by harvest. Swap `active` for `inactive` or `onhold` to run the same report against harvests in those states. `include=plants` attaches the plants that went into each harvest instead, and `include=history` attaches the harvest's Metrc history. ## Incoming transfer manifests **The problem:** you want a line-item list of everything arriving at your facility, not one row per transfer, but one row per package on each transfer, with the manifest number and transporter attached. `/v2/transfers/incoming/manifest/report` does this in a single request. Unlike a super report, you do not ask for the packages with `include`: this report always loads the packages and transporters for every transfer and cross-joins them: ``` https://api.trackandtrace.tools/v2/transfers/incoming/manifest/report?secretKey=YOUR_SECRET_KEY&licenseNumber=EX-00001&contentType=csv ``` ``` # Same preamble as the first example: uv script header, # imports, SECRET_KEY and LICENSE_NUMBER. def main(): response = httpx.get( "https://api.trackandtrace.tools/v2/transfers/incoming/manifest/report", params={ "licenseNumber": LICENSE_NUMBER, "contentType": "json", # Manifest reports reach the size limit early. See the note below. "rowLimit": 500, }, headers={"X-T3-API-Key": SECRET_KEY}, # A report waits up to 240 seconds before giving up. timeout=250.0, ) response.raise_for_status() report = response.json() for transfer in report["data"]: for package in transfer.get("packages", []): print( transfer["manifestNumber"], package["packageLabel"], package["productName"], package["shippedQuantity"], package["shippedUnitOfMeasureAbbreviation"], ) if __name__ == "__main__": main() ``` In JSON, each record is a transfer with its `packages` and `transporters` nested inside it. In `csv`, `xlsx` and `googleSheets`, each row is stitched together from the transfer, a package and the transporter, so the columns are prefixed by where they came from. The default columns are: | Column | Comes from | | ---------------------------------------------- | --------------- | | `transfer.manifestNumber` | The transfer | | `transfer.recipientFacilityLicenseNumber` | The transfer | | `transfer.recipientFacilityName` | The transfer | | `transporter.transporterFacilityName` | The transporter | | `transporter.transporterFacilityLicenseNumber` | The transporter | | `package.packageLabel` | The package | | `package.productName` | The package | | `package.shippedQuantity` | The package | | `package.shippedUnitOfMeasureAbbreviation` | The package | `rowLimit` counts transfers, not rows, and these reports reach the size limit at a few thousand transfers. See [Transfer manifest reports work differently](https://wiki.trackandtrace.tools/reports/endpoints/#transfer-manifest-reports-work-differently-from-every-other-report). `/v2/transfers/outgoing/manifest/report` is the same report for outgoing transfers, and adds driver and vehicle columns (`transporterDetails.driverName`, `transporterDetails.vehicleLicensePlateNumber`, and so on). `/v2/transfers/rejected/manifest/report` is the rejected equivalent, with identical columns; Metrc returns rejected transfers in the same shape as outgoing ones. ## Received transfer manifests **The problem:** you want the same line-item list for transfers you have already received, over a date range: who shipped each package, what it was, how much, when it was due, and when it arrived. A received transfer leaves the incoming list, so use `/v2/transfers/incoming/inactive/manifest/report` and filter on `receivedDateTime`, written as a full UTC timestamp: ``` https://api.trackandtrace.tools/v2/transfers/incoming/inactive/manifest/report?secretKey=YOUR_SECRET_KEY&licenseNumber=EX-00001&contentType=googleSheets&filter=receivedDateTime__gte:2026-08-01T00:00:00.000Z&sort=receivedDateTime:asc&columns=transfer.manifestNumber,transfer.shipperFacilityName,transfer.estimatedArrivalDateTime,transfer.receivedDateTime,package.packageLabel,package.productName,package.shippedQuantity,package.shippedUnitOfMeasureAbbreviation ``` ``` # Same preamble as the first example: uv script header, # imports, SECRET_KEY and LICENSE_NUMBER. def main(): response = httpx.get( "https://api.trackandtrace.tools/v2/transfers/incoming/inactive/manifest/report", params={ "licenseNumber": LICENSE_NUMBER, "contentType": "json", "filter": "receivedDateTime__gte:2026-08-01T00:00:00.000Z", "sort": "receivedDateTime:asc", }, headers={"X-T3-API-Key": SECRET_KEY}, timeout=250.0, ) response.raise_for_status() for transfer in response.json()["data"]: for package in transfer.get("packages", []): print( transfer["receivedDateTime"], transfer["shipperFacilityName"], package["productName"], package["shippedQuantity"], package["shippedUnitOfMeasureAbbreviation"], ) if __name__ == "__main__": main() ``` The default columns are the incoming manifest report's plus `transfer.receivedDateTime`. To narrow to one shipper, add `&filter=shipperFacilityInfo__contains:Example Farms`. `filterLogic` applies to every filter at once, so a date filter cannot be combined with an `or` across several shippers: run one report per shipper instead. `/v2/transfers/outgoing/inactive/manifest/report` is the outgoing equivalent. Filter it on `createdDateTime`, since each delivery of an outgoing transfer is received separately; its default columns add `delivery.receivedDateTime`. ## Reconciling a shipment as it is unloaded **The problem:** a truck has arrived and someone has to check that every package on the manifest is physically present, and that nothing turned up that should not have. Add `&transform=scanSheet` to any of the manifest reports and you get a spreadsheet built for exactly that: one row per package, a column holding the expected tag, and an empty column beside it that colours itself as a worker scans. ``` https://api.trackandtrace.tools/v2/transfers/incoming/manifest/report?secretKey=YOUR_SECRET_KEY&licenseNumber=EX-00001&transform=scanSheet&contentType=googleSheets&filter=manifestNumber__eq:0000123456 ``` A scan sheet loads the same data as the report it is built from, so the two share a cached result: run the report, then the scan sheet, and the scan sheet is served from cache and returns immediately. See [Scan Sheets](https://wiki.trackandtrace.tools/t3-api/scan-sheets/index.md) for the columns, the colour meanings, and the manifest-number filter syntax. ## Lab results for every active package **The problem:** you want a COA summary across your inventory (every active package with its potency results) without opening each package in Metrc one at a time. This is the most commonly used super report. `&include=labResults` attaches the lab results to each package: ``` https://api.trackandtrace.tools/v2/packages/active/super/report?secretKey=YOUR_SECRET_KEY&licenseNumber=EX-00001&include=labResults&contentType=json ``` ``` # Same preamble as the first example: uv script header, # imports, SECRET_KEY and LICENSE_NUMBER. def main(): response = httpx.get( "https://api.trackandtrace.tools/v2/packages/active/super/report", params={ "licenseNumber": LICENSE_NUMBER, "include": "labResults", "contentType": "json", # Super reports cap at 5,000 records, so narrow to what you need. "filter": "item.productCategoryName__eq:Buds", }, headers={"X-T3-API-Key": SECRET_KEY}, # A report waits up to 240 seconds before giving up. timeout=250.0, ) response.raise_for_status() report = response.json() for package in report["data"]: extracted = package["metadata"]["extractedLabResults"] print(package["label"], package["item"]["name"], extracted) if __name__ == "__main__": main() ``` Each package carries its standard fields plus a `labResults` array of raw Metrc lab result data, and a `metadata` object with the results already parsed into a usable shape: `extractedLabResults`, `indexedLabResults`, `testSamplePackageLabels` and `labResultPdfs`. The `metadata` fields are usually what you want; the raw `labResults` array is there when you need something the parsing didn't surface. **In a spreadsheet, add `&rowMode=collapsed`.** Because the `metadata` fields are already one-per-package, a CSV of this report would otherwise repeat each package once per lab result. A package carries a result per analyte per test, so this is the difference between one row and a hundred. See [One row per record, or one row per included record](https://wiki.trackandtrace.tools/reports/super-reports/#one-row-per-record-or-one-row-per-included-record). Watch the row cap A super report returns at most 5,000 records, a tenth of a plain report, because each `include` adds work for every package. Filtering to a product category, a location, or a date range is usually how you get under it. See [Report Request Too Large](https://wiki.trackandtrace.tools/reports/limits/#report-request-too-large) if you hit the limit. Other useful package includes are `sourceHarvests` (which harvest the package came from), `history` (the package's full Metrc history), and `labResultBatches` (results grouped by test batch). All the options are listed on the [Supercollections](https://wiki.trackandtrace.tools/t3-api/supercollection-includes/#superpackage-includes) page, and published as an enum on each endpoint in the [API documentation](https://api.trackandtrace.tools/v2/docs/). ## Next Steps - Narrow or reshape any of these with [Shaping a Report](https://wiki.trackandtrace.tools/reports/shaping/index.md). - See recipes for filtering and delivery in [Delivery Examples](https://wiki.trackandtrace.tools/reports/examples-delivery/index.md). - If a script fails, match the message in [Limits and Troubleshooting](https://wiki.trackandtrace.tools/reports/limits/index.md). # Limits and Troubleshooting ``` flowchart TB R["Report request"] --> L{"Within your
rate limits?"} L -->|no| RL["429 Rate Limit Exceeded"] L -->|yes| C{"Same licenses, path and
data parameters in the
last 5 minutes?"} C -->|yes| HIT["Served from cache,
returns immediately"] C -->|no| B{"Under the row cap and
small enough to build?"} B -->|no| X["Report Request Too Large,
rejected before any data loads"] B -->|yes| G["Generating, usually 15 to 20 seconds"] G --> W{"Finished within
240 seconds?"} W -->|yes| OK["Returned, and cached
for the next 5 minutes"] W -->|no| T["504, but generation continues.
Request it again and it
usually comes from cache"] ``` ## Limits | Limit | Report | Super report | | ---------------------------------------------- | -------------------- | ----------------------------------------------------- | | Rows returned | 50,000 | 5,000 | | Rate limit, per report endpoint | 6/minute and 48/hour | 6/minute and 48/hour | | Rate limit, all reports together | 48/hour | 48/hour | | `include` values (CSV, `xlsx`, `googleSheets`) | n/a | 1 | | `include` values (JSON) | n/a | Several, while the report stays small enough to build | | Cached for | 5 minutes | 5 minutes | | Request waits up to | 240 seconds | 240 seconds | **Rate limits** are counted per T3+ subscription, and every request counts, including one served from cache. Over a limit, the request returns `429`. [Emailed reports](https://wiki.trackandtrace.tools/reports/delivery/#emailing-a-report) are also limited to 10 a minute, and [point-in-time reports](https://wiki.trackandtrace.tools/reports/point-in-time/#limits) to 2 built an hour. **A report is refused before it loads when it would be too large to build.** Each `include` adds work for every record, so a super report with one include tops out near 5,000 records, and fewer with more includes. See [Report Request Too Large](#report-request-too-large). ## Caching and Timing **Caching.** Identical report requests are served from a cache for **5 minutes**. "Identical" means the same licenses, the same path, and the same parameters that select data (`filter`, `filterLogic`, `sort`, `rowLimit`, `include` and so on). Parameters that only shape the output do not count: change `columns`, `contentType`, `columnHeaderOverrides`, `rowMode`, `transform`, `prependCsvMetadata` or `contentDisposition` and the report is served from cache and returns immediately. See [Shaping a Report](https://wiki.trackandtrace.tools/reports/shaping/index.md). Because license order determines row order, `licenseNumber=A&licenseNumber=B` and `licenseNumber=B&licenseNumber=A` are different reports and cache separately. This matters for Spreadsheet Sync: `IMPORTDATA` refreshes roughly once an hour, which is well outside the cache window, so each refresh gets fresh data. But if you refresh manually several times in a row, or have several sheets pulling the same Sync Link, you will get the same document back until the five minutes elapse. **Timing.** Reports usually finish in 15–20 seconds. A request waits up to **240 seconds** before giving up. If the wait elapses you get a `504` response, but the report keeps building, so it has not failed. Request it again; by then it has usually finished and comes straight from the cache. A report has about **five minutes** to build. One that needs longer fails however you request it, so narrow it with filters or a `rowLimit`. [`delivery=email`](https://wiki.trackandtrace.tools/reports/delivery/#emailing-a-report) removes the 240-second wait: it returns a receipt immediately and sends the report when it is ready, or an email explaining why it failed. ## Troubleshooting ### Report Request Too Large This one title covers two different limits, and the message tells you which you hit. **Too many rows:** ``` Too many records to fetch: 120000. Please refine your filters so fewer than 50000 is returned. ``` Your collection is bigger than the report's row cap, 50,000 for a report, 5,000 for a super report. Reports reject an oversized collection rather than silently returning part of it, because a truncated spreadsheet looks exactly like a complete one. **Too large to build:** ``` Report too large: 25000 records with 1 includes. Refine filters to reduce record count, reduce includes, or set a lower rowLimit. ``` The report would be too large to build. The message names what drove it up: the **record count** and the number of **includes**. Any of these will bring either version back under the limit: 1. **Filter harder.** `&filter=locationName__eq:Bulk Storage` on a report that currently returns everything is usually the biggest win, and gives you a more useful report besides. 1. **Add a row limit.** `&rowLimit=1000` caps the record count directly. Both limits are checked against the limited count, not the full collection, so this works on either version of the error. 1. **Drop an include.** Each one you remove takes work off every record. 1. **Use the plain report.** If you did not need the related data, the plain report takes no `include` and has a 50,000 row cap. Transfer manifest reports hit this limit at a few thousand transfers even though they take no `include`, and their message names only the record count. See [Transfer manifest reports work differently](https://wiki.trackandtrace.tools/reports/endpoints/#transfer-manifest-reports-work-differently-from-every-other-report). ### Too Many Includes for 2D Format ``` 2D output formats (CSV) support a maximum of 1 include parameter. You requested 2 includes: labResults, history. Use JSON for multiple includes, or specify only one include. ``` Switch to `&contentType=json`, or request one include and run a second report for the other. See [One include in tabular formats, many in JSON](https://wiki.trackandtrace.tools/reports/super-reports/#one-include-in-tabular-formats-many-in-json). ### Invalid Include ``` Unrecognized include `labresults`. This endpoint accepts: history, sourceHarvests, labResultBatches, labResults, coaResults. ``` The `include` value is not one this report accepts. Include names are case-sensitive, and each report accepts a different set. The error lists the ones that work here. Two common causes: - **A comma-joined list.** `&include=labResults,history` is one value, not two. Repeat the parameter instead: `&include=labResults&include=history`. - **An include from a different report.** `plants` works on a harvest super report but not on a package one; each report attaches only what its own records relate to. Every endpoint's valid includes are published as an enum in the [API documentation](https://api.trackandtrace.tools/v2/docs/). ### Invalid columns ``` The following columns are not valid for MetrcPackage: labResults. Valid columns: id, label, packageType, quantity, ... ``` One of the names in your `&columns=` list is not a column on this report's data model. The error lists every valid name, so the fix is usually visible in the response itself. Two common causes: - **A related object rather than a column.** `labResults` is data you attach with `include` on a super report, not a column you select with `columns`. - **Nested syntax where it does not apply.** Only packages support `item.*`, and only for four fields. See [Specifying Field Names](https://wiki.trackandtrace.tools/reports/shaping/#specifying-field-names). ### Tag list entries did not resolve ``` 2 of 200 entries did not resolve to exactly one object in ACTIVE_PACKAGES_REPORT. Nothing was returned; see errors for each entry. ``` A `422` from a report with `tagListId`. The `errors` array names the failing entries, up to 1,000, and the message counts them all: `NOT_FOUND` when no row in the report's collection has the handle, `AMBIGUOUS` when more than one does. A package that has been sold or moved is no longer active, so it fails an active packages report. Remove the entry, or report the list against the collection it is in now. See [Scoping a Report to a Tag List](https://wiki.trackandtrace.tools/reports/shaping/#scoping-a-report-to-a-tag-list). ### Report Generation Timeout ``` Report generation did not complete within the timeout period. Please try again. ``` A `504` after 240 seconds. The report is still being generated: request the same URL again and it will usually be ready and cached. If it happens repeatedly, the report is probably close to the limits. Narrow it with filters or a `rowLimit`, or switch to [`delivery=email`](https://wiki.trackandtrace.tools/reports/delivery/#emailing-a-report), which returns at once instead of waiting. An emailed report must still finish building within about five minutes. ______________________________________________________________________ ## Next Steps - Cut a too-large report down with [Shaping a Report](https://wiki.trackandtrace.tools/reports/shaping/index.md). - Have a slow report sent to you instead by [emailing it](https://wiki.trackandtrace.tools/reports/delivery/#emailing-a-report). - Browse working requests in [Report Examples](https://wiki.trackandtrace.tools/reports/examples/index.md). # Output and Delivery Format ## Choosing a Response Format Add **`&contentType=`** with one of four values: | `contentType` | You get | Includes | Use it for | | -------------- | -------------------------------- | --------- | ------------------------------------------------- | | `json` | Nested JSON envelope | Unlimited | Scripts and integrations | | `csv` | `.csv` file download | One | Spreadsheets, scheduled pulls, anything automated | | `xlsx` | `.xlsx` file download | One | Opening in Excel without an import step | | `googleSheets` | A redirect to a new Google Sheet | One | One-off exports you intend to share or edit | `json` and `csv` can also be set with the `Content-Type` header. `xlsx` and `googleSheets` are query-parameter only. `csv`, `xlsx` and `googleSheets` contain exactly the same thing: same rows, same title-cased headers, same [metadata preamble](#the-metadata-preamble). Only the container differs. All three of `json`, `csv` and `xlsx` download as file attachments. See [Downloading vs. Rendering](#downloading-vs-rendering). A JSON report returns a single object describing both the request and the results: ``` { "generatedAt": "2024-01-01T00:00:00+00:00", "filters": ["quantity__gte:100"], "filterLogic": "and", "sort": "label:asc", "licenseNumbers": ["LIC-00001"], "data": [ ... ] } ``` The `data` array holds the records. The other fields echo back the request that produced them, which is useful when you are storing report output and need to know later how it was generated. ## Downloading vs. Rendering Reports download by default. Open a report URL in a browser and you get a saved file rather than a wall of text, for `json`, `csv` and `xlsx` alike. **If you are writing a script, this changes nothing.** `Content-Disposition` is a hint to browsers; `curl`, Python's `requests`, JavaScript's `fetch` and Google Sheets `IMPORTDATA` all ignore it and hand you the same bytes they always did. Add **`&contentDisposition=inline`** when you do want a browser to display the response instead: reading a JSON report without saving it, or eyeballing a CSV in a tab: ``` # Saves a file https://api.trackandtrace.tools/v2/packages/active/report?licenseNumber=LIC-00001 # Displays in the browser https://api.trackandtrace.tools/v2/packages/active/report?licenseNumber=LIC-00001&contentDisposition=inline ``` `contentType=googleSheets` redirects to a spreadsheet rather than returning a file, so it ignores this parameter. **The filename** describes the report, the license, the date it was generated, and a short hash of the request: ``` active-packages-report_LIC-00001_2024-01-01_a1b2c3.csv ``` A report covering several licenses names the first and counts the rest: `LIC-00001-plus-3`. The hash on the end stops two variants of the same report (different `columns`, a different `filter`) from overwriting each other in your downloads folder. A [scan sheet](https://wiki.trackandtrace.tools/reports/examples/#reconciling-a-shipment-as-it-is-unloaded) names itself instead. ## The Metadata Preamble By default every tabular report (`csv`, `xlsx` and `googleSheets` alike) starts with eight rows describing the request, before the column headers: ``` Report:,ACTIVE_PACKAGES_REPORT Data model:,MetrcPackage Generated at:,2024-01-01T00:00:00+00:00 License numbers:,LIC-00001 Filters:,quantity__gte:100 Filter logic:,and Sort:,label:asc Label,Location Name,Item Name,Quantity,Unit Of Measure Abbreviation 1A4400000000000000001234,Room A,Blue Dream,10,ea ``` So the column headers land on **row 9**, and your first data row is on **row 10**. The example above is CSV, but `xlsx` and `googleSheets` put the same values in the same cells: labels in column A, values in column B. A multi-license report lists them comma-joined in that one cell (`License numbers:,LIC-00001, LIC-00002`), so the preamble stays eight rows and the header stays on row 9 however many licenses you request. Add **`&prependCsvMetadata=false`** to remove the preamble entirely. Headers then start on row 1 and data on row 2. The parameter keeps its `Csv` name for backwards compatibility, but it governs all three tabular formats. **Which should you use?** - **Keep the preamble** when a person will open the file and needs to know which license, filters and sort produced it. - **Turn it off** when the output feeds a formula or query that expects headers first. This is usually what you want with `IMPORTDATA` in Google Sheets or Power Query in Excel, since otherwise every formula referencing the sheet has to be offset by eight rows. ## Reporting Across Multiple Licenses Reports and [search](https://wiki.trackandtrace.tools/t3-api/search/index.md) are the only endpoints that accept more than one license; every other endpoint returns a `400` when `licenseNumber` is repeated. Repeat **`licenseNumber`** to pull several into one document: `https://api.trackandtrace.tools/v2/packages/active/report?licenseNumber=LIC-00001`**`&licenseNumber=LIC-00002`** A comma-joined list does not work: repeat the parameter. Repeating the *same* license returns a 400, and at most **20** licenses may be requested at once. **Rows come back in the order you list the licenses.** Every row of `LIC-00001` precedes every row of `LIC-00002`. `sort` orders rows within each license, not across them. **Add `licenseNumber` to your `columns` so you can tell the rows apart.** Every record already carries it, so the column costs nothing extra: `...&licenseNumber=LIC-00001&licenseNumber=LIC-00002`**`&columns=licenseNumber,label,quantity`** It is not a default column, so single-license reports are unchanged. On the transfer manifest reports the field is `transfer.licenseNumber`, because those rows are built from a transfer/delivery/package hierarchy. **The limits are totals, not per-license allowances.** This is the part worth reading twice: - The **row cap** (50,000 for a report, 5,000 for a super report) applies to the *sum*. Two licenses holding 30,000 records each are 60,000 records, and the request is rejected. The error names each license's count so you can see which one to filter. - **`rowLimit` is a total**: filled in license order. `&rowLimit=600` against a first license holding 400 records returns all 400 of the first and the first 200 of the second, and never loads the rest of the second. - The limit on a report [too large to build](https://wiki.trackandtrace.tools/reports/limits/#report-request-too-large) is likewise one total across all licenses. A report is all-or-nothing If any license fails, most often because your account cannot access it, the whole request fails. A partial report would look complete, and a spreadsheet has no way to notice the difference. A multi-license request counts as **one** report request against your rate limits, no matter how many licenses it names. ``` #!/usr/bin/env python3 # /// script # requires-python = ">=3.8" # dependencies = [ # "httpx", # ] # /// """Pull active packages across several licenses into one CSV.""" import csv import io import httpx SECRET_KEY = "YOUR_SECRET_KEY" LICENSE_NUMBERS = ["EX-00001", "EX-00002"] response = httpx.get( "https://api.trackandtrace.tools/v2/packages/active/report", params=[ ("contentType", "csv"), ("columns", "licenseNumber,label,quantity"), ("prependCsvMetadata", "false"), # Repeat the parameter, once per license. httpx serializes a list of # tuples as licenseNumber=EX-00001&licenseNumber=EX-00002, which is # exactly what the endpoint expects. *[("licenseNumber", x) for x in LICENSE_NUMBERS], ], headers={"X-T3-API-Key": SECRET_KEY}, # A report waits up to 240 seconds before giving up. timeout=250.0, ) response.raise_for_status() rows = list(csv.DictReader(io.StringIO(response.text))) # Rows arrive grouped by license, in the order the parameters were sent. for license_number in LICENSE_NUMBERS: matching = [x for x in rows if x["License Number"] == license_number] print(f"{license_number}: {len(matching)} packages") print(f"total: {len(rows)}") ``` ## Next Steps - Email a report or push it to Google Sheets in [Delivering a Report](https://wiki.trackandtrace.tools/reports/delivery/index.md). - Cut the dataset down first with [Shaping a Report](https://wiki.trackandtrace.tools/reports/shaping/index.md). - See a multi-license export end to end in [Report Examples](https://wiki.trackandtrace.tools/reports/examples/index.md). # Point-in-Time Inventory `/v2/packages/point-in-time/report` lists every package one license held on a past date, with the quantity each had then. It works from each package's history, so it includes packages that have since been finished, discontinued or sent to another license. ``` https://api.trackandtrace.tools/v2/packages/point-in-time/report?secretKey=YOUR_SECRET_KEY&licenseNumber=EX-00001&date=2026-09-30&moment=close&contentType=csv ``` That is the license's inventory as September 30 closed, in Central time. ## Parameters | Parameter | Required | Meaning | | --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | `licenseNumber` | Yes | One license. A second one is refused. | | `date` | Yes | `YYYY-MM-DD`. Today or up to 180 days back. | | `moment` | No | `open` (the default) or `close`. The close of a day is the opening of the next. The close of today is refused, since it has not happened yet. | | `timezone` | No | An IANA zone such as `America/Denver`. Defaults to your state's: Missouri is `America/Chicago`. | `columns`, `contentType`, `delivery`, `columnHeaderOverrides` and the other output options work as on every report. `filter`, `filterLogic`, `sort`, `include`, `rowMode` and `rowLimit` are refused: the report lists one license's whole inventory, so there is nothing to narrow. ## Columns The default columns are `label`, `item.name`, `quantity`, `unitOfMeasureAbbreviation`, `status`, `quantityConfidence` and `note`. `packageId` and the other `item.` fields are available through `columns`. | Column | Meaning | | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | `quantity` | What the package held at that moment. Empty when it could not be worked out. Can be negative when Metrc had the package overdrawn. | | `status` | `held`, or `unknown` when the report cannot settle whether the license held it. Unknown rows are listed, never dropped. | | `quantityConfidence` | `exact`, `probable`, `bounded`, `unreliable` or `estimated`. See below. | | `note` | Anything that qualifies the row, in words. | `quantityConfidence`: - **`exact`**: worked out two ways that agree, or read from a package nothing has changed since. - **`probable`**: worked out one way only. - **`bounded`**: the two ways disagree. The quantity shown is worked back from the current one. - **`unreliable`**: the history could not be read far enough to work it out. - **`estimated`**: the package has since left the license, and Metrc keeps no history for it there, so the quantity shipped is shown. ## What counts as held - A package on a manifest is held by its shipper until the receiver accepts it. - A package rejected by its receiver is held by nobody until the shipper takes it back. - A finished or discontinued package is not listed, and neither is one not yet made. - A date counts as the user entered it in Metrc, not when it was recorded. A use entered a day late still counts on its own day. A package that has since left is held on the date if nothing shows it arriving after it. The report reads your deliveries and used tags since the date to tell. If your Metrc login cannot read used tags, a package no delivery explains is listed as `unknown`. ## Example ``` #!/usr/bin/env python3 # /// script # requires-python = ">=3.8" # dependencies = [ # "httpx", # ] # /// import httpx SECRET_KEY = "1234-1234-1234-1234-1234-1234" LICENSE_NUMBER = "EX-00001" def main(): response = httpx.get( "https://api.trackandtrace.tools/v2/packages/point-in-time/report", params={ "licenseNumber": LICENSE_NUMBER, "date": "2026-09-30", "moment": "close", "contentType": "json", }, headers={"X-T3-API-Key": SECRET_KEY}, # A report waits up to 240 seconds before giving up. timeout=250.0, ) response.raise_for_status() for package in response.json()["data"]: print( package["label"], package["quantity"], package["unitOfMeasureAbbreviation"], package["status"], package["note"] or "", ) if __name__ == "__main__": main() ``` ## Limits The report reads every package the license could have held, so it takes more work than a plain report. A license that could have held more than 50,000 packages on the date, or whose report would be too large to build, is refused with **Report Request Too Large**. Point-in-time reports for licenses that large are not available yet. Each subscription can build 2 point-in-time reports an hour, within the [report rate limits](https://wiki.trackandtrace.tools/reports/limits/#limits). Asking again for a report while it is [cached](https://wiki.trackandtrace.tools/reports/limits/#caching-and-timing) does not count toward the 2. Over the limit, the request returns `429`. # Scheduling a Report A [saved report](https://wiki.trackandtrace.tools/reports/delivery/#saving-a-report) can run on a schedule. Each run requests the saved URL exactly as you would, so the URL decides what happens to the report. **To receive each run, save the URL with `&delivery=email&email=you@example.com`.** Every run then arrives by email, and so does any error. A report without `delivery=email` is still generated on schedule, but nothing is sent anywhere. ## Creating a Schedule `PUT` the schedule onto a saved report, **authenticated with your secret key**: ``` # /// script # requires-python = ">=3.8" # dependencies = [ # "httpx", # ] # /// import httpx SECRET_KEY = "YOUR_SECRET_KEY" PUBLIC_ID = "YOUR_SAVED_REPORT_PUBLIC_ID" response = httpx.put( f"https://api.trackandtrace.tools/v2/saved-reports/{PUBLIC_ID}/schedule", headers={"X-T3-API-Key": SECRET_KEY}, json={ "frequency": "daily", "timeOfDay": "06:00", "timezone": "America/Denver", }, ) print(response.json()["data"]["nextRunAt"]) ``` | `frequency` | Runs | | --------------------------------------------------- | ---------------------------------------------------------------------- | | `hourly` | Once an hour, at the same minute past every hour | | `daily` | Every day at `timeOfDay` in `timezone`, following daylight saving time | | `every5Minutes`, `every15Minutes`, `every30Minutes` | Every 5, 15 or 30 minutes. Only if your subscription allows it | `timeOfDay` and `timezone` go with `daily` only. `timezone` is an IANA name such as `America/Denver` or `America/New_York`. A saved report has one schedule. Sending the `PUT` again replaces it. ## Which Key Runs It **The schedule runs with the secret key you send the `PUT` with.** A request authenticated with a bearer token is refused, because it leaves no key to run with. - **Rotating** that key keeps the schedule working. - **Deleting** it pauses the schedule. - **To switch keys**, send the `PUT` again with the other key. The key is never returned. `secretKeyHint` shows its last four characters so you can tell which key it is. ## Checking on It ``` schedule = httpx.get( f"https://api.trackandtrace.tools/v2/saved-reports/{PUBLIC_ID}/schedule", headers={"X-T3-API-Key": SECRET_KEY}, ).json()["data"] runs = httpx.get( f"https://api.trackandtrace.tools/v2/saved-reports/{PUBLIC_ID}/schedule/runs", headers={"X-T3-API-Key": SECRET_KEY}, ).json()["data"] for run in runs: print(run["createdAt"], run["status"], run["error"]) ``` | Run `status` | Means | | -------------- | --------------------------------------------------------------------------------------- | | `queued` | Accepted for delivery. The report, or an explanation of why it failed, arrives by email | | `succeeded` | The report was generated | | `failed` | It did not run; `error` says why | | `rate_limited` | Your report rate limit was reached. The next scheduled run tries again | Runs are kept for 30 days. ## When a Schedule Pauses A paused schedule has a `pausedReason` and does not run. **To resume it, fix the cause and send the `PUT` again.** | `pausedReason` | Cause | | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `credential_failure` | Metrc rejected the key's credentials, usually because the Metrc password changed. The schedule stops at once so repeated failed logins cannot lock your Metrc account. [Update the key's credentials](https://wiki.trackandtrace.tools/t3-api/authentication/#when-your-metrc-credentials-change), then send the `PUT` again | | `secret_key_unavailable` | The key was deleted or disabled | | `limit_exceeded` | Your subscription no longer allows this schedule | | `consecutive_failures` | The report failed 5 runs in a row | ## Good to Know - **Runs count toward your [report rate limits](https://wiki.trackandtrace.tools/reports/limits/index.md)**, exactly like requests you make yourself. - **Runs can start up to two minutes late, and missed runs are not caught up.** A schedule that could not run for a while runs once, then carries on. - **Prefer `csv` or `xlsx`.** `contentType=googleSheets` creates a new sheet on every run. - **Subscriptions allow 10 active schedules**, and no more often than hourly, unless arranged otherwise. - **Deleting the saved report deletes its schedule.** - **A report scoped to a tag list follows the list.** Each run reads the list's entries as they are then, and fails if any entry no longer matches. See [Scoping a Report to a Tag List](https://wiki.trackandtrace.tools/reports/shaping/#scoping-a-report-to-a-tag-list). | Method | Path | What it does | | -------- | -------------------------------------------- | ----------------------------------------------------- | | `PUT` | `/v2/saved-reports/{publicId}/schedule` | Create or replace the schedule, resuming it if paused | | `GET` | `/v2/saved-reports/{publicId}/schedule` | Retrieve it | | `GET` | `/v2/saved-reports/{publicId}/schedule/runs` | List its runs, newest first | | `DELETE` | `/v2/saved-reports/{publicId}/schedule` | Stop it and delete its run history | ## Next Steps - Set up email delivery in [Delivering a Report](https://wiki.trackandtrace.tools/reports/delivery/index.md). - If a scheduled report fails, see [Limits and Troubleshooting](https://wiki.trackandtrace.tools/reports/limits/index.md). # Shaping a Report ## Filtering and Sorting A report takes filters, a sort and a column list, and returns `csv`, `json`, `xlsx` or `googleSheets`. See [Choosing a Response Format](https://wiki.trackandtrace.tools/reports/output/#choosing-a-response-format) for the formats. - If you wanted to only return packages in the Bulk Storage room, you would add **`&filter=locationName__eq:Bulk Storage`** to your Sync Link - If you wanted to control which columns you want in the report, you would add **`&columns=label,productionBatchNumber,labTestingStateName`** to your Sync Link A filter is spelled `field__operator:value`. Repeat `filter` to apply more than one, and set `filterLogic` to `and` (the default) or `or` to say how they combine: | Operator | Meaning | | ---------------- | --------------------- | | `eq` | equals | | `neq` | not equals | | `contains` | contains | | `doesnotcontain` | does not contain | | `startswith` | starts with | | `endswith` | ends with | | `lt` | less than | | `lte` | less than or equal | | `gt` | greater than | | `gte` | greater than or equal | A collection's `/fields` endpoint lists the fields Metrc's table offers and the operators each one takes. See [Filterable Fields](https://wiki.trackandtrace.tools/t3-api/collection-fields/index.md). Sorting takes a single field and direction, `&sort=label:asc` or `&sort=label:desc`, and orders rows *within* each license rather than across them. Each report's full parameter reference is in the [API documentation](https://api.trackandtrace.tools/v2/docs/#/Reports/get_v2_packages_active_report). ## Limiting the Number of Rows Reports return the entire matching dataset by default, which can be very large. Add **`&rowLimit=100`** to your Sync Link to cap how many records come back. **Start with a small `rowLimit` while you are still building the request.** `&rowLimit=10` returns in a second or two with the same columns and formatting as the full report, so you can check your filters and `columns` before you drop the parameter for the real run. - The minimum is `1`. Omit `rowLimit` to return everything. - Every report also enforces a hard cap of its own: **50,000 records** for a report, **5,000** for a super report. A `rowLimit` above that cap is clamped down to it, which is the same as leaving `rowLimit` off. - Both the cap and `rowLimit` are **totals across every requested license**, not per-license allowances. See [Reporting Across Multiple Licenses](https://wiki.trackandtrace.tools/reports/output/#reporting-across-multiple-licenses). - A `rowLimit` can rescue a request that would otherwise be rejected as too large. A license with 100,000 active packages will normally fail, but `&rowLimit=500` succeeds and returns 500 packages. - **Which** records you get depends on the sort order. Pair `rowLimit` with `sort` for a predictable result, for example **`&sort=label:asc&rowLimit=100`**. - The limit counts top-level records. Reports that expand one record into several rows, such as the transfer manifest reports, or a super report cross-joined on an `include` in CSV format, can return more rows than the limit. On a super report, [`rowMode=collapsed`](https://wiki.trackandtrace.tools/reports/super-reports/#one-row-per-record-or-one-row-per-included-record) removes that gap: one row per record means the limit counts rows exactly. - Changing `rowLimit` loads fresh data, because it changes which records are fetched. Changing `columns`, `contentType`, `columnHeaderOverrides` or another output option does not: re-requesting with different columns is served from [cache](https://wiki.trackandtrace.tools/reports/limits/#caching-and-timing) and returns immediately. ## Scoping a Report to a Tag List A [tag list](https://wiki.trackandtrace.tools/opentag/tag-lists/index.md) can pick a report's rows instead of a filter. Add **`&tagListId=`** with the list's id, and the report returns one row per entry, in the order the entries were added, formatted exactly as the report formats any row: `https://api.trackandtrace.tools/v2/packages/active/report?licenseNumber=LIC-00001`**`&tagListId=3f6c1e2a-9b4d-4f7e-8a21-5c0d7e9b1234`** ``` import requests response = requests.get( "https://api.trackandtrace.tools/v2/packages/active/super/report", headers={"Authorization": f"Bearer {T3_JWT}"}, params={ "licenseNumber": "LIC-00001", "tagListId": tag_list_id, "include": "labResults", "contentType": "csv", }, ) if response.status_code == 422: for error in response.json()["errors"]: print(error["handle"], error["reason"]) # "1A4... NOT_FOUND" else: print(response.text) ``` - **All or nothing.** If any entry matches no row in the report's collection, or more than one, the report fails with a `422` whose `errors` lists the failing entries, the first 1,000 of them. To see every entry's status instead, [resolve the list](https://wiki.trackandtrace.tools/opentag/tag-lists/#resolving-a-tag-list). - **The list's license.** Send exactly one `licenseNumber`, the list's own. - **The list picks the rows.** `filter`, `filterLogic`, `sort` and `rowLimit` return a `400` alongside `tagListId`. `columns`, `include`, every output format, delivery and [scan sheets](https://wiki.trackandtrace.tools/t3-api/scan-sheets/index.md) work as usual. - **It follows the list.** The entries are read on every request, so a [saved](https://wiki.trackandtrace.tools/reports/scheduling/index.md) or scheduled report always reports the list as it is now. A scheduled report fails once an entry stops matching, for example when a package in the list is sold. - **Size.** A list can be as long as the report's row cap: 50,000 entries, or 5,000 for a super report. - **Named in JSON.** A `json` report carries the list's id as `tagListId`, next to `licenseNumbers`. - Works on the reports of packages, plants, plant batches, tags, transfers (manifest reports included), harvests, items and strains. ## Specifying Field Names Every report returns one **data model**, and its fields are the columns you can ask for. Active packages are `MetrcPackage`. The name is on the `Data model:` row of the [metadata preamble](https://wiki.trackandtrace.tools/reports/output/#the-metadata-preamble), and in the `dataModel` field of every JSON record. To list a data model's columns, open **Schemas** at the bottom of the [API docs](https://api.trackandtrace.tools/v2/docs/) and expand it. A misspelled name also returns an error listing every valid one. See [Invalid columns](https://wiki.trackandtrace.tools/reports/limits/#invalid-columns). To show License Number, Facility Name, Label and Production Batch Number, add: `https://api.trackandtrace.tools/v2/packages/active/report?licenseNumber=...`**`&columns=licenseNumber,facilityName,label,productionBatchNumber`** These are returned as the column headers, in the order you list them. In CSV output the headers are title-cased from the field names, so `productionBatchNumber` appears as `Production Batch Number`. `columns` was previously called `fieldnames` Both spellings work and mean exactly the same thing, so existing Sync Links and saved reports keep running untouched; there is nothing you need to change. `fieldnames` is deprecated and `columns` is the name documented from here on, so prefer it for anything new. Sending both in one request returns a `400`, since there is no way to tell which column list you meant. **Packages nest their item.** Prefix an item field with `item.` to use it, for example `item.productCategoryName` for the item category: `https://api.trackandtrace.tools/v2/packages/active/report?licenseNumber=...`**`&columns=licenseNumber,facilityName,label,productionBatchNumber,item.productCategoryName`** Four nested item fields are available this way: `item.name`, `item.strainName`, `item.productCategoryName` and `item.unitThcContent`. Packages are the only Metrc object with nesting like this, and `item` on its own is not a valid column. The transfer manifest reports prefix every column with the object it came from. See [Transfer manifest reports work differently](https://wiki.trackandtrace.tools/reports/endpoints/#transfer-manifest-reports-work-differently-from-every-other-report). ## Renaming the Column Headers Headers are title-cased from the field names, which is not always the name you want. Add **`&columnHeaderOverrides=`** to replace them with your own. The value is a comma-separated list matched **positionally** against the columns, and an empty entry keeps that column's default name. So to rename only the fourth column, count three commas first: ``` https://api.trackandtrace.tools/v2/packages/active/report?licenseNumber=...&columns=label,item.name,quantity,unitOfMeasureAbbreviation&columnHeaderOverrides=,,,Unit ``` ``` Label,Item Name,Quantity,Unit ``` Trailing entries can be dropped entirely, so `&columnHeaderOverrides=Tag` renames just the first column and leaves the rest alone. This is most useful on the transfer manifest reports, whose columns carry an object prefix that reads awkwardly once title-cased: | Column | Default header | With an override | | ----------------------------------------------- | --------------------------------------------------- | ---------------- | | `package.packageLabel` | `Package Package Label` | `Package Tag` | | `transfer.manifestNumber` | `Transfer Manifest Number` | `Manifest` | | `transporterDetails.driverVehicleLicenseNumber` | `Transporter Details Driver Vehicle License Number` | `Plate` | **Names are used exactly as you send them.** No title-casing, no trimming, no change of case: `qty` stays `qty`. That is what makes it safe to point a pivot table, a Power Query step or a partner's import template at a header. A name beginning with `=` is written as text, never as a live spreadsheet formula. Two rules to know: - **A header cannot contain a comma.** A comma always starts a new entry, even encoded as `%2C`. - **You can send fewer entries than there are columns, but not more.** Extra entries return a `400`. Trailing commas count as entries: `,,,Unit,,` is six of them. The parameter applies to the tabular formats: `csv`, `xlsx` and `googleSheets`. A `json` report returns records keyed by their field names and is unaffected, so you can set it once alongside a `contentType` that varies. It also cannot be combined with `transform`, which names its own columns. Renaming a header does not change which data is loaded, so switching headers on a report you just pulled is served from cache and returns immediately. ``` #!/usr/bin/env python3 # /// script # requires-python = ">=3.8" # dependencies = [ # "httpx", # ] # /// """Pull an incoming manifest report with headers a warehouse team will recognize.""" import httpx SECRET_KEY = "YOUR_SECRET_KEY_GOES_HERE" LICENSE_NUMBER = "LIC-00001" COLUMNS = [ "transfer.manifestNumber", "transfer.recipientFacilityName", "package.packageLabel", "package.productName", "package.shippedQuantity", ] HEADERS = ["Manifest", "Destination", "Tag", "Product", "Qty"] response = httpx.get( "https://api.trackandtrace.tools/v2/transfers/incoming/manifest/report", params={ "licenseNumber": LICENSE_NUMBER, "contentType": "csv", "columns": ",".join(COLUMNS), "columnHeaderOverrides": ",".join(HEADERS), "prependCsvMetadata": "false", }, headers={"X-T3-API-Key": SECRET_KEY}, # A report waits up to 240 seconds before giving up. timeout=250.0, ) response.raise_for_status() print(response.text.splitlines()[0]) # Manifest,Destination,Tag,Product,Qty ``` ## Next Steps - Pick a format and decide whether it downloads in [Output Format](https://wiki.trackandtrace.tools/reports/output/index.md). - Send the result somewhere with [Delivering a Report](https://wiki.trackandtrace.tools/reports/delivery/index.md). - See these parameters combined in [Report Examples](https://wiki.trackandtrace.tools/reports/examples/index.md). - If a column name is rejected, see [Invalid columns](https://wiki.trackandtrace.tools/reports/limits/#invalid-columns). # Super Reports A **super report** is a report that can also load related Metrc data for each record (lab results, history, source harvests, transactions) using the same `include` parameter as [Supercollections](https://wiki.trackandtrace.tools/t3-api/supercollections/index.md). Introducing T3 Super Reports Every super report path is its report path with `/super` inserted before `/report`: - `/v2/packages/active/report` → `/v2/packages/active/super/report` Add includes by repeating the parameter: `https://api.trackandtrace.tools/v2/packages/active/super/report?licenseNumber=...`**`&include=labResults&include=sourceHarvests`** The `include` options for each data type are listed on the [Supercollections](https://wiki.trackandtrace.tools/t3-api/supercollection-includes/index.md) page. A super report accepts exactly the same values as the matching supercollection. ## When to use a super report Use a **report** when the columns you need are all on the object itself. It is faster and returns ten times as many rows. Use a **super report** when you need related data that Metrc keeps separately, the classic case being lab results for each package. The trade-offs: | | Report | Super report | | ----------------- | --------------------------------- | ------------ | | Row cap | 50,000 | 5,000 | | Rate limit | 6/minute and 48/hour per endpoint | Same | | `include` support | No | Yes | | Speed | Faster | Slower | The super report row cap is lower because each `include` adds work for every record. See [Limits](https://wiki.trackandtrace.tools/reports/limits/#limits). ## One include in tabular formats, many in JSON With `contentType=json` you can request several includes, as long as the report stays small enough to build. With `csv`, `xlsx` or `googleSheets` you can request **at most one**. A flat grid can widen each row for one list of related records, but has no way to hold two independent lists on one row. If you need several includes in a spreadsheet, run one super report per include and join them in the sheet. ## One row per record, or one row per included record By default a super report gives you **one row per included record**. Ask for `include=labResults` on 500 packages and you get one row per lab result, and a package accumulates a result per analyte per test, so 500 packages can easily become 40,000 rows with the package columns repeated down each block. That is the right shape when you want the results themselves. It is the wrong shape when you wanted the packages. `rowMode=collapsed` gives you **one row per package** instead: ``` https://api.trackandtrace.tools/v2/packages/active/super/report?secretKey=YOUR_SECRET_KEY&licenseNumber=EX-00001&include=labResults&rowMode=collapsed&columns=label,item.name,metadata.indexedLabResults.totalTHC.value&columnHeaderOverrides=,,Total%20THC&contentType=csv ``` ``` Label,Item Name,Total THC 1A4000000000000000000001,Blue Dream,21.4 1A4000000000000000000002,OG Kush,18.9 1A4000000000000000000003,Trim, ``` The `include` is still loaded and the `metadata` fields are still built from it; you are only choosing not to spread the raw results across rows. `totalTHC` is the same key in every state, however the lab spelled the test. [Lab Result Keys](https://wiki.trackandtrace.tools/t3-api/lab-result-keys/index.md) lists every key. A saved report or spreadsheet that still names an older key, such as `Total_THC`, keeps working. | | `rowMode=expanded` (default) | `rowMode=collapsed` | | ----------------------- | ---------------------------- | -------------------- | | Rows | One per included record | One per record | | `labResults.*` columns | Available | **400 if requested** | | `metadata.*` columns | Available | Available | | Records with no results | **Omitted** | Included | | `rowLimit` | Counts records, not rows | Counts rows exactly | Three things to know: Child columns are refused, not blanked With `rowMode=collapsed` there is no single lab result on the row, so `columns=labResults.testTypeName` returns 400 rather than an empty column. Use `metadata.` columns instead: `metadata.indexedLabResults`, `metadata.extractedLabResults` and the rest are already summarized one-per-record. Or drop `rowMode` to get the results as rows. **Collapsing rescues records that would otherwise vanish.** An expanded report omits any record whose include came back empty: a package with no lab results is simply absent, with nothing in the output to say so. Collapsed output includes it, with the `metadata.` columns blank. **Switching is fast.** Both shapes are built from the same cached result, so re-running a report with a different `rowMode` is served from cache and returns immediately. Switch back and forth while you work out the shape you want. `rowMode` applies only to super reports that request an `include`. Sending it to a plain report returns 400, because there is nothing to collapse. ## Next Steps - See which paths have a super form in [Report Endpoints](https://wiki.trackandtrace.tools/reports/endpoints/index.md). - Read the full `include` reference in [Supercollections](https://wiki.trackandtrace.tools/t3-api/supercollection-includes/index.md). - Check the caps before a large run: super reports return at most 5,000 records. See [Limits and Troubleshooting](https://wiki.trackandtrace.tools/reports/limits/index.md). - Work through a super report in [Report Examples](https://wiki.trackandtrace.tools/reports/examples/index.md). # T3 Labels # T3 Labels ## Introduction **T3 Labels** enables you to design, generate, and print fully customized labels using data directly from Metrc. Whether you're printing product tags, package labels, or compliance stickers, T3 Labels streamlines your entire labeling workflow. There are three core ideas surrounding T3 Labels: 1. **Easily create flexible label templates.** - Text, tables, images, and barcodes are all supported. - Label generation is all done via a standardized API, meaning you can take existing label designs and alter them inside T3 or on your own. - Label layouts are responsive, so printing the same label layout on a different-sized label is easy. 1. **Fill label templates with any data from Metrc**. - Any data available in Metrc can be inserted into labels. - This includes, but is not limited to: - Plants - Plant batches - Packages - Test results, including THC/CBD totals and top terpenes 1. **Download labels in PDF format and print them on your own label printer**. - All label printers support the PDF format and require no special software for printing. - Just open the PDF with any PDF reader and send the labels to your connected printer. Introducing T3 Label Studio ______________________________________________________________________ ## How a label gets made Three things go in and one PDF comes out. You assemble a **template**, a **layout** and a **data list**, post them together to a single endpoint, and the API renders and returns the finished document. ``` flowchart TB subgraph you["What you assemble, in Label Studio or your own script"] T["Template
size, margins, padding,
rows and columns per page"] L["Layout
the elements on one label, each
with a Jinja valueTemplate"] D["Label data
one record per label, from Metrc,
demo data, a file, or typed in"] end T --> REQ L --> REQ D --> REQ REQ["POST /v2/labels/generate"] REQ --> PDF["One PDF, one label per record"] PDF --> OUT(["The preview pane, a saved file,
or straight to your printer"]) ``` The **template** is physical and the **layout** is what gets printed, which is why the two are saved separately: one layout can be printed on any template you own. The **data list** decides how many labels you get, because each record in it becomes exactly one label. Each element's `valueTemplate` is a [Jinja](https://jinja.palletsprojects.com/) expression evaluated against that label's record, so `{{ package.item.name }}` resolves to a different item name on every label in the run: ``` import requests pdf = requests.post( "https://api.trackandtrace.tools/v2/labels/generate", headers={"X-T3-API-Key": SECRET_KEY}, json={ "labelTemplateLayoutConfig": template, "labelContentLayoutConfig": layout, "labelContentDataList": [{"package": p} for p in packages], }, ) with open("labels.pdf", "wb") as f: f.write(pdf.content) ``` Labels generated without a [T3+ subscription](https://wiki.trackandtrace.tools/t3-plus/index.md) are watermarked. The layout editor, starter templates and demo data work the same either way. ______________________________________________________________________ ## Next Steps - Follow the step-by-step [T3 Labels Tutorial](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md), the fastest way to get your first label rendered. - See [Getting Started](https://wiki.trackandtrace.tools/t3-labels/getting-started/index.md) for sample labels, each with its PDF and source data. - Keep the [Label Studio](https://wiki.trackandtrace.tools/t3-labels/label-studio/index.md) reference open while you build. It covers every tab and control. - Deep-dive on [Label Templates](https://wiki.trackandtrace.tools/t3-labels/label-templates/index.md) and [Label Layouts](https://wiki.trackandtrace.tools/t3-labels/label-layouts/index.md). - Learn how to [generate](https://wiki.trackandtrace.tools/t3-labels/generating-label-pdfs/index.md) and [print](https://wiki.trackandtrace.tools/t3-labels/printing-label-pdfs/index.md) label PDFs. - Walk through the [Retail ID](https://wiki.trackandtrace.tools/t3-labels/retail-id/index.md) example for a CSV-driven label workflow. # Choosing a Label Printer Choosing a label printer involves balancing a number of factors: - **Label Size**: Smaller labels require more precise printing, especially if they contain small text or barcodes. This typically means a higher DPI printer. Larger labels may require a printer with a bigger form factor to accommodate the media. - **Print Volume**: Consider how many labels you need to print on a daily or weekly basis. High-volume operations benefit from industrial-grade printers designed for continuous use, while low-volume needs can often be met with desktop models. - **Print Type**: Options include thermal transfer, direct thermal, inkjet, and laser. Thermal printers are the most common in industrial environments due to their speed and durability. Inkjet and laser printers are better suited for full-color printing or label sheets. - **Print Speed**: In high-throughput settings, print speed can become a bottleneck. Look for specifications in inches per second (IPS) to evaluate performance. - **Connectivity**: Ensure compatibility with your systems. USB is standard, but Ethernet is ideal for shared workstations or networked environments. Some models also offer Wi-Fi or Bluetooth. - **DPI (Dots Per Inch)**: Lower DPI (203 dpi) is suitable for larger labels or basic use cases. Higher DPI (typically 300 dpi or more) is essential for printing legible small fonts, sharp barcodes, and detailed graphics. Most base-tier thermal printers print at 203 dpi, and increasing DPI incurs a substantial jump in printer cost. - **Label Durability**: For long-lasting labels or those exposed to heat, moisture, or abrasion, thermal transfer printers are preferable. Direct thermal is acceptable for short-term labeling where durability is less critical. - **Color Printing**: Most thermal printers are monochrome. If your labels require color (for branding, compliance symbols, or product identification), you’ll need a printer that supports color output, such as an inkjet or laser model. - **Cutter/Peeler Options**: Some printers include built-in cutters or peel-and-present mechanisms that can greatly improve efficiency in high-volume labeling workflows. ### Types of Printers **Direct Thermal** printers use heat-sensitive paper and do not require ink or ribbons. They are simpler and cheaper to operate but produce labels that fade over time, making them better for short-term use such as shipping labels. **Thermal Transfer** printers use a ribbon to melt ink onto the label surface, producing long-lasting, high-contrast prints. These are ideal for labels that must withstand moisture, sunlight, or long storage periods. Some thermal transfer printers are capable of printing directly onto *Metrc tags*, eliminating the need for separate labels. Be sure to verify compatibility with Metrc-supplied tag stock before purchasing. **Inkjet and Laser Printers** are best suited for printing on label sheets from vendors like Avery. These are commonly used for small batch jobs. While they offer flexibility, they are generally slower and less durable than thermal options. ### Cost Thermal printers typically have a higher upfront cost but lower operating costs over time due to fewer consumables. Inkjet and laser printers may be cheaper to acquire, but the cost of toner or ink and label sheets adds up quickly. Factor in ribbon, label rolls, and maintenance when estimating total cost of ownership for thermal units. ______________________________________________________________________ ## Setting Up Your Printer This section assumes you have purchased a printer, have powered it on, and connected it to your computer via network or USB. To ensure compatibility and proper sizing, **always install the latest drivers** for your specific printer model. **Note**: When adding your printer, your operating system may offer a default driver for printing. It's strongly recommended that you install any available drivers from the manufacturer and use that instead. Adding a Zebra printer on Mac OS X Selecting the driver for a Zebra printer on Mac OS X ### Installing Dedicated Drivers Here are links to driver download pages from major manufacturers: - [Zebra](https://www.zebra.com/us/en/support-downloads.html) - [Rollo](https://www.rolloprinter.com/pages/setup) - [Dymo](https://www.dymo.com/support) - [Brother](https://www.brother-usa.com/support) - [Sato](https://www.satoamerica.com/support) - [TSC](https://www.tscprinters.com/en-us/support) - [Honeywell](https://sps.honeywell.com/us/en/support/productivity/printers) - [Citizen](https://www.citizen-systems.com/en/printer/support/) - [Godex](https://www.godexintl.com/en/download) ### Inkjet/Laser Printers If you're printing sheets of labels (8.5x11"), you're likely using an inkjet or laser printer. Since these page sizes are standard, there will likely be zero configuration needed for this setup. Place the label sheets into the printer drawer and print the PDFs as you would any other document. ______________________________________________________________________ ## Next Steps - Once your printer is set up, see [Printing Label PDFs](https://wiki.trackandtrace.tools/t3-labels/printing-label-pdfs/index.md). - Match your template to the label stock in [Label Templates](https://wiki.trackandtrace.tools/t3-labels/label-templates/index.md). # Generating Label PDFs ## Introduction T3 label PDFs are generated using several different sources that control how the labels will appear: - [Templates](#templates) - [Layouts](#layouts) - [Data List](#data-list) - [Default Data](#default-data) - [Built-In Data](#built-in-data) - [Images](#images) - [Fragments](#fragments) - [Settings](#settings) ______________________________________________________________________ ### Templates A **template** defines the overall layout and physical structure of the label, including its dimensions, margins, padding, and page arrangement such as rows, columns, and spacing. [Learn more about label templates](https://wiki.trackandtrace.tools/t3-labels/label-templates/index.md) ______________________________________________________________________ ### Layouts Layouts control what will be printed on each label and how it is arranged. When you are configuring a label, this is where most of the effort will be dedicated. [Learn more about layouts and layout elements](https://wiki.trackandtrace.tools/t3-labels/label-layouts/index.md) ______________________________________________________________________ ### Data List The data list controls how many unique labels are generated, and what data is inserted into each label. Each item in the data list represents one label. If you wanted to print a set of 5 labels that didn't need any special data into each, you would just create an empty list of length 5: ``` [ {}, {}, {}, {}, {} ] ``` If you wanted to insert two values, say `firstName` and `lastName` into each label, you could specify that as follows: ``` [ { "firstName": "Mike", "lastName": "Smith" }, { "firstName": "Jane", "lastName": "Jones" } ] ``` Package data returned from the T3 API is structured as follows: ``` [ { "package": { "hostname": "ca.metrc.com", "label": "1A4400001234000000005678", "item": { "name": "Bubba Kush", ... }, "isInTransit": false, "isOnHold": false, "isOnRecall": false, ... } }, { "package": { "hostname": "ca.metrc.com", "label": "1A4400001234000000005679", "item": { "name": "1g Wedding Cake Preroll - 5pk", ... }, "isInTransit": false, "isOnHold": false, "isOnRecall": false, ... } } ] ``` How to add these values to a label is covered in [Injecting Values](#injecting-values). ______________________________________________________________________ ### Default Data Default data is used in two situations: - You want to inject a value into all labels, but don't want to repeat it in every data list entry. (Example: facility address, shared between labels) - Items in your data list are missing values, and you want to fall back to a specific value Default data is passed in the `commonContentData` field. Its keys are merged into the **top level** of every label's data, so they are read exactly as if you had repeated them in each data list entry: a `commonContentData` of `{"facilityAddress": "123 Main St"}` is used as `{{ facilityAddress }}`. A key set on an individual data list entry takes precedence over the shared value of the same name, which is what makes the fallback case work. Default data is usually not needed. ______________________________________________________________________ ### Built-In Data Built-in data is provided by T3 out of the box. It includes text and images that are commonly used by cannabis businesses, and is accessed under the `t3.*` namespace. Examples: - State-specific warning images (e.g. `{{ t3.images['ca_cannabis_warning.png'] }}`) - State-specific warning disclosures (e.g. `{{ t3.text.ca_cannabis_warning_disclosure }}`) - Generic cannabis images - Poison Control Center contact information (`{{ t3.text.poison_control_center_phone }}`) You don't have to manage any of these yourself; they're available in every label generation request. #### State Disclosures Most states require specific warning language on cannabis packaging. T3 ships that text under `t3.text`, keyed by the state's two-letter abbreviation: ``` t3.text._cannabis_warning_disclosure ``` So a California label reads: ``` {{ t3.text.ca_cannabis_warning_disclosure }} ``` Warning text is available for **AK, AZ, CA, CO, MA, MD, ME, MI, MN, MO, MT, NJ, NV, OH, OK, OR** and **RI**. Some states separate particular warnings into their own statement, which are keyed by topic so you can place them independently: | Key | States | | -------------------------------------- | ---------------- | | `_cannabis_warning_disclosure` | all of the above | | `_pregnancy_warning_disclosure` | AZ, CO, MI | | `_delayed_onset_disclosure` | CO, OR | The state abbreviation matches the Metrc hostname your packages come from, so a package loaded from `co.metrc.com` pairs with `co_cannabis_warning_disclosure`. A layout printed in one state is therefore a one-key edit away from another. `GET /v2/labels/globals` returns every built-in value currently available, which is the authoritative list. #### State Images Several states require a warning mark or a printed warning panel alongside the text. T3 ships those images under `t3.images`, keyed the same way the disclosures are, with the file extension in place of `_disclosure`: ``` t3.images['_.png'] ``` So the Michigan warning panel is: ``` {{ t3.images['mi_cannabis_warning.png'] }} ``` Place one with an `IMAGE` element: ``` { "description": "California marijuana product warning image", "elementType": "IMAGE", "valueTemplate": "{{ t3.images['ca_cannabis_warning.png'] }}", "xStartFraction": 0.67 } ``` Images are available for **AK, CA, CO, MA, MD, ME, MI, MN, MO, MT, NJ, NV, NY, OH, OK, OR** and **RI**. Key names follow the same shape as the disclosures, with a topic and an optional variant: | Part | Values | | ------- | --------------------------------------------------------------------------------------------------- | | topic | `universal_symbol`, `medical_label`, `cannabis_warning`, `cannabis_disclosure`, `not_safe_for_kids` | | variant | `light` and `dark` when a state publishes both, plus `dark_boxed` for Montana's boxed mark | So Minnesota, which mandates three separate marks, offers: ``` t3.images['mn_universal_symbol_light.png'] t3.images['mn_medical_label_light.png'] t3.images['mn_cannabis_warning_light.png'] ``` Each also has a `_dark` rendering for dark label stock. `GET /v2/labels/globals` returns every key currently available, which is the authoritative list. These are sized for label printing, not for artwork reproduction. Scale one up much beyond the area of a label and it will soften. `images` and `t3.images` are different namespaces Your own uploads are read as `{{ images['logo.png'] }}`. T3's built-ins are read as `{{ t3.images['name.png'] }}`. An upload never appears under `t3`. ______________________________________________________________________ ### Images Images can be inserted into labels and rendered using an `IMAGE` layout element. The following is an example of how image data might be passed: ``` { "logo.png": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO..." } ``` This image can now be used as follows in a layout element: ``` { "elementType": "IMAGE", "valueTemplate": "{{ images['logo.png'] }}" } ``` ______________________________________________________________________ ### Fragments `fragments` works like `images`, but for whole layouts: a map of named layouts sent with your request, each drawn inside the rectangle of a `FRAGMENT` layout element that names it in `fragmentKey`. To reuse a saved layout, pass the `labelContentLayoutConfig` from its entry in `GET /v2/labels/label-content-layouts`. See [Reusing Layouts With Fragments](https://wiki.trackandtrace.tools/t3-labels/label-layouts/#reusing-layouts-with-fragments) for an example, positioning, and the limits that apply. ______________________________________________________________________ ### Settings Label settings are sent as `renderingOptions` and configure how your labels will appear. Settings used most often: - `labelCopies`: how many copies of each label should be printed - `reversePrintOrder`: reverses the print order - `rotationDegrees`: `90` rotates your layout sideways - `debug`: draws boundaries around each layout element - `strictTemplates`: makes expressions that would render blank fail loudly instead. See [Catching Blank Output While Authoring](https://wiki.trackandtrace.tools/t3-labels/layout-element-values/#catching-blank-output-while-authoring). The watermark follows your subscription: labels generated without [T3+](https://wiki.trackandtrace.tools/t3-plus/index.md) are watermarked, and labels generated with it are not. ______________________________________________________________________ ## Injecting Values Most layout elements take a **value template**, a [Jinja](https://jinja.palletsprojects.com/en/stable/templates/) string rendered against each label's data, so `{{ package.label }}` prints that label's tag. Values can come from the label's own data list entry, [Default Data](#default-data), your [images](#images) and [Built-In Data](#built-in-data). See [Jinja Templating](https://wiki.trackandtrace.tools/t3-labels/layout-element-values/#jinja-templating) for every namespace, conditionals and filters, and the tutorial's [Name the Product](https://wiki.trackandtrace.tools/t3-labels/tutorial/name-the-product/index.md) step for a walkthrough. ______________________________________________________________________ ## Arranging and Styling Text `TEXT` and `TABLE` elements control font, size, spacing, alignment and overflow with fields such as `paragraphFontName`, `paragraphFontSize` and `paragraphTextResizeStrategy`. Tables are written in HTML. See [Textual Elements](https://wiki.trackandtrace.tools/t3-labels/layout-element-values/#textual-elements) for every option. ______________________________________________________________________ ## Next Steps - Build a label from scratch with the [Tutorial](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md). - Full reference for the two halves of a label: [Label Templates](https://wiki.trackandtrace.tools/t3-labels/label-templates/index.md) and [Label Layouts](https://wiki.trackandtrace.tools/t3-labels/label-layouts/index.md). - [Print your PDFs](https://wiki.trackandtrace.tools/t3-labels/printing-label-pdfs/index.md) reliably across thermal, inkjet, and laser printers. - Walk through the CSV-driven [Retail ID](https://wiki.trackandtrace.tools/t3-labels/retail-id/index.md) example. - Call the [T3 API Label endpoints](https://api.trackandtrace.tools/v2/docs/#/Labels) directly to generate labels from your own tooling. - [Start your free 30-day T3+ trial](https://dash.trackandtrace.tools) # Getting Started One T3 label, using an image, a barcode, a table and text. Every example on this page is a real PDF you can open ## Introduction Everything about a T3 label is configurable, from its size, margins and print order to the text, tables, images and barcodes on it. Layouts resize to fit the label, and data goes in through [Jinja](https://jinja.palletsprojects.com/en/stable/) templates, so `{{ package.item.name }}` prints each package's item name. Build labels in the [Label Studio](https://wiki.trackandtrace.tools/t3-labels/label-studio/index.md), or call the [T3 API](https://api.trackandtrace.tools/v2/docs/#/Labels) directly. [T3 Labels](https://wiki.trackandtrace.tools/t3-labels/index.md) shows how the pieces fit together. ______________________________________________________________________ ### Example Labels All the PDFs shown below were generated by T3. Below each screenshot is the actual printable PDF and the source data used to generate the PDF via the T3 API. ______________________________________________________________________ #### CA warning labels - Avery 8160 template [PDF](https://wiki.trackandtrace.tools/assets/pdf/AVERY_8160_2_625Wx1_0H-CA_WARNING_LABEL-x30.pdf) • [Source data](https://wiki.trackandtrace.tools/assets/text/avery-ca-warning-input.txt) ______________________________________________________________________ #### Package item/label with Code128 barcode - 3x1 thermal template\* [PDF](https://wiki.trackandtrace.tools/assets/pdf/THERMAL_3_0Wx1_0H-COL_TEXT_CODE128_TEXT-x10.pdf) • [Source data](https://wiki.trackandtrace.tools/assets/text/package-item-label-barcode.txt) ______________________________________________________________________ #### Demo labels - 3x2 thermal template [PDF](https://wiki.trackandtrace.tools/assets/pdf/3x2-DEMO-Image_Barcode_Table_Text-x3.pdf) • [Source data](https://wiki.trackandtrace.tools/assets/text/demo.txt) ______________________________________________________________________ #### MI tested package - 4x6 thermal labels [PDF](https://wiki.trackandtrace.tools/assets/pdf/THERMAL_4_0Wx6_0H-DEMO_MI_PACKAGE_LABEL-x10.pdf) • [Source data](https://wiki.trackandtrace.tools/assets/text/tested-package-mi-label.txt) ______________________________________________________________________ ## Next Steps - Follow the [Tutorial](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md) to build a label from scratch. - Learn about [Label Templates](https://wiki.trackandtrace.tools/t3-labels/label-templates/index.md) and [Label Layouts](https://wiki.trackandtrace.tools/t3-labels/label-layouts/index.md). - Learn how to [generate label PDFs](https://wiki.trackandtrace.tools/t3-labels/generating-label-pdfs/index.md) and [set up your label printer](https://wiki.trackandtrace.tools/t3-labels/printing-label-pdfs/index.md). - If you're not subscribed to T3+, [start your 30-day free trial here](https://dash.trackandtrace.tools) # Label Layouts ## Introduction Layouts control what will be printed on each label and how it is arranged. Things to know: - Layouts can be **static** (each label is exactly the same) or **dynamic** (data is inserted into the label from the data list). Most commonly, layouts are a mix of both. - Layouts are responsive, meaning they will resize to fit the [template](https://wiki.trackandtrace.tools/t3-labels/label-templates/index.md) dimensions. Usually, they'll be designed to fit specific labels. - Layouts are made up of one or more [layout elements](#layout-elements). The entire label layout specification can be viewed [here](https://api.trackandtrace.tools/v2/docs/#:~:text=T3LabelContentLayoutConfig) ### Examples Here is an example of a layout with a barcode in the top 75%, and text in the bottom 20%. Both the barcode and the text show a package label: ``` { "labelContentLayoutElements": [ { "elementType": "CODE128_BARCODE", "valueTemplate": "{{package.label}}", "yStartFraction": 0.25 }, { "elementType": "TEXT", "valueTemplate": "{{package.label}}", "yEndFraction": 0.2 } ] } ``` Here is how this layout renders on a 3x1 thermal label: Barcode/text layout rendered on 3x1 thermal label Here is how this layout renders on an Avery 8160 label sheet: Barcode/text layout rendered on Avery 8160 ### Layout Elements A **layout element** is a single element that appears somewhere on a label. Text, images, and barcodes are all examples of layout elements. Each layout element has a specific `elementType` that describes how it will appear. Available element types: | `elementType` | Description | | ----------------- | -------------------------------------------------------- | | `TEXT` | A paragraph of text | | `TABLE` | A table made of rows/columns of cells, defined with HTML | | `IMAGE` | An image file (passed as base64) | | `CODE128_BARCODE` | A Code 128 barcode | | `CODE39_BARCODE` | A Code 39 barcode | | `QR_CODE` | A QR code | | `BOX` | A rectangular box used for borders or background fills | | `FRAGMENT` | Another label layout, embedded inside this one | Every element type also accepts the same four base fields, whatever else it supports: | Field | Description | | ------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `elementType` | Which of the types above this element is | | `enabled` | Set `false` to skip the element without deleting it. This is the eye toggle in the [layer stack](https://wiki.trackandtrace.tools/t3-labels/label-studio/layout-builder/#the-layer-stack) | | `description` | A free-text name for the element. It is not printed; it is how the element is labeled in the Label Studio, so a layout with more than a few elements stays readable | | `xStartFraction`, `xEndFraction`, `yStartFraction`, `yEndFraction` | The element's rectangle. See [Position and Sizing](#position-and-sizing) | `elementType` is the only required field. The API accepts the eight types above and rejects anything else, so a typo is reported rather than silently skipped. The [Label Studio](https://wiki.trackandtrace.tools/t3-labels/label-studio/index.md) is more forgiving while you are editing: an element whose type it does not recognize is shown as **Unknown** with its position controls intact, so one bad element in a hand-edited layout leaves the rest of the layout editable. #### Text A `TEXT` layout element adds a paragraph of text. #### Tables A `TABLE` element adds multiple pieces of text formatted in rows and columns. - All text in a table has a consistent font size and spacing. - Table borders are not displayed by default. - Tables are defined with HTML. #### Images An `IMAGE` layout element adds an image file onto the label. - Images are centered in the layout element and fit to the available space. - Image data is passed as base64 and accessed via filename (see [value templates](https://wiki.trackandtrace.tools/t3-labels/layout-element-values/#value-templates)). - The value template **must** resolve to usable image data. Unlike other element types, an `IMAGE` that renders blank is an error rather than an empty space. See [Missing Images](https://wiki.trackandtrace.tools/t3-labels/layout-element-values/#missing-images). #### Barcodes The `CODE128_BARCODE` and `CODE39_BARCODE` elements display a scannable 1D barcode that encodes a piece of text. - The barcode will fill the layout element area horizontally and vertically. - The barcode encodes whatever is produced by the [value template](https://wiki.trackandtrace.tools/t3-labels/layout-element-values/#value-templates). - Use `CODE128_BARCODE` for Metrc tags and most general-purpose use. `CODE39_BARCODE` is available for systems that specifically require Code 39. #### QR Codes A `QR_CODE` element displays a scannable QR code that encodes a piece of text. - QR codes are centered in the layout element and fit to the available space, with padding. - The QR code encodes whatever is produced by the [value template](https://wiki.trackandtrace.tools/t3-labels/layout-element-values/#value-templates). #### Boxes A `BOX` element draws a rectangular box inside the layout element area. It does not use a value template. - `boxStrokeColor` sets the border color (hex, default `#000000`). - `boxStrokeWidth` sets the border width in points (default `0.5`). - `boxStrokeAlpha` sets the border opacity (`0.0`–`1.0`, default `1.0`). - `boxBackgroundColor` sets the fill color (hex). Omit to disable fill. - `boxBackgroundAlpha` sets the fill opacity (`0.0`–`1.0`, default `1.0`). #### Fragments A `FRAGMENT` element draws **another layout** inside its rectangle, so a block you use on many labels is written once instead of copied into each one. See [Reusing Layouts With Fragments](#reusing-layouts-with-fragments). ### Position and Sizing Layout elements are positioned as rectangles inside the printable area. The boundaries of the rectangle are specified as **fractions** of the label's printable width and height. This allows the same layout to be reused across labels of different sizes. Layout elements use the following values to define size and position: - `xStartFraction`: left edge (default `0`) - `xEndFraction`: right edge (default `1`) - `yStartFraction`: bottom edge (default `0`) - `yEndFraction`: top edge (default `1`) Values are decimals between 0 and 1 (for example, `0.05` = 5% of the total dimension). Y is measured up from the bottom edge. The Label Studio's position readout counts Y down from the top instead, so its `Y: 10% – 30%` is `yStartFraction: 0.7` and `yEndFraction: 0.9` here. **Note**: The default start and end values fill the entire printable area. In the earlier example, only one fraction is defined for each layout element. The rest fall back to defaults. ### Aspect Ratio Limits By default, layouts will fill the available template width and height. You can define a minimum and maximum aspect ratio for the layout, which will limit how much it will stretch. Layouts use two values to control this: - `minAspectRatio` - `maxAspectRatio` **Note:** If T3 detects a minimum or maximum aspect ratio is reached, it will center the layout inside the template. ### Reusing Layouts With Fragments Most labels share blocks: a state warning panel, a barcode with its human-readable tag underneath, a facility footer. A **fragment** lets you write that block once and embed it in as many layouts as you like. A fragment is not a special kind of object; it is an ordinary label layout. Anything you can print on its own can be embedded in another layout. Fragments work like `images`: send a map of named layouts alongside your request, then reference one by name from a `FRAGMENT` element. ``` { "labelContentLayoutConfig": { "labelContentLayoutElements": [ { "elementType": "CODE128_BARCODE", "valueTemplate": "{{ package.label }}", "yStartFraction": 0.4 }, { "elementType": "FRAGMENT", "fragmentKey": "state_warning", "yStartFraction": 0, "yEndFraction": 0.35 } ] }, "fragments": { "state_warning": { "labelContentLayoutElements": [ { "elementType": "TEXT", "valueTemplate": "{{ t3.text.poison_control_center_phone }}", "paragraphFontSize": 6, "yStartFraction": 0.5 }, { "elementType": "BOX", "boxStrokeWidth": 1 } ] } }, "renderingOptions": { "renderingVersion": 2 } } ``` #### Positioning inside a fragment A fragment fills its element's rectangle, and its own elements are positioned **relative to that rectangle**, not to the whole label. In the example above, the fragment occupies the bottom 35% of the label, so the `TEXT` at `yStartFraction: 0.5` sits halfway up *the fragment*, not halfway up the label. This is what makes a fragment portable: move the `FRAGMENT` element and everything inside it moves with it. #### Aspect ratio A fragment honors its own `minAspectRatio` and `maxAspectRatio` inside its rectangle, exactly as a layout does inside a label, so a block designed to be wide is not squeezed into a tall box. If the rectangle falls outside the fragment's limits, the fragment is centered within it. The defaults are wide (`0.1` and `10`), so an ordinary layout used as a fragment will simply fill its rectangle. Set the limits on the fragment when its proportions matter. #### Font sizes do not scale `paragraphFontSize` is measured in points, so it is **not** affected by the size of the fragment's rectangle. A fragment written with 10pt text renders at 10pt whether it fills the label or sits in a narrow strip. This is worth planning around, because barcodes, QR codes and images *do* scale to fit their element. Put text that needs to fit its box on `paragraphTextResizeStrategy: SHRINK_TEXT` (see [Responsive Sizing](https://wiki.trackandtrace.tools/t3-labels/layout-element-values/#responsive-sizing)). #### Data A fragment sees exactly the same data as the layout that embeds it, so `{{ package.label }}` means the same thing in both. There is no separate data list for a fragment. #### Nesting and limits A fragment can embed other fragments, up to five levels deep. Every fragment goes in the same flat `fragments` map no matter how deeply it is nested. Requests are rejected with a `400` if: - A `fragmentKey` is not in the `fragments` map. The error lists the available keys and suggests near matches. - A fragment embeds itself, directly or through another fragment. - Fragments are nested more than five levels deep. - Fragments expand a single label past 500 elements. - `renderingOptions.renderingVersion` is not `2`. Fragments require version 2. All of these are detected before anything is drawn, so a rejected request never produces a partial PDF. #### Using a saved layout To embed a layout saved in the Label Studio, fetch it from `GET /v2/labels/label-content-layouts` and pass its `labelContentLayoutConfig`. The response wraps each layout with its id, description and tags, so the entry itself is not a layout: ``` import requests layouts = requests.get( "https://api.trackandtrace.tools/v2/labels/label-content-layouts", headers={"X-T3-API-Key": SECRET_KEY}, ).json()["data"] warning = next(x for x in layouts if x["description"] == "State warning panel") payload["fragments"] = {"state_warning": warning["labelContentLayoutConfig"]} ``` ## Next Steps - The full value syntax and every text option: [Layout Element Values](https://wiki.trackandtrace.tools/t3-labels/layout-element-values/index.md). - Build a layout interactively in [Layout Builder](https://wiki.trackandtrace.tools/t3-labels/label-studio/layout-builder/index.md). - Define the physical label in [Label Templates](https://wiki.trackandtrace.tools/t3-labels/label-templates/index.md). # Label Templates ## Introduction A **template** defines the overall layout and physical structure of the label, including its dimensions, margins, padding, and page arrangement such as rows, columns, and spacing. - Dimensions (height, width) - Margins - Padding - Page arrangement (not applicable to thermal labels) - Rows - Columns - Gaps - Page margins - Row/column spacing **Note**: All template measurements are defined in **inches**. ### Template Fields Every control in the [Label Studio's](https://wiki.trackandtrace.tools/t3-labels/label-studio/template-builder/#template-builder) Template Builder writes one of these fields, so a template built visually and a template written by hand are the same object. | Field | Studio control | What it sets | | ------------------ | ----------------- | ------------------------------------------------------------ | | `labelWidthIn` | Label Width | The width of one label | | `labelHeightIn` | Label Height | The height of one label | | `labelPaddingXIn` | Label Padding X | Unprintable margin on the left and right of each label | | `labelPaddingYIn` | Label Padding Y | Unprintable margin on the top and bottom of each label | | `pagesizeXIn` | Page Size X | The width of the sheet the labels are printed on | | `pagesizeYIn` | Page Size Y | The height of the sheet | | `pageMarginLeftIn` | Page Margin Left | Distance from the left edge of the sheet to the first column | | `pageMarginTopIn` | Page Margin Top | Distance from the top edge of the sheet to the first row | | `xGapIn` | X Gap | Horizontal space between adjacent labels | | `yGapIn` | Y Gap | Vertical space between adjacent labels | | `numColumns` | Number of Columns | Labels across the sheet | | `numRows` | Number of Rows | Labels down the sheet | **Padding is not the same as page margin.** Padding is inside a label and reduces its printable area, which is what [layout fractions](https://wiki.trackandtrace.tools/t3-labels/label-layouts/#position-and-sizing) are measured against. Page margins are outside the labels and position the grid on the sheet. ### Thermal Labels A thermal printer prints one label per page, where the page is exactly the size of the label. That is not a separate kind of template; it is an ordinary template whose page happens to hold a single label: - `pagesizeXIn` and `pagesizeYIn` equal the label dimensions - `numColumns` and `numRows` are both `1` - every margin and gap is `0` The Label Studio's **Thermal Label** toggle is a shortcut for exactly that arrangement. It pins those eight values and locks their controls; it is a convenience in the editor and is never stored in the template itself. See [The Thermal Label Toggle](https://wiki.trackandtrace.tools/t3-labels/label-studio/template-builder/#the-thermal-label-toggle). The 3"x1" example below is a thermal template. ### Examples Here is an example template for a 3"x1" thermal label, with 1/8" margins: ``` { "labelHeightIn": 1, "labelPaddingXIn": 0.125, "labelPaddingYIn": 0.125, "labelWidthIn": 3, "numColumns": 1, "numRows": 1, "pageMarginLeftIn": 0, "pageMarginTopIn": 0, "pagesizeXIn": 3, "pagesizeYIn": 1, "xGapIn": 0, "yGapIn": 0 } ``` *Note: printable area border drawn as a visual aid* 3x1 thermal label template Here is an example template for an 8.5"x11" sheet of Avery 8160 labels (3 columns and 10 rows, 30 total), with 1/16" margins: ``` { "labelHeightIn": 1, "labelPaddingXIn": 0.0625, "labelPaddingYIn": 0.0625, "labelWidthIn": 2.625, "numColumns": 3, "numRows": 10, "pageMarginLeftIn": 0.1875, "pageMarginTopIn": 0.5, "pagesizeXIn": 8.5, "pagesizeYIn": 11, "xGapIn": 0.125, "yGapIn": 0 } ``` *Note: printable area borders drawn as a visual aid* Avery 8160 label template ______________________________________________________________________ ## Next Steps - Learn how to [create label layouts](https://wiki.trackandtrace.tools/t3-labels/label-layouts/index.md) - See how templates and layouts come together in [Generating Label PDFs](https://wiki.trackandtrace.tools/t3-labels/generating-label-pdfs/index.md) - Work through the [Tutorial](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md) to wire this up end-to-end - Configure your printer using [Printing Label PDFs](https://wiki.trackandtrace.tools/t3-labels/printing-label-pdfs/index.md) - [Start your free 30-day T3+ trial](https://dash.trackandtrace.tools) # Layout Element Values ## Textual Elements Textual elements (`TEXT`, `TABLE`) have options to control how the text appears: size, font, spacing, positioning, etc. ### Text Formatting Textual elements can control font size, font family, and paragraph spacing. - `paragraphFontSize` controls the font size. Default is `6`. - `paragraphSpacing` controls the line spacing, in points. Defaults to `paragraphFontSize`. Set it below the font size and lines overlap. - `paragraphFontName` controls the font family. Supported fonts: - Times-Roman - Times-Bold - Times-Italic - Times-BoldItalic - Helvetica (default) - Helvetica-Bold - Helvetica-Oblique - Helvetica-BoldOblique - Courier - Courier-Bold - Courier-Oblique - Courier-BoldOblique - Symbol - ZapfDingbats ### Text Alignment Textual elements can control how text is aligned inside the element boundaries, or, in the case of tables, inside each cell. - `horizontalParagraphAlignment` controls horizontal alignment: `LEFT`, `CENTER` (default), `RIGHT` - `verticalParagraphAlignment` controls vertical alignment: `TOP`, `CENTER` (default), `BOTTOM` ### Responsive Sizing Textual elements also allow you to specify how the text behaves when it overflows the layout element boundaries, using `paragraphTextResizeStrategy`: - `ALLOW_OVERFLOW` (default) displays text at its initial font size, even if it overflows the layout element boundaries. - `TRUNCATE_TEXT` preserves the initial font size and removes letters from the end until the remaining text fits. An ellipsis (`...`) is appended to indicate truncation. - `SHRINK_TEXT` preserves the initial text length but progressively reduces the font size until the text fits. **Note:** `TRUNCATE_TEXT` and `SHRINK_TEXT` are best-effort; they will only shorten or shrink the text to a certain point before giving up. ## Element Values A *value* is the data that appears inside a layout element: paragraph text, table contents, image data, or barcode contents. This data is produced by a *value template*. ### Value Templates The *value template* is a string used to specify text, HTML, or images that will appear inside the element. Different element types use the value template differently, and some do not use it at all. Each value template is *processed* before being rendered onto the label. ### Template Processing All value templates are processed with [Jinja](https://jinja.palletsprojects.com/en/stable/) before being added to the label. - `TEXT` uses the processed value as the text displayed inside the element. - Example: `Hello, my name is {{ user.name }}` - `TABLE` uses the processed value as the HTML table displayed inside the element. - Example: `
First NameLast Name
{{ user.firstName }}{{ user.lastName }}
` - `IMAGE` uses the processed value as a reference to a base64-encoded image. - `CODE128_BARCODE` / `CODE39_BARCODE` use the processed value as the barcode's scan value. - `QR_CODE` uses the processed value as the QR code's scan value. - `BOX` does not use a value template. ### Jinja Templating Value templates use [Jinja](https://jinja.palletsprojects.com/en/stable/templates/) syntax. The most important feature is **variable interpolation** with double curly braces: ``` {{ package.label }} ``` When the label PDF is generated, T3 processes each value template against the data available for that label. Variables are drawn from these namespaces: - **Per-label data**: each entry in your data list. For example, if your data list contains `{"package": {"label": "1A44..."}}`, then `{{ package.label }}` renders `1A44...`. - **Shared data**: values passed via `commonContentData` are merged into **the top level** of every label's data, so a `commonContentData` of `{"facilityContactInfo": {...}}` is read as `{{ facilityContactInfo.phoneNumber }}`, not `{{ common.facilityContactInfo.phoneNumber }}`. A key you set per label wins over the shared value of the same name. - **`images.*`**: base64 image data you supplied, accessed by filename. For example, `{{ images['logo.png'] }}`. - **`t3.*`**: built-in text and images provided by T3. For example, `{{ t3.images['t3_logo.png'] }}` or `{{ t3.text.poison_control_center_phone }}`. Call `GET /v2/labels/globals` for the full list. - **`data.*`**: an alias for that label's entire data entry, so `{{ data.package.label }}` and `{{ package.label }}` are equivalent. Useful when a key name would otherwise be ambiguous. Jinja also supports conditionals, loops, and filters, which can be useful for labels that conditionally display information: ``` {% if package.isOnHold %}ON HOLD{% endif %} ``` ``` {{ package.item.name | upper }} ``` ### Filters Jinja filters transform a value on its way onto the label, written with a pipe: `{{ value | filterName }}`. All of [Jinja's built-in filters](https://jinja.palletsprojects.com/en/stable/templates/#builtin-filters) are available, including `upper`, `title`, `round`, `truncate` and `default`. T3 adds four of its own, for things a template cannot do on its own. #### `boldEndingDigits` Bolds the significant tail of a Metrc tag, so the part that differs between packages is the part that reads at arm's length. ``` {{ package.label | boldEndingDigits }} ``` A tag of `1A4400005678000000000001` renders as 1A440000567800000000000**1**. The filter takes the last 8 characters, finds the first one that is not a zero, and wraps that character and everything after it in ``. Apply it to a tag string, not to the package. #### `packageStateName` Resolves the state a package belongs to, from the Metrc hostname it was loaded from. ``` {{ package | packageStateName }} ``` A package from `ca.metrc.com` renders as `California`. Apply it to the package itself rather than to a field. A hostname T3 does not recognize falls back to its prefix, uppercased, so an unmapped `xx.metrc.com` renders as `XX`. This is worth knowing about because the state is not a field on the package. It is carried by the hostname, so there is no `package.state` to read. #### `offset` Shifts an ISO 8601 date by a number of `years`, `months`, `weeks` or `days`. ``` Best by {{ package.packagedDate | offset(months=6) }} ``` A `packagedDate` of `2025-01-15` renders as `Best by 2025-07-15`. Units combine, as in `offset(years=1, days=-1)`, and negative values shift backwards. A date stays a date, and a timestamp keeps its time and zone, so `2025-01-15T17:38:24+00:00` becomes `2025-07-15T17:38:24+00:00`. When the target month is shorter, the day clamps to its last day: `2025-08-31` plus 6 months is `2026-02-28`. A null, missing or non-date value is an error rather than a blank, since a wrong date is worse than none. To print nothing instead, guard it: `{% if package.packagedDate %}{{ package.packagedDate | offset(months=6) }}{% endif %}`. #### `strict` Turns a single value that would render blank into an error. ``` {{ package.lot | strict }} ``` Use it on the one or two fields that must never print empty, while leaving the rest of the label forgiving. For the same behaviour across every expression at once, use `strictTemplates` in your [rendering options](https://wiki.trackandtrace.tools/t3-labels/generating-label-pdfs/index.md) instead, described under [Catching Blank Output While Authoring](#catching-blank-output-while-authoring). ### Missing Values By default, an expression that cannot be resolved renders as an **empty string** rather than failing. `{{ package.lot }}` on a package with no `lot` key simply prints nothing. That is forgiving when a field is genuinely optional, but it also means a typo produces a silently blank label. To supply an explicit fallback: ``` {{ package.lot | default('N/A') }} ``` `default` only covers keys that are **missing**. To also cover keys that are present but `null`, pass `true` as a second argument: ``` {{ package.packagedDate | default('N/A', true) }} ``` To guard an optional key in a conditional, prefer `is defined` over a bare truthiness test: ``` {% if package.isOnHold is defined and package.isOnHold %}ON HOLD{% endif %} ``` ### Missing Images `IMAGE` elements are the one exception to the blank-by-default rule above. An image has nothing to draw when its value template resolves to nothing, so blank output is reported as a `400 LABEL_TEMPLATE_ERROR` instead of printing an empty rectangle. This most often happens when the filename in the template does not match the one in your `images` payload: ``` payload = { "images": {"logo.jpg": "data:image/png;base64,iVBORw0KGgoAAA..."}, "labelContentLayoutConfig": { "labelContentLayoutElements": [ {"elementType": "IMAGE", "description": "Brand logo", "valueTemplate": "{{ images['logo.png'] }}"} ] }, # ... } ``` `logo.png` was never supplied, so the response names the element and the key you probably meant: ``` { "code": "LABEL_TEMPLATE_ERROR", "detail": "1 template problem across 40 labels. element[0] 'Brand logo' (IMAGE) line 1, 'dict object' has no attribute 'logo.png', that object has 1 key(s): logo.jpg", "errors": [ { "elementIndex": 0, "elementType": "IMAGE", "description": "Brand logo", "line": 1, "sourceLine": "{{ images['logo.png'] }}", "didYouMean": ["logo.jpg"], "occurrences": 40, "firstLabelIndex": 0 } ] } ``` The same error covers image data that is present but unusable; a payload that is not valid base64, or base64 that does not decode to a PNG, JPEG or GIF. If an image is genuinely optional, give the template something to fall back on rather than letting it render blank: ``` {{ images['state_warning.png'] | default(images['generic_warning.png']) }} ``` To drop the image from a layout entirely, set `enabled` to `false` on the element. ### Catching Blank Output While Authoring Set `strictTemplates` in your [rendering options](https://wiki.trackandtrace.tools/t3-labels/generating-label-pdfs/index.md) to turn every silently-blank expression into an error: ``` { "renderingOptions": { "renderingVersion": 2, "strictTemplates": true } } ``` With `strictTemplates` enabled, an undefined variable, a missing key, or a `null` value all return a `400 LABEL_TEMPLATE_ERROR` naming the element, the line, and what the data actually held. The `default` filter and `is defined` shown above continue to work, so they remain the way to say "blank here is intentional." It defaults to `false`, so existing layouts are unaffected. Turning it on while building a layout is the fastest way to find typos; leaving it off in production keeps optional fields forgiving. If a template fails, T3 returns a `400 Bad Request` reporting **every** problem it found across your layout and data, not just the first. See [Troubleshooting](https://wiki.trackandtrace.tools/t3-labels/tutorial/troubleshooting/index.md) in the tutorial. ______________________________________________________________________ ## Next Steps - Back to the element reference: [Label Layouts](https://wiki.trackandtrace.tools/t3-labels/label-layouts/index.md). - Where the values come from: [Label Data](https://wiki.trackandtrace.tools/t3-labels/label-studio/label-data/index.md). - Work through a data-driven label in [Name the Product](https://wiki.trackandtrace.tools/t3-labels/tutorial/name-the-product/index.md). # Printing Label PDFs ## Introduction The T3 Label Generator produces PDF labels that can be printed on **any printer**, including thermal, inkjet, and laser models. Some printers will print PDFs correctly out of the box, and some will require some configuration. ______________________________________________________________________ ## Generating Label PDFs Generate your label PDF from within the [T3 Label Studio](https://wiki.trackandtrace.tools/t3-labels/label-studio/index.md) or with the [T3 API Label Endpoints](https://api.trackandtrace.tools/v2/docs/#/Labels). Each label in the PDF is formatted to the exact dimensions based on your template configuration. Once a label PDF is generated, it can be sent directly to your printer for printing. ______________________________________________________________________ ## Printing Labels Once you have your label PDF and your printer is ready to print, you will need to configure how your label printer handles PDFs. **Note:** Some label printers take more adjustment than others. Print a single test label, change one setting at a time, and repeat until the print is correct. Every label printer has a configuration that prints PDF labels correctly. You'll only need to perform this setup once, and then easily reuse it each time you print PDFs. ______________________________________________________________________ ### Configuring Printer Settings For accurate label output, configure the following settings in your print dialog or printer preferences: - **Paper Size**: Match your label template size exactly (e.g. 4"x6", 2.25"x1.25"). Some label printer drivers will include presets that you can select from, while others will require you to enter the dimensions manually. - **Scaling**: Set scaling to **100%** or **Actual Size**. - **Margins**: Use **no margins** or “borderless” settings if available - **Portrait/Landscape**: This typically does not affect the print output, but prefer **portrait** unless your labels are coming out sideways. - **Print Quality / DPI**: For text and barcode clarity, use **300 DPI** or higher when available. However, you may not always want to use the highest DPI available. See [Troubleshooting](#troubleshooting) for additional details. ______________________________________________________________________ ## How Label Printers Handle PDFs (Skip this section if you are not interested in the technical details) Most label printers cannot interpret PDF files on their own. Instead, the computer takes responsibility for converting the PDF into a printable format. This process is known as host-side rendering. ### Host-side Rendering When a PDF is sent to a label printer, the operating system or print driver first converts the PDF into a raster image. A raster image is a pixel-based representation of the content, similar to a photograph or a screenshot. This step ensures that any fonts, vector graphics, or layout elements from the PDF are flattened into a format that the printer can handle. Once the raster image is generated, it is translated into the printer's native command language. Common languages include ZPL (Zebra Programming Language), EPL (Eltron Programming Language), and DPL (Datamax Programming Language). These are text-based markup formats that describe how the printer should place text, lines, barcodes, and other graphical elements on the label. This approach means the printer itself does not need to understand PDFs. It simply receives a stream of instructions that describe how to print the rasterized label. This method is widely used for desktop and industrial label printers that connect via USB or network. It allows for maximum compatibility without requiring the printer to support complex document formats like PDF. However, the quality and accuracy of the final printout depend on the resolution used during rasterization and the capabilities of the printer driver. ______________________________________________________________________ ## Printing your PDF ### Print Dialog The **print dialog** is the window that shows up after you click a "print" button. The print dialog controls how the PDF is sent to the printer. It includes all the configurable settings for how the print will appear: portrait/landscape, scale, orientation, DPI, etc. Some PDF viewers will have their own print dialogs, and others will use the system print dialog. Below are three different print dialogs printing the same labels: Adobe Acrobat, Google Chrome, and Mac OS X: Adobe print dialog Google Chrome print dialog Mac OS X system print dialog ### Driver Print Settings Most print dialogs will group the label printer settings in a nested window that is hidden by default. See below for examples of Zebra and Dymo label printer settings: Accessing printer driver settings Dymo driver settings Zebra driver settings ______________________________________________________________________ ## Troubleshooting **95% of label printing problems are from the PDF label size not matching the print setup size.** Check that these **exactly** match before proceeding. | **Problem** | **Possible Explanations** | **Solution** | | ------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Printed barcode content is not centered on the label** | • Label size does not match the print setup size | • Check that your T3 label template size, print options size, and actual label dimensions all match | | **Printed barcodes are unscannable** | • Barcode print accuracy goes down when the printer output speed is too fast • Barcode is too small for your layout/printer DPI | • Adjust the print speed down in print settings • Change to a larger label, or make the barcode larger | | **I can't find the settings I need to change in the print dialog** | • Some print dialogs, like the Google Chrome print dialog, don't use the label printer driver | • Use the system print dialog to print the labels | | **Label text is grainy or unreadable** | • Label font size is too small for this printer's DPI • Print head is dirty | • Increase the DPI if possible, or use a larger label size • Clean the print head | | **Printing appears normal but overflows the label** | • PDF label size likely does not match print setup size | • Check that the PDF label size matches the print setup size | | **Printing appears rotated and extends outside label border** | • Your printed dimensions are reversed. For example, some thermal printers offer both 3x1 and 1x3 labels, and these print differently | • Ensure your printed dimensions are correct | | **Printing appears magnified and extends outside label border** | • Some printer drivers let you select a higher DPI than the printer can actually print, and the printer may enlarge the printed content to compensate | • Lower your DPI settings | | **Barcode bars appear too fat or distorted** | • The label is too small for the barcode, which will likely be unscannable • DPI is too low | • Increase your DPI • Dymo printers need to print in **barcode+graphics/300x600 DPI** mode to print barcodes properly. That mode prints slower than text/300 DPI mode, but text mode prints bars too fat to scan | ______________________________________________________________________ ## Next Steps - Picking or setting up hardware? See [Choosing a Label Printer](https://wiki.trackandtrace.tools/t3-labels/choosing-a-label-printer/index.md). - Produce the PDF in the first place: [Generating Label PDFs](https://wiki.trackandtrace.tools/t3-labels/generating-label-pdfs/index.md). - [Start your free 30-day T3+ trial](https://dash.trackandtrace.tools) # Retail ID QR Code Labels from CSV This tutorial covers how to generate printable QR code labels from a downloaded CSV file using the T3 Label Studio. ______________________________________________________________________ ## Step 1: Download Your CSV Export or download a CSV file containing the data you want to encode in QR codes. Your CSV should have a column with the values to be encoded (e.g., `Unit Code`). To fetch the codes through the T3 API instead of Metrc's page, see [Retail ID Labels](https://wiki.trackandtrace.tools/t3-api/retail-id/index.md). [Download demo CSV](https://wiki.trackandtrace.tools/assets/csv/1A4000000000000000012345-r0-demo.csv) Example CSV with Unit Code column ______________________________________________________________________ ## Step 2: Select a Template Open the T3 Label Studio and click the **Template Builder** tab. If a template is already loaded, click **Reset** on its card. Search the starter templates for one that matches your label size (e.g., `2x1`) and select it. Selecting a 2x1 thermal label template ______________________________________________________________________ ## Step 3: Select a Layout Click the **Layout Builder** tab, clicking **Reset** on the current layout's card if one is loaded. Search the starter layouts for `Retail ID CSV QR Code` and select it. Selecting the Retail ID CSV QR Code layout ______________________________________________________________________ ## Step 4: Load CSV Data 1. Click the **Label Data** tab 1. Under **Data source**, click **Import from File** 1. Click **CSV File** 1. Select your CSV file Loading data from CSV ______________________________________________________________________ ## Step 5: Generate Labels Click **Generate PDF**. Each row in your CSV produces one QR code label. Generated QR code labels from CSV data Click **Print** to send the labels to your printer, **Download PDF** to save the label PDF, or **Open in new tab** to view it in its own tab. ______________________________________________________________________ ## Sample Files - [Demo CSV](https://wiki.trackandtrace.tools/assets/csv/1A4000000000000000012345-r0-demo.csv) - Final PDF (download: [`t3-retail-id-final.pdf`](https://wiki.trackandtrace.tools/assets/pdf/retail-id/t3-retail-id-final.pdf)) ______________________________________________________________________ ## Next Steps - [Learn to print your label PDFs](https://wiki.trackandtrace.tools/t3-labels/printing-label-pdfs/index.md) - [Create custom label layouts](https://wiki.trackandtrace.tools/t3-labels/label-layouts/index.md) - Work through the [Tutorial](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md) for a deeper look at label layouts and Metrc data - Full reference for [Label Templates](https://wiki.trackandtrace.tools/t3-labels/label-templates/index.md) and [Label Layouts](https://wiki.trackandtrace.tools/t3-labels/label-layouts/index.md) # Label Studio The Label Studio workspace ## Introduction The **T3 Label Studio** is the visual label builder inside the [T3 Chrome Extension](https://wiki.trackandtrace.tools/t3-chrome-extension/index.md). It lets you design a label, fill it with Metrc data, preview the result, and download a print-ready PDF without writing any configuration by hand. Everything the Label Studio produces is ordinary T3 Labels configuration. The Studio is a front end over the same [label generation API](https://wiki.trackandtrace.tools/t3-labels/generating-label-pdfs/index.md) you can call directly, so any label you build here can be reproduced from a script, and any configuration you already have can be loaded into the Studio to keep editing visually. This page is a reference for the interface. If you would rather follow a guided build from scratch, start with the [T3 Label Tutorial](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md). T3 Free is a preview T3 Free users can open the Label Studio and explore it, but **Metrc data cannot be loaded** and every generated label is **watermarked**. Design work still works: starter templates, demo data, and the full layout editor are all available. A [T3+ subscription](https://wiki.trackandtrace.tools/t3-plus/index.md) removes both restrictions. ______________________________________________________________________ ## Opening the Label Studio 1. Log in to Metrc with the [T3 Chrome Extension](https://wiki.trackandtrace.tools/t3-chrome-extension/getting-started/index.md) installed. 1. Open the T3 menu and choose **Label Studio**. It is also in the menu that opens when you hover over the T3 button at the bottom right, and under **Tags & Labels** on the toolbox's **Tools** screen. Until you generate a PDF, the preview pane offers three ways to start: - **Show me an example** loads a complete working label so you can see how the pieces fit together. - **Start fresh** clears the layout and data and gives you a blank 3x1 thermal label to build on. - **Example package tags** loads five of your lab-tested packages from Metrc onto a starter package tag layout and renders them. It loads Metrc data, so it needs T3+. Once a preview is showing, **Reset** below it returns the Studio to this starting point. ______________________________________________________________________ ## The Workspace The Studio is split into a set of tabs on the left and a live PDF preview on the right. The right column stays fixed while the left column scrolls, so the label you are looking at never leaves the screen. Three **primary tabs** carry the main workflow and are always visible: | Tab | Purpose | | -------------------- | ---------------------------------------------------------------------------- | | **Template Builder** | The physical label: its size, padding, and how labels are arranged on a page | | **Layout Builder** | What is printed on each label | | **Label Data** | The list of records to print, one label per record | Everything else lives behind a **More** dropdown to the right of them, which renames itself to whichever of these you have open: | Tab | Purpose | | ----------------- | ----------------------------------------------------- | | **My Templates** | Templates you have saved | | **My Layouts** | Layouts you have saved | | **Default Data** | Values shared by every label | | **Built-in Data** | Text and images T3 provides under the `t3.` namespace | | **Images** | Your own uploaded images | | **Settings** | Copies, rotation, and printer tuning | | **Quick Print** | Defaults used by one-click printing elsewhere in T3 | | **Import/Export** | Move a whole configuration to or from a file | | **Debug** | Raw configuration, for troubleshooting | The dropdown also links to the label tutorial and to this documentation. Most tabs open with a short help card explaining what that tab is for. Dismiss them individually as you learn your way around, or turn all of them off with **Show Help Information Cards** in [Settings](#settings). ### Status Icons and Validation Each of the three primary tabs carries a **status icon** showing whether that piece of the configuration is currently valid. Five things are checked continuously: Tab status icons - the template - the layout - the label data list - the default data - your uploaded images **Generate PDF is enabled only when all five are valid.** When one is not, the right column names the first problem and tells you what to do about it, and the tab icon points you at where to fix it. This is why a broken label is usually caught before you generate rather than after. The exception is errors that only the renderer can find, covered in [When Generation Fails](https://wiki.trackandtrace.tools/t3-labels/label-studio/generating/#when-generation-fails). ______________________________________________________________________ ## Settings | Setting | What it does | | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Copies** | How many copies of each label to generate | | **Reverse print order** | Thermal printers print labels sequentially, but the spooled order is reversed (last to first). Enable this to print labels in the same order as they appear in the PDF. | | **Rotation** | Degrees to rotate the layout. 90 prints sideways. | | **Barcode bar thickness** | Adjust if you are using a low-DPI printer and printed barcodes are too thick or unscannable. Higher means thicker bars. 1.0 suits most thermal printers. | | **Label margin thickness** | Adjust if your printer has trouble printing the exact center of labels. Higher means thicker margins. 1.0 suits most thermal printers. | | **Debug** | Enables rendering debug output, the same element borders as **Draw borders** | | **Show Help Information Cards** | Shows or hides the help cards in each tab | The Settings panel These map to the rendering options documented under [Settings](https://wiki.trackandtrace.tools/t3-labels/generating-label-pdfs/#settings). The tab also has a **Reset** button that returns the entire Studio (template, layout, data and settings) to its defaults. ______________________________________________________________________ ## Quick Print Elsewhere in T3 you can print a label for a package, plant or plant batch in one click, without opening the Studio at all. The **Quick Print** tab sets what those shortcuts use: Quick Print - **Quick Print Template**: the label stock, shared by all three - **Quick Print Package Layout** - **Quick Print Plant Layout** - **Quick Print Plant Batch Layout** A separate layout per object type means a plant tag can differ from a package label while both print in one click. These are read by **Quick print label** and **Add to label data list** in package, plant and plant batch row menus and T3 search results. ______________________________________________________________________ ## Import and Export **Import/Export** writes your Studio configuration to a single file and loads it back. It is the way to move a design somewhere the saved template and layout lists do not reach: to another account, to a colleague, or into a file you keep alongside the rest of your work. Six parts can be included independently: | Part | What travels with it | | ------------------ | ----------------------------------------------------------------- | | **Template** | Label size, padding, and the page arrangement | | **Layout** | Every element on the label, including its value templates | | **Label Data** | The record list currently loaded | | **Default Data** | The shared and fallback values | | **Images** | Your uploaded images, embedded in the file rather than referenced | | **Print Settings** | Copies, rotation, barcode and margin tuning | **The same six checkboxes drive both directions**, which is what makes partial transfers work. Export everything once, then import only the parts you want: - **Send a design to a colleague** by exporting Template, Layout and Images, and leaving Label Data out so your records do not travel with it. Ticking Images matters here: [uploads live in your browser](https://wiki.trackandtrace.tools/t3-labels/label-studio/label-data/#images), so a layout that references one arrives without it otherwise. - **Copy printer tuning between facilities** by exporting Print Settings alone, once you have dialled in barcode thickness and margins on a given printer. - **Keep a checkpoint before a large change** by exporting everything, since an import can put any subset back. **Import** is a file picker accepting `.json` or `.txt`. **Export** writes a file named by the **Export filename** box, which carries a `.txt` suffix. Import and export are not the same as saving. [Saving a template or layout](https://wiki.trackandtrace.tools/t3-labels/label-studio/generating/#saving-templates-and-layouts) keeps it in your account and lists it under My Templates or My Layouts; exporting produces a file that leaves T3 entirely. ## Debug **Debug** shows the raw configuration behind the Studio: the save state of the current template and layout, the generated PDF's location, the validation status of each piece of configuration, and the serialized value of every field. If you need help with a label, **Send configuration to support** on the Import/Export tab files a support ticket with your whole configuration attached, whichever checkboxes are ticked. ______________________________________________________________________ ## Next Steps - Set up your label medium in [Template Builder](https://wiki.trackandtrace.tools/t3-labels/label-studio/template-builder/index.md). - Arrange what appears on the label in [Layout Builder](https://wiki.trackandtrace.tools/t3-labels/label-studio/layout-builder/index.md). - Pull Metrc records in with [Label Data](https://wiki.trackandtrace.tools/t3-labels/label-studio/label-data/index.md). - Produce the PDF in [Saving and Generating](https://wiki.trackandtrace.tools/t3-labels/label-studio/generating/index.md). - New to the Studio? Work through the [Tutorial](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md). # Saving and Generating Previewing a generated label ## Saving Templates and Layouts Templates and layouts are saved separately, so a layout you design once can be printed on any template you have. When a template or layout is loaded, a card at the top of the tab shows its name and status: - **Starter** marks a built-in template or layout provided by T3. These are read-only: every field on the tab is disabled, and a banner says so. **Save as Copy** creates an editable version of your own. - **Custom** marks something you saved yourself. **Make a Copy** duplicates it under a new name. - **New Template** and **New Layout** (in My Templates and My Layouts), **Start fresh** and **Use example** open a design that isn't saved yet. It shows a **Save** button until it is saved. With Auto-save on, your first change saves it too. From then on it is **Custom** and listed in My Templates or My Layouts. - **Auto-save** saves every change as you work, a moment after you stop. Turn it off if you would rather save deliberately with the **Save** button. - A **save status** sits beside the name and tells you where you stand: saving, saved, unsaved changes, or a save that failed. - **Reset** clears the current selection and starts over. Saved templates and layouts are visible to Metrc users who have access to the same license, so a design made once can be shared across your team. Editing a saved template or layout also adds your own licenses to the set that can see it. ### My Templates and My Layouts These two tabs are the full management screens for everything you have saved. Each row shows the name and description, whether it is a T3 system object or your own, and up to three tags. - **Search** filters by name. - **Edit** renames and re-tags one of your own. - **Archive** removes an item from the pickers without deleting it. Archived items are still listed when you turn on **Show archived**. - Clicking a row makes it the active template or layout. Nothing is deleted, and archiving is one way Custom templates and layouts are archived rather than deleted, because a layout may be embedded as a [fragment](https://wiki.trackandtrace.tools/t3-labels/label-studio/layout-builder/#fragments) in labels you have forgotten about. An archived layout still loads by id, so anything already using it keeps working. Archiving cannot currently be undone, so archive something only when you are done with it. If you are unsure, rename it out of your way instead. ______________________________________________________________________ ## Generating and Previewing Click **Generate PDF** to render your labels. A long generation shows a spinner and can be cancelled. The preview appears in the right column, with four buttons below it: - **Print** opens the print dialog for the PDF. - **Download PDF** saves it. - **Open in new tab** opens it in its own browser tab. - **Reset** asks for confirmation, then returns the whole Studio (template, layout, data and settings) to its defaults. The controls beside the button: | Control | What it does | | -------------------------------- | ----------------------------------------------------------------------------------------------------------- | | **Auto-regenerate** | Re-renders the PDF on every change, rather than waiting for you to click | | **Draw borders** | Outlines every element in the rendered PDF. The fastest way to understand why something is positioned oddly | | **Real data / Template preview** | See [Template Preview Mode](#template-preview-mode) | | **Copies** | Prints each label more than once | | **Rotate** | Turns the layout on the page | For printer setup, driver installation and troubleshooting, see [Printing Label PDFs](https://wiki.trackandtrace.tools/t3-labels/printing-label-pdfs/index.md). ### Template Preview Mode Switching the **Real data / Template preview** pair to **Template preview** prints the label's *own templates* instead of their values. You see `{{ package.label }}` on the label where a tag would be. This exists so you can lay out and size a label before you have loaded any data, which is the normal order of work, since sizing a field is much easier when you can see where it sits. Four things to know: - **It changes only what is sent to be rendered.** A layout you save while it is on still stores your real templates. There is no way to accidentally save a literalized layout. - **It is not remembered.** Reopening the Studio puts you back on real data. - **Quick Print always uses real data**, because it prints labels for real packages. - **Only value interpolations are literalized.** Jinja statements such as `{% for %}` still run, so a generated table still looks like a table rather than collapsing into its own source. Image elements are the exception; an image value has to decode as image data, so those are replaced with a placeholder image. Switch back to **Real data** before printing labels you intend to use. ### When Generation Fails Two different kinds of failure are reported differently. A failed generation **A validation error** means generation never started: one of the [five configuration checks](https://wiki.trackandtrace.tools/t3-labels/label-studio/#status-icons-and-validation) failed. The right column names the problem and what to do about it. **A generation error** means the API rejected the request. This block is worth reading closely, because it is specific: - The API's own explanation of what went wrong. - **One card per failing element**: naming the element, the message, and the line of your value template that caused it. If the failure happened inside an embedded layout, the card shows the path through the fragment so you know which layout to open. - **Suggestions.** The most common cause is a value template referencing a field that does not exist in your loaded data, and the error offers the closest matching field names. - A **Show layer** button that jumps straight to the element at fault. - A **Full error details** section with the raw response, which is the right thing to include when asking for help. The tutorial covers [what to do when a label will not render](https://wiki.trackandtrace.tools/t3-labels/tutorial/troubleshooting/index.md). ______________________________________________________________________ ## Next Steps - Send the PDF to a printer with [Printing Label PDFs](https://wiki.trackandtrace.tools/t3-labels/printing-label-pdfs/index.md). - Generate the same label from code: [Generating Label PDFs](https://wiki.trackandtrace.tools/t3-labels/generating-label-pdfs/index.md). - If generation fails, check the layout in [Layout Builder](https://wiki.trackandtrace.tools/t3-labels/label-studio/layout-builder/index.md). # Label Data The **Label Data** tab supplies the list of records to print. One record produces one label, so a list of 30 packages prints 30 labels. Once data is loaded, a card at the top of the tab shows how many records you have, with **Show** to inspect them as JSON and **Clear** to start over. There are four sources: | Source | Use it for | | -------------------- | ---------------------------------------------------------------------- | | **Load from Metrc** | Pulling packages, plants or plant batches directly. **T3+ only** | | **Demo Packages** | Sample data for exploring label features without touching real records | | **Import from File** | Uploading a CSV or JSON file | | **Manual Entry** | Typing or pasting label data directly | With no records loaded, the tab also offers a quick start, **Just give me some package label data**, which loads five lab-tested Active Superpackages from your Metrc license. Like any Metrc load, it needs T3+. ## Loading From Metrc Choose what to load. The **superpackage** options attach lab results, history and source harvests to each package. That is what makes potency and testing fields available to your templates, and it is also why they are capped lower: Loading data from Metrc | Data type | Maximum records | | ------------------------ | --------------- | | Active Superpackages | 100 | | In-Transit Superpackages | 100 | | Active Packages | 500 | | In-Transit Packages | 500 | | Vegetative Plants | 500 | | Flowering Plants | 500 | | Active Plant Batches | 500 | Then pick your records. The tags you print are a [tag list](https://wiki.trackandtrace.tools/t3-chrome-extension/tag-lists/#in-label-studio): your scratchpad for that kind of record (packages, plants or plant batches), or another list chosen in **Tag list:**. Two ways to fill it: - **Search Metrc**: a search box over the records of the data type you picked. Click a result, or pick it with **↑**, **↓** and **Enter**, to add its tag to the list. Good for a handful of records. - **Paste**: a text box for pasting tags, one per line, with **Add to list**. Good for a list you already have in a spreadsheet. **Add to Scratchpad** in a Metrc table row's menu adds to the same list while you work in Metrc. **Load** looks the list's tags up and loads them as label data, naming any it couldn't find. The Studio opens on **Active Superpackages**, and returns there whenever you reset. ## Other Data Sources **Import from File** takes a CSV or a JSON array, one row or object per label. **Manual Entry** gives you a JSON editor bound directly to the label list, plus an **empty label generator**: pick a count and get that many blank records. This is how you print a run of identical labels that carry no Metrc data at all: generate the number of labels you want, and let the layout supply everything. **Demo Packages** loads ten randomly generated sample packages as soon as you click it. Use it to explore fields, sizes and layouts before pointing the label at anything real. Once data is loaded, every field on the record is available to your value templates. For a package, that includes: - `{{ package.label }}`: the Metrc tag - `{{ package.item.name }}`: the item name - `{{ package.item.strainName }}`: the strain - `{{ package.quantity }}` and `{{ package.unitOfMeasureName }}`: quantity and unit - `{{ package.metadata.indexedLabResults.totalTHC.value }}` and `{{ package.metadata.indexedLabResults.totalCBD.value }}`: indexed lab results, when present (see [Lab Result Keys](https://wiki.trackandtrace.tools/t3-api/lab-result-keys/index.md)) Use **Insert Field** in the Layout Builder rather than typing these from memory. It lists exactly what your loaded data contains, with an example value beside each one. ## Where else a value can come from The Label Data tab supplies one record per label. Three other tabs supply values too, and a template reads all four the same way: | Tab | What it holds | Read as | | ----------------- | --------------------------------------------------- | ------------------------------------------- | | **Label Data** | One record per label | `{{ package.item.name }}` | | **Default Data** | Values shared by every label, or used as a fallback | `{{ facilityAddress }}` | | **Built-in Data** | Text and images T3 ships | `{{ t3.text.poison_control_center_phone }}` | | **Images** | Images you upload | `{{ images['logo.png'] }}` | ## Default Data **Default Data** is a single JSON editor holding values shared across every label, or values to fall back on when a record does not carry its own. It is sent as `commonContentData`. Its keys merge into the **top level** of each label's record, so they read exactly as if you had repeated them in every entry: ``` { "facilityAddress": "123 Main St, Denver CO", "facilityLicense": "LIC-00001" } ``` ``` {{ facilityAddress }} ``` **A record's own value always wins.** Default Data only fills in keys a record does not already have, which is what makes the fallback case work: set a default strain name, and only the packages missing one will use it. Most labels do not need Default Data. Reach for it when the same literal appears on every label, or when your data is uneven and you want a safety net. ## Built-in Data **Built-in Data** is a read-only list of values T3 provides on every label request, under the `t3.` namespace. Nothing to upload and nothing to configure. ``` {{ t3.text.poison_control_center_phone }} {{ t3.images['ca_cannabis_warning.png'] }} ``` It covers state warning images, compliance disclosures and Poison Control Center contact information. Both halves are keyed by state abbreviation, so `{{ t3.text.co_cannabis_warning_disclosure }}` is the Colorado wording and `{{ t3.images['ca_cannabis_warning.png'] }}` is the California mark. Seventeen states have warning text, and seventeen have images. See [State Disclosures](https://wiki.trackandtrace.tools/t3-labels/generating-label-pdfs/#state-disclosures) and [State Images](https://wiki.trackandtrace.tools/t3-labels/generating-label-pdfs/#state-images) for the full lists and the key naming. `GET /v2/labels/globals` returns the full current list. ## Images **Images** is where your own logos and graphics live. **Upload images** takes any image type and accepts several files at once; uploads appear as a thumbnail grid showing each image with its filename. Reference an uploaded image from an `IMAGE` layout element by the filename it was uploaded under: ``` { "elementType": "IMAGE", "valueTemplate": "{{ images['logo.png'] }}" } ``` In the Layout Builder, **Insert Image** on an IMAGE layer lists your uploads under **My Images** and T3's under **Built-in**, so you rarely need to type the name. With nothing uploaded yet it says so and links back to this tab. Uploaded images are stored in your browser rather than on your T3 account, so they stay on the machine you uploaded them from. To move a design that uses one to another browser or another person, [export](https://wiki.trackandtrace.tools/t3-labels/label-studio/#import-and-export) it with **Images** ticked, which embeds the image data in the exported file. `images` and `t3.images` are different namespaces Your uploads are read as **`{{ images['name.png'] }}`**. T3's built-ins are read as **`{{ t3.images['name.png'] }}`**. The `t3` namespace is replaced with T3's own values on every request, so an uploaded file will never be found there no matter what it is called. ______________________________________________________________________ ## Next Steps - Write the values into your layout in [Layout Element Values](https://wiki.trackandtrace.tools/t3-labels/layout-element-values/index.md). - Produce the PDF in [Saving and Generating](https://wiki.trackandtrace.tools/t3-labels/label-studio/generating/index.md). - Follow a data-driven label end to end in [Name the Product](https://wiki.trackandtrace.tools/t3-labels/tutorial/name-the-product/index.md). # Layout Builder A **layout** is a stack of elements (text, barcodes, images, boxes) each positioned within the label. Layouts are responsive: positions are fractions of the label rather than fixed measurements, so the same layout adapts when printed on a different size. As with templates, a starter search gets you going (try `QR`, `barcode`, or `package`) and hovering a result renders that layout to scale so you can see what you are about to load. Starter layouts are read-only until you save a copy. A collapsible **Current layout JSON** section at the bottom of the tab holds the raw configuration, editable directly. Changes there show up in the controls above, and the reverse. ## The Layer Stack The panel on the left lists every element in the layout. Elements later in the list are drawn on top of earlier ones. The layer stack | Control | What it does | | --------- | --------------------------------------------------------------------------------------------- | | **+** | Adds a layer. Choose the element type from the dropdown. | | **Copy** | Duplicates the selected layer | | **Trash** | Deletes the selected layer | | **Eye** | Hides a layer without deleting it. Hidden layers are dimmed in the stack and are not printed. | | **Grip** | Drag to reorder, which changes what is drawn on top | Click any layer to edit it. Give layers a **Layer description** so the stack stays readable once a layout grows past a few elements. That description is the name shown here, and it is what T3 uses to name the layer in an error message. If a layer fails to render, it is highlighted in the stack, so a failed generation points at the element that caused it. ## Position and Size Above the layer stack is a scale drawing of your label showing every element in place. Position and size controls - Drag the middle of the selected element to move it. - Drag an edge to resize it. - Other layers are shown behind the selected one, labeled with their name and type. Click one to select it. - **Fragment layers draw their contents in place** rather than as an empty rectangle, so an embedded layout is visible while you position it. Below the canvas, a readout gives the element's edges as percentages of the printable area, such as `X: 5% – 95%` and `Y: 34% – 54%`, and its real size in inches, so you can sanity-check a design against the label you are actually printing on. The readout counts Y down from the top edge. Dragging moves in steps of 1%. Dragging writes the element's `xStartFraction`, `xEndFraction`, `yStartFraction` and `yEndFraction`, described in [Position and Sizing](https://wiki.trackandtrace.tools/t3-labels/label-layouts/#position-and-sizing). To set them by hand, edit the layer in **Current layout JSON**. The JSON counts Y up from the bottom edge, so a readout of `Y: 34% – 54%` is stored as `yStartFraction: 0.46` and `yEndFraction: 0.66`. ## Element Types | Type | Renders | | -------------------- | -------------------------------------------------------------------- | | **Text** | A paragraph of text, with font, size, alignment and spacing controls | | **Code 128 Barcode** | A 1D barcode | | **Code 39 Barcode** | An alternative 1D barcode format | | **QR Code** | A scannable QR code | | **Image** | An image from the Images tab or the T3 built-ins | | **Box** | A rectangle, with stroke and fill color, width and opacity | | **Table** | A table defined with simple HTML | | **Fragment** | Another saved layout, embedded inside this one | Each of these corresponds to an `elementType` in the layout config: `TEXT`, `CODE128_BARCODE`, `FRAGMENT`, and so on. [Label Layouts](https://wiki.trackandtrace.tools/t3-labels/label-layouts/#layout-elements) documents every element type and each of its styling fields. A new layer fills the whole label and arrives with sensible defaults (placeholder text at a small centered Helvetica, a black hairline box, a two-cell table), so it is visible on the canvas immediately. Drag its edges in to place it before you write its content. ## Editing a Layer Selecting a layer opens its editor beside the stack. Which sections appear depends on the element type. Editing a layer **Type and description.** Change the element type at any time. Position is preserved, so you can swap a Code 128 barcode for a QR code without repositioning it. The description names the layer. **Content.** A **Value template** editor holding what the element renders. It accepts [Jinja templating](https://wiki.trackandtrace.tools/t3-labels/layout-element-values/#value-templates), so `{{ package.label }}` prints the current record's tag rather than a fixed string. For Table elements the editor is in HTML mode. Two buttons sit in the editor's bottom-left corner: - **Insert Field** opens a searchable list of everything available to your templates, grouped into common fields, all fields, T3's [built-in data](https://wiki.trackandtrace.tools/t3-labels/generating-label-pdfs/#built-in-data), and your [default data](https://wiki.trackandtrace.tools/t3-labels/label-studio/label-data/#default-data). Each row shows the field's path and a sample value taken from the data you have loaded. Clicking a row inserts it, braces included, at the cursor. On Image layers it becomes **Insert Image**, listing [your uploaded images](https://wiki.trackandtrace.tools/t3-labels/label-studio/label-data/#images) under **My Images** and T3's under **Built-in**. - **Generate Table**, on Table layers, writes an HTML table skeleton with the rows and columns you choose, so you can fill in cells rather than typing the markup. Load your data before laying out fields The **Insert Field** list is built by reading the **first record** in your loaded [label data](https://wiki.trackandtrace.tools/t3-labels/label-studio/label-data/#label-data). With no data loaded there is nothing to list; with demo data loaded you get demo fields. Load the records you actually intend to print and the picker will show you their real field names and real values. **Formatting**, on Text and Table layers: font, size, resize strategy, horizontal and vertical alignment, and line spacing. Line spacing has an **Auto** option that keeps it tracking the font size, which is what you want unless you are deliberately tightening a block of text. The font dropdown offers Times-Roman, Helvetica and Courier. The renderer also supports the bold, italic and oblique variants of each, plus Symbol and ZapfDingbats. To use one, set the layer's `paragraphFontName` in **Current layout JSON**, for example `"Helvetica-Bold"`. See [Text Formatting](https://wiki.trackandtrace.tools/t3-labels/layout-element-values/#text-formatting). The resize strategy decides what happens when text does not fit: - **Allow Overflow**: text may spill outside its box - **Truncate Text**: text is cut off at the boundary - **Shrink Text**: the font shrinks until the text fits **Box**, on Box layers: border color, width and opacity in one column; background color and opacity in the other. Leave the background unset for an outline with nothing behind it. **Fragment**, on Fragment layers: see below. Each layer's editor ends with a read-only **Layer JSON** view of that layer. To change a field the editor does not expose, edit the layer in **Current layout JSON**. ## Fragments A **Fragment** element embeds one saved layout inside another. A compliance warning panel, a barcode with its human-readable tag underneath, or a facility footer can be designed once and reused across every label that needs it. Fragments To add one, create a **Fragment** layer and search for a saved layout under **Embedded layout**. Behind the scenes a fragment is referenced by a **fragment key**, usually the layout's ID; picking a layout fills that in for you. The editor tells you live whether that key will resolve: - **Resolves**: the key matches a layout in this facility's catalogue, and the layout is named. - **Does not resolve**: no layout in this facility has that key. It must resolve when the label is generated or the request is rejected, so this is a warning worth acting on. - **Nothing selected**: the layer renders nothing until you pick a layout. Three things are worth knowing: - **Editing a fragment changes every label that embeds it.** That is the point, and also the risk. - **Positions inside a fragment are relative to the fragment**, not to the label. Moving or resizing the Fragment layer moves everything inside it. - **Font sizes do not scale.** Text set at 10pt stays 10pt whether the fragment fills the label or sits in a narrow strip, because font sizes are absolute. Barcodes, QR codes and images *do* scale. If text must fit its box, set its resize strategy to **Shrink Text**. Fragments can embed other fragments, up to five levels deep, though more than two levels is rarely useful. For how fragments are sent to the API, and the full list of limits, see [Reusing Layouts With Fragments](https://wiki.trackandtrace.tools/t3-labels/label-layouts/#reusing-layouts-with-fragments). ______________________________________________________________________ ## Next Steps - Every element and styling option: [Label Layouts](https://wiki.trackandtrace.tools/t3-labels/label-layouts/index.md). - Insert Metrc values with [Label Data](https://wiki.trackandtrace.tools/t3-labels/label-studio/label-data/index.md). - The full value syntax: [Layout Element Values](https://wiki.trackandtrace.tools/t3-labels/layout-element-values/index.md). # Template Builder A **template** describes the physical label and the sheet it sits on. It says nothing about content; that is the layout's job. The same layout can be printed on any template, which is what makes it easy to move a design from a thermal roll to a sheet of Avery labels. The Template Builder tab The top controls set the label itself: - **Label Width** and **Label Height**, in inches. - **Label Padding X** and **Label Padding Y**, the unprintable margin inside each label. Padding is useful when your printer cannot reliably reach the very edge of a label. The controls below describe the page the labels are arranged on: **Page Size X/Y**, **Page Margin Left/Top**, **X Gap**, **Y Gap**, **Number of Columns**, and **Number of Rows**. Every value is both a slider and a number box, so you can drag to find a size and then type the exact one. Two live diagrams sit above them: a scale drawing of a single label with its padding shaded, and (when a page holds more than one label) a scale drawing of the full sheet with the grid on it. Each control maps to one field in the template config. For the field names and worked examples, see [Template Fields](https://wiki.trackandtrace.tools/t3-labels/label-templates/#template-fields). A **Current template JSON** section at the bottom of the tab holds the raw configuration, editable directly. Anything you change there is reflected in the controls above, and vice versa. ## Starting From a Starter Template With no template loaded, the tab offers a search box over T3's starter templates. Search by size, brand, or printer type (`3x1`, `Dymo`, `thermal`) and hovering a result previews it: a page diagram for sheet templates, a single-label diagram for thermal ones. Starter template search with hover preview Starter templates are read-only. Pick one to work from and use **Save as Copy** to get an editable version of your own. See [Saving Templates and Layouts](https://wiki.trackandtrace.tools/t3-labels/label-studio/generating/#saving-templates-and-layouts). ## The Thermal Label Toggle Most thermal printers print one label per page, where the "page" is exactly the size of the label. The **Thermal Label** toggle is a shortcut for that arrangement. The thermal label toggle Turning it on pins eight values at once: page size becomes the label size, columns and rows become 1, and all margins and gaps become 0. If any of those values would change, you are shown exactly what will be overwritten and asked to confirm first. While the toggle is on: - The eight page settings are locked, and a note explains why. - **Page Size X** and **Page Size Y** follow the label dimensions automatically, so resizing the label resizes the page with it. Turning the toggle off unlocks those settings and changes nothing else; your saved template is left exactly as it was. Uncheck it whenever you need to print on a sheet of labels rather than a roll. The toggle is an editor convenience, not a template setting Nothing about thermal mode is stored in the template or sent to the API; a thermal template is just [a template whose page holds one label](https://wiki.trackandtrace.tools/t3-labels/label-templates/#thermal-labels). The toggle only decides whether the Studio locks those eight controls for you. If you edit the raw JSON or import a template so that its page no longer holds exactly one label, the toggle turns **off**. Turning it **off** yourself sticks: the Studio will not switch it back on for you. ______________________________________________________________________ ## Next Steps - Every template field, with worked examples: [Label Templates](https://wiki.trackandtrace.tools/t3-labels/label-templates/index.md). - Arrange content on the label in [Layout Builder](https://wiki.trackandtrace.tools/t3-labels/label-studio/layout-builder/index.md). - Match the template to your hardware in [Choosing a Label Printer](https://wiki.trackandtrace.tools/t3-labels/choosing-a-label-printer/index.md). # Tutorial This tutorial builds one label from scratch on a 2.25x4 thermal template, using real Metrc package data. Here is what you will have at the end: [PDF](https://wiki.trackandtrace.tools/assets/pdf/label-tutorial/step-09.pdf) • [Demo data](https://wiki.trackandtrace.tools/assets/text/label-tutorial/demo-superpackages.json) **Time to complete: 12 minutes** Each step is its own page and takes about a minute. Work straight through, or jump to the element you need. | Step | What you add | | -------------------------------------------------------------------------------------------------------------- | ------------------------ | | 1. [Start with a blank label](https://wiki.trackandtrace.tools/t3-labels/tutorial/blank-label/index.md) | The template | | 2. [Load the demo packages](https://wiki.trackandtrace.tools/t3-labels/tutorial/load-demo-packages/index.md) | The data | | 3. [Add a scannable barcode](https://wiki.trackandtrace.tools/t3-labels/tutorial/add-a-barcode/index.md) | `Code 128 Barcode` | | 4. [Show the tag number](https://wiki.trackandtrace.tools/t3-labels/tutorial/show-the-tag-number/index.md) | `Text` with a filter | | 5. [Add your logo](https://wiki.trackandtrace.tools/t3-labels/tutorial/add-your-logo/index.md) | `Image` | | 6. [Name the product](https://wiki.trackandtrace.tools/t3-labels/tutorial/name-the-product/index.md) | `Text` bound to a field | | 7. [Add the THC result](https://wiki.trackandtrace.tools/t3-labels/tutorial/add-the-thc-result/index.md) | A lab result | | 8. [Add the full lab panel](https://wiki.trackandtrace.tools/t3-labels/tutorial/add-the-lab-panel/index.md) | `Table` | | 9. [Add the state warning](https://wiki.trackandtrace.tools/t3-labels/tutorial/add-the-state-warning/index.md) | Built-in compliance text | [Troubleshooting](https://wiki.trackandtrace.tools/t3-labels/tutorial/troubleshooting/index.md) covers what to do when a label will not render or comes out wrong. ### Tutorial format Every step tells you what to do, then shows the label that comes out. You place each element by dragging it on the Layout Builder's canvas, and the step gives the position readout to aim for. Each step also carries a collapsed **Behind the scenes** block with the layout as the T3 API receives it. You never need to open it. To catch up to any step without dragging, paste that step's **Layout JSON**, linked under its label, into **Current layout JSON** at the bottom of the Layout Builder tab. > Sections explaining *why* look like this. Skip them if you just want the next step. ______________________________________________________________________ ## Checklist You will need: 1. **The T3 extension**, installed and logged in to Metrc. See [installation](https://wiki.trackandtrace.tools/t3-chrome-extension/index.md). 1. **A printer**, if you want to print what you build. A thermal printer, a sheet of Avery labels, or plain paper all work. Neither of these is needed to follow along. The label renders in your browser. > Without a T3+ subscription your labels render with a T3 watermark. Everything in this tutorial still works. See [the watermark](https://wiki.trackandtrace.tools/t3-labels/tutorial/troubleshooting/#a-watermark-covers-the-label). ______________________________________________________________________ ## Open the Label Studio Hover over the T3 button in the bottom right, then choose **Label Studio** in the menu that opens. > The studio has two panes. The left pane configures the label, the right pane shows the generated PDF. The left pane's tabs each control one part: > > - **Template Builder** sets what you are printing on. > - **Layout Builder** arranges what goes on the label. > - **Label Data** supplies the list of records, one per label. > - **Images**, under the **More** menu, holds the images your layout can use. > > The other tabs are covered in the [Label Studio reference](https://wiki.trackandtrace.tools/t3-labels/label-studio/index.md). ______________________________________________________________________ ## Next Steps - Begin with step 1, [Start with a blank label](https://wiki.trackandtrace.tools/t3-labels/tutorial/blank-label/index.md). - Keep the [Label Studio reference](https://wiki.trackandtrace.tools/t3-labels/label-studio/index.md) open as you work. # Step 3: Add a scannable barcode Open the **Layout Builder** tab. This is where you say what goes on the label, starting with the one thing every Metrc label needs. 1. Click **+** at the top of the layer stack and choose **Code 128 Barcode**. The new layer fills the whole label. 1. Set **Layer description** to `Tag barcode`. 1. On the canvas above the layer stack, drag the layer's top and bottom edges to make a band across the middle of the label, a little above center, then pull each side in slightly. The readout under the canvas should say `X: 5% – 95%` and `Y: 34% – 54%`. 1. Replace the **Value template** placeholder with `{{ package.label }}`. Each label now carries its own package tag as a barcode. Scan one with your phone and you will read the tag number back. To skip the dragging, paste this step's [Layout JSON](https://wiki.trackandtrace.tools/assets/text/label-tutorial/step-03.json) into **Current layout JSON** at the bottom of the tab. Each step's Layout JSON holds every element added so far. > A layout is a list of **layout elements** stacked in a **layer stack**. Elements later in the stack draw on top of earlier ones, and you can drag a layer by its grip to reorder it. > > Every element is a rectangle. Drag the middle of the selected layer to move it and drag an edge to resize it. The readout gives its edges as percentages of the printable width and height, with `Y` counted down from the top. Because they are percentages rather than inches, the same layout fits a bigger template without rework. > > The JSON counts `Y` up from the bottom instead, so `Y: 34% – 54%` on the readout is stored as `yStartFraction: 0.46` and `yEndFraction: 0.66`. > > `{{ package.label }}` is an injection. The `{{ }}` braces tell T3 to look up `label` inside the `package` record for that label and drop the value in. Since every entry in the data list is a different package, every barcode differs. > > Instead of typing the path, clear the editor and click **Insert Field** in its bottom-left corner. It searches the fields your loaded data has, shows an example value for each, and inserts the one you click with the braces already in place. [Printed PDF](https://wiki.trackandtrace.tools/assets/pdf/label-tutorial/step-03.pdf) • [Layout JSON](https://wiki.trackandtrace.tools/assets/text/label-tutorial/step-03.json) Behind the scenes ``` { "name": "Tutorial label", "labelContentLayoutElements": [ { "description": "Tag barcode", "elementType": "CODE128_BARCODE", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.46, "yEndFraction": 0.66, "valueTemplate": "{{ package.label }}" } ] } ``` ______________________________________________________________________ ## Next Steps - Continue to step 4, [Show the tag number](https://wiki.trackandtrace.tools/t3-labels/tutorial/show-the-tag-number/index.md). - Back to step 2, [Load the demo packages](https://wiki.trackandtrace.tools/t3-labels/tutorial/load-demo-packages/index.md). - [All tutorial steps](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md) - Every element type: [Label Layouts](https://wiki.trackandtrace.tools/t3-labels/label-layouts/index.md). # Step 8: Add the full lab panel One number is rarely enough. A table gives you the whole panel. 1. Add a **Table** layer and set its **Layer description** to `Lab results`. 1. Drag it into a block just below the THC line, a little narrower than the label: `X: 10% – 90%`, `Y: 73% – 86%`. 1. Set **Font Size** to `7` and **Resize Strategy** to `Shrink Text`. 1. Replace the **Value template** with: ``` {% for key in ['totalTHC', 'totalCBD', 'CBG', 'totalTerpenes'] %} {% set entry = package.metadata.indexedLabResults[key] %} {% endfor %}
{{ entry.name }}{{ entry.value }} {{ entry.unit }}
``` One element left: the state warning. > A table element takes HTML. T3 reads the first `` it finds and lays the cells out for you, so you build rows with a loop rather than by hand. > > Listing the keys rather than looping over everything is deliberate: it puts THC first and keeps a result you did not expect from appearing on a printed label. > > Tables draw no lines of their own. The grid you saw while **Draw borders** was on came from the border overlay, not the table. [Printed PDF](https://wiki.trackandtrace.tools/assets/pdf/label-tutorial/step-08.pdf) • [Layout JSON](https://wiki.trackandtrace.tools/assets/text/label-tutorial/step-08.json) Behind the scenes ``` { "name": "Tutorial label", "labelContentLayoutElements": [ { "description": "Tag barcode", "elementType": "CODE128_BARCODE", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.46, "yEndFraction": 0.66, "valueTemplate": "{{ package.label }}" }, { "description": "Tag number", "elementType": "TEXT", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.38, "yEndFraction": 0.45, "valueTemplate": "{{ package.label | boldEndingDigits }}", "paragraphFontName": "Helvetica", "paragraphFontSize": 7, "paragraphSpacing": 8, "horizontalParagraphAlignment": "CENTER", "paragraphTextResizeStrategy": "SHRINK_TEXT" }, { "description": "Logo", "elementType": "IMAGE", "xStartFraction": 0.25, "xEndFraction": 0.75, "yStartFraction": 0.84, "yEndFraction": 0.98, "valueTemplate": "{{ images['logo.png'] }}" }, { "description": "Product name", "elementType": "TEXT", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.69, "yEndFraction": 0.81, "valueTemplate": "{{ package.item.name }}", "paragraphFontName": "Helvetica-Bold", "paragraphFontSize": 11, "paragraphSpacing": 12, "horizontalParagraphAlignment": "CENTER", "paragraphTextResizeStrategy": "SHRINK_TEXT" }, { "description": "Potency", "elementType": "TEXT", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.27, "yEndFraction": 0.35, "valueTemplate": "{{ package.metadata.indexedLabResults.totalTHC.full }}", "paragraphFontName": "Helvetica-Bold", "paragraphFontSize": 10, "paragraphSpacing": 11, "horizontalParagraphAlignment": "CENTER", "paragraphTextResizeStrategy": "SHRINK_TEXT" }, { "description": "Lab results", "elementType": "TABLE", "xStartFraction": 0.1, "xEndFraction": 0.9, "yStartFraction": 0.14, "yEndFraction": 0.27, "valueTemplate": "
{% for key in ['totalTHC', 'totalCBD', 'CBG', 'totalTerpenes'] %}{% set entry = package.metadata.indexedLabResults[key] %}{% endfor %}
{{ entry.name }}{{ entry.value }} {{ entry.unit }}
", "paragraphFontName": "Helvetica", "paragraphFontSize": 7, "paragraphSpacing": 8, "paragraphTextResizeStrategy": "SHRINK_TEXT" } ] } ``` ______________________________________________________________________ ## Next Steps - Continue to step 9, [Add the state warning](https://wiki.trackandtrace.tools/t3-labels/tutorial/add-the-state-warning/index.md). - Back to step 7, [Add the THC result](https://wiki.trackandtrace.tools/t3-labels/tutorial/add-the-thc-result/index.md). - [All tutorial steps](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md) - Print what you built: [Printing Label PDFs](https://wiki.trackandtrace.tools/t3-labels/printing-label-pdfs/index.md). - Generate the same label from code: [Generating Label PDFs](https://wiki.trackandtrace.tools/t3-labels/generating-label-pdfs/index.md). # Step 9: Add the state warning Most states require specific warning language on cannabis packaging. You do not have to type it: T3 ships the text for you. 1. Add a **Text** layer and set its **Layer description** to `State warning`. 1. Drag it into a band along the bottom edge, almost the full width: `X: 4% – 96%`, `Y: 87% – 99%`. 1. Set **Value template** to `{{ t3.text.ca_cannabis_warning_disclosure }}`. **Insert Field** lists it under **Built-in Fields**. 1. Set **Font Size** to `5`, **Resize Strategy** to `Shrink Text`, and **Horizontal Alignment** to `Left`. Finally, turn off **Draw borders**. The label is finished. > `t3` is a namespace T3 fills in on every request, separate from your own data and your own images. Nothing to upload and nothing to keep up to date. > > The key carries the state abbreviation, so `co_cannabis_warning_disclosure` is the Colorado wording and `ma_cannabis_warning_disclosure` the Massachusetts one. That abbreviation matches the Metrc hostname your packages come from, so printing this label in another state is a one-key edit. Seventeen states are covered; see [State Disclosures](https://wiki.trackandtrace.tools/t3-labels/generating-label-pdfs/#state-disclosures). > > Warning text is long and every state's is a different length, which is exactly the case `Shrink Text` exists for. Give it the space you can spare and let it size itself. > > The bold lead-in comes from the text itself. Disclosures may carry simple HTML such as ``, and a `Text` element renders it. [PDF with borders](https://wiki.trackandtrace.tools/assets/pdf/label-tutorial/step-09-debug.pdf) • [Layout JSON](https://wiki.trackandtrace.tools/assets/text/label-tutorial/step-09.json) Behind the scenes ``` { "name": "Tutorial label", "labelContentLayoutElements": [ { "description": "Tag barcode", "elementType": "CODE128_BARCODE", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.46, "yEndFraction": 0.66, "valueTemplate": "{{ package.label }}" }, { "description": "Tag number", "elementType": "TEXT", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.38, "yEndFraction": 0.45, "valueTemplate": "{{ package.label | boldEndingDigits }}", "paragraphFontName": "Helvetica", "paragraphFontSize": 7, "paragraphSpacing": 8, "horizontalParagraphAlignment": "CENTER", "paragraphTextResizeStrategy": "SHRINK_TEXT" }, { "description": "Logo", "elementType": "IMAGE", "xStartFraction": 0.25, "xEndFraction": 0.75, "yStartFraction": 0.84, "yEndFraction": 0.98, "valueTemplate": "{{ images['logo.png'] }}" }, { "description": "Product name", "elementType": "TEXT", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.69, "yEndFraction": 0.81, "valueTemplate": "{{ package.item.name }}", "paragraphFontName": "Helvetica-Bold", "paragraphFontSize": 11, "paragraphSpacing": 12, "horizontalParagraphAlignment": "CENTER", "paragraphTextResizeStrategy": "SHRINK_TEXT" }, { "description": "Potency", "elementType": "TEXT", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.27, "yEndFraction": 0.35, "valueTemplate": "{{ package.metadata.indexedLabResults.totalTHC.full }}", "paragraphFontName": "Helvetica-Bold", "paragraphFontSize": 10, "paragraphSpacing": 11, "horizontalParagraphAlignment": "CENTER", "paragraphTextResizeStrategy": "SHRINK_TEXT" }, { "description": "Lab results", "elementType": "TABLE", "xStartFraction": 0.1, "xEndFraction": 0.9, "yStartFraction": 0.14, "yEndFraction": 0.27, "valueTemplate": "{% for key in ['totalTHC', 'totalCBD', 'CBG', 'totalTerpenes'] %}{% set entry = package.metadata.indexedLabResults[key] %}{% endfor %}
{{ entry.name }}{{ entry.value }} {{ entry.unit }}
", "paragraphFontName": "Helvetica", "paragraphFontSize": 7, "paragraphSpacing": 8, "paragraphTextResizeStrategy": "SHRINK_TEXT" }, { "description": "State warning", "elementType": "TEXT", "xStartFraction": 0.04, "xEndFraction": 0.96, "yStartFraction": 0.01, "yEndFraction": 0.13, "valueTemplate": "{{ t3.text.ca_cannabis_warning_disclosure }}", "paragraphFontName": "Helvetica", "paragraphFontSize": 5, "paragraphSpacing": 5, "horizontalParagraphAlignment": "LEFT", "paragraphTextResizeStrategy": "SHRINK_TEXT" } ] } ``` ______________________________________________________________________ ## Next Steps - Something not rendering? See [Troubleshooting](https://wiki.trackandtrace.tools/t3-labels/tutorial/troubleshooting/index.md). - Back to step 8, [Add the full lab panel](https://wiki.trackandtrace.tools/t3-labels/tutorial/add-the-lab-panel/index.md). - [All tutorial steps](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md) - Every built-in value: [Built-In Data](https://wiki.trackandtrace.tools/t3-labels/generating-label-pdfs/#built-in-data). # Step 7: Add the THC result This is what the superpackage was for. The package carries its own lab results, so the label can print them. 1. Add a **Text** layer and set its **Layer description** to `Potency`. 1. Drag it into a strip below the tag number: `X: 5% – 95%`, `Y: 65% – 73%`. 1. Set **Value template** to `{{ package.metadata.indexedLabResults.totalTHC.full }}`. 1. Set **Font Size** to `10` and **Resize Strategy** to `Shrink Text`. 1. Make it `Helvetica-Bold` in **Current layout JSON**, as in the last step. Each label now shows its own potency. > Lab results arrive as a long list with inconsistent naming, so T3 indexes them for you under `metadata.indexedLabResults`, with one camelCase key per test however the lab spelled it. `Total THC` and `Total Delta-9 THC` both become `totalTHC`, and `THCa` becomes `THCA`. [Lab Result Keys](https://wiki.trackandtrace.tools/t3-api/lab-result-keys/index.md) lists every key, and **Insert Field** lists the keys your loaded data has. > > Each entry gives you four ways to use it: > > - `.full` is the ready made string, `Total THC: 18.2 %` > - `.name` is `Total THC` > - `.value` is the number `18.2` > - `.unit` is `%` > > Use `.full` when you want the whole thing, and `.value` when you are building your own formatting, as we do next. [Printed PDF](https://wiki.trackandtrace.tools/assets/pdf/label-tutorial/step-07.pdf) • [Layout JSON](https://wiki.trackandtrace.tools/assets/text/label-tutorial/step-07.json) Behind the scenes ``` { "name": "Tutorial label", "labelContentLayoutElements": [ { "description": "Tag barcode", "elementType": "CODE128_BARCODE", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.46, "yEndFraction": 0.66, "valueTemplate": "{{ package.label }}" }, { "description": "Tag number", "elementType": "TEXT", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.38, "yEndFraction": 0.45, "valueTemplate": "{{ package.label | boldEndingDigits }}", "paragraphFontName": "Helvetica", "paragraphFontSize": 7, "paragraphSpacing": 8, "horizontalParagraphAlignment": "CENTER", "paragraphTextResizeStrategy": "SHRINK_TEXT" }, { "description": "Logo", "elementType": "IMAGE", "xStartFraction": 0.25, "xEndFraction": 0.75, "yStartFraction": 0.84, "yEndFraction": 0.98, "valueTemplate": "{{ images['logo.png'] }}" }, { "description": "Product name", "elementType": "TEXT", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.69, "yEndFraction": 0.81, "valueTemplate": "{{ package.item.name }}", "paragraphFontName": "Helvetica-Bold", "paragraphFontSize": 11, "paragraphSpacing": 12, "horizontalParagraphAlignment": "CENTER", "paragraphTextResizeStrategy": "SHRINK_TEXT" }, { "description": "Potency", "elementType": "TEXT", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.27, "yEndFraction": 0.35, "valueTemplate": "{{ package.metadata.indexedLabResults.totalTHC.full }}", "paragraphFontName": "Helvetica-Bold", "paragraphFontSize": 10, "paragraphSpacing": 11, "horizontalParagraphAlignment": "CENTER", "paragraphTextResizeStrategy": "SHRINK_TEXT" } ] } ``` ______________________________________________________________________ ## Next Steps - Continue to step 8, [Add the full lab panel](https://wiki.trackandtrace.tools/t3-labels/tutorial/add-the-lab-panel/index.md). - Back to step 6, [Name the product](https://wiki.trackandtrace.tools/t3-labels/tutorial/name-the-product/index.md). - [All tutorial steps](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md) # Step 5: Add your logo Labels usually carry a brand mark. Images live in their own tab and are referenced by name. Choose **Images** from the **More** menu, click **Upload images** and pick your logo. Then return to **Layout Builder**. 1. Add an **Image** layer and set its **Layer description** to `Logo`. 1. Drag it into a box centered at the top, half the label's width: `X: 25% – 75%`, `Y: 2% – 16%`. 1. Click **Insert Image** and pick your upload under **My Images**, or set **Value template** to `{{ images['logo.png'] }}` with your file's name. > The key is the image's filename, exactly as you uploaded it, so a file named `my-brand.png` is read as `{{ images['my-brand.png'] }}`. The square brackets are what make a filename usable as a key, since the dot in `.png` would otherwise be read as reaching into a nested value. **Insert Image** writes the whole thing for you. > > Referencing by name means one upload can be used by several elements. The image keeps its aspect ratio inside the box you gave it. > > Use an image with a solid background rather than a transparent one. Transparent areas print as black, which is the single most common surprise with label images. See [the logo prints as a black box](https://wiki.trackandtrace.tools/t3-labels/tutorial/troubleshooting/#the-logo-prints-as-a-black-box). [Printed PDF](https://wiki.trackandtrace.tools/assets/pdf/label-tutorial/step-05.pdf) • [Layout JSON](https://wiki.trackandtrace.tools/assets/text/label-tutorial/step-05.json) Behind the scenes ``` { "name": "Tutorial label", "labelContentLayoutElements": [ { "description": "Tag barcode", "elementType": "CODE128_BARCODE", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.46, "yEndFraction": 0.66, "valueTemplate": "{{ package.label }}" }, { "description": "Tag number", "elementType": "TEXT", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.38, "yEndFraction": 0.45, "valueTemplate": "{{ package.label | boldEndingDigits }}", "paragraphFontName": "Helvetica", "paragraphFontSize": 7, "paragraphSpacing": 8, "horizontalParagraphAlignment": "CENTER", "paragraphTextResizeStrategy": "SHRINK_TEXT" }, { "description": "Logo", "elementType": "IMAGE", "xStartFraction": 0.25, "xEndFraction": 0.75, "yStartFraction": 0.84, "yEndFraction": 0.98, "valueTemplate": "{{ images['logo.png'] }}" } ] } ``` ______________________________________________________________________ ## Next Steps - Continue to step 6, [Name the product](https://wiki.trackandtrace.tools/t3-labels/tutorial/name-the-product/index.md). - Back to step 4, [Show the tag number](https://wiki.trackandtrace.tools/t3-labels/tutorial/show-the-tag-number/index.md). - [All tutorial steps](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md) # Step 1: Start with a blank label Everything starts from an empty label on the right template. 1. In the preview pane on the right, click **Start fresh**. If a PDF preview is already showing, click **Reset** below it and confirm, and the start buttons come back. 1. Open **Template Builder** and click **Reset** on the current template card. 1. Search the starter templates for `2.25x4` and pick the thermal one. 1. Turn on **Draw borders** below **Generate PDF**. The label redraws with its edges outlined. If it does not, click **Generate PDF**. > **Start fresh** clears the layout and the data, but loads a 3x1 template, which is why you swap it for the taller one. > > **Draw borders** is the fastest way to see what you are doing. It outlines the label edge, the printable area inside the padding, and every element you add. We leave it on for the whole build and turn it off at the end. > > The template controls the physical medium: a 2.25 by 4 inch label, one per page, with 1/16 inch of padding. On a thermal printer the page and the label are the same rectangle. [Printed PDF](https://wiki.trackandtrace.tools/assets/pdf/label-tutorial/step-01.pdf) • [Layout JSON](https://wiki.trackandtrace.tools/assets/text/label-tutorial/step-01.json) Behind the scenes ``` { "name": "Tutorial label", "labelContentLayoutElements": [] } ``` ______________________________________________________________________ ## Next Steps - Continue to step 2, [Load the demo packages](https://wiki.trackandtrace.tools/t3-labels/tutorial/load-demo-packages/index.md). - [All tutorial steps](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md) - Every template field: [Label Templates](https://wiki.trackandtrace.tools/t3-labels/label-templates/index.md). # Step 2: Load the demo packages A label needs data. T3 ships demo packages so you can build without touching real inventory. Open the **Label Data** tab and click **Demo Packages** under **Data source**. Confirm the prompt to replace the one blank record that **Start fresh** left, then click **Generate PDF**. One label appears per package. Demo packages are generated fresh each time, so your labels show different products from the five on these pages. > The label data is a list. Each entry produces one label, so ten packages means ten labels. An entry can be a full Metrc package or an empty `{}` if every label is identical. > > These demo packages are **superpackages**: a package plus everything Metrc knows about it, including lab results. That is what lets us put a THC number on the label in step 7. See [Supercollections](https://wiki.trackandtrace.tools/t3-api/supercollections/index.md). [Printed PDF](https://wiki.trackandtrace.tools/assets/pdf/label-tutorial/step-02.pdf) • [Layout JSON](https://wiki.trackandtrace.tools/assets/text/label-tutorial/step-02.json) Behind the scenes ``` { "name": "Tutorial label", "labelContentLayoutElements": [] } ``` ______________________________________________________________________ ## Next Steps - Continue to step 3, [Add a scannable barcode](https://wiki.trackandtrace.tools/t3-labels/tutorial/add-a-barcode/index.md). - Back to step 1, [Start with a blank label](https://wiki.trackandtrace.tools/t3-labels/tutorial/blank-label/index.md). - [All tutorial steps](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md) - Every data source: [Label Data](https://wiki.trackandtrace.tools/t3-labels/label-studio/label-data/index.md). # Step 6: Name the product The barcode already pulls from the package record. Now put the product name on the label the same way. 1. Add a **Text** layer and set its **Layer description** to `Product name`. 1. Drag it into a band between the logo and the barcode: `X: 5% – 95%`, `Y: 19% – 31%`. 1. Set **Value template** to `{{ package.item.name }}`. 1. Set **Font Size** to `11` and **Resize Strategy** to `Shrink Text`. 1. Make it bold: open **Current layout JSON** at the bottom of the tab, find the `Product name` layer, and change its `"paragraphFontName"` from `"Helvetica"` to `"Helvetica-Bold"`. > `package.item.name` reaches one level deeper than `package.label`. The item is a nested record on the package, so you walk to it with a dot. Anything Metrc stores on the package is reachable the same way. > > The **Font** dropdown offers only the three base families. Bold, italic and oblique variants are set in the JSON, and [Text Formatting](https://wiki.trackandtrace.tools/t3-labels/layout-element-values/#text-formatting) lists every name. > > Product names vary in length, which is exactly when `Shrink Text` earns its keep. Compare the longest and shortest names below: both fit their box. [Printed PDF](https://wiki.trackandtrace.tools/assets/pdf/label-tutorial/step-06.pdf) • [Layout JSON](https://wiki.trackandtrace.tools/assets/text/label-tutorial/step-06.json) Behind the scenes ``` { "name": "Tutorial label", "labelContentLayoutElements": [ { "description": "Tag barcode", "elementType": "CODE128_BARCODE", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.46, "yEndFraction": 0.66, "valueTemplate": "{{ package.label }}" }, { "description": "Tag number", "elementType": "TEXT", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.38, "yEndFraction": 0.45, "valueTemplate": "{{ package.label | boldEndingDigits }}", "paragraphFontName": "Helvetica", "paragraphFontSize": 7, "paragraphSpacing": 8, "horizontalParagraphAlignment": "CENTER", "paragraphTextResizeStrategy": "SHRINK_TEXT" }, { "description": "Logo", "elementType": "IMAGE", "xStartFraction": 0.25, "xEndFraction": 0.75, "yStartFraction": 0.84, "yEndFraction": 0.98, "valueTemplate": "{{ images['logo.png'] }}" }, { "description": "Product name", "elementType": "TEXT", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.69, "yEndFraction": 0.81, "valueTemplate": "{{ package.item.name }}", "paragraphFontName": "Helvetica-Bold", "paragraphFontSize": 11, "paragraphSpacing": 12, "horizontalParagraphAlignment": "CENTER", "paragraphTextResizeStrategy": "SHRINK_TEXT" } ] } ``` ______________________________________________________________________ ## Next Steps - Continue to step 7, [Add the THC result](https://wiki.trackandtrace.tools/t3-labels/tutorial/add-the-thc-result/index.md). - Back to step 5, [Add your logo](https://wiki.trackandtrace.tools/t3-labels/tutorial/add-your-logo/index.md). - [All tutorial steps](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md) # Step 4: Show the tag number A barcode is for scanners. Add the digits underneath for people. 1. Add a **Text** layer and set its **Layer description** to `Tag number`. 1. Drag it into a thin strip directly below the barcode, the same width: `X: 5% – 95%`, `Y: 55% – 62%`. 1. Set **Value template** to `{{ package.label | boldEndingDigits }}`. 1. Set **Font Size** to `7` and **Resize Strategy** to `Shrink Text`. > The `| boldEndingDigits` part is a **filter**: it transforms the value on its way onto the label. This one bolds the significant digits at the end of a Metrc tag, so a human can read the part that actually differs between packages. See [Filters](https://wiki.trackandtrace.tools/t3-labels/layout-element-values/#filters) for the rest. > > **Resize Strategy** decides what happens when text does not fit. `Shrink Text` steps the font down until it does. The alternatives are `Truncate Text`, which cuts and adds an ellipsis, and `Allow Overflow`, which lets it spill. All three are [compared side by side](https://wiki.trackandtrace.tools/t3-labels/tutorial/troubleshooting/#text-spills-out-of-its-box). [Printed PDF](https://wiki.trackandtrace.tools/assets/pdf/label-tutorial/step-04.pdf) • [Layout JSON](https://wiki.trackandtrace.tools/assets/text/label-tutorial/step-04.json) Behind the scenes ``` { "name": "Tutorial label", "labelContentLayoutElements": [ { "description": "Tag barcode", "elementType": "CODE128_BARCODE", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.46, "yEndFraction": 0.66, "valueTemplate": "{{ package.label }}" }, { "description": "Tag number", "elementType": "TEXT", "xStartFraction": 0.05, "xEndFraction": 0.95, "yStartFraction": 0.38, "yEndFraction": 0.45, "valueTemplate": "{{ package.label | boldEndingDigits }}", "paragraphFontName": "Helvetica", "paragraphFontSize": 7, "paragraphSpacing": 8, "horizontalParagraphAlignment": "CENTER", "paragraphTextResizeStrategy": "SHRINK_TEXT" } ] } ``` ______________________________________________________________________ ## Next Steps - Continue to step 5, [Add your logo](https://wiki.trackandtrace.tools/t3-labels/tutorial/add-your-logo/index.md). - Back to step 3, [Add a scannable barcode](https://wiki.trackandtrace.tools/t3-labels/tutorial/add-a-barcode/index.md). - [All tutorial steps](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md) - Text styling and filters: [Layout Element Values](https://wiki.trackandtrace.tools/t3-labels/layout-element-values/index.md). # Troubleshooting Two kinds of thing go wrong with labels. Either nothing renders and T3 hands you an error, or a PDF comes out and it looks wrong. This page covers both. Every label on this page is real output from the T3 renderer. ______________________________________________________________________ ## Nothing renders When a value template refers to something that is not there, T3 renders no PDF and reports **every** problem it found across your whole layout and data, not just the first one. ### "'packagez' is undefined" You mistyped a field name. The Studio names the element, the line, and what it could not find, usually with a suggestion. Fix the spelling in **Value template**. **Insert Field**, in the editor's bottom-left corner, is the reliable way to avoid this, since it only offers fields your data actually has. > This is caught because you asked for a property *of* something that does not exist. A bare `{{ packagez }}` on its own renders blank instead, with no error. See [missing values](#a-field-renders-blank) below. Behind the scenes ``` { "code": "LABEL_TEMPLATE_ERROR", "title": "Label Template Error", "status": 400, "detail": "1 template problem across 5 labels. element[3] 'Product name' (TEXT) line 1, 'packagez' is undefined", "type": "https://api.trackandtrace.tools/errors/LABEL_TEMPLATE_ERROR", "errors": [ { "elementIndex": 3, "elementType": "TEXT", "description": "Product name", "line": 1, "sourceLine": "{{ packagez.item.name }}", "expressions": ["packagez.item.name"], "message": "'packagez' is undefined", "didYouMean": ["package"], "occurrences": 5, "firstLabelIndex": 0 } ] } ``` `elementIndex` and `description` say which element failed, which matters once a layout has several. `occurrences` says how many labels hit it, and `firstLabelIndex` which one hit it first, so a problem affecting only one row of your data is findable. ### A field renders blank Not an error. A value that is simply absent renders as nothing, which is usually what you want for optional data: packages without a lab result should not fail the whole print run. If you would rather be told, turn on `strictTemplates` in your rendering options. See [Missing Values](https://wiki.trackandtrace.tools/t3-labels/layout-element-values/#missing-values). ### "boldEndingDigits needs a string" A filter was applied to the wrong kind of value. `boldEndingDigits` formats a Metrc tag, so it needs `{{ package.label | boldEndingDigits }}` and not a number or an object. ______________________________________________________________________ ## The label renders, but looks wrong ### Text spills out of its box Your text is longer than the space you gave it, and the element is set to `Allow Overflow`. It will print over whatever is underneath. Change **Resize Strategy**. The same label with `Shrink Text`, which steps the font down until it fits: And with `Truncate Text`, which cuts the end and adds an ellipsis: > Pick by what the text is. Shrink a product name, so it stays readable in full. Truncate a description, where the first few words carry the meaning. Allow overflow almost never, and only when you know the length. > > If text does not overflow, the strategy does nothing. ### The logo prints as a black box Your image has a transparent background. Label rendering does not honor an alpha channel, so every transparent pixel prints solid black. Re-export the image with a solid white background. Labels print on white stock, so a white ground reads as though the mark is floating on the label. ### An element is missing Check its position first. An element whose percentages fall outside `0%` to `100%` is drawn off the printable area and simply does not appear. Here the potency line is still in the layout, but sits above the top edge. Turn on **Draw borders** and every element's rectangle is outlined, including ones that landed somewhere you did not expect. Also worth checking: - The eye icon beside the layer in the layer stack. A hidden layer is dimmed there and is not printed. - Whether another layer is drawing on top of it. Layers lower in the stack are drawn later, on top of the ones above them. ### The table has no lines Tables draw no rules of their own. If you saw a grid while building, that was **Draw borders**, not the table. ### A watermark covers the label Not an error, and nothing in your layout causes it. Labels render with a watermark unless the account has T3+. Everything else works the same, so you can build and test a whole layout before subscribing. [Start your free 30-day T3+ trial](https://dash.trackandtrace.tools) to render without it. ______________________________________________________________________ ## Next Steps - Back to [the tutorial](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md). - Strict templates and missing values: [Layout Element Values](https://wiki.trackandtrace.tools/t3-labels/layout-element-values/index.md). - What the Studio shows when generation fails: [Saving and Generating](https://wiki.trackandtrace.tools/t3-labels/label-studio/generating/index.md). # T3 Chrome Extension # T3 Chrome Extension The [T3 Chrome Extension](https://trackandtrace.tools/extension) adds tools directly into [metrc.com](https://metrc.com). Once it is installed, Metrc pages you already use grow extra buttons, columns, and panels. There is no separate application to log in to. Most tools run in your browser; reports, labels and scan sheets are built on T3's servers. ## What it changes about Metrc The extension targets the parts of Metrc that cost the most clicking: | Area | What the extension adds | | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Grids** | Search across every page of a collection at once, and select rows in bulk rather than one at a time | | **Forms** | Fill a Metrc form from a CSV instead of typing each row, see [CSV Form Fill](https://wiki.trackandtrace.tools/t3-chrome-extension/csv-form-fill/index.md) | | **Transfers** | Build scan sheets to verify an incoming manifest with a barcode scanner, see [Scan Sheets](https://wiki.trackandtrace.tools/t3-chrome-extension/scan-sheets/index.md) | | **Reporting** | Export whole datasets through a form instead of paging a grid, see [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/index.md) | | **Labels** | Design and print labels filled with Metrc data, see [Label Studio](https://wiki.trackandtrace.tools/t3-chrome-extension/label-studio/index.md) | ## Free and T3+ The extension is free, and most of what it adds is free with it. Label generation is free too, but labels are watermarked without T3+. A [T3+ subscription](https://wiki.trackandtrace.tools/t3-plus/index.md) unlocks reports, scan sheets, unwatermarked labels and more tools. The [Primary Features](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/index.md) page lists what is free; [T3+ Features](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/index.md) lists the rest. ## Browser support Fully supported on Google Chrome. It also installs on other Chromium browsers: Edge, Brave, and Opera. It is **not** supported on Firefox or Safari, which use a different extension system. ## Next Steps - Install it and tour the settings in [Getting Started](https://wiki.trackandtrace.tools/t3-chrome-extension/getting-started/index.md). - See what it adds to each Metrc page in [Primary Features](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/index.md). - Export data without paging a grid using [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/index.md). - [Start your free 30-day T3+ trial](https://dash.trackandtrace.tools) # CSV Form Fill T3 allows you to automatically fill out *any* Metrc form using just a CSV. It is one of the most powerful T3 tools available. Demo of Metrc CSV Autofill Need software for editing CSVs? See the [FAQ](https://wiki.trackandtrace.tools/faq/#t3-uses-lots-of-csv-files-where-can-i-get-csv-editing-software). ## Overview T3 CSV autofill reads out values from a `.t3csv` template file and writes these values into any Metrc form. The following fields all can be autofilled: - Text fields - Dropdown fields - Slider fields - Checkboxes - Autocomplete fields (Packages, Locations, Strains, Items, etc) - Photos Demo of different form field types in T3 csv autofill The free version autofills up to 5 rows per form. T3+ has unlimited form fills. ## Understanding the T3 CSV Form Fill tool The T3 CSV Autofill menu at the top of every Metrc form The **T3 CSV Autofill** menu has the following options: - **Download empty template**: T3 will analyze the Metrc form and download an empty `.t3csv` template that you can fill out with any spreadsheet software like Excel or Google Sheets. - **Export form data**: T3 will read any values you have filled out in the form and download a prefilled `.t3csv` file. This is useful for figuring out how to fill out a `.t3csv` template to accomplish autofilling values in a particular way. - **Preload images**: This is used only when you need to upload images. [Read on to learn how to autofill images and other files.](#inserting-files-and-photos) - **Reset Metrc form**: Removes all added rows from the Metrc form, and clears any inputs. - **Load T3 CSV**: Prompts you to select a filled `.t3csv` file. Once it is loaded, the button is replaced by: - **Autofill T3 CSV**: Fills the loaded file into the form. Do this once each time a Metrc modal form is opened. - **Batch**: Fills one batch of rows at a time (25 by default, set by **CSV Form Fill batch size** in the T3 Page Widgets section of T3 Settings). - **Clear T3 CSV**: Unloads the file. Three checkboxes control how the form is filled: - **T3 adds new rows before filling**: Checked, T3 adds a row to the form for each row in your file, which is how you fill out a new form. Unchecked, T3 fills the rows already in the form, which is how you set specific values in a form you have already started. - **T3 skips unmatched form fields**: Keeps filling when a value in your file can't be matched to a field in the form, instead of stopping. - **T3 allows reusing the same tag across rows**: Lets the same tag appear in more than one row. ## Supported field types The following table describes what values T3 is capable of autofilling: | Field type | Example Metrc field | How to enter in a `.t3csv` template | | ------------ | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | | Text | Package note | Enter the text as you normally would, e.g. `Example` | | Number | Package quantity | Enter the number as you normally would, e.g. `15` | | Dropdown | Item Category | Enter the text exactly as it appears in the dropdown, e.g. `Flower` | | Slider | Strain Indica % | Enter the percentage as a number, e.g. `50` | | Checkbox | Use same pkg item | Leave blank for unchecked, otherwise any entered value is checked | | Autocomplete | Package item | Enter the text that appears in the autocomplete input, e.g. for a package autocomplete, the full package tag `1A4400000001000000001234` | | Photo | Packaging Photo | Enter the exact filename of the preloaded photo, e.g. `blue_dream_01.png` | ## Tips for using T3 CSV Form Fill - **CSV Form Fill uses a special `.t3csv` file format**. - You will fill out data into a `.t3csv` and upload it to automatically fill out any Metrc form. - **Every Metrc form can be filled with CSV Form Fill**. You are able to completely fill out a Create Transfer form with multiple transporters, packages, layovers, and destinations with a `.t3csv`. - **A `.t3csv` will be mostly empty**. T3 will skip empty cells, so you can use a `.t3csv` template to autofill as much or as little as you want. - **Each Metrc form has its own `.t3csv` template**. For example, the "Create Packages" Metrc form uses a different template than "Adjust Packages". - **If you're not sure how to fill out a `.t3csv`, fill out the Metrc form and export it**. When you export a filled out Metrc form, T3 will generate a pre-filled `.t3csv` template. Using this pre-filled file to autofill a fresh Metrc form will identically re-create what you had previously entered. - **CSV Form Fill supports filling out nested Metrc inputs**. For example, to create an item with multiple ingredients, stack the ingredient names before starting the next item. T3 will automatically create the additional rows. An example is shown below: | | | | -------------------- | ---------------------------------- | | line in repeaterData | ingredient in line.itemIngredients | | itemName | ingredientName | | Item Name | Ingredient Name | | ItemA | ItemA Ingredient1 | | | ItemA Ingredient2 | | | ItemA Ingredient3 | | ItemB | ItemB Ingredient1 | | | ItemB Ingredient2 | | ItemC | ItemC Ingredient1 | | | ItemC Ingredient2 | | | ItemC Ingredient3 | | | ItemC Ingredient4 | ## Understanding the .t3csv file format A `.t3csv` file is essentially the same as a regular `.csv` file. The only difference is that the top two rows are reserved for form data, and the column headers start in row 3. **NOTE: T3 will generate these files for you** Here's an example of a regular `.csv` file: | Plant ID | Strain Name | Growth Phase | Planted Date | | ------------------------ | ----------- | ------------ | ------------ | | 1A4400000000123400001234 | Blue Dream | Vegetative | 2024-06-01 | | 1A4400000000123400001235 | OG Kush | Flowering | 2024-06-02 | | 1A4400000000123400001236 | Sour Diesel | Flowering | 2024-05-30 | | 1A4400000000123400001237 | Green Crack | Flowering | 2024-06-03 | Here's that same data in a `.t3csv` file: | | | | | | ------------------------ | -------------------- | -------------------- | -------------------- | | line in repeaterData | line in repeaterData | line in repeaterData | line in repeaterData | | plantTag | strainName | growthPhaseName | plantedDate | | Plant ID | Strain Name | Growth Phase | Planted Date | | 1A4400000000123400001234 | Blue Dream | Vegetative | 2024-06-01 | | 1A4400000000123400001235 | OG Kush | Flowering | 2024-06-02 | | 1A4400000000123400001236 | Sour Diesel | Flowering | 2024-05-30 | | 1A4400000000123400001237 | Green Crack | Flowering | 2024-06-03 | Note that from row 3 and below, it's exactly the same as the `.csv`. The top two rows should never be modified. ## Inserting Files and Photos T3 can automatically insert and upload photos, but it requires an additional step. The process is as follows: 1. **Prepare your photo files**. Any photos you wish to upload should be placed inside a single folder. 1. **Fill out your `.t3csv`.** In a photo field (for example, ProductPhoto), enter the filename of the photo you wish to autofill. For example, `blue_dream_01.png` 1. **Preload your photos**. In the T3 CSV Autofill menu, select **Preload images**, and select the **folder** that contains all the images. 1. **Load your `.t3csv` with Load T3 CSV, then click Autofill T3 CSV**. T3 will match the filenames to the preloaded photos, and automatically upload and select them in the Metrc form. ______________________________________________________________________ ## Free CSV Form Fill for External Incoming Transfers When a state transitions to Metrc (either from another provider like Biotrack or when a state newly legalizes), Metrc uses **external transfers** to allow licenses to add existing inventory into Metrc. **CSV Form Fill has no row limit on the New Incoming Transfer form for *all* users** (Transfer Dropdown → External → Incoming Tab → New Transfer). Any T3 user, free or paid, can onboard their entire inventory into Metrc using the T3 CSV Form Fill tool. Below shows an example `.t3csv` template filled out, and the resulting form once it's imported. CSV Form Fill template, completed with values for a New Incoming Transfer New Incoming Transfer form filled with values after Autofill T3 CSV was used ______________________________________________________________________ ## Next Steps - Learn about other [T3+ features](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/index.md) - Browse [Primary Features](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/index.md) for the full toolbox - For large package creation jobs, see the T3+ [CSV Package Creator](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/#package-tools) - Install the [T3 Chrome Extension](https://trackandtrace.tools/extension) # Exports (Legacy) This page documents the older export tool Exports has been superseded by [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/index.md), which builds a reusable report URL, previews the data before you run it, and saves reports to your account. New work belongs there. The legacy tool is still available from the **Exports (Legacy)** link in the T3 Reports header, and this page documents it. Three of its exports (Quickview, Employee Activity and Transfer Invoices) have no T3 Reports equivalent yet, because they aggregate or reshape data rather than exporting a Metrc collection. Point-in-time inventory is available in T3 Reports as [Point-in-Time Inventory](https://wiki.trackandtrace.tools/reports/point-in-time/index.md). T3 report tool T3+ includes access to the T3 Chrome Extension report generation tool. This tool allows you to instantly generate advanced reports or complete dumps of your Metrc data and export them in a convenient format like CSV, Excel, or Google Sheets. Exports give you a very high level of customization: - Select which columns to export - Smart filters such as planted/packaged date, wholesale transfers, active/inactive objects, transfer ETA, etc - Export multiple licenses together - Export multiple reports at once, merged into a single sheet when possible Once your export is generated, the following outputs are available: - CSV direct download - XLSX - Direct download - Emailed to the email address in [T3 Settings](https://wiki.trackandtrace.tools/t3-chrome-extension/getting-started/#selecting-a-report-email-address) - Export to Google Sheets: T3 creates the sheet and shares it with the email address in T3 Settings The T3 API offers the same formats, plus JSON, on its [report endpoints](https://wiki.trackandtrace.tools/reports/output/#choosing-a-response-format) via `contentType`. Both create Google Sheets on T3's side, and anyone with a sheet's link can open it. To restrict an API report's sheet to one account, pass `sheetVisibility=private` along with an `email`. See [`contentType=googleSheets`](https://wiki.trackandtrace.tools/reports/delivery/#the-googlesheets-format). ## Quickview Exports Quickview reports give high-level counts of items across a license. Select multiple dimensions to analyze (packages/locations, plants/strains, etc) T3 quickview export of items/packages - **Packages quickview**: with the following slices: - License - Item - Location - Packaged Date - **Mature Plants quickview**: with the following slices: - License - Strain - Growth Phase - Location - Planted Date - Vegetative Date - Flowering Date - **Plant Batch quickview**: with the following slices: - License - Strain - Location - Planted Date ## Catalog Exports Catalog exports allow you to fully dump entire sets of data, including only the fields you actually need. All catalog exports allow you to load data from *multiple licenses*, all into the same export. T3 catalog export of harvests - **Packages**: with the following filters: - Active/inactive/intransit - Packaged date - Is production batch? - **Plant Batches** - Active/inactive - Planted date - **Mature Plants** - Vegetative/flowering/inactive - Planted date - **Incoming Transfers** - Active/inactive - Is wholesale? - ETA - **Outgoing Transfers** - Active/inactive/rejected - Is wholesale? - ETA - **Tags** - Plant/package - Available/used/voided - **Harvests** - Active/inactive - Harvest date ## Transfer Exports T3 incoming manifest export - **Incoming Transfer Manifests** displays full transfer and package data for all incoming transfers. Filters include: - Active/inactive - Is wholesale? - ETA - **Outgoing Transfer Manifests** displays full transfer and package data for all outgoing transfers. Filters include: - Active/inactive/rejected - Is wholesale? - ETD - **Transfer Invoices** creates a printable Excel invoice from transfer information already present in Metrc. Address, phone number, manifest packages, and wholesale price are all formatted cleanly in a ready-to-print format. - **Scan Sheet** generates a scannable, color-coded spreadsheet to rapidly check transfer manifest packages. [Learn more](https://wiki.trackandtrace.tools/t3-chrome-extension/scan-sheets/index.md) ## Package Exports - **Point-in-time Inventory** displays all active packages on a certain date, to account for Metrc's broken PIT export. T3 Reports has the same report as [Point-in-Time Inventory](https://wiki.trackandtrace.tools/reports/point-in-time/index.md). - **Straggler Inventory** finds old and empty inventory. Filters include: - Quantity limits - Last modified date - Packaged date - **Lab Results** gather all lab results for tested packages in Metrc. Filters include: - Package type - Package dates - Test types ## Employee Exports - **Employee Activity** combs through all employee activity in Metrc. Filters include: - Employee name or ID matching - Package/transfer activity - Activity date filtering - **Employee Permissions** exports every employee's Metrc permissions. ## Items Exports - **Items Metadata** exports items with additional details such as created date and approval number. ______________________________________________________________________ ## Next Steps - Build the same datasets in the current tool with [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/index.md) - [Scan Sheets](https://wiki.trackandtrace.tools/t3-chrome-extension/scan-sheets/index.md) is a focused Transfer Export for verifying transfer manifests - Compare against [T3 API Reports](https://wiki.trackandtrace.tools/reports/index.md), which produce similar datasets but are code/URL-driven - Learn about other [T3+ features](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/index.md) - Install the [T3 Chrome Extension](https://trackandtrace.tools/extension) # Getting Started with the T3 Chrome Extension You can install the [T3 Chrome Extension](https://trackandtrace.tools/extension) from the Chrome Web Store. Once you've installed the extension, you will see the T3 interface added to Metrc the next time you log in. If you've subscribed to [T3+](https://trackandtrace.tools/plus), you will need to register your Metrc username to access T3+ features. T3 toolbox button ______________________________________________________________________ ## T3 Chrome Extension Components - The **Toolbox Button** is located in the bottom right of your screen, and is used to access nearly every T3 Chrome Extension feature. Beside it, the **Ctrl + K** button opens a search box that jumps to any T3 tool, Metrc page, or setting (see [Keyboard Shortcuts](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#keyboard-shortcuts)). Hovering over the toolbox button opens a menu above it. Open Toolbox, Search and Keyboard Shortcuts show their keyboard shortcut beside them: - **Open Toolbox**, at the top: the same as clicking the toolbox button (**Alt+T**) - [Search](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#metrc-search-engine) (**Alt+S**) - [Quick Scripts](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#quick-scripts), which lists your quick scripts to the side - [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/index.md) - [Label Studio](https://wiki.trackandtrace.tools/t3-chrome-extension/label-studio/index.md) - [Exports (Legacy)](https://wiki.trackandtrace.tools/t3-chrome-extension/exports/index.md) - T3 API - Announcements, with the number of unread ones - [Settings](#t3-settings) - Keyboard Shortcuts (**Alt+/**) - [Report a Problem](https://wiki.trackandtrace.tools/faq/#how-to-report-problems-with-t3) - Your installed T3 version, at its foot **↑** and **↓** move through the menu, **Enter** opens an item and **Esc** closes it. When there are unread announcements, the toolbox button shows how many. After you scroll down a page, an arrow button appears beside the others to take you back to the top. Without T3+, a **Get T3+** button beside them opens the [T3+ page](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/#the-t3-page). - **Announcements:** when there's a new announcement, a card above the toolbox button shows its title, its date and its first few lines. **Read more** opens it in full on the toolbox's **Announcements** page, and **×** dismisses the card. The Announcements page lists every announcement, newest first, with a **New** label on the ones you haven't read. **Dismiss all** clears the page, and **Show dismissed** brings them back. - The **Toolbox** opens from the toolbox button or **Alt+T**. Its menu on the left lists **Home**, **Tools** (every [package, plant, tag and sales tool](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#the-tools-screen) on one screen), T3 Reports, Label Studio, Quick Scripts, the [Dashboard](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#license-dashboard) and the rest; below them **Announcements**, **Settings** and **Help** (the T3 Wiki, the Community forum, Office Hours and Report a Problem); and at its foot **Get T3+**, which opens the [T3+ page](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/#the-t3-page), or **Manage T3+**. The search bar at the top of the toolbox, and the large search box on its [home screen](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#toolbox-home), find any tool, report, Metrc page or setting. The home screen also shows the tools you've [pinned](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#pinning) and counts for the license Metrc is on. - The **Search Metrc** bar at the top of each page opens [T3 search](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#metrc-search-engine), as **Alt+S** does. Beside it are the filters set on the table you're looking at, with **Clear filters**. The Search Metrc bar - The **License picker** is an enhanced license select interface, allowing for autocomplete license search and pinning of a home license. - T3 adds a **row menu** button to every row of the Metrc tables [search](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#metrc-search-engine) covers, for quick access to the [actions](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#row-menus) for that package, transfer, plant or other object. T3 package row menu - The **T3 icon** in Chrome's toolbar, to the right of the URL, opens the T3 popup: your T3 version, the latest announcements, and **Report a problem…**. It works even when T3 doesn't load on a Metrc page: see [What if T3 doesn't load on Metrc pages?](https://wiki.trackandtrace.tools/faq/#what-if-t3-doesnt-load-on-metrc-pages) ______________________________________________________________________ ## T3 Settings The T3 Chrome Extension is highly customizable. In the T3 Settings menu, you're able to enable and disable features, customize Metrc behavior, set table and page defaults, and [enable T3 snowflakes](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#metrc-snowflakes). To open Settings, hover over the purple toolbox button in the bottom right of the Metrc page and choose **Settings** in the menu that opens. You can also open the toolbox and click **Settings** in its menu. Settings are grouped into sections: Account, Metrc Overrides, Session, Appearance, T3 Page Widgets, T3 Behavior, Packages, Transfers, Sales, Tags, Plants, and Advanced. The T3 settings screen ### Registering a License Key If you were provided a license key, enter it in the **License** field in the **Account** section of T3 Settings. After entering your license key and clicking **Save**, T3 will check the key. If it is valid, you will see "Client: (your username/business name)" appear. **NOTE: most T3 users do not need a user license key** T3 license key input Successfully registered license key ### Selecting a Report Email Address Enter your email address in the **Account** section of T3 Settings. [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/index.md) uses it as the default delivery address for emailed reports, and [Exports (Legacy)](https://wiki.trackandtrace.tools/t3-chrome-extension/exports/index.md) emails Excel files to it and shares the Google Sheets it creates with it. T3 settings ### Checking Permissions If you need to find out what Metrc permissions the current account has, open the **Advanced** section of T3 Settings and click **Check my permissions**. T3 permissions check tool ______________________________________________________________________ ## Enabling T3+ Once you have a [T3+ subscription](https://wiki.trackandtrace.tools/t3-plus/index.md), refer to [Registering a Metrc username](https://wiki.trackandtrace.tools/t3-plus/#registering-a-metrc-username-in-t3) to learn how to register your username to enable T3+ features. ______________________________________________________________________ ## Next Steps - Head over to [T3 Chrome Extension Primary Features](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/index.md) to learn about what tools you have right out of the box. - Learn more about [T3+ Chrome Extension features](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/index.md) - Fill out any Metrc form from a spreadsheet with [CSV Form Fill](https://wiki.trackandtrace.tools/t3-chrome-extension/csv-form-fill/index.md) - Export Metrc data to CSV, Excel or Google Sheets with [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/index.md) - Design and print labels with [Label Studio](https://wiki.trackandtrace.tools/t3-chrome-extension/label-studio/index.md) - Install the [T3 Chrome Extension](https://trackandtrace.tools/extension) # Label Studio The T3 Label Studio is the label designer in the T3 Chrome Extension. It generates printable label PDFs filled with data from Metrc, for any label size and printer type. Open it from **Label Studio** in the toolbox's menu, from **Tools › Tags & Labels**, or from the menu that opens when you hover over the T3 button at the bottom right of Metrc. T3 Chrome Extension label generation interface T3 Free is a preview T3 Free users can open the Label Studio and design labels with starter templates and demo data, but Metrc data cannot be loaded and generated labels are watermarked. Both restrictions are lifted by [T3+](https://wiki.trackandtrace.tools/t3-plus/index.md). With T3+, the packages, plants and plant batches you print come from a [tag list](https://wiki.trackandtrace.tools/t3-chrome-extension/tag-lists/#in-label-studio): your scratchpad, which **Add to Scratchpad** in a row's menu fills as you work in Metrc, or another list you choose. ______________________________________________________________________ ## Next Steps - Every tab and control is documented in the [Label Studio reference](https://wiki.trackandtrace.tools/t3-labels/label-studio/index.md). - Build a label from scratch with the [T3 Labels Tutorial](https://wiki.trackandtrace.tools/t3-labels/tutorial/index.md). - Learn how templates, layouts and label data fit together, and generate labels from the T3 API, in [T3 Labels](https://wiki.trackandtrace.tools/t3-labels/index.md). - Fill the list you print from with [Tag Lists](https://wiki.trackandtrace.tools/t3-chrome-extension/tag-lists/index.md). - Learn about other [T3+ features](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/index.md) # T3 Chrome Extension Primary Features ## Metrc Search Engine T3 search finds anything in your license from one box: packages, plants, plant batches, harvests, transfers, tags, items, strains, locations, sales, processing jobs and more. Type a few characters of a tag, a manifest number or a name. Search looks on the license you're on as you type, and on your [other licenses](#your-other-licenses) when you ask or [pick them](#what-to-search). Open it from anywhere on a Metrc page: - **Alt+S** (**Option+S** on a Mac). Press it again, or **Esc**, to close it. - The **Search Metrc** bar at the top of the page. - **Search** in the menu that opens when you hover over the T3 button at the bottom right. - **Open in T3 search** or **Show history in T3 search** in a Metrc table row's [menu](#row-menus). The Search Metrc bar Results arrive as Metrc answers, best matches first, sliding into the list, and a violet glow runs under the search box while T3 is still searching. A line above them counts what was found and says what T3 searched: one chip per type (**Packages 2**, **Tag 1**), then "3 results · This license · Default types". Click **This license** or **Default types** to choose [what to search](#what-to-search). A tag's ending, from the first nonzero character in its last eight, is dark and bold, so the part that differs from tag to tag stands out. Point at a chip (or move to it with **Tab**) to see only that type's results while you're there: that chip turns solid and the others turn white. Click a chip to list only that type: "2 of 3 results". Click it again to list every type, or click another chip to switch to it. A picked chip is filled in; an unpicked one is white with a colored border. Your choice lasts for your next searches in that browser tab, even after the page reloads. The license chips below work the same way. Each result shows its type and state beside its icon (**Tag**, Used), then its tag, number or name, with what you typed highlighted, and under it a few details (a tag's type, a package's quantity and item). A state worth knowing, such as On hold or Failed lab testing, shows as a pill on the right. When your text matched another column, such as a location, a line names that column, highlighted. The box has three columns: the results, the highlighted result, and its [actions](#actions). The middle column shows, at the top, its type and state, its name (for an object without a tag) and where T3 found it, then its tag drawn as a Metrc tag with its barcode (a plant batch's name too, when it is a Metrc tag). Under that: its details, the other columns your text matched, and its tabs: **All fields**, its history and more ([below](#history-and-more)). Click a value to copy it: a copy icon shows when you point at it, and "Copied" when it's done. In a window narrower than 1200 pixels, the actions move into the middle column, above the details. - **↑** and **↓** move through the results. - **Enter** opens the result in Metrc: its page and tab, with the table filtered to it. On the result's own page, the table filters in place. **Ctrl+Enter** (**Cmd+Enter** on a Mac) opens it in a new tab. - **→** moves to the result's actions; **↑** and **↓** move through them, **Enter** runs one, and **Esc** goes back to the search box. - **Ctrl+C** (**Cmd+C** on a Mac) copies its tag, number or name. - T3 searches the default types first: active records and transferred packages. **Shift+Enter**, or the **Search inactive, on hold and more** row, searches the rest: inactive and on-hold records and more. T3 does this on its own when nothing active matches. - **Alt+Enter** (**Option+Enter** on a Mac), or the **Search 23 other licenses** row, searches your [other licenses](#your-other-licenses) too. - **Alt+L** (**Option+L** on a Mac) opens [What to search](#what-to-search). - With nothing typed, the box lists your recent searches. If part of a search fails (Metrc doesn't answer in time, say), the results name what couldn't be searched, with a **Retry**. When using T3, everything in Metrc has its own link. Apply filters to any Metrc table, then use the current URL to re-apply all existing filters. Unique link automatically assigns Metrc table filters ### Your other licenses When what you're looking for isn't on this license, choose **Search 23 other licenses** under the results, or press **Alt+Enter** (**Option+Enter** on a Mac). T3 searches the other licenses in Metrc's facility menu for what you typed, this once, a few at a time until it has searched them all (the row says "in one go" when they fit at once). On each it searches the default types, or the types you picked in [What to search](#what-to-search), so inactive and on-hold records only if you pick them. With a type's chip picked, it searches only that type. If you search a full tag that nothing on this license has, the list says "No object has this tag on this license" and highlights **Search 23 other licenses**, so one **Enter** searches them. A line under the summary follows the search: "9 of 23 licenses", and a purple chip for each license, yours first, each with its number and how many results it has so far. A chip pulses while T3 searches that license; a license not searched yet, or where nothing was found, has a dashed border. The license chips look and work like the type chips: once a license's results are in the list, point at its chip (or **Tab** to it) to see only that license's results, all of them; click it (or press **Space**) to list only that license, and click it again to list every license. Your next search starts with every license. Each row's counts follow the other: with one license picked, the type chips count that license's results. - **Alt+Enter** again, or **Pause**, pauses: T3 finishes the licenses it's on, then stops ("Paused · 12 of 23 licenses searched · 11 left"). Look through what it found, then press **Alt+Enter** or **Resume** to carry on with the next licenses. - Closing search pauses it too. Open search again to see the results so far, with **Resume**. - Typing a new search starts again on this license. - If you reach T3's search limit, or your Metrc session expires, T3 pauses and says why. **Resume** tries again. Once other licenses are searched, results group by license, each under its license number and facility name ("this license" on yours), the license with the best match first. Only licenses with results show, and the summary says how many: "found on 5 licenses". - A license whose results only match in the middle of a value (not at its start or end) starts folded: "3 weak matches on LIC-00019". Choose that line to see them. - With 6 or more licenses searched, each license shows its best 5 results, then "12 more on LIC-00007". - **Alt+A** (**Option+A** on a Mac), or **Show all licenses**, opens every license's results. Press it again, or **Fold weak matches**, to fold them. - On another license's result, **Open** reads **Open on LIC-00007**: **Enter** opens it on that license's page in this tab, and **Ctrl+Enter** (**Cmd+Enter** on a Mac) in a new tab. ### What to search Click **This license** or **Default types** in the summary, or press **Alt+L** (**Option+L** on a Mac), to choose what search covers: - **Licenses:** yours is always checked, and searched first. Check other licenses to search them with every search in this browser tab, right after yours, a few at a time, as above. Filter the list by license number or name; **All** checks every license the list shows, and **Default** goes back to your license alone. - **Types:** each type, with its kinds as toggles. **Packages:** Active, In transit, On hold, Inactive, Transferred, Lab samples. Click a type's name to turn all its kinds on or off. **Default** goes back to the default types, **All** picks every kind, and **only** beside a type picks just that type. A line at the bottom says what each search will take: "17 picked · your license, then 3 other licenses in one go, every search". **Tab** moves between the toggles and **Space** turns one on or off. **Enter**, **Esc** or the green **Apply** button applies your picks, goes back to the search box and searches again. Your picks apply to this license as you type, too: with only Inactive turned on under Packages, search finds only inactive packages. T3 searches just what you picked, so it doesn't go on to inactive, on hold and more by itself. The picks last while the browser tab is open, even across page loads, and each tab has its own. While you have picks, the summary shows them tinted ("4 licenses", "Only inactive packages"), each with its own **Reset**: the licenses' goes back to your license alone, the types' to the default types. With other licenses checked, **Search 23 other licenses** doesn't show: they're already searched. If nothing matches your picks, **Search the default types** searches the defaults for that search only, and your picks stay. ### History and more Under a result's details, tabs show the rest of what T3 knows about it. A tab loads when you open it, so the details show at once, and then shows how many rows it has (**History 4**). - **All fields:** every column of the result, apart from those already shown as matched. A very long value (a package's source harvests, say) is cut short, with **Show all** to see it whole. - **History,** for packages, plants, plant batches, harvests, outgoing, rejected and hub transfers, items and processing jobs: each entry's date, who recorded it and what happened, with its detail lines (which you can hide). Every package, plant, plant batch, harvest and manifest a line names is a link: click it to search for that object, which T3 highlights, its own tabs ready. A line that names the result itself is marked instead. T3 looks on the result's license first, then your other licenses. - **Lab result batches**, **Source harvests**, **Plants**, **Packages**, **Transactions** and more, as the object has them: one row each, its tag or name a link that searches for it, the arrow beside it showing every field. - **Metadata,** for most types: its summary and description, and what T3 works out from the tabs you've opened, such as a package's quantity ledger (after **History**) and its lab results (after **Lab result batches**). Metrc keeps no history for incoming transfers, sales, or packages on the Transferred and lab sample tabs, so those have no History tab. If a tab can't load, it says why, with a **Retry**; the other tabs keep what they loaded. If the result has left the list T3 found it in (a package that was finished, say), the tab says so: search again to find where it went. T3 remembers the tab you chose: the next result that has it opens on it, so with **History** chosen, every result with a history opens on its history, and the others on **All fields**. - **Alt+\[** and **Alt+\]** (**Option+\[** and **Option+\]** on a Mac) move between the tabs. - **Ctrl+\[** and **Ctrl+\]** (**Cmd+\[** and **Cmd+\]**), or the arrows before the search box, go back and forward through the searches the links ran. - **Show history in T3 search** in a Metrc table row's menu opens search on that row with its history, as does **Show history in T3 search** when a merge finishes. This replaces Metrc Explorer, which is free now, as part of search. **Explorer** in the T3 toolbox explains the move, and opens search. ### Actions Every result has actions, and they are the same ones as in its [row menu](#row-menus) in a Metrc table: - **Open** and **Open in new tab** (search only). On a result from another license, **Open** reads **Open on LIC-00007**. - **Show history in T3 search** (row menus only): for a package, plant, plant batch, harvest, transfer, item or processing job, opens search on it, on its [History](#history-and-more) tab when it has one. - **Open in T3 search** (row menus only): searches T3 for the row's tag, number or name, with its type picked. - **Copy tag** (or **Copy manifest**, **Copy name** and so on) and **Copy link**, the link to it in Metrc. - What T3 can do with that kind of object. A package: Package history, Split package, Merge…, Add to Scratchpad · Packages, Add to list…, Quick print label, and its lab test PDFs and results. A transfer: Edit transfer, Add to Scratchpad · Transfers, Add to list…, its manifest, its summary as CSV or XLSX, Generate invoice, Create scan sheet, and its packages' lab tests. A plant, mother plant or plant batch: Add to Scratchpad, Add to list… and Quick print label. A harvest or a Metrc tag: Add to Scratchpad and Add to list… (see [Tag Lists](https://wiki.trackandtrace.tools/t3-chrome-extension/tag-lists/#from-a-row-menu-or-t3-search)). Actions marked T3+ need [T3+](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/index.md). - [Quick filters](#quick-filters). ### Quick filters A quick filter lists the rows that share a value with this one: **Matching item**, **Matching location**, **Matching strain** and so on, each showing the value it filters by. They come last in the actions, for tables that have T3's [filter bar](#filter), and match objects of the same type only: from a package, other packages. - **In a table's row menu,** a quick filter adds the filter to the filter bar above that table. When the bar doesn't offer that column, search opens with the value typed instead. - **In search,** it closes search, opens the table the result is in, and adds the filter there. ## Row Menus T3 adds a button with its tools icon to every row of the Metrc tables search covers: packages (and the packages under a transfer), transfers and the transfer hub, plants, plant batches, harvests, tags, tag orders, items, strains, locations, sales, processing jobs and transfer templates. Click it to open the row's menu. It opens the way the row's result does in search: its type and state, its tag drawn as a Metrc tag with its barcode (or its name, for an object without a tag), and its details, where a click on a value copies it. Under them are the same [actions](#actions) as the row's result in search, without **Open** and **Open in new tab** (you're already on its page), and with **Show history in T3 search** and **Open in T3 search**. - **↑** and **↓** move through the actions, **→** opens a submenu (**Merge…**) and **←** closes it, and **Enter** runs an action. - **Esc** closes the menu. T3 package row menu ## Filter T3's filter bar sits above Metrc's tables. Type a column, a colon and a value to filter the table: **Location:Vault** lists the rows whose location contains Vault, and short names work too, as in **qty:>5**. After the colon, **=** means exactly, **!=** not, and **>**, **\<**, **>=** and **\<=** compare numbers and dates. Each filter shows as a chip and applies to the table at once. - **Alt+F** (**Option+F** on a Mac) goes to the bar. - **Enter** adds the filter you typed. In the empty field, **Backspace** edits the last filter; on a chip, **Delete** or **Backspace** removes it. **Clear** removes them all. - The bar and Metrc's own column menus share their filters: a filter set in Metrc's menus shows in the bar, and the other way round. - Filtering on a column the table hides shows that column first. - [Quick filters](#quick-filters) in a row's menu add a chip with that row's value. - **Generate report…** opens [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/#starting-from-a-metrc-table) on a report of this table, with its filters and sort. - **Save as tag list…** (T3+) saves every row matching the table's filters, up to 5,000, as a [tag list](https://wiki.trackandtrace.tools/t3-chrome-extension/tag-lists/#saving-a-metrc-table-as-a-tag-list). The same filters work in **Browse**, in Merge Packages' picker (see [Picking packages](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/#picking-packages)). Filter is free, and its filters stay in the tab you set them in. ## License Dashboard The Dashboard shows one of your licenses at a glance: how many packages, plants, transfers and more it has, and what changed in the last 24 hours. Open the T3 toolbox and choose **Dashboard** in its menu, or click **Dashboard ›** under **This license** on the toolbox's [home screen](#toolbox-home). The Dashboard is free. The Dashboard: a license's counts, and what changed in the last 24 hours ### Picking a license The list at the top shows the licenses your Metrc login can open, your home license first. The license Metrc is on reads **open in Metrc**, and your home license reads **home**. - **Pick a license to see its numbers straight away.** Metrc stays on the page and license it's on, so you can look at another license without leaving your work. - **Switch Metrc to this license** shows when the license on the Dashboard isn't the one Metrc is on. It switches Metrc, as choosing the license in Metrc's own facility menu does. When they're the same license, a green **Open in Metrc** label shows instead. ### Counts Each kind of object has a card with its counts: | Card | Counts | | ------------- | --------------------------- | | Packages | Active, In transit, On hold | | Plants | Vegetative, Flowering | | Plant Batches | Active | | Harvests | Active | | Transfers | Incoming, Outgoing | | Tags | Available | | Sales | Active | - **Click a count to open that Metrc table** on the license shown. **Ctrl+click** (**Cmd+click** on a Mac), or a middle click, opens it in a new tab. - A card is left out when your Metrc login can't open its page on that license. - A count that didn't load shows a dash with the reason, and **Retry**. ### Changed in the last 24h Under the counts are the 15 most recent changes to the license's packages, plants, plant batches, harvests and transfers in the last 24 hours, newest first. Each shows its tag, name or manifest number, a detail such as the item, the strain, or where a transfer is coming from or going to, and how long ago it changed. Click one to open it in [T3 search](#metrc-search-engine). ### Keeping the numbers current The Dashboard keeps what it loaded for 5 minutes, so going back to a license you just looked at shows its numbers at once. **Updated 2 min ago** at the top says how old they are, and **Refresh** loads them again. **↑** and **↓** move through the counts and the changes, and **Enter** opens one. ## CSV Form Fill T3 allows you to automatically fill out *any* Metrc form using just a CSV. It is one of the most powerful T3 tools available. [Full documentation for CSV Form Fill](https://wiki.trackandtrace.tools/t3-chrome-extension/csv-form-fill/index.md) ## Label Printing T3 can easily generate printable label PDFs prefilled with data taken from Metrc. It supports common label sizes for thermal printers and laser/inkjet printers. Labels are watermarked without [T3+](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/index.md). See [Label Studio](https://wiki.trackandtrace.tools/t3-chrome-extension/label-studio/index.md). ## PDF Viewing and Printing T3 allows you to quickly and easily view and print PDFs from Metrc, including manifest PDFs and lab result COA PDFs. T3 package row menu T3 COA preview ## Quick Select All T3 plant and package tools use a quick select interface, allowing you to instantly select any number of Metrc tags for the task at hand. Quick select interface Rapidly filter plants and packages by common values like strain, location, and item. Quick select autocomplete filter Bulk paste lists of tags to instantly select hundreds at a time. Quick select paste tags Merge Packages has its own picker, with **Quick Select**, **Paste** and **Browse**: see [Picking packages](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/#picking-packages). ## Auto-generate CSV If you don't want to submit through T3, T3 tools allow you to download a CSV that you can upload to Metrc instead. ## Batch Submit All T3 plant and package tools submit to Metrc in batches, ensuring the data is submitted correctly. When Metrc is too busy to take a batch, T3 waits and sends it again. When Metrc doesn't answer, T3 doesn't send the batch again on its own, because it may already have gone through: it marks those rows and asks you to check Metrc before you retry them. ## Toolbox Home The T3 toolbox opens on its home screen, **Home** in its menu. From the top: - **You're using T3 Free** (only without [T3+](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/index.md)): what T3+ adds, and **See what T3+ unlocks**, which opens the T3+ page in the toolbox. - **The search box** ("What do you want to do?") finds any tool, report, Metrc page or setting: it opens the [Ctrl+K](#keyboard-shortcuts) search box with what you type. - **Recent** lists the places you opened last. - **Getting started** links to this wiki, the extension's features, the community forum, the T3 API, Settings and Report a Problem. Close it with its **×** once you know your way around; it stays closed. The wiki, the forum and Report a Problem are also under **Help** in the menu, and Settings and T3 API have their own entries. - **Pinned** holds the tools, reports and screens you pin, in the order you pinned them. Click one to open it. To unpin one, hover over it and click its **×**. - **This license** shows the license Metrc is on, with four of the [Dashboard](#license-dashboard)'s counts: active packages, flowering plants, incoming transfers and available tags. Click a count to open its Metrc table (**Ctrl+click** or **Cmd+click** for a new tab), or **Dashboard ›** for the rest. ### Pinning - On the [Tools screen](#the-tools-screen), hover over a tool and click the star at the right end of its row. A pinned tool's star stays filled in: click it again to unpin. - In the **Ctrl+K** box, highlight a tool, report or screen and press **Alt+P** (**Option+P** on a Mac). The highlighted row shows **Pin** or **Unpin** beside the key, and pinned results are marked **Pinned**. - You can pin up to 12. Your pins belong to your Metrc username on that Metrc site, and show in every Metrc tab in your browser. ## The Tools screen Every tool that works on many plants, packages, tags or sales receipts at once is on one screen: open the T3 toolbox and choose **Tools** in its menu. The tools are grouped into **Plants**, **Packages**, **Tags & Labels** and **Sales**, each with a line on what it does. - A tool that needs [T3+](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/index.md) shows a **T3+** badge. Without T3+, a locked tool (marked with a lock) opens the [T3+ page](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/#the-t3-page) instead. - A tool that can't run on your Metrc site or facility is dimmed, with the reason beside it. When the reason is your Metrc site, **Why?** explains. - The star at the right end of a tool's row [pins it](#pinning) to the toolbox's home screen. - **↑** and **↓** move through the tools, **Home** and **End** jump to the first and last, and **Enter** opens one. - Inside a tool, the header at the top reads **T3 › Tools › the tool's name**: click **Tools** to go back. ## Plant Tools T3 offers a suite of tools for rapidly performing large-scale cultivation compliance tasks. Tools intelligently allocate tags and correctly size plant batches. - **Mother Plants** and **Mother Plant Batches**: Select mother plants or plant batches, and T3 can generate large numbers of clones and seeds in the correct quantities per plant batch. - **Promote Immature Plants**: Select a group of plant batches, earmark a list of tags, and T3 will automatically generate plants using the correct number from each source plant batch. - **Pack Immature Plants**: Package immature plant batches into plant batch packages. - **Unpack Immature Plants** (California only): Turn plant batch packages back into plant batches. - **Destroy Plants** - **Move Plants** - **Retag Plants** - **Retag Plant Batches** Harvesting, manicuring, changing growth phase, and destroying or moving plant batches are [T3+ tools](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/#plant-tools). Create plant batches from mothers tool ## Package Tools T3 offers a suite of tools for rapidly performing large-scale package compliance tasks. Tools intelligently allocate tags and correctly manage strains and items. - **Move Packages** - **Finish Packages** [Merge Packages](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/#package-tools), Split Package, New Package CSV and Bulk Add COAs are T3+ tools. ## Tag and Sales Tools - **Finalize Sales**: Select a date, and T3 will automatically finalize all sales receipts prior to that date in the background. - **Void Tags**: Select any number of tags and T3 can void them in a single click. Void tags tool ## Transfer Tools The Metrc Transfer Create/Edit form has additional tools: - Autofill same-site transfer - Autofill package weights - Toggle Metrc form buttons for quicker tabbing - Autofill package weight/unit/price - Autofill directions (T3+) - Autofill recent destinations (T3+) - Autofill recent transporters (T3+) The T3 transfer toolbar ## User Interface Enhancements - Keyboard shortcuts for every part of T3, and **Ctrl+K** to jump to any tool, report, Metrc page, facility, quick script or setting (see [Keyboard Shortcuts](#keyboard-shortcuts)) - Notifications you can act on, and find again (see [Notifications](#notifications)) - License picker featuring type-to-autocomplete - Prevents auto-logout (**Settings › Session**): clicks Metrc's Keep me logged in button for you, and keeps you logged in to Metrc even with no Metrc tab open, while the browser stays open and the computer stays awake - Auto-open tabs on load - Auto-dismiss Metrc warning banners - Auto-refresh Metrc forms after dialog window is closed - Dark mode - Customize Metrc appearance ## Notifications T3 tells you what happened in a notification at the bottom center of the page: a red one for an error, amber for a warning, green when something worked, purple for information, and one with a spinner while something runs. - **Hover over them to keep them up.** Each one leaves on its own after a few seconds (a bar along its bottom shows the time left), but not while your pointer is over it, and not while you're in another tab. - **Several at once** stack up: the newest in front, the two before it peeking out behind. Rest your pointer on them for a moment to see them all. The same message again counts into the one showing (×3) instead of adding another. - **Click one to close it,** or its **×**. One with a button of its own (**Go to homepage**) stays until you answer it or it runs out, and one with a spinner stays while it runs. - **Buttons:** some notifications have a button of their own, such as **Go to homepage** on Metrc's error pages. Every error has **Copy**, to paste it into an email. Most also have **Report**, which opens a support ticket with the error already filled in: add what you were doing and send it. - **Something that takes a while** shows one notification that changes as it goes, then says how it ended. Filling a form from a CSV counts up the rows it has filled. Generating labels shows a spinner and a **Cancel** button. - **Missed one?** **Alt+N** (**Option+N** on a Mac), or typing **!** in the **Ctrl+K** box, lists this tab's recent notifications, newest first. Type after the **!** to narrow them. **Enter** copies one; most errors have a **Report** button. - **Settings › T3 Page Widgets › Hide info and success notifications** keeps the "it worked" and information ones off the screen (they still show under **Alt+N**). Errors and warnings always show. ## Keyboard Shortcuts T3 is built to be used from the keyboard. - **Ctrl+K** (**Cmd+K** on a Mac), the **Ctrl + K** button beside the T3 button at the bottom right, or the search bar at the top of the T3 toolbox (the large box on its home screen) opens a search box from anywhere on a Metrc page. Type a few letters to jump to any T3 tool, any report in [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/index.md), any Metrc page or table your license can open, any of your [tag lists](https://wiki.trackandtrace.tools/t3-chrome-extension/tag-lists/#in-the-ctrlk-box), any T3 setting, or another facility, or to run a quick script or one of T3's actions (**New tag list**, for example). Each result's shortcut shows beside it, so you learn them as you go. Tools and reports that need T3+ show a T3+ badge; without T3+, choosing one opens the [T3+ page](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/#the-t3-page). - In the **Ctrl+K** box, **Alt+P** (**Option+P** on a Mac) [pins](#pinning) the highlighted tool, report or screen to the toolbox's home screen, or unpins it. - Metrc's pages read **Metrc ›** before their name (a table listed on its own, **Metrc › Plants ›** before its), and the highlighted one says **Go to page** or **Go to table** beside the Enter key: choosing it leaves the page you're on. **Ctrl+Enter** (**Cmd+Enter**) opens it in a new tab instead. - A Metrc page's tables show under it only when they match what you typed: "plants flowering" finds the Flowering table under Plants. The same goes for the reports under T3 Reports: "active packages" finds the active packages reports. A page's row says how many tables it has (T3 Reports says how many reports); press **→** with the page highlighted, or click the count, to list them all, and **←** to go back to the ones that match. - **Alt+S** (**Option+S** on a Mac) opens [T3 search](#metrc-search-engine), to find a package, plant, transfer or anything else in your license. With search open, it closes it. - In search, **Alt+Enter** (**Option+Enter** on a Mac) searches your [other licenses](#your-other-licenses), and pauses or resumes that search; **Alt+A** (**Option+A**) shows every license's results, or folds them again; **Alt+L** (**Option+L**) opens [What to search](#what-to-search). - **Alt+/** (**Option+/** on a Mac), **Keyboard shortcuts** at the top of the **Ctrl+K** box, or typing **?** in it lists the shortcuts for what's open (a tool, a picker, a row menu) along with the ones that work anywhere, such as **Alt+T** for the T3 toolbox and **Alt+S** for search. Type after the **?** to narrow the list: **?select** shows the selection keys. - In Merge Packages' package picker, **Alt+1**, **Alt+2**, **Alt+3** and **Alt+4** (**Option+1** to **Option+4** on a Mac) switch to Quick Select, Paste, Browse and Tag List, and **Ctrl+A** (**Cmd+A**) in the selected list checks every row. The shortcuts list groups these under **Picking packages**; see [Picking packages](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/#picking-packages) for the picker itself. - **Alt+N** (**Option+N** on a Mac) lists this tab's recent [notifications](#notifications), **Alt+Enter** (**Option+Enter**) presses the button on the newest one (**Go to homepage**, or **Undo** after an add to a [tag list](https://wiki.trackandtrace.tools/t3-chrome-extension/tag-lists/#from-a-row-menu-or-t3-search)), and **Alt+X** (**Option+X**) closes them all. With search open, **Alt+Enter** searches your other licenses instead. - **Esc** closes what's in front: an open list or menu first, then the T3 window, then Metrc's own window. - Lists and menus share their keys: **↑** and **↓** move, **Enter** chooses, **Tab** chooses and moves to the next field, and **Esc** closes the list. - In a tool, **Alt+O** (**Option+O** on a Mac) shows the table you're in full screen, or puts it back; **Esc** puts it back too. ## Metrc Snowflakes Metrc no longer adds the CPU-sucking snowflakes during the winter holidays anymore, but T3 lets you add them again! Customize snowflakes to use emojis, text, or images. Custom T3 snowflakes ## Quick Scripts T3 "quick scripts" are one-click tools that can save you a lot of clicking or tabbing: - Automatically expand a tag range in the Change Growth Phase window to account for the Metrc tag range bug - Automatically fill the Gross Weight and unit of measure fields for the current transfer - Automatically total all the source package quantities in the New Packages window and enter it into the new package Quantity input - Automatically check all the plant checkboxes in the Restore Harvested Plants window - Bulk add package content fields in the New Package window - Toggle visibility of Metrc table columns ______________________________________________________________________ ## Next Steps - Learn more about [T3+ Chrome Extension features](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/index.md) - Deep-dive on [CSV Form Fill](https://wiki.trackandtrace.tools/t3-chrome-extension/csv-form-fill/index.md), one of T3's most-used tools - Export Metrc data with [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/index.md) - Design labels with [Label Studio](https://wiki.trackandtrace.tools/t3-chrome-extension/label-studio/index.md) - Install the [T3 Chrome Extension](https://trackandtrace.tools/extension) # Scan Sheets T3 can generate an Excel file or Google Sheet populated with all packages from any transfer. Using a bluetooth scanner, scan in the packages in the transfer in any order and get visual feedback on the scanned tag. ## Generating a Scan Sheet Scan sheets can be generated either with **Create scan sheet** in an incoming, outgoing or rejected transfer's [row menu](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#row-menus) (or its actions in T3 search), or from the **Scan Sheets** category in [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/index.md): Generating a scan sheet from the transfer table Generating a scan sheet from T3 Reports ### Selecting transfers Choose a **transfer type** (incoming, outgoing, rejected, or hub) and a license. T3 lists the active transfers for that license, each with its manifest number, shipper, recipient, package count, and date. Check as many as you want to appear on one sheet. One sheet covers one transfer type. To reconcile incoming and outgoing at the same time, generate a sheet for each. A scan sheet holds 10,000 packages The row budget shown above the Generate button counts **packages**, not transfers, across every manifest you have selected. Going over blocks the request. A scan sheet that large is almost always a forgotten filter rather than a real day's work. ### Output formats A scan sheet is a formatted spreadsheet (the colors are what make it work) so the plain text formats do not apply. Format and delivery are chosen separately. **Format:** - **Google Sheets** (recommended): a new sheet you open in a tab - **Excel (.xlsx)**: a workbook file **Delivery:** - **Open / download now**: the sheet or file is built while you wait - **Email a copy**: T3 builds it and emails it to you. Use this for a large sheet Filling in an email address when opening a Google Sheet shares that sheet with the Google account, so you can find it again later. Anyone with the sheet's link can open it. ## Using your Scan Sheet 1. **Open your scan sheet in any spreadsheet software.** Click to select the first empty cell in the "Scanned Tags" column. 1. **Scan each Metrc package tag.** The cells will update with color to indicate if that tag is expected or not. Refer to the [Scan Sheet color codes section below](#scan-sheet-color-codes) to learn what different cell colors mean. 1. **Once finished scanning, review your scan sheet**. - If all colored cells are green, you have successfully scanned in the entire order with no extra or missing packages. - If any colored cells are red, yellow, or orange, there is a problem. Inspect the list of scanned tags to determine which tags are missing, duplicated, or extra. ## Scan Sheet color codes Scan sheets use colored cells to visually indicate how the scanned tags match the expected list of transfer tags. - **Green**: tag matched exactly once - **Yellow**: tag was scanned twice - **Orange**: tag is not present in the order - **Red**: tag is missing ### Initial state of a Scan Sheet When you open a scan sheet for the first time, all Package Tag cells will be red, indicating they have not been scanned. Initial state of a Scan Sheet ### Scanning in tags As you scan in matching tags, the corresponding cells will begin to turn green if they match. You can scan in tags in any order. Scanning in tags ### Duplicate scanned tags If you scan a tag more than once, all the matching cells will turn yellow. Delete the duplicate scan and continue on to the next package. Duplicate scanned tags ### Unexpected scanned tags If you scan a tag that does not appear anywhere in the scan sheet, the cell will turn orange. Unexpected scanned tags ### Example: order with a single missing package The following screenshot shows a scan sheet with two orders after all scanning is completed. There is a single missing package, and the scan sheet immediately identifies which package is missing. Scan sheet missing package ## Obtaining a scanner for scan sheets Scan sheets are designed to use HID barcode scanners (such as [this one](https://www.amazon.com/NETUM-Bluetooth-Wireless-Handheld-NT-1228BC/dp/B07CBRTWS5)) to scan in Metrc package tags in transfers. When you connect the HID scanner to your computer or phone, it will register as a keyboard. When scanning a Metrc tag, the scanner will type out the tag contents and move to the cell below it. ## Scan Sheet Demo Demo of T3 Scan Sheet ______________________________________________________________________ ## Next Steps - Build the underlying manifest report yourself in [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/index.md). - Browse the older [Exports (Legacy)](https://wiki.trackandtrace.tools/t3-chrome-extension/exports/index.md) tool for reports with no T3 Reports equivalent yet (quickview, employee activity, invoices). - Learn more about [T3+ Chrome Extension features](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/index.md) - Install the [T3 Chrome Extension](https://trackandtrace.tools/extension) # T3 Chrome Extension T3+ Features ## The T3+ Page The T3 toolbox has a T3+ page that sums up what T3+ adds. Without T3+, you reach it from a locked tool, a T3+ result in the **Ctrl+K** box, the **Get T3+** button at the bottom right of Metrc, or **Get T3+** at the foot of the toolbox's menu. It shows: - **Start free trial**, which opens the [T3+ dashboard](https://dash.trackandtrace.tools) to start a 30-day free trial. - **What T3+ unlocks**: a card for each T3+ feature. Click one to open the tool, or its page in this wiki. - **Questions**: what T3+ is, what it costs, and more. Click a question to read its answer. With T3+, the page reads **You have T3+**, with **Manage T3+** to manage your plan and the usernames on it in the T3+ dashboard, and lists the same features under **What's included**. ## Unrestricted Tools The following primary tools have their limits removed with T3+: - [CSV Form Fill](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#csv-form-fill): no row limit - [Label Printing](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#label-printing): no watermark, and labels filled with your Metrc data - [Transfer Tools](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#transfer-tools): autofill directions, recent destinations, and recent transporters ## Report Generation T3+ includes access to **T3 Reports**, the report builder in the Chrome Extension. Export complete dumps of your Metrc data as CSV, JSON, Excel or Google Sheets, attach related data such as lab results, and save the report so a spreadsheet can keep itself up to date. [Full documentation for T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/index.md) The older export tool is still available and documented under [Exports (Legacy)](https://wiki.trackandtrace.tools/t3-chrome-extension/exports/index.md). ## Scan Sheets Generate scannable, color-coded spreadsheets to rapidly check transfer manifest packages. [Full documentation for T3 Scan Sheets](https://wiki.trackandtrace.tools/t3-chrome-extension/scan-sheets/index.md) ## Tag Lists Keep lists of tags, see what's in them in Metrc now, and share them with your license. The **Tag Lists** tool (**Tools › Tags & Labels**) makes and manages them. **Add to Scratchpad** and **Add to list…** in a row's menu, **Save as tag list…** above a Metrc table and in Merge Packages' picker fill them, and Label Studio prints from them. [Full documentation for Tag Lists](https://wiki.trackandtrace.tools/t3-chrome-extension/tag-lists/index.md) ## Plant Tools - **Harvest Plants and Manicure Plants**: This tool is T3's most popular feature, and has been used to harvest billions of dollars of flower. - **Change Plants Growth Phase** - **Destroy Plant Batches**: Rapidly destroy entire sets of plant batches with a single click. - **Move Plant Batches** Destroy Plants and Move Plants are [free](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#plant-tools). ## Package Tools - **New Package CSV** (CSV Package Creator): Enables creation of large quantities of packages with a simple CSV upload. The tool intelligently infers sensible default values for new packages, allowing you to input as little data as possible. /// caption Demo of T3 CSV Package Creator /// - **Split Package**: From a single source package, rapidly generate large sets of child packages. This tool is heavily used by manufacturing licenses. - **Merge Packages**: Combine several packages into one new package. Select every package of an item, a location or a range of packaged dates, or a range of tags; paste tags, tag ranges or a spreadsheet column; or check packages in a list (see [Picking packages](#picking-packages)). T3 picks the next available tag, checks the merge with Metrc before you submit, and finishes the packages the merge uses up. Your work is saved for each license, so a reload or a browser restart doesn't lose it. Merge packages tool - **Bulk Add COAs**: Add large numbers of COAs to packages with a simple CSV format. Bulk add COAs tool ### Picking packages Merge Packages picks its packages in two panes. On the left, choose how to pick: **Quick Select**, **Paste**, **Browse** or **Tag List**. On the right, the selected list shows the packages found, each with a checkbox, and how many are selected. **Quick Select** opens first, and selects whole groups at once: - **By item, location, date** selects every package that matches what you set: an **Item**, a **Location**, and **Packaged** dates (a from date, a to date, or both). A package must match all of them. Item and Location list the items and locations of your packages (only those that match the rest of what you set), alphabetically, when you click into the empty box, and search as you type. - Each item and location in those lists shows how many packages it would select with the rest of what you set: with Location set to Vault, each item shows how many of its packages are in the Vault. The numbers fill in as the options scroll into view. - Under the count ("214 packages match"), the matches are broken down by item and by location: the top 6 values of each with their counts, and "+n more". Click a value to filter by it. - **Tag range** selects the packages from one tag to another, or the next N from a tag. Type a tag's last digits to find it. - Quick Select takes up to 5,000 packages. When more match, it selects the first 5,000 and says so. **Paste** takes tags, tag ranges or a spreadsheet column. **Select** (or **Enter**) finds them, and lists any that weren't found. **Browse** lists your packages, 25 to a page, the whole page at once: search it, [filter](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#filter) it, and check packages row by row. The checkbox in the header checks the whole page. Above and below the table you see where you are ("26–50 of 1,234 packages") and the page numbers; the next page is loaded ahead, so moving on is usually instant. **Tag List** picks the packages in one of your [tag lists](https://wiki.trackandtrace.tools/t3-chrome-extension/tag-lists/#in-merge-packages-picker) of active packages. **Save as tag list…**, beside **All** and **None**, saves the checked packages as a tag list. **Full screen**, above Browse and above the selected list, shows that table over the whole screen, all its rows in view, and it works there just as it does in the picker. **Esc** or **Close** puts it back. Review's table, the run's table and New Package CSV's tables have it too. Each mode keeps its own packages, and the one shown is what the merge uses: switch to another and the selection is that one's, switch back and it's as you left it. The number beside each is how many it has selected. In the selected list, uncheck what you don't want: click a row, or Shift-click for a range. **All** and **None** check or uncheck every row, and the list's search narrows the rows by tag, item, quantity or location. Changing Quick Select's filters or tag range selects every match again. A package measured differently from the others (by count rather than weight, say) shows a warning, and a merge can't mix them. An empty package is marked **Empty**. **Merge…** in a package's [row menu](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#row-menus) opens the picker: **All of this item** on Quick Select, with that package's item set, and **Choose packages…** on Paste, with that package. The picker is saved with your merge, so a reload brings back what you set in each mode and what you checked. - **Alt+1**, **Alt+2**, **Alt+3** and **Alt+4** (**Option+1** to **Option+4** on a Mac) switch to Quick Select, Paste, Browse and Tag List. - In the selected list, **Space** checks or unchecks a row, **Shift+↑** and **Shift+↓** extend a range, **Delete** unchecks, and **Ctrl+A** (**Cmd+A** on a Mac) checks every row. - **PageUp** and **PageDown** turn the pages of Browse and of the selected list. - **Alt+O** (**Option+O** on a Mac), from inside a table, shows it full screen or puts it back. All but **Alt+O** are listed under **Picking packages** in the shortcuts list that **Alt+/** (**Option+/** on a Mac) opens, and **Alt+O** under **Tables** (see [Keyboard Shortcuts](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#keyboard-shortcuts)). To open the picker on another one, set **Package picker opens on** in the Packages section of [T3 Settings](https://wiki.trackandtrace.tools/t3-chrome-extension/getting-started/#t3-settings): **Last used** (the one you used last), **Quick Select** (the default), **Paste** or **Browse**. If yours was set to Last used before Quick Select arrived, T3 moved it to Quick Select once; Paste or Browse stays as you set it. ## Transfer Tools - **Transfer Builder**: Build an outgoing transfer from a list of packages. To show it in the toolbox, turn on **Enable legacy transfer tools** in the T3 Behavior section of [T3 Settings](https://wiki.trackandtrace.tools/t3-chrome-extension/getting-started/#t3-settings). ______________________________________________________________________ ## Next Steps - Learn about the [T3 API](https://wiki.trackandtrace.tools/t3-api/index.md) and [T3 Labels](https://wiki.trackandtrace.tools/t3-labels/index.md) - Explore [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/index.md), [Scan Sheets](https://wiki.trackandtrace.tools/t3-chrome-extension/scan-sheets/index.md), and [Label Studio](https://wiki.trackandtrace.tools/t3-chrome-extension/label-studio/index.md) in depth - Install the [T3 Chrome Extension](https://trackandtrace.tools/extension) # Configuring a Report The builder is two columns: **configuration on the left, output on the right**. The output column updates as you type, so the URL and the preview always describe the form as it currently stands. Cards appear in the left column in the order below. Several are conditional: **a control a format cannot express is hidden rather than shown and ignored**. JSON returns the whole record, so it has no columns to pick and no rows to collapse, and neither card appears. ## Report type and licenses Pick the endpoint from the **Report Type** dropdown. Super variants are named as such, and a **View schema** link opens the record's field list. **Licenses** is a searchable multi-select with **None**, **Current** and **All** shortcuts. A report may span at most **20 licenses**, and the counter turns red when you go over. Rows come back grouped in the order the licenses were selected, and the caps are totals rather than per-license allowances. See [Reporting Across Multiple Licenses](https://wiki.trackandtrace.tools/reports/output/#reporting-across-multiple-licenses). ## Format Four formats, each mapping to [`contentType`](https://wiki.trackandtrace.tools/reports/output/#choosing-a-response-format): | Format | Best for | Includes | Column picker | Row layout | Metadata preamble | | ----------------- | ----------------------------------- | --------- | ------------- | ---------- | ----------------- | | **CSV** | Spreadsheets and `=IMPORTDATA` | One | Yes | Yes | Yes | | **JSON** | Scripts and integrations | Unlimited | No | No | No | | **XLSX** | Opening in Excel directly | One | Yes | Yes | Yes | | **Google Sheets** | A sheet you intend to share or edit | One | Yes | Yes | Yes | ## Includes Super reports only. Each include attaches related Metrc data (lab results, history, source harvests) to every record. - **JSON** accepts several includes (up to the report size limit), so the card is a set of checkboxes. - **CSV, XLSX and Google Sheets** accept exactly one, so the card becomes a radio group. See [One include in tabular formats, many in JSON](https://wiki.trackandtrace.tools/reports/super-reports/#one-include-in-tabular-formats-many-in-json). Selecting an include also adds the report's default metadata columns, which are the summarized form of the included data. Each include adds work for every record, which is why super reports have a lower row cap. See [Limits](https://wiki.trackandtrace.tools/reports/limits/index.md). ## Row layout Super reports in a tabular format only. This card answers "what is one row of this report?", and it is the setting people most often get wrong. The two options are labeled with the report's own nouns. For a packages report with lab results: | Option | One row is | | ---------------------------------------- | ------------------------------------------------------------- | | **One lab result per row** (the default) | One included record, repeating the package's columns for each | | **One package per row** | One top-level record, with the included data summarized | Ask for lab results on 500 packages with **One lab result per row** and you get one row per analyte per test; **One package per row** gives you 500 rows. It also keeps records whose include came back empty, which the default silently omits. The card appears whenever the endpoint offers includes and stays disabled until you select one, so it does not appear and vanish as you experiment. **Switching to one record per row drops any column that came from the include**, and the builder names the ones it removed. Why the two shapes exist, and which columns survive a collapse: [One row per record, or one row per included record](https://wiki.trackandtrace.tools/reports/super-reports/#one-row-per-record-or-one-row-per-included-record). ## Delivery Two options, and the right choice is mostly about size: | Delivery | What happens | | ------------ | -------------------------------------------------------------------------------------- | | **Download** | The report is generated while you wait. Subject to the 240-second request limit | | **Email** | T3 builds the report and emails it to you. Use this for a report too large to wait for | For Google Sheets the same two options read as **Open now** (creates the sheet and opens it in a new tab) and **Email link** (T3 builds the sheet and emails you the link). The **Email** field appears when it applies, and what it means depends on the delivery: - With **email delivery** it is required; it is where the report goes, and where any error is reported. - With **Google Sheets opened now** it is optional. Filling it in shares the new sheet with that Google account. Either way, anyone with the sheet's link can open it. Email delivery is the only way to retrieve a report that takes longer than 240 seconds. See [Emailing a Report](https://wiki.trackandtrace.tools/reports/delivery/#emailing-a-report). ## Report columns Tabular formats only. Leave it on **Default fields** to get the report's standard columns, or switch to **Custom fields** to choose your own. The custom picker has three parts, all bound to the same selection: - **Available fields**: a filterable checkbox list of every column on the record, plus any [extra columns found in your data](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports-output/#extra-columns-found-in-your-data). - **Selected**: your chosen columns as a draggable list. **The order here is the column order in the output.** - **Fieldnames**: a comma-separated text box mirroring the other two. Type into it and the checkboxes follow; click a checkbox and the text updates. Paste a column list from a colleague here. Bulk buttons reset the selection to the report's defaults, to everything, or to nothing. Two things the picker will tell you about: - Past roughly **16 columns** you get a soft warning. Nothing breaks, but wide reports get unwieldy fast. - Columns blocked by the one-record-per-row [row layout](#row-layout) are shown but not selectable, so you can see why a column you expected is unavailable. Column names map directly to [`columns`](https://wiki.trackandtrace.tools/reports/shaping/#specifying-field-names). ## Column headers Tabular formats only. By default each column gets a title-cased header derived from its name. Switch to **Custom names** to override any of them; a blank override keeps the default. This renames the header row only: the columns and their data are unchanged. It is for matching an existing spreadsheet's headers so a downstream formula keeps working. Headers cannot contain a comma The override list is comma-delimited with no escape syntax, so a comma inside a header would split it into two. The builder rejects it rather than producing a misaligned file. See [Renaming the Column Headers](https://wiki.trackandtrace.tools/reports/shaping/#renaming-the-column-headers). ## Sort Off by default. Turn it on to choose a field and a direction. The field list is limited to the columns the endpoint can actually sort on. Sorting applies **within** each license, not across them. See [Reporting Across Multiple Licenses](https://wiki.trackandtrace.tools/reports/output/#reporting-across-multiple-licenses). ## Filter Off by default. Each filter row is a field, an operator, and a value. Add as many as you need; once there are two or more, an **AND / OR** toggle decides how they combine. Each row becomes one `filter` parameter, spelled `field__operator:value`: ``` https://api.trackandtrace.tools/v2/packages/active/report?licenseNumber=LIC-00001&filter=locationName__eq:Bulk Storage&filterLogic=and&contentType=csv ``` The full operator list is in [Filtering and Sorting](https://wiki.trackandtrace.tools/reports/shaping/#filtering-and-sorting). Filtering is the best fix for an oversized report It brings the request back under its limits and gives you a more useful report besides. See [Report Request Too Large](https://wiki.trackandtrace.tools/reports/limits/#report-request-too-large). ## Options | Option | What it does | | ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Row limit** | Caps how many records the report returns. Excellent for testing a wide report before running it for real | | **Prepend report metadata** | On by default. Adds a header block describing the report to CSV, XLSX and Google Sheets output. **Turn it off when the output feeds a formula that expects column headers on row 1**. See [The Metadata Preamble](https://wiki.trackandtrace.tools/reports/output/#the-metadata-preamble) | | **Open in browser instead of downloading** | Renders the report in the tab instead of saving a file. For troubleshooting only; a large report can hang the tab it renders into. See [Downloading vs. Rendering](https://wiki.trackandtrace.tools/reports/output/#downloading-vs-rendering) | ______________________________________________________________________ ## Next Steps - Read the URL the form produces in [The Report Output Pane](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports-output/index.md). - The parameters behind each control: [Shaping a Report](https://wiki.trackandtrace.tools/reports/shaping/index.md). - Attach related records with [Super Reports](https://wiki.trackandtrace.tools/reports/super-reports/index.md). # The Report Output Pane ## The Report URL The URL is always visible, and it is shown broken apart rather than as one long string: the origin, the path, and then one row per query parameter with a short description of what that parameter does. Parameters that are invalid or missing are highlighted, so an incomplete report tells you which piece it is waiting for rather than silently producing a URL that does not work. The `secretKey` parameter is masked until you choose to reveal it. A finished report URL looks like this: ``` https://api.trackandtrace.tools/v2/packages/active/super/report?secretKey=YOUR_SECRET_KEY&licenseNumber=LIC-00001&include=labResults&rowMode=collapsed&columns=label,item.name,metadata.indexedLabResults.totalTHC.value&contentType=csv&prependCsvMetadata=false ``` Every part of it came from a control in the left column. ## Actions | Action | What it does | | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | **Generate Report** | Runs the report now and downloads it. Reads **Create & open sheet** for Google Sheets, and is replaced by a send panel when delivery is set to email | | **Save report** | Saves the current settings under a name. See [Saving a Report](#saving-a-report) | | **Copy report URL** | Copies the full URL, secret key included | | **Copy report URL w/ IMPORTDATA** | Copies the URL already wrapped in `=IMPORTDATA("…")`, ready to paste into a Google Sheets cell. Shown only for CSV with **Download** delivery | ## Data Preview The preview fetches up to **5 rows** and is available for every format, so you can check the shape of a report before running it in full. Two details worth knowing: - **XLSX and Google Sheets are previewed as CSV.** All three contain the same rows, and a preview should never create a real Google Sheet. - **The preview tells you when it is stale.** Change any setting after fetching and it marks itself out of date rather than showing you results from a configuration you have since edited. ______________________________________________________________________ ## Extra Columns Found in Your Data Some real columns cannot be known ahead of time. `metadata.indexedLabResults` has one column per test on your packages' lab results, so its columns depend on which tests your lab ran. The keys themselves are the same in every state; see [Lab Result Keys](https://wiki.trackandtrace.tools/t3-api/lab-result-keys/index.md). To find them, the column picker **samples 20 rows of your own data** and flattens the result. Columns discovered this way are marked, and the picker tells you how many it found. Three things follow: - **Discovery only ever adds.** The standard column list is available immediately and nothing is removed while sampling runs. If sampling fails, you get the standard list and a retry link. - **Results are cached for the session only**: per report and license and include combination. Analyte names are specific to a license and a point in time, so they are never persisted. - **Discovered columns are real columns.** They work in a saved report and in a spreadsheet formula exactly like any other. This is what makes a report like *"every active package with its Total THC"* buildable from the picker instead of by hand. ______________________________________________________________________ ## Saving a Report A saved report stores **settings, not a credential**. The secret key is stripped before the URL is stored, and the stored URL has no origin on it. That has a useful consequence: **a saved report keeps working when you rotate or revoke a secret key**, because the key was never part of it. Saved reports belong to your Metrc account, so anyone signing in as the same username sees the same list. To save one, use **Save report** and give it a name and an optional description. The panel opens inline beneath the URL so you can still see what you are saving. Once a saved report is loaded, the button becomes **Update**, with **Save as new** and **Rename** alongside it. Rename changes only the name and description. Closing Metrc forgets which saved report was loaded, so a reopened builder starts with a fresh form and a **Save report** button. | Limit | Value | | ------------------------- | ---------------- | | Saved reports per account | 100 | | Name | 200 characters | | Description | 2,000 characters | The same saved reports are available from the API. See [Saving a report](https://wiki.trackandtrace.tools/reports/delivery/#saving-a-report). ______________________________________________________________________ ## Scan Sheets Scan Sheets is its own builder rather than a report type, so choosing that category replaces the form. See [Scan Sheets](https://wiki.trackandtrace.tools/t3-chrome-extension/scan-sheets/index.md). ______________________________________________________________________ ## What Carries Over Between Sessions The builder remembers the settings that describe *how you work* and forgets the ones that describe *a particular report*, so reopening it never leaves you with a half-configured form you did not build. | Remembered | Forgotten | | ----------------------------------------------------------- | ----------------------------------- | | Your active secret key, or that you chose the temporary key | Selected licenses | | The last category you used | Column selection, filters, sort | | The last report you chose in each category | Row layout | | Format, delivery, row limit, metadata preamble | Which saved report was loaded | | | Preview data and discovered columns | For the temporary key, the builder remembers only that you chose it, never the key itself. ______________________________________________________________________ ## Limits These limits are specific to the builder: | Limit | Value | | ------------------------- | --------------------------- | | Preview rows | 5 | | Recommended column count | 16 (a warning, not a limit) | | Column discovery sample | 20 rows | | Saved reports per account | 100 | Limits on licenses, rows, includes and time, and what to do when you exceed one, are covered in [Limits and Troubleshooting](https://wiki.trackandtrace.tools/reports/limits/index.md). ______________________________________________________________________ ## Next Steps - Go back to the form in [Configuring a Report](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports-configuring/index.md). - Keep a spreadsheet live with [Spreadsheet Sync](https://wiki.trackandtrace.tools/t3-api/spreadsheet-sync/index.md). - If a report fails, match the message in [Limits and Troubleshooting](https://wiki.trackandtrace.tools/reports/limits/index.md). # T3 Reports **T3 Reports** is the report builder in the [T3 Chrome Extension](https://wiki.trackandtrace.tools/t3-chrome-extension/index.md). It exports Metrc data as CSV, JSON, Excel, or Google Sheets, either as a one-time snapshot or as a live view that a spreadsheet re-fetches on its own. The builder assembles a [T3 API report URL](https://wiki.trackandtrace.tools/reports/index.md), shows you a preview of the data it returns, and then hands you that URL. **The URL is the product.** You can open it, download it, email it, turn it into a Google Sheet, or paste it into a spreadsheet's `=IMPORTDATA()` formula so the sheet keeps itself up to date. See [Spreadsheet Sync](https://wiki.trackandtrace.tools/t3-api/spreadsheet-sync/index.md). Every setting in the builder corresponds to one query parameter on that URL. Nothing the builder does is unavailable to a script, and nothing a script can do to a report URL will confuse the builder; you can paste a URL you wrote by hand straight back into it. ## Opening T3 Reports Hover over the T3 button in the bottom right of Metrc and choose **T3 Reports** in the menu that opens, or open the toolbox and choose **T3 Reports** in its menu. To go straight to one report, press **Ctrl+K** (**Cmd+K** on a Mac) and type its name, as the **Report Type** menu names it: "superpackages active" finds the supercollection report of active packages, and "scan sheet incoming" the incoming scan sheet. Enter opens T3 Reports on that report's form. Reports there carry a T3+ badge: without T3+, choosing one opens the T3+ page instead. See [Keyboard Shortcuts](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#keyboard-shortcuts). To report on what a Metrc table is showing, use the **Generate report…** button at the right end of the [filter bar](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#filter) above the table instead. See [Starting from a Metrc table](#starting-from-a-metrc-table). The header links to a video walkthrough, to the [T3 API Reports](https://wiki.trackandtrace.tools/reports/index.md) reference, and to **Exports (Legacy)**, the older export tool documented under [Exports (Legacy)](https://wiki.trackandtrace.tools/t3-chrome-extension/exports/index.md). ## T3 Free and T3+ T3 Reports is a [T3+](https://wiki.trackandtrace.tools/t3-plus/index.md) feature. T3 Free users can open the builder and see how it works, but access to the reports themselves is limited. Full access comes with a [T3+ subscription](https://dash.trackandtrace.tools). ______________________________________________________________________ ## Authentication A report URL carries its own credential. This is not a shortcut: a browser following a link and a spreadsheet calling `IMPORTDATA` have no way to send an `Authorization` header, so the credential has to live in the URL. ### Secret key or temporary key The **Authentication** card offers two modes: | Mode | What it is | When to use it | | ----------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | | **Secret key** | A long-lived key generated once from your Metrc credentials and saved to your account | Anything you intend to keep: a saved report, a spreadsheet formula, a scheduled pull | | **Temporary key** | A short-lived key that expires on its own | Trying something out. No setup, but the URL stops working when the key expires | The builder shows which key is active by its last four characters and validates it in the background, so you find out that a key is wrong while you are building rather than when the report fails. Choosing the temporary key adds a standing warning under the generated URL. A temporary link is fine for a one-off download and useless in a spreadsheet. A report URL contains your credential Anyone holding the URL can read the Metrc data it returns. The builder masks the key in the URL breakdown by default and lets you reveal it deliberately. Do not paste a report URL into a shared document, a ticket, or a screenshot. ### Generating a secret key If you have no key yet, the builder offers to generate one. Your hostname and username are filled in for you and cannot be edited: a key belongs to the Metrc account you are signed in as. Two states need one extra field: | State | Extra field | Notes | | -------- | ------------------------------- | ---------------------------------- | | Colorado | Metrc login email | The email tied to your Metrc login | | Michigan | Multi-factor authentication key | The **key**, not a 6-digit code | Michigan: the key is not the code Metrc's MFA setup shows both a QR code and a manual-entry **key**. Enter the MFA setup key (the long string you would type into an authenticator app), not a 6-digit code. If you paste something that starts with six digits, the form tells you so. Getting the key means resetting MFA in Metrc, and a reset key has to be activated by logging into Metrc with it once before T3 can use it. The generate form walks through those steps. Keys can also be generated and managed outside the builder. See [Authentication](https://wiki.trackandtrace.tools/t3-api/authentication/index.md) and the [secret key page](https://api.trackandtrace.tools/v2/pages/secret-key). ______________________________________________________________________ ## Choosing What to Build ### Report categories Reports are grouped into four categories: | Category | What it produces | Trade-off | | --------------------------- | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | | **Manifest Reports** | Transfer manifests with their packages and transporters | The widest rows. See [transfer manifest reports](https://wiki.trackandtrace.tools/reports/endpoints/index.md) | | **Collection Reports** | Plain lists of Metrc records: packages, items, plants, harvests | The largest maximum size | | **Supercollection Reports** | Records with related data attached: packages with lab results, harvests with source plants, items with ingredients | More detail, smaller maximum size. See [Super Reports](https://wiki.trackandtrace.tools/reports/super-reports/index.md) | | **Scan Sheets** | Manifest packages laid out for barcode scanning | Google Sheets and Excel only. See [Scan Sheets](https://wiki.trackandtrace.tools/t3-chrome-extension/scan-sheets/#scan-sheets) | A category with no endpoints available to you is shown as **Coming soon** rather than hidden, so the set of categories does not change shape between accounts. The builder remembers the last category you used and the last report you chose *within each category*, so returning to a category puts you back where you left it. ### Starting from an existing report URL Paste a T3 report URL into the **Edit an existing report URL** box and the builder reopens with every setting filled in from it: report path, licenses, format, includes, row layout, columns, header overrides, filters, sort, row limit, delivery, and email. An entire spreadsheet formula works too. This is valid input: ``` =IMPORTDATA("https://api.trackandtrace.tools/v2/packages/active/report?licenseNumber=LIC-00001&contentType=csv&prependCsvMetadata=false") ``` If anything in the URL could not be applied exactly (a column that no longer exists, a format that does not support an option you asked for) the builder loads what it can and tells you what it changed. This is the fastest way to modify a report that is already running in a spreadsheet: paste the formula, change what you need, and copy the new formula back. ### Starting from a Metrc table The filter bar above a Metrc table has a **Generate report…** button. Its menu offers the table's reports: | Table | Menu | | --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | | Packages, plants, plant batches, harvests, sales, tags, tag orders, items, strains, locations | **Collection report**, **Supercollection report** | | Transfers | **Collection report**, **Manifest report** (the packages on the transfers) | Transfer templates have no report, so their tables have no **Generate report…** button. Picking one opens T3 Reports on that report, for the license you are on, with what the table shows: - **Its filters** become the report's filters. - **Its sort** (the first column it sorts by) becomes the report's sort. - **Its visible columns**, in the table's order, become the report's columns. A manifest report keeps its own columns, since its rows are packages rather than transfers. The format, delivery and key stay as you had them. A report can't always take everything a table shows. It filters and sorts on fewer columns than Metrc's table. For a package table, that means a package's own fields and four of its item's (name, category, strain and THC content), not the item's weights, volumes or CBD figures. Anything left out is listed under **Opened from the table, with some changes**. A filter that was left out means the report has rows the table hides, so check that list before you rely on the numbers. ### Starting from a saved report Your saved reports are listed with their names and descriptions and can be searched. Clicking one loads it into the builder, exactly as if you had pasted its URL. Rows can be renamed or deleted in place. See [Saving a Report](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports-output/#saving-a-report). ______________________________________________________________________ ## Next Steps - Fill in the form with [Configuring a Report](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports-configuring/index.md). - Use the result in [The Report Output Pane](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports-output/index.md). - Build the same request by hand with the [T3 API Reports](https://wiki.trackandtrace.tools/reports/index.md). # Tag Lists A tag list is a named list of tags on one of your licenses: package tags, plant tags, plant batch names, manifest numbers, and so on. T3 keeps it for you, so it's there in every browser, in the [OpenTag](https://wiki.trackandtrace.tools/opentag/index.md) app and in the [T3 API](https://wiki.trackandtrace.tools/t3-api/index.md). [Tag Lists in OpenTag](https://wiki.trackandtrace.tools/opentag/tag-lists/index.md) explains the list itself and its API. The T3 Chrome Extension lets you make a list, fill it, look through it and use it from wherever you meet a package, plant or transfer in Metrc: - the **Tag Lists** tool in the T3 toolbox - **Add to Scratchpad** and **Add to list…** in a row's menu and in T3 search - the **Ctrl+K** box - **Save as tag list…** above a Metrc table - the package picker in Merge Packages - Label Studio, which prints from a tag list Tag lists need T3+ The Tag Lists tool and every way to add to a list need [T3+](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/index.md). Without T3+, the tool shows what T3+ adds, with **Get T3+**, and the buttons that add to a list carry a T3+ badge and open the [T3+ page](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/#the-t3-page). A tag list is not a report A tag list holds tags, not columns of data, and there is no way to export or download one. To get your Metrc data into a spreadsheet, use [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/index.md). Reports may one day take a tag list as what they report on. ______________________________________________________________________ ## What a List Holds - **Each tag once.** Adding a tag that's already in the list changes nothing. Case and spaces around a tag don't count: `1a4…` is `1A4…`. - **One kind of object.** A list says what it holds, such as **Active packages** or **Flowering plants**. That's where T3 looks its tags up when it shows the list. A list saved from a table, a row or a picker holds what they show; in **New list**, you choose. - **Yours, or your license's.** A new list is private: only you see it. Share it with the license, and everyone who uses that license on your Metrc site can see it, and add and remove its tags. Only you can rename, share or archive a list you made. - **Archived, never deleted.** An archived list leaves your lists, keeping every tag, and you can bring it back. What T3 keeps as the tag depends on the kind of object: | Kind | Kept as | | --------------------------------------- | ---------------------------------------------------- | | Packages, plants, Metrc tags | The tag (for a transferred package, its package tag) | | Plant batches, harvests, items, strains | The name | | Transfers | The manifest number | ## Scratchpads A scratchpad is a list T3 keeps ready, so adding a tag takes one click. There is one for each kind of object: - **Scratchpad · Packages** - **Scratchpad · Plants** (mother plants too) - **Scratchpad · Plant batches** - **Scratchpad · Transfers** - **Scratchpad · Harvests** - **Scratchpad · Tags** A scratchpad is made, private, the first time you add something to it. It is an ordinary tag list, so you can rename, share or archive it like any other: archive it, and the next add makes a new one. Your scratchpads belong to you, your license and your browser. Every Metrc tab in the browser adds to the same ones. In another browser, or on another computer, you get scratchpads of your own, and a scratchpad from elsewhere shows as an ordinary list. To make any of your lists a scratchpad, use **Make it the Packages scratchpad** in its menu in the [Tag Lists tool](#your-lists). ## The Tag Lists Tool Open it from **Tag Lists** in the T3 toolbox's menu, from **Tools › Tags & Labels**, or from the [Ctrl+K box](#in-the-ctrlk-box). You can also [pin it](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#pinning) to the toolbox's home screen. The tool shows the lists of the license Metrc is on. To see another license's lists, switch Metrc to it. ### Your lists The tool opens on the license's lists, the most recently changed first: yours, and the ones coworkers share with the license. Under each name are its count, how many of its tags have been scanned (in OpenTag, for example), and what it holds: "12 packages · 3 scanned · Active packages". Labels beside the name mark: - **Scratchpad · Packages**: the list is your packages scratchpad in this browser. - **Shared by sam**: a coworker made it and shared it with the license. - **Shared**: you made it and shared it. - **Archived**. Click a list, or move to it with **↑** and **↓** (**Home** and **End** jump to the first and last) and press **Enter**, to open it. - **New list** opens a form above the lists: a **Name** (up to 200 characters), and **What it holds** (Active packages, unless you choose another). **Create** makes the list and opens it. - **Show archived** lists your archived lists instead. - **⋮** at the right end of a list you made opens its menu: **Rename**, **Share with the license** (or **Make private**), **Make it the Packages scratchpad** (or Plants, Harvests and so on, by what the list holds), and **Archive** (or **Unarchive**). A coworker's list has no menu. ### A list A list opens on what its tags are in Metrc right now: a card for each package, plant, transfer and so on, in the order the tags were added, each with the day it was scanned, if it was. **×** on a card takes it out of the list. **All lists** goes back. - **Show as** looks the list up as another kind of the same object, for this look only: a list of Active packages shown as **On hold packages**, for example, to find the packages that went on hold. The list says so: "Shown as On hold packages for now. The list still holds Active packages." - **Use in…** sends the list's tags to a tool that takes them. A list of packages goes to [Merge Packages](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/#picking-packages), whose picker opens on **Paste** with the tags already found and checked, and says what it couldn't find. A merge you've started asks before it's replaced. **Use in…** is greyed out while the list is empty. - **Add by paste** takes tags pasted from a spreadsheet, one a line, and tag ranges; or names, or manifest numbers, one a line, for a list of plant batches, harvests or transfers. **Add to list** adds them and looks the list up again. It says what happened: "Added 3 · 1 already in the list · 2 not tags". A list made in OpenTag may not say what it holds ("No collection" under its name). It opens as Active packages: choose another in **Show as**. ### When some tags can't be found A list shows only when T3 finds every tag exactly once in what it holds. A package that went on hold, was finished or left on a transfer is no longer an active package, so a list of Active packages can't show it. Instead of part of the list, you see which tags are the problem: "2 entries aren't in Active packages", each **Not found** or **Matches more than one**. - **Remove these 2** (or **Remove it**, for one) takes them out of the list, and the rest shows. - Or use **Show as** to look the list up as another kind, such as On hold packages. Until then, the list's tags show in a table, with **Remove** beside each. ## From a Row Menu or T3 Search The [row menu](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#row-menus) of a package, plant, mother plant, plant batch, transfer, harvest or Metrc tag has two more actions, and so does the same result in [T3 search](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#actions). They show on every package table but lab samples, on the transfer hub, and on the packages under a transfer's row. - **Add to Scratchpad · Packages** (or Plants, Plant batches, Transfers, Harvests, Tags) adds the row to that [scratchpad](#scratchpads), making it if this is the first add. A notification says "Added 1A4…0042 to Scratchpad · Packages", with **Undo**. **Alt+Enter** (**Option+Enter** on a Mac) presses it. When the tag was already there, it says "Already in Scratchpad · Packages", with **Open**. - **Add to list…** opens the Tag Lists tool on **Save 1A4…0042 to a list**: name a new list and click **Save as a new list**, or click one of your lists of packages to add it there. The tool then opens the list. A menu doesn't check whether the row is in a list already, and it has no **Remove**: adding a tag twice does nothing. To take a tag out again, click **Undo**, or remove it in the Tag Lists tool. With tag lists, **Add to Scratchpad** takes the place of **Add to label data list**: [Label Studio](#in-label-studio) prints from your scratchpad. ## Saving a Metrc Table as a Tag List **Save as tag list…**, on the [filter bar](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#filter) above a Metrc table and left of **Generate report…**, saves every row that matches the table's filters as a tag list. It shows on the tables of packages (not lab samples), plants and mother plants, plant batches, harvests, transfers, Metrc tags, items and strains. 1. Filter the table: **Item:Blue Dream 1g**, for example. 1. Click **Save as tag list…**. T3 reads the matching rows' tags, every page of them, and counts as it goes: "Reading 1,000 of 3,200 packages from T3…". **Cancel** stops it, and nothing is saved. 1. The Tag Lists tool opens on **Save 3,200 packages to a list**. A new list is named after the table and its filters ("Active packages · Item is Blue Dream 1g"): change the name if you like, and click **Save as a new list**. Or click one of your lists of packages to add the rows there. 1. **Up to 5,000 rows.** When more match, nothing is saved: "6,123 packages match. Narrow the table to 5,000 rows or fewer to save it as a tag list." 1. **Filters T3 can't apply** are named above the save, as [T3 Reports](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-reports/#starting-from-a-metrc-table) names them: "Not applied by T3: “Location contains A or Location contains B”. The list may hold rows the table doesn't show." Among them are filters set in Metrc's own column menus that the bar can't show as one of its filters. 1. **Nothing matching** saves nothing: "No packages match this table's filters, so there's nothing to save." The list holds the rows' tags only, not their columns or the table's sort. ## In Merge Packages' Picker Merge Packages' [package picker](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/#picking-packages) has a fourth mode, **Tag List**, after Quick Select, Paste and Browse. **Alt+4** (**Option+4** on a Mac) switches to it. - **Tag lists of active packages** lists your lists of active packages, and the ones coworkers share, the most recently changed first. Click one to pick its packages: T3 looks its tags up as **Paste** does, and the packages it finds show checked on the right. Under the lists, it says what it found ("Found 2 of 3 in Vault.") and lists the tags it didn't find (with **Copy**), the ones that matched more than one package, and the ones that aren't tags. Click the list again to look it up again. - With no lists yet, **Open Tag Lists** opens the tool. - **Package picker opens on** in [T3 Settings](https://wiki.trackandtrace.tools/t3-chrome-extension/getting-started/#t3-settings) doesn't offer Tag List, but **Last used** opens on it when it was the mode you used last. **Save as tag list…**, beside **All** and **None** at the top of the selected list, saves the checked packages as a tag list, from any mode. It opens **Save 12 packages as a tag list**: a new list, named "Active packages · Dec 1" until you change it, with **Save as a new list**, or one of your lists of packages to add them to. **×** closes it. ## In Label Studio With T3+, [Label Studio](https://wiki.trackandtrace.tools/t3-chrome-extension/label-studio/index.md) prints from a tag list. On the **Label Data** tab, **Load from Metrc**'s data type says what kind of list: packages for the package types (Active Superpackages, In-Transit Packages and so on), plants for Vegetative and Flowering Plants, plant batches for Active Plant Batches. - **The list** is that kind's [scratchpad](#scratchpads), or another of your lists chosen in **Tag list:**. A coworker's list reads "shared by sam". A list you choose lasts until the page reloads; the next time, Label Studio opens on the scratchpad again. To change the list it opens on, make another list the scratchpad in the Tag Lists tool: **Manage lists** opens it. - **Search Metrc**, and the paste box with **Add to list**, add to the list ("Added 2 · 1 already in the list"). **×** beside a tag removes it from the list. - **Load** looks each tag up in the data type you chose and loads the labels' data. It loads what it finds and names the tags it couldn't find, so a package that went on hold doesn't stop the rest from printing. It asks before replacing data you've already loaded. - **Add to Scratchpad** in a row's menu adds to the scratchpad Label Studio opens on, so what you add while you work in Metrc is there the next time you open it. The first time you open Label Studio with T3+ after tag lists arrived, the tags in its old list move into the scratchpad, and a notification says so: "Label Studio prints from tag lists now: your 12 tags are in Scratchpad · Packages". Without T3+, **Load from Metrc** has a T3+ badge, and shows what T3+ adds in place of Search Metrc and the tag box, with **Get T3+**. **Quick print label**, **Demo Packages**, **Import from File** and **Manual Entry** work as they did. ## In the Ctrl+K Box The [Ctrl+K box](https://wiki.trackandtrace.tools/t3-chrome-extension/primary-features/#keyboard-shortcuts) (**Cmd+K** on a Mac) finds: - **Tag Lists**, the tool. - **Your lists, by name.** Type part of a list's name, or the username of the coworker who shared it. The lists that match show under Tag Lists, with their count beside them ("12 packages · Shared by sam"). Tag Lists' row says how many lists there are: press **→** with it highlighted, or click the count, to see them all. Choosing a list opens it in the tool. - **New tag list**, which opens the tool on its New list form. Lists can't be pinned; the tool can. ## Keyboard Shortcuts - **Alt+Enter** (**Option+Enter** on a Mac) presses **Undo** on the notification an add shows. - **Alt+4** (**Option+4**) switches Merge Packages' picker to Tag List. - In the Tag Lists tool, **↑** and **↓** move through your lists, **Home** and **End** jump to the first and last, and **Enter** opens one. ______________________________________________________________________ ## Next Steps - Read what a tag list is, how scanning works and how to use lists from a script in [Tag Lists in OpenTag](https://wiki.trackandtrace.tools/opentag/tag-lists/index.md). - Scan a list on your phone with [OpenTag](https://wiki.trackandtrace.tools/opentag/index.md). - Pick packages for a merge in [Merge Packages](https://wiki.trackandtrace.tools/t3-chrome-extension/t3-plus-features/#picking-packages). - Print labels from a list in [Label Studio](https://wiki.trackandtrace.tools/t3-chrome-extension/label-studio/index.md). # OpenTag # T3 OpenTag ## Overview [Metrc](https://wiki.trackandtrace.tools/metrc/index.md) sells RFID tags to licensees, but does not provide those licensees with a working mobile app or RFID scanning of any kind. Third-party operators sell devices for RFID scanning, but they are expensive and require a high degree of vendor lock-in. OpenTag steps in to solve this problem. Cannabis operators should be able to scan their own Metrc tags with their own devices. ### Supported Devices OpenTag runs on iOS 13 or later and Android 7.0 or later. On a phone, OpenTag scans tag barcodes with the camera or a Bluetooth barcode scanner. OpenTag also runs on the [Chainway C72](https://www.barcode-arena.com/chainway-c72-rfid.html?), an Android handheld with a built-in UHF RFID reader and barcode scanner. RFID scanning is available only on the C72. Chainway C72 RFID Scanner ______________________________________________________________________ ## Getting Started OpenTag signs in with the same credentials you use for Metrc; there's no separate account to create. After install: 1. Download OpenTag on your iOS or Android device. 1. Sign in with your Metrc username, password, and state. 1. Select a license to work against. OpenTag reads Metrc with your login. Tag lists you create are saved to your T3 account, so a script or another device can read them. ______________________________________________________________________ ## Basic Features ### Search OpenTag lets you quickly look up any Metrc tag from your device. Search by package or plant tag to pull back the relevant Metrc record (item, quantity, location, and status) without logging into metrc.com. ### Tag Lists **Tag lists** are the core of OpenTag. A tag list is a set of Metrc tags grouped together for a specific purpose; for example, the contents of a room during an inventory check, or the packages that should be on a transfer manifest. Tag lists are used to: - **Check inventory**: compare a physical count against what Metrc says is on hand. - **Verify RFID tags**: scan a group of packages or plants and confirm each scanned tag belongs to the expected set. Anyone can open their existing tag lists. Creating a list, adding tags to it, and scanning tags against it need [T3+](https://wiki.trackandtrace.tools/t3-plus/index.md). As tags are scanned, OpenTag visually indicates which tags in the list have been accounted for and which have not. For the full reference (including API usage, the data model, and non-OpenTag use cases) see the [Tag Lists](https://wiki.trackandtrace.tools/opentag/tag-lists/index.md) page. ______________________________________________________________________ ## RFID Scanning OpenTag reads Metrc RFID tags on the [Chainway C72](https://www.barcode-arena.com/chainway-c72-rfid.html?), an Android handheld with a built-in UHF RFID reader. Install OpenTag on the C72 itself; OpenTag doesn't read RFID tags on a phone. The typical workflow: 1. Install OpenTag on the C72 and sign in. 1. Open a tag list in OpenTag (or start a new one). 1. Start a single or continuous RFID read to sweep nearby tags. Scanned tags stream into OpenTag and are checked against the active tag list. 1. Review matched, missing, and unexpected tags on-device. For background on how RFID works and its limitations in a Metrc environment, see the [RFID page](https://wiki.trackandtrace.tools/opentag/rfid/index.md) and [Metrc RFID Tags](https://wiki.trackandtrace.tools/metrc-tags/#metrc-rfid-tags). ______________________________________________________________________ ## Next Steps - Background on [Metrc](https://wiki.trackandtrace.tools/metrc/index.md) and [Metrc RFID tags](https://wiki.trackandtrace.tools/metrc-tags/#metrc-rfid-tags) - How [RFID](https://wiki.trackandtrace.tools/opentag/rfid/index.md) works, and its limitations in a Metrc environment - Subscribe to [T3+](https://wiki.trackandtrace.tools/t3-plus/index.md) to create and scan tag lists - [Start your free 30-day T3+ trial](https://dash.trackandtrace.tools) # What is RFID? RFID (Radio Frequency Identification) is a technology that uses radio waves to transfer data between an RFID tag and a reader, allowing for automated tracking and identification of items without requiring line-of-sight scanning. A UHF RFID chip. This is the frequency Metrc tags use, and the one this page is ultimately about ______________________________________________________________________ ## How Does RFID Work? RFID systems consist of three main components: an RFID tag, an RFID reader, and an antenna. At a high level, the process works as follows: 1. **RFID Tag**: An RFID tag contains an embedded microchip and an antenna. The microchip stores data (such as a unique identification number), and the antenna transmits this data when activated by a reader. 1. **RFID Reader**: The RFID reader emits a radio frequency signal through its antenna. When an RFID tag comes into the range of the reader's signal, the tag's antenna picks up the radio waves, powers the embedded microchip, and transmits the stored data back to the reader. 1. **Communication and Data Processing**: The reader captures the data from the tag and processes it. This data is often sent to a backend system, where it can be used for tracking, logging, or other operations. The entire process is quick and can be done over a distance, allowing for fast and efficient identification of items in various environments, from warehouses to retail stores. ______________________________________________________________________ ## RFID Frequencies and Tag Technology RFID operates at different frequencies, which affect its range, speed, and ability to pass through materials: 1. **Low-Frequency (LF)** (125-134 kHz): Offers a short read range (typically inches to a foot) and can penetrate materials like liquids and metals more effectively, but it transmits data slowly. Examples include pet microchips and keycard fobs. Low-Frequency RFID keyfob 1. **High-Frequency (HF)** (13.56 MHz): This frequency offers a slightly longer range (up to 3 feet) and faster data transfer than LF. Examples include contactless payment cards and Near Field Communication (NFC) scanning. High-Frequency RFID NFC chip read 1. **Ultra-High-Frequency (UHF)** (860-960 MHz): UHF RFID is the standard used in most industrial and inventory applications, including Metrc. UHF tags offer a long read range (up to 20-30 feet in optimal conditions), making them suitable for scanning large quantities of items at once. UHF tags are highly susceptible to interference from metal, liquids, and other environmental factors, which can cause read failures and reduce accuracy. Scanning a UHF RFID tag requires a high-power scanner. These scanners can be very expensive, often costing thousands of dollars. Ultra-High Frequency RFID chips ______________________________________________________________________ ## RFID Scanners RFID scanners, also known as RFID readers, are crucial components of an RFID system. They are responsible for communicating with RFID tags and collecting the data stored on them. There are several types of RFID scanners, each suited for different use cases and environments: 1. **Handheld RFID Scanners**: These scanners are portable and are typically used in warehouses, retail stores, and other locations where mobility is important. They can scan tags at different frequencies, depending on the type of tag being used. Handheld RFID Scanner 1. **Fixed RFID Readers**: Fixed readers are installed in a specific location, such as entry points in warehouses or production lines. They provide continuous scanning of tags that pass through their read range, making them ideal for automated tracking. Fixed RFID Reader 1. **Integrated RFID Readers**: These readers combine the reader and antenna in a single device, making them easy to install and use in various environments. They are commonly used in applications where space is limited or where a compact solution is needed. RFID scanners can be equipped with different types of antennas to suit the specific needs of the environment they are used in. The choice of scanner and antenna depends on factors such as the type of RFID tags being used, the required read range, and the physical environment. ______________________________________________________________________ ## Next Steps - Read about [how RFID works in Metrc](https://wiki.trackandtrace.tools/metrc-tags/#how-rfid-readers-scan-guns-work-in-metrc) - Background on [Metrc RFID tags](https://wiki.trackandtrace.tools/metrc-tags/#metrc-rfid-tags), the physical tags Metrc licensees actually scan - [OpenTag](https://wiki.trackandtrace.tools/opentag/index.md) scans Metrc tag barcodes on a phone, and reads RFID tags on the Chainway C72 handheld # Tag Lists ## Overview A **tag list** is a named, ordered set of [Metrc](https://wiki.trackandtrace.tools/metrc/index.md) tag handles with per-entry metadata. Tag lists are a T3-side grouping construct; they live inside the T3 platform and never write back to Metrc. A list can be [resolved](#resolving-a-tag-list) against a Metrc collection to fetch the objects its handles name. Tag lists are the primary unit of work in [OpenTag](https://wiki.trackandtrace.tools/opentag/index.md) and are also exposed as a set of endpoints in the [T3 API](https://wiki.trackandtrace.tools/t3-api/index.md), so the same list can be built on a phone, queried from a script, or edited from either. ______________________________________________________________________ ## Why a Tag List Holds Only Identifiers An entry stores a handle, not a copy of the object it names. **State changes, handles don't.** A package moves from active to inactive, goes on hold, or transfers to another license. A tag list never holds a stale copy of that state: [resolving](#resolving-a-tag-list) a list reads what Metrc says now. **Scans match directly.** A Metrc tag's barcode and RFID chip both return its 24-character UID (see [Metrc Tags and RFID](https://wiki.trackandtrace.tools/metrc-tags/index.md)). That UID is the handle for a package, plant or tag, so a scanned value checks against a list as-is. Transfers match on manifest number, and harvests, plant batches, items and strains match on name; see the table under [Resolving a Tag List](#resolving-a-tag-list). **Lists mirror how inventory is already grouped:** - the packages on a transfer manifest - plants harvested together - goods manufactured from one production batch of raw material - a run of unused Metrc tags **A list can name its collection.** Every list belongs to one license, and can record what its handles are with a `t3EndpointId`, such as `METRC_ACTIVE_PACKAGES`. Interfaces use it to show a list where it applies, and resolve reads it by default. Naming a collection doesn't lock the list to it: resolve against any collection to check what the list holds right now. ``` import requests BASE = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {T3_JWT}"} for t3_endpoint_id in ["METRC_ACTIVE_PACKAGES", "METRC_INACTIVE_PACKAGES"]: page = requests.get( f"{BASE}/v2/tag-lists/{tag_list_id}/resolve", headers=HEADERS, params={"t3EndpointId": t3_endpoint_id, "pageSize": 500}, ).json() # the first 500 entries; see Resolving a Tag List for longer lists missing = [item["handle"] for item in page["data"] if item["status"] != "FOUND"] if missing: print(t3_endpoint_id, "does not hold", missing) else: print(t3_endpoint_id, "holds every entry") ``` ______________________________________________________________________ ## How Tag Lists Are Built Tag lists can be built in two ways. **One at a time.** Start with an empty list, then add entries as you encounter them; for example, scanning package tags with a phone or an RFID reader, or `POST`ing entries to the API one by one as they come in from another system. **Bulk-generated from an existing source.** Populate a list in a single request from data you already have; for example, the package list from a transfer manifest, the rows of a Metrc report, or a CSV of handles. A list can also be seeded with entries at creation time and added to later. The two paths are not mutually exclusive. A common pattern is to seed a list from a manifest, then scan physical tags against it to verify the shipment. ______________________________________________________________________ ## How Tag Lists Are Used ### Checking Off Inventory Each entry has a nullable `scannedAt` timestamp. Marking an entry as scanned (setting `scannedAt`) is how tag lists record that a physical tag has been accounted for, and `scannedBy` records who scanned it. The standard workflow: 1. Create a list and populate it with the tags you expect to see. 1. As you scan, send the handles to the bulk scan endpoint (`POST /v2/tag-lists/{id}/scan`). It stamps every matching entry in one call and returns any handles that weren't in the list. It ignores case and surrounding whitespace. 1. Read the list back. Its `scannedCount` tells you how many entries are accounted for. ### Membership Lookup Given a handle, is it in this list? Pass it to `GET /v2/tag-lists/{id}/entries` as `handle`, repeated for up to 200 handles. Only the entries for those handles come back. This powers workflows like "did this package ship on manifest X?" or "is this plant part of the harvest batch I'm auditing?". ### Working a List Together A list is private to the user who created it by default. Set `visibility` to `LICENSE` to share it with everyone on the same Metrc hostname whose account has access to its license. They can read it, add and remove entries, and scan, so a team can check off one shipment from several phones. See [Visibility](#visibility). ### Other Use Cases Beyond inventory check-offs and membership, tag lists are useful for: - **Reconciliation.** Build a list of what Metrc says is on hand, then bulk scan what's physically present. `handlesNotFound` is what's on the floor but not in the list; entries left unscanned are what's missing. - **Pre-transfer checks.** Assemble the packages intended for an outgoing transfer, then [resolve](#resolving-a-tag-list) the list against `METRC_ACTIVE_PACKAGES` to confirm every one is an active package before you create the transfer. - **Audit trails.** Per-entry `scannedAt` and `scannedBy` plus arbitrary `metadata` give you a dated record of what was accounted for, which survives after the physical work is done. They hold the latest scan only. - **Narrowing other workflows.** Resolving a list against a `/super` collection returns exactly the objects you care about, with related data attached through `include`, in place of filtering a whole collection. ______________________________________________________________________ ## Anatomy of a Tag List A tag list has two layers: the list itself, and the entries inside it. **List-level fields:** - `id`: the list's UUID. - `licenseNumber`: the license the list belongs to. - `name`: a label ("Room A inventory", "Manifest M-0123"). Required, and editable later. - `visibility`: `USER` or `LICENSE` (see [Visibility](#visibility)). - `t3EndpointId`: the collection the handles belong to, as a [T3 endpoint id](https://wiki.trackandtrace.tools/t3-api/t3-endpoint-ids/index.md), or `null`. - `metadata`: a freeform JSON object for the list, returned exactly as you stored it. - `archivedAt`: when the list was archived, or `null` (see [Archiving](#archiving)). - `entryCount`, `scannedCount`: summary counts. `scannedCount` is the number of entries whose `scannedAt` is set. - `createdAt`, `createdBy`: when the list was created, and the Metrc username that created it. - `updatedAt`: the list's latest activity, entry changes and scans included. **Entry-level fields:** - `handle`: the tag string itself (for example a Metrc package label). - `name`: an optional label describing what the row is ("Vault shelf 3", "Top drawer"). - `metadata`: a freeform JSON object (see [Entry Metadata](#entry-metadata)). - `scannedAt`, `scannedBy`: the latest scan, and who made it (see [The `scannedAt` Field](#the-scannedat-field)). - `createdAt`, `createdBy`: when the entry was added, and by whom. Entries come back in the order they were added, and an entry is addressed by its handle. ### Entry Metadata Every entry carries a `metadata` object that accepts any JSON. Typical uses: - **Display hints**: a color or icon name so the UI can group entries visually. - **Contextual notes**: free text the scanner entered on-device. - **Source tracking**: where the handle came from (`{"source": "manifest-M-0123"}`), which makes it easy to filter later. - **Workflow state**: anything downstream tooling needs to remember between runs. Metadata is opaque to the T3 API: it stores and returns whatever you put in. Treat it as a small per-entry scratchpad. ### The `scannedAt` Field `scannedAt` is the field that makes the inventory check-off workflow possible. It starts out `null`. [Bulk scan](#checking-off-inventory) sets it on many entries at once. To set or clear it on particular entries, send them to `POST /v2/tag-lists/{id}/entries` with `scannedAt`: a timestamp to mark them, `null` to undo. Either way `scannedBy` follows: you when a time is set, `null` when it is cleared. Scanning an entry again overwrites the earlier time and scanner. ______________________________________________________________________ ## One Entry per Handle A list holds each handle once. Handles match ignoring case and surrounding whitespace, so `1a4...` and `1A4...` are the same entry. Adding a handle that is already in the list updates the entry instead of adding another: the fields you send replace the stored ones, and fields you leave out keep their values. The response counts both: `created` for new handles and `updated` for ones already there. A request that names the same handle twice is rejected with a `400` listing the repeats. ______________________________________________________________________ ## Visibility | | `USER` list (default) | `LICENSE` list | | -------------------------------------------------------------------------------------- | --------------------- | ---------------------------------- | | Its creator | Everything | Everything | | Someone else on the same Metrc hostname whose account has access to the list's license | Not visible | Read, add and remove entries, scan | | Anyone else | Not visible | Not visible | Only the creator can rename a list, change its `visibility`, `t3EndpointId` or `metadata`, or archive it. Another user who can see the list gets a `403` for those; a user who can't see it gets a `404`. You can only share a list with a license your own account has access to. ______________________________________________________________________ ## Archiving Lists cannot be deleted; they're archived. `PATCH /v2/tag-lists/{id}` with `archived: true` hides the list from the default listing but keeps every entry intact and still retrievable by ID. `GET /v2/tag-lists?archived=true` returns only archived lists. `archived: false` restores it. Archiving is a convenient way to close out a completed inventory run or shipment verification without losing the record. ______________________________________________________________________ ## Access and Pricing You see your own lists, plus `LICENSE` lists shared under licenses your account has access to. **Reads are free.** Listing lists, reading a list, and reading its entries work on any Metrc login without a T3+ subscription. **Writes require T3+.** Creating, renaming, sharing and archiving lists, adding and removing entries, and bulk scanning all require a T3+ subscription. **Resolving requires T3+.** Resolving a list reads Metrc, so it requires a T3+ subscription. **Extracting COA results requires T3+.** Checking extraction status is free. ______________________________________________________________________ ## Using Tag Lists via the T3 API Every tag list endpoint is documented in the interactive API docs under the **Tag Lists** tag: **** | Method | Path | Does | | ------------- | ----------------------------------- | ----------------------------------------------------------------- | | `GET` | `/v2/tag-lists` | The lists you can see under a license, with counts | | `POST` | `/v2/tag-lists` | Create a list, optionally seeded with `entries` | | `GET` | `/v2/tag-lists/{id}` | One list, with counts | | `PATCH` | `/v2/tag-lists/{id}` | Rename, share, name a collection, or archive | | `GET` | `/v2/tag-lists/{id}/entries` | Entries in the order added, or only the `handle`s named | | `POST` | `/v2/tag-lists/{id}/entries` | Add entries, or update ones already in the list | | `DELETE` | `/v2/tag-lists/{id}/entries` | Remove entries by handle | | `POST` | `/v2/tag-lists/{id}/scan` | Mark entries scanned by handle | | `GET` | `/v2/tag-lists/{id}/resolve` | Entries in the order added, each with its Metrc object and status | | `POST`, `GET` | `/v2/tag-lists/{id}/coa-extraction` | Schedule COA extraction, and check on it | Only listing lists and creating one take a `licenseNumber`. Every other request names the list by its `id`, which already belongs to a license. Listing lists, reading entries and resolving page by cursor: send each response's `nextCursor` as `cursor` while `hasMore` is true. `pageSize` defaults to 100 and is capped at 500. Lists with the most recent activity come first; entries come in the order added, and a list's `entryCount` says how many it holds. A minimal Python example covering the end-to-end check-off flow: ``` import requests BASE = "https://api.trackandtrace.tools" HEADERS = {"Authorization": f"Bearer {T3_JWT}"} # 1. Create a list of active packages, seeded with one handle. tag_list = requests.post( f"{BASE}/v2/tag-lists", headers=HEADERS, json={ "licenseNumber": "LIC-00001", "name": "Manifest M-0123", "t3EndpointId": "METRC_ACTIVE_PACKAGES", "entries": [{"handle": "1A4..."}], }, ).json()["data"] tag_list_id = tag_list["id"] # 2. Add another handle. requests.post( f"{BASE}/v2/tag-lists/{tag_list_id}/entries", headers=HEADERS, json={"entries": [{"handle": "1A5...", "metadata": {"source": "manifest-M-0123"}}]}, ) # 3. Mark scanned handles in a single call. result = requests.post( f"{BASE}/v2/tag-lists/{tag_list_id}/scan", headers=HEADERS, json={"handles": ["1A4...", "1A5...", "UNKNOWN..."]}, ).json() print(result["data"]) # {"scanned": 2, "scannedAt": "...", "handlesNotFound": ["UNKNOWN..."]} ``` Correcting entries and closing out a list: ``` # Undo a scan. requests.post( f"{BASE}/v2/tag-lists/{tag_list_id}/entries", headers=HEADERS, json={"entries": [{"handle": "1A5...", "scannedAt": None}]}, ) # Remove an entry. requests.delete( f"{BASE}/v2/tag-lists/{tag_list_id}/entries", headers=HEADERS, json={"handles": ["1A5..."]}, ) # Share the list with the license, then archive it once the run is done. requests.patch(f"{BASE}/v2/tag-lists/{tag_list_id}", headers=HEADERS, json={"visibility": "LICENSE"}) requests.patch(f"{BASE}/v2/tag-lists/{tag_list_id}", headers=HEADERS, json={"archived": True}) ``` ______________________________________________________________________ ## Resolving a Tag List Resolving pages through a list's entries and returns each one with the Metrc object its handle names, read under the list's license. Choose the collection with `t3EndpointId`, or leave it out to use the list's own. ``` def resolve_all(tag_list_id, t3_endpoint_id): """Every entry with its status and object, page by page.""" items, cursor = [], None while True: page = requests.get( f"{BASE}/v2/tag-lists/{tag_list_id}/resolve", headers=HEADERS, params={"t3EndpointId": t3_endpoint_id, "cursor": cursor}, ).json() items += page["data"] if not page["hasMore"]: return items cursor = page["nextCursor"] items = resolve_all(tag_list_id, "METRC_ACTIVE_PACKAGES") packages = [item["object"] for item in items if item["status"] == "FOUND"] problems = [(item["handle"], item["status"]) for item in items if item["status"] != "FOUND"] print(problems) # [("1A4...", "NOT_FOUND")] ``` - **Every entry comes back.** Each item is the entry, as `/entries` returns it, plus `status`, `matchCount` and `object`. `status` is `FOUND`, `NOT_FOUND`, or `AMBIGUOUS` when more than one object has the handle. `object` is null unless the entry was found. - **Forgiving matches.** Case and surrounding whitespace are ignored. - **Just the tags you scanned.** Repeat `handle`, up to 200, to resolve only those entries. - **Extras.** Resolve against a `/super` collection, such as `METRC_ACTIVE_SUPERPACKAGES`, with `include` to attach related data, and use `collectionMask` to trim fields. A `/super` page holds at most 50 entries. | Collection | Matches on | | --------------------------------------------------------------------------------------------------------------- | ---------------- | | `/v2/packages/active`, `onhold`, `inactive`, `intransit` | `label` | | `/v2/packages/transferred` | `packageLabel` | | `/v2/plants/vegetative`, `flowering`, `onhold`, `inactive`, `mother/active`, `mother/onhold`, `mother/inactive` | `label` | | `/v2/plantbatches/active`, `onhold`, `inactive` | `name` | | `/v2/tags/available`, `used`, `voided` | `label` | | `/v2/transfers/incoming/active`, `incoming/inactive`, `outgoing/active`, `outgoing/inactive`, `rejected`, `hub` | `manifestNumber` | | `/v2/harvests/active`, `onhold`, `inactive` | `name` | | `/v2/items` | `name` | | `/v2/strains` | `name` | Every collection above also accepts its `/super` collection. [T3 Endpoint IDs](https://wiki.trackandtrace.tools/t3-api/t3-endpoint-ids/index.md) lists the id of each. ### Resolve or Report? Resolve pages through a list for code that works entry by entry: a scanner app, a check before a transfer. To get the whole list at once, in a spreadsheet, a file or an email, pass `tagListId` to that collection's [report](https://wiki.trackandtrace.tools/reports/shaping/#scoping-a-report-to-a-tag-list): `https://api.trackandtrace.tools/v2/packages/active/report?licenseNumber=LIC-00001`**`&tagListId=3f6c1e2a-9b4d-4f7e-8a21-5c0d7e9b1234&contentType=xlsx`** The report returns one row per entry, in list order, and fails with a `422` naming every entry that is not exactly one package. Resolve tells you which entry is which; the report succeeds only when the whole list matches. ______________________________________________________________________ ## Extracting COA Results A package's lab results link to COA PDFs. T3 can read those PDFs into structured results, `metadata.indexedCoaResults`, keyed exactly like `indexedLabResults`. Reading a PDF takes about a minute, so it happens ahead of time: schedule a tag list, wait for it, then request the results. ``` import time def schedule(): response = requests.post( f"{BASE}/v2/tag-lists/{tag_list_id}/coa-extraction", headers=HEADERS, json={"t3EndpointId": "METRC_ACTIVE_PACKAGES"}, ) response.raise_for_status() return response.json()["data"] # 1. Schedule every COA the list's packages reference. print(schedule()) # {"scheduledCount": 40, "alreadyScheduledCount": 47, ...} # 2. Wait until every package is READY. A COA whose download gave up # returns to NOT_SCHEDULED; scheduling again picks it back up. while True: time.sleep(30) packages = requests.get( f"{BASE}/v2/tag-lists/{tag_list_id}/coa-extraction", headers=HEADERS, ).json()["data"]["packages"] statuses = {package["status"] for package in packages} if statuses <= {"READY", "NO_DOCUMENTS"}: break if "NOT_SCHEDULED" in statuses: schedule() # 3. Read the results: the list's packages, scoped by a super report. packages = requests.get( f"{BASE}/v2/packages/active/super/report", headers=HEADERS, params={ "licenseNumber": "LIC-00001", "tagListId": tag_list_id, "include": "coaResults", "contentType": "json", }, ).json()["data"] print(packages[0]["metadata"]["indexedCoaResults"]["totalTHC"]["full"]) # "Total THC: 25.32 %" ``` - **Which packages.** `t3EndpointId` names active, inactive, on hold or in transit packages, either the plain or the `/super` collection, or leave it out to use the list's own. Lab results come from the `/super` collection, so that is the one read. - **Each COA is read once.** Many packages share a COA. A document already scheduled or read, by anyone, is never read again, so scheduling the same list twice schedules nothing new beyond COAs that returned to `NOT_SCHEDULED`. - **Strict.** An entry that is not exactly one package fails with a `422` listing it, and nothing is scheduled. Up to 500 entries. - **Rate limited.** At most 10 schedule requests per minute per T3+ subscription; more return `429`. - **Status follows the last schedule.** Status reports the packages the latest schedule request resolved, whoever sent it. Entries added since appear after you schedule again. - **Final results only.** Revoked and unreleased lab results are ignored. - **The include never waits.** `include=coaResults` on a package supercollection, super report or resolve returns `409 COA_EXTRACTION_REQUIRED` if any package on the page has a COA that is not read yet, and returns nothing else. - **Unreadable COAs.** A COA that cannot be read is marked `FAILED` and contributes no results. It does not block the include. - **Shareable PDFs.** Every stored COA has a `publicPdfUrl` that needs no login and never expires, so it can go on a label as a QR code. See [Supercollection Includes](https://wiki.trackandtrace.tools/t3-api/supercollection-includes/#coa-results) for the shape of the results. ______________________________________________________________________ ## Using Tag Lists in OpenTag On mobile, tag lists are the OpenTag app's central feature. OpenTag creates and edits the same tag lists the T3 API exposes, so a list scanned on-device can be read back from a script, and vice versa. See the [OpenTag](https://wiki.trackandtrace.tools/opentag/index.md) page for the device workflow. ## Using Tag Lists in the T3 Chrome Extension The [T3 Chrome Extension](https://wiki.trackandtrace.tools/t3-chrome-extension/index.md) works with the same lists on Metrc's own pages: add a package from its row menu, save a filtered Metrc table as a list, look a list up in Metrc, pick a merge's packages from one, and print labels from one. See [Tag Lists in the extension](https://wiki.trackandtrace.tools/t3-chrome-extension/tag-lists/index.md). ______________________________________________________________________ ## Next Steps - Read the [OpenTag](https://wiki.trackandtrace.tools/opentag/index.md) page for the mobile scanning workflow that drives tag lists. - Make and use tag lists on Metrc's pages with the [T3 Chrome Extension](https://wiki.trackandtrace.tools/t3-chrome-extension/tag-lists/index.md). - Browse the [T3 API documentation](https://wiki.trackandtrace.tools/t3-api/index.md) for how to integrate tag lists into scripts and automations. - Subscribe to [T3+](https://wiki.trackandtrace.tools/t3-plus/index.md) to unlock tag list writes and OpenTag's premium features. - Try the [interactive API docs](https://api.trackandtrace.tools/v2/docs/#/Tag%20Lists) to explore every tag list endpoint. - Example script: [`basics/tag-lists.py`](https://github.com/classvsoftware/t3-api-examples/blob/master/basics/tag-lists.py) (turn a CSV column of tag labels into package records).