Skip to main content

t3api-utils

A Python library and t3api command for the T3 API (Track & Trace Tools), which serves Metrc cannabis-compliance data. It handles login and secret keys, loads whole collections, sends writes safely (dry run unless you say otherwise), downloads server-side reports and builds tag lists.

Documentation: https://classvsoftware.github.io/t3api-python-utils/

2.0 is a rewrite and doesn't share an API with 1.x. See Migrating from 1.x. 1.x is frozen at 1.5.0.

Install

Python 3.12 or later.

uv add t3api-utils
pip install "t3api-utils[tui]"    # [tui] adds the terminal row inspector

Quickstart

Log in once. This creates a T3 secret key from your Metrc login and saves it to your OS keyring; your Metrc password isn't stored.

t3api login

Then, in a script:

import t3api_utils as t3

client = t3.connect()
items = client.collect("METRC_ACTIVE_ITEMS", license="LIC-00001")
t3.to_csv(items, "items.csv")

For scheduled jobs and CI, set T3_SECRET_KEY instead of logging in.

A few more things it does:

# Writes are a dry run unless submit=True
client.post("/v2/items/discontinue", license="LIC-00001", json={"id": 12345}, submit=True)

# Validate every row, then submit
client.bulk("/v2/items/discontinue", rows=[{"id": i["id"]} for i in items], license="LIC-00001", submit=True)

# Server-side report straight to a file
client.report("ITEMS_REPORT", licenses=["LIC-00001"], to="items.xlsx")

# A column of tag labels to full package records
tl = client.tag_lists.from_csv("labels.csv", column="label", license="LIC-00001",
                               endpoint="METRC_ACTIVE_PACKAGES")
packages = tl.resolve()

The t3api command

t3api login                                                   # save a secret key to a profile
t3api pull METRC_ACTIVE_PACKAGES -l LIC-00001 -o packages.csv # a whole collection to CSV or JSON
t3api report ITEMS_REPORT -l LIC-00001 -o items.xlsx          # a server-side report
t3api endpoints harvest --kind collection                     # search the T3 spec
t3api keys list                                               # manage secret keys

t3api --help lists every command.

Development

uv sync
uv run pytest
uv run mypy
uv run mkdocs serve

See CLAUDE.md for the project layout and conventions, and CHANGELOG.md for release notes.

License

GPL-3.0-only.

Metadata

Release files for t3api-utils 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for t3api-utils 2.0.0
File Size Uploaded Provenance Actions
t3api_utils-2.0.0.tar.gz 273.3 kB With provenance Details for t3api_utils-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for t3api-utils 2.0.0
File Interpreter ABI Platform Actions
t3api_utils-2.0.0-py3-none-any.whl Python 3 none any Details for t3api_utils-2.0.0-py3-none-any.whl

Total release size: 554.7 kB

Release files / t3api_utils-2.0.0.tar.gz

Download URL t3api_utils-2.0.0.tar.gz
Size 273.3 kB
Tags Source
SHA-256 checksum
How to use checksums
de9f1e0c94482641b6c6474e22c0fd21f85a0a8be5ef5f338cf8c65c358e452f
BLAKE2b-256 checksum
How to use checksums
c37592f8b344f76fc7325b2651604dfb65bcdd66e5c791a3b9d36bfd7fc25bc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / t3api_utils-2.0.0-py3-none-any.whl

Download URL t3api_utils-2.0.0-py3-none-any.whl
Size 281.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a607ae9c7c8a2ad6011c042aa6f382d228ca0937289088811ce3c19c5dd85c8
BLAKE2b-256 checksum
How to use checksums
3b681272aa985096cff9f66365efe5d794b262c41b5ee3d0b37c03c14e01330a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for t3api-utils 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for t3api_utils-2.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page