2026 customs changesWhat it means

Webhook Setup Guide

Set up webhooks so your TMS or ERP hears about documents and shipments as CargoLint processes them, and verify, test and monitor the deliveries.

Overview

Webhooks let your systems, such as a TMS or an ERP, react as CargoLint processes documents and evaluates shipments. This guide walks through creating a webhook, verifying its deliveries, testing it and watching it run. The full contract, with every payload, is in the Webhooks API reference.

Webhooks are available on the Business and Enterprise plans. Managing them needs an Owner or Admin account.

Create a webhook

In the app

  1. Go to Settings > Integrations.
  2. Under Webhook Management, click Add Webhook.
  3. Enter your endpoint URL. Use an HTTPS URL so the payloads travel encrypted.
  4. Under Events to Subscribe, select the events.
  5. Click Create Webhook.

When the webhook is created, the app shows its signing secret once, with a Copy button: store it then. The rotate icon on a webhook issues a new secret, shown the same way, and the old one stops working at once.

Through the API

curl -X POST https://api.cargolint.com/api/v1/webhooks \
  -H "Authorization: Bearer YOUR_JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-domain.com/webhooks/cargolint",
    "events": ["document.completed", "shipment.evaluated"]
  }'

The response includes a secret. Store it now: it is not shown again. Webhook endpoints take a user’s JWT; an API key is refused because it carries no role.

Events

Documents

  • document.uploaded - a file was received
  • document.pending_approval - read with nothing held for a reviewer; waiting for approval
  • document.requires_review - held for a person, or sent back to review by a document or shipment check
  • document.recognized - identified as a kind CargoLint recognizes but does not read
  • document.split - an upload held several documents and was split into them
  • document.failed - could not be processed
  • document.reviewed - a reviewer approved or corrected the document
  • document.completed - approved
  • document.generated - a packing list was generated from an invoice
  • document.cloned - a document was cloned
  • document.skipped - a reviewer deferred the document

Shipments

  • shipment.created - a shipment was created
  • shipment.document_linked - a document was attached to a shipment
  • shipment.evaluated - a cross-document evaluation completed, with its overallStatus
  • shipment.settled - a shipment was settled

Compliance

  • compliance.completed - a document’s check result was stored for the first time, or a later check changed it

Pushes

  • push.sent - a connection created the record, wrote values to the linked job and read them back, linked the job, or rendered the file
  • push.unchanged - nothing new to send
  • push.changes_pending - the record changed since the last send and the target cannot be updated safely, so it waits for a person
  • push.needs_review - nothing was written and a person has to look: no job was found, something changed after an approval, or an outcome could not be confirmed
  • push.failed - the target refused the push, every attempt failed, or the connection was disabled, deleted or locked first

An event name CargoLint does not send is refused when you subscribe. The URL must be https:// and at a public address. Payloads are listed in the API reference.

Verify each delivery

Each delivery is signed with HMAC-SHA256 and carries these headers:

Header Purpose
X-CargoLint-Signature v1={hex} signature
X-CargoLint-Timestamp Unix time used in the signature
X-CargoLint-Event The event name
X-CargoLint-DeliveryId The delivery id, the same on retries

The signature covers "{timestamp}.{body}". The signing secret is base64-encoded; decode it to get the HMAC key:

import base64
import hashlib
import hmac

def verify_signature(body: str, signature_header: str, timestamp_header: str, secret: str) -> bool:
    signed = f"{timestamp_header}.{body}".encode()
    expected = hmac.new(base64.b64decode(secret), signed, hashlib.sha256).hexdigest()
    provided = signature_header.split("v1=", 1)[-1]
    return hmac.compare_digest(expected, provided)

Security: compare with hmac.compare_digest() (constant time), never ==. Also reject deliveries whose timestamp is far from the current time, to refuse replays.

Get or rotate the signing secret

Rotating returns a new secret once and invalidates the old one at once. The webhook and its delivery history are kept. Use it when a secret is lost or may be exposed; the app offers the same action on each webhook.

curl -X POST https://api.cargolint.com/api/v1/webhooks/{id}/rotate-secret \
  -H "Authorization: Bearer YOUR_JWT"

GET /webhooks lists your webhooks with their ids.

Test your webhook

  1. In Settings > Integrations, click the send icon (Send test event) on the webhook. This delivers a webhook.test event.
  2. Check that your endpoint answered with a 2xx status.
  3. Open the webhook’s Delivery Log to see the result.

Through the API: POST /webhooks/{id}/test.

Monitor deliveries

The Delivery Log on each webhook shows its recent deliveries: the event, the status (Pending, Success or Failed), the HTTP status your endpoint returned, the number of attempts and the last error. The full history, kept 30 days, is at GET /webhooks/{id}/deliveries.

To pause a webhook without deleting it, switch it from Active to Inactive.

Retries

A non-2xx response or a network error is retried, for 3 attempts in all: about 5 seconds after the first, then about 15 seconds after the second. Each attempt times out after 10 seconds. After the third failure the delivery stays Failed; the webhook stays active and later events are still delivered.

Troubleshooting

No deliveries arrive:

  • Check that the endpoint is reachable from the internet.
  • Check that the webhook is Active and subscribed to the event you expect, spelled exactly.
  • Read the last error in the Delivery Log.

Deliveries fail:

  • Return a 2xx within 10 seconds and do heavy work in the background.
  • Look in your server logs for connection or TLS errors.

Signatures do not match:

  • Sign the raw body exactly as received, before any parsing.
  • Decode the secret from base64 before using it as the key.
  • If the secret was lost, rotate it, in the app or through the API, and use the new one.