Libraries
Official Trackified clients for TypeScript, Python, Go, Ruby and PHP.
Each library wraps the whole API: trackings, carriers, webhooks, webhook deliveries, API keys and usage. They all work the same way, so this page covers what they share. Each language page has install steps and a full example.
The source for each is on GitHub under github.com/trackified.
Client options
Every client reads the API key from TRACKIFIED_API_KEY and the API host from TRACKIFIED_BASE_URL (default https://api.trackified.net). You can pass both in code instead.
Option | TypeScript | Python | Go | Ruby | PHP | Default |
|---|---|---|---|---|---|---|
API key |
|
|
|
|
|
|
Base URL |
|
|
|
|
|
|
Timeout |
|
|
|
|
| 30 seconds |
Retries |
|
|
|
|
| 2 |
Request hooks |
|
|
|
|
| none |
A client with no key fails as soon as you create it. The base URL works with or without /v1 at the end. health() checks that the API is up, with no key needed.
New in 0.2: health checks, carrier name resolution, webhook updates and secret rotation, typed events, request hooks and new error classes. See What's new in 0.2.
Retries
Network errors, 408, 429 and 5xx responses are retried with exponential backoff and jitter, starting near half a second and capped at 8 seconds between tries. A 429 waits for the Retry-After header. Other 4xx errors are never retried. See Pagination, retries and idempotency.
Idempotency
trackings.create sends an Idempotency-Key header, a fresh UUID unless you pass your own, and reuses it across that call's retries. A retried create never adds a second tracking.
The libraries send a key on bulk creates too, but the API ignores it there. Don't blindly retry a bulk create that timed out; check what was added first.
Typed errors
Every API error is a subclass of one base error (TrackifiedError) carrying the HTTP status, the error code, the message and the request_id. Catch the subclass you care about: ValidationError (400, 422), AuthenticationError (401), QuotaExceededError (402), PermissionError (403), NotFoundError (404), ConflictError (409), RateLimitError (429, with the retry-after seconds), APIError (5xx) and ConnectionError (no response, with code timeout or connection). After a timeout the outcome is unknown: retry with the same idempotency key. Errors has the full table.
Pagination
list returns one page with data and pagination (limit, offset, total). Each library also has a helper that walks every page for you:
Language | One page | Every page |
|---|---|---|
TypeScript |
|
|
Python |
|
|
Go |
|
|
Ruby |
|
|
PHP |
|
|
Webhook verification
Each library verifies the x-tracking-signature header against the raw request body, rejects signatures more than 5 minutes old, and parses the event. constructEvent (or construct_event, ConstructEvent) returns the event or fails with a reason. verify returns a boolean, and verifyDetailed returns {valid, reason}. Each takes several secrets during a rotation. trackingOf returns the tracking for any event type. See Verifying webhooks.
Method names
TypeScript | Python | Go | Ruby | PHP | |
|---|---|---|---|---|---|
Add a tracking |
|
|
|
|
|
Add a batch |
|
|
|
|
|
Get |
|
|
|
|
|
Update |
|
|
|
|
|
Stop tracking |
|
|
|
|
|
Check again now |
|
|
|
|
|
Detect a carrier |
|
|
|
|
|
Resolve a carrier name |
|
|
|
|
|
Search the catalog |
|
|
|
|
|
Add a webhook |
|
|
|
|
|
Update a webhook |
|
|
|
|
|
Rotate its secret |
|
|
|
|
|
Health |
|
|
|
|
|
Usage |
|
|
|
|
|
Verify what you installed
Every release is built in GitHub Actions and carries a signed build-provenance attestation.
For the npm package, check the registry signatures and provenance of what's installed:
npm audit signaturesFor any release file (a Go, Python, Ruby or PHP package from its GitHub Release, or a CLI archive), check it against the repo that built it:
gh attestation verify trackified-0.1.0.gem --repo trackified/trackified-ruby