Tag Lists¶
Overview¶
A tag list is a named, ordered set of Metrc 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 against a Metrc collection to fetch the objects its handles name.
Tag lists are the primary unit of work in OpenTag and are also exposed as a set of endpoints in the T3 API, 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 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). 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.
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 POSTing 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:
- Create a list and populate it with the tags you expect to see.
- 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. - Read the list back. Its
scannedCounttells 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.
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.
handlesNotFoundis 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 the list against
METRC_ACTIVE_PACKAGESto confirm every one is an active package before you create the transfer. - Audit trails. Per-entry
scannedAtandscannedByplus arbitrarymetadatagive 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
/supercollection returns exactly the objects you care about, with related data attached throughinclude, 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:USERorLICENSE(see Visibility).t3EndpointId: the collection the handles belong to, as a T3 endpoint id, ornull.metadata: a freeform JSON object for the list, returned exactly as you stored it.archivedAt: when the list was archived, ornull(see Archiving).entryCount,scannedCount: summary counts.scannedCountis the number of entries whosescannedAtis 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).scannedAt,scannedBy: the latest scan, and who made it (see ThescannedAtField).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 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:
https://api.trackandtrace.tools/v2/docs/#/Tag%20Lists
| 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 handles 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
/entriesreturns it, plusstatus,matchCountandobject.statusisFOUND,NOT_FOUND, orAMBIGUOUSwhen more than one object has the handle.objectis 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
/supercollection, such asMETRC_ACTIVE_SUPERPACKAGES, withincludeto attach related data, and usecollectionMaskto trim fields. A/superpage 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 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://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.
t3EndpointIdnames active, inactive, on hold or in transit packages, either the plain or the/supercollection, or leave it out to use the list's own. Lab results come from the/supercollection, 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
422listing 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=coaResultson a package supercollection, super report or resolve returns409 COA_EXTRACTION_REQUIREDif 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
FAILEDand contributes no results. It does not block the include. - Shareable PDFs. Every stored COA has a
publicPdfUrlthat needs no login and never expires, so it can go on a label as a QR code.
See Supercollection Includes 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 page for the device workflow.
Using Tag Lists in the T3 Chrome Extension¶
The T3 Chrome Extension 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.
Next Steps¶
- Read the OpenTag page for the mobile scanning workflow that drives tag lists.
- Make and use tag lists on Metrc's pages with the T3 Chrome Extension.
- Browse the T3 API documentation for how to integrate tag lists into scripts and automations.
- Subscribe to T3+ to unlock tag list writes and OpenTag's premium features.
- Try the interactive API docs to explore every tag list endpoint.
- Example script:
basics/tag-lists.py(turn a CSV column of tag labels into package records).