What's new in 0.2
Health checks, carrier name resolution, webhook updates and secret rotation, typed events, request hooks and new error classes.
Version 0.2.0 of the API and libraries adds features and changes nothing that worked in 0.1. Upgrade the package and your code keeps running.
Language | Package | 0.2 |
|---|---|---|
TypeScript |
| 0.2.0 |
Python |
| 0.2.0 |
Go |
| v0.2.0 |
Ruby |
| 0.2.0 |
PHP |
| 0.2.0 |
Health check
GET /v1/health needs no API key and isn't rate limited. It returns 200 {"status": "ok"}, or 503 {"status": "degraded", "checks": {...}} when part of the service is down. The libraries call it with health(). A 503 raises APIError.
Carrier names
carrier on a create now takes free text as well as our id: "USPS Priority Mail", "FedEx SmartPost", "Correos de España", or another provider's slug such as "dhl_express" or "royal-mail". Matching ignores case, accents and punctuation. The tracking stores, and returns, our id. A name we can't resolve with confidence 0.8 or more fails with 422 carrier_not_supported, as before.
To look a name up without creating anything, call GET /v1/carriers/resolve?name=:
{ "carrier": "usps", "name": "USPS", "confidence": 0.97, "matched": "alias" }matched is id, alias, name, provider_slug or prefix. A carrier we don't serve returns {"carrier": null, "confidence": 0}, and the libraries' resolve returns null. Each carrier from GET /v1/carriers now lists its aliases, and carries display_name (the older displayName is still sent, and deprecated).
Webhook updates and secret rotation
PATCH /v1/webhooks/{id}changesurl,event_typesorenabled. The secret stays the same. A webhook withenabled: falsereceives nothing.POST /v1/webhooks/{id}/rotate-secretreturns a new secret, once. The old secret keeps working forexpires_in_hours(default 24, at most 168;0drops it at once). Until then each delivery carries two signatures. See Verifying webhooks.
Verification reasons and several secrets
Verification now says why it failed: missing (no header or no secret), malformed (no t or v1, a non-numeric t, bad hex), timestamp (outside the tolerance) or mismatch (no signature matches). constructEvent raises SignatureVerificationError with a reason, and a new verifyDetailed returns {valid, reason}. A header may carry several v1= values, and you can pass several secrets: the request is valid if any pair matches.
Typed events
Events are typed by type. tracking.status_changed carries {tracking, previous_status, current_status}; the others carry the tracking. trackingOf(event) returns the tracking for any type.
One exception: a tracking.exception sent because we couldn't reach the carrier carries {tracking_id, error}, not a tracking. Check for tracking_id before you rely on trackingOf.
Errors
QuotaExceededErrorfor402 quota_exceeded.ConflictErrorfor409, includingidempotency_in_progress.ConnectionErrornow has acode:timeoutorconnection.
A timeout means the outcome is unknown
After a timeout, the request may or may not have reached us. For a create, retry with the same idempotency key: you get the tracking the first request made, or a new one if it never arrived. The libraries do this on their own retries.
Request hooks
Every client takes two callbacks, called once per attempt, for logging and metrics:
onRequestgets the method, URL, attempt number and idempotency key.onResponsegets the same plus the status,request_id, whether the response was an idempotent replay, the duration, and the typed error when the status is 400 or more or the connection failed.
A hook that throws is ignored and never breaks the request.
Smaller changes
The base URL can be
https://api.trackified.netorhttps://api.trackified.net/v1, with or without a trailing slash.eventsis always newest first, sorted byoccurred_at. Events with no time keep the carrier's order, after the dated ones. The API guarantees this.dateon events is deprecated. It's sent until 2027-06-01 and removed after that. Useoccurred_at.
Names in each library
TypeScript | Python | Go | Ruby | PHP | |
|---|---|---|---|---|---|
Health |
|
|
|
|
|
Resolve a carrier name |
|
|
|
|
|
Update a webhook |
|
|
|
|
|
Rotate the secret |
|
|
|
|
|
Verify with a reason |
|
|
|
|
|
Several secrets | pass an array | pass a list |
| pass an array | pass an array |
Tracking of any event |
|
|
|
|
|
Request hooks |
|
|
|
|
|
Hook attempt numbers start at 0 in TypeScript and at 1 in the other libraries.
Each library page shows these in context.