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.
Your first report¶
Every report is one authenticated GET. This pulls every active package on a license into a CSV:
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.8"
# dependencies = [
# "httpx",
# ]
# ///
"""Download every active package on a license as CSV."""
import csv
import io
import httpx
SECRET_KEY = "YOUR_SECRET_KEY"
LICENSE_NUMBER = "EX-00001"
response = httpx.get(
"https://api.trackandtrace.tools/v2/packages/active/report",
params={
"licenseNumber": LICENSE_NUMBER,
"contentType": "csv",
"prependCsvMetadata": "false",
},
headers={"X-T3-API-Key": SECRET_KEY},
timeout=120.0,
)
response.raise_for_status()
rows = list(csv.DictReader(io.StringIO(response.text)))
print(f"{len(rows)} active packages")
Generate a secret key at the secret-key page. See Authentication for the alternatives.
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 for the caps and how to stay under them.
You do not have to build these URLs by hand
T3 Reports 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. 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.
- Narrow what comes back with Shaping a Report.
- Choose a format and a destination in Output and Delivery Format and Delivering a Report.
- Attach related records with Super Reports.
- Copy a working script from Report Examples.