TrustColdDevelopers
Notifications›Webhooks

Webhooks

TrustCold POSTs status changes to your HTTPS URL, including cancel and delete.

Run this from your browser — add your free test keys.
curl -X PUT https://trustcoldeg.com/api/v1/b2b/webhook \
  -H "Authorization: Bearer CLIENT_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://partner.example/trustcold/hooks"}'

First registration

{
  "data": {
    "url": "https://partner.example/trustcold/hooks",
    "secret_set": true,
    "secret": "Qm3…40 characters…shown only the first time"
  }
}

URL refused

{
  "message": "The domain points to a private or reserved address.",
  "errors": {
    "url": ["The domain points to a private or reserved address."]
  }
}

POST /webhook/test

{
  "data": {
    "event_id": "7f3c1e2a-5d34-4b86-9a52-0c9e2a6d41b8",
    "result": "delivered",
    "error": null
  }
}

Key points

  • Register — PUT /webhook with {"url":"https://partner.example/hooks"\}. The secret is shown once.
  • Test — POST /webhook/test sends a signed webhook.test event and tells you the result.
  • Rotate — POST /webhook/rotate-secret issues a new secret. The old one stops working at once.
  • Verify — Check X-TrustCold-Signature-V2 on every request. See Verify signatures.

Register one HTTPS URL. TrustCold POSTs a signed JSON event each time a trip status changes. If your server is down, the trip still continues.

The secret is returned once, the first time you register a URL. Store it in your secrets manager. TrustCold keeps it encrypted and cannot show it again. Lost it? Rotate it.

URL rules

RuleWhy
https:// on port 443Webhooks are never sent in clear text
A public domain nameNo IP addresses, localhost, .local, .internal
Resolves to public addresses onlyPrivate, loopback, link-local and cloud-metadata ranges are refused. Checked when you save and again on every delivery
No credentials in the URLUse the signature instead of user:pass@
Redirects are not followedAnswer on the registered URL itself

Manage

CallWhat it does
GET /webhookShows the URL and whether a secret is set (never the secret)
PUT /webhookSets or changes the URL. Keeps the current secret
POST /webhook/rotate-secretNew secret, shown once. The old one stops working immediately
POST /webhook/testSends a signed webhook.test event and returns delivered or failed
curl -X POST https://trustcoldeg.com/api/v1/b2b/webhook/rotate-secret \
  -H "Authorization: Bearer CLIENT_KEY" \
  -H "Accept: application/json"
curl -X POST https://trustcoldeg.com/api/v1/b2b/webhook/test \
  -H "Authorization: Bearer CLIENT_KEY" \
  -H "Accept: application/json"

Request headers

HeaderValue
X-TrustCold-EventUnique event id. Same as event_id in the body
X-TrustCold-TimestampUnix time (seconds) when TrustCold signed the request
X-TrustCold-Signature-V2t=<timestamp>,v1=<hex> where v1 is HMAC-SHA256 of "{timestamp}.{raw body}". Use this one.
X-TrustCold-Signaturesha256=<hex> HMAC of the raw body only. Kept for older integrations. It has no replay protection

Step by step with code: Verify signatures.

Delivery

  • Answer with any 2xx within 4 seconds. Do slow work after you reply.
  • Otherwise TrustCold tries up to 3 times in a row. Events can arrive more than once and out of order: use event_id and the trip status, not arrival order.
  • The payload carries ids, the code and the new status. It never carries the client key or the webhook secret.

Event

Response 200 · Request body sent to your URL
{
  "event_id": "7f3c1e2a-5d34-4b86-9a52-0c9e2a6d41b8",
  "event": "trip.status_changed",
  "trip": {
    "id": 10025,
    "code": "TRUST10025",
    "status": "en_route",
    "status_label": "En route",
    "deleted": false
  }
}