What's new in 0.2

Health checks, carrier name resolution, webhook updates and secret rotation, typed events, request hooks and new error classes.

Embed
Preview of the card
<a href="https://trackified.net/docs/whats-new"><img src="https://trackified.net/docs/_api/public/orgs/e2a7773e-db9e-41cb-bd59-bd248745cac3/spaces/9d63a5d4-feb0-4803-84a5-dc68639362a6/pages/183d1a20-adc5-4f30-bbcf-31b431b33754/social-card.svg?v=3e7ae33eec8b" alt="What's new in 0.2" width="600" height="315"></a>

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

trackified

0.2.0

Python

trackified

0.2.0

Go

github.com/trackified/trackified-go

v0.2.0

Ruby

trackified

0.2.0

PHP

trackified/trackified-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} changes url, event_types or enabled. The secret stays the same. A webhook with enabled: false receives nothing.

  • POST /v1/webhooks/{id}/rotate-secret returns a new secret, once. The old secret keeps working for expires_in_hours (default 24, at most 168; 0 drops 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

  • QuotaExceededError for 402 quota_exceeded.

  • ConflictError for 409, including idempotency_in_progress.

  • ConnectionError now has a code: timeout or connection.

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:

  • onRequest gets the method, URL, attempt number and idempotency key.

  • onResponse gets 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.net or https://api.trackified.net/v1, with or without a trailing slash.

  • events is always newest first, sorted by occurred_at. Events with no time keep the carrier's order, after the dated ones. The API guarantees this.

  • date on events is deprecated. It's sent until 2027-06-01 and removed after that. Use occurred_at.

Names in each library

TypeScript

Python

Go

Ruby

PHP

Health

client.health()

client.health()

client.Health(ctx)

client.health

$client->health()

Resolve a carrier name

carriers.resolve(name)

carriers.resolve(name)

Carriers.Resolve(ctx, name)

carriers.resolve(name)

carriers->resolve($name)

Update a webhook

webhooks.update(id, {url, eventTypes, enabled})

webhooks.update(id, url=, event_types=, enabled=)

Webhooks.Update(ctx, id, &UpdateWebhookParams{})

webhooks.update(id, url:, event_types:, enabled:)

webhooks->update($id, url:, eventTypes:, enabled:)

Rotate the secret

webhooks.rotateSecret(id, {expiresInHours})

webhooks.rotate_secret(id, expires_in_hours=)

Webhooks.RotateSecret(ctx, id, &RotateSecretParams{})

webhooks.rotate_secret(id, expires_in_hours:)

webhooks->rotateSecret($id, expiresInHours:)

Verify with a reason

Trackified.webhooks.verifyDetailed

trackified.verify_detailed

trackified.VerifyDetailed

WebhookSignature.verify_detailed

WebhookSignature::verifyDetailed

Several secrets

pass an array

pass a list

ConstructEventSecrets

pass an array

pass an array

Tracking of any event

Trackified.webhooks.trackingOf(event)

trackified.tracking_of(event)

trackified.TrackingOf(event)

event.tracking

$event->tracking()

Request hooks

onRequest, onResponse

on_request=, on_response=

WithHooks(trackified.Hooks{...})

on_request:, on_response:

onRequest:, onResponse:

Hook attempt numbers start at 0 in TypeScript and at 1 in the other libraries.

Each library page shows these in context.

Updated