2026 customs changesWhat it means

API Reference

Webhooks API
CargoLint REST API.

Register webhook endpoints, the events and payloads CargoLint sends, signature verification, and delivery and retry behavior.

Webhooks API

Webhooks push events to your application as CargoLint processes documents and evaluates shipments, so you do not have to poll.

Webhooks are available on the Business and Enterprise plans; on other plans these endpoints return 403 with "code": "PLAN_FEATURE_UNAVAILABLE".

Authentication: managing webhooks needs an Owner or Admin user, so these endpoints take a JWT (Authorization: Bearer {token}). An API key carries no role and receives 403.

Create a webhook

POST /webhooks
{
  "url": "https://example.com/webhooks/cargolint",
  "events": ["document.completed", "shipment.evaluated"]
}
Field Required Description
url Yes The endpoint that receives deliveries: an absolute https:// URL at a public address. Plain HTTP, localhost and internal addresses (private ranges, link-local, loopback) are refused with 400, and a host name is checked again when each delivery connects
events Yes At least one event name. A name CargoLint does not send is refused with 400, and the error lists the events
curl -X POST "https://api.cargolint.com/api/v1/webhooks" \
  -H "Authorization: Bearer YOUR_JWT" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.com/webhooks/cargolint", "events": ["document.completed", "shipment.evaluated"] }'

The response includes the signing secret. It is returned only here and by rotate; store it now.

{
  "id": "3f1c1b2a-8d4e-4c3a-9b51-2f6d0e7a1c44",
  "url": "https://example.com/webhooks/cargolint",
  "events": ["document.completed", "shipment.evaluated"],
  "isActive": true,
  "createdAt": "2026-10-22T10:30:00Z",
  "updatedAt": null,
  "secret": "Base64SigningSecretShownOnceProtectThisValue=="
}

A webhook created in the app (Settings > Integrations > Webhook Management) shows its secret once in the app, which can also rotate it.

List, get, update and delete

GET    /webhooks              - { "items": [ ... ] }, without secrets
GET    /webhooks/{id}
PUT    /webhooks/{id}         - { "url"?, "events"?, "isActive"? }; only the fields sent change
DELETE /webhooks/{id}

events in an update replaces the whole list. Setting isActive to false pauses deliveries without deleting the webhook.

Rotate the signing secret

POST /webhooks/{id}/rotate-secret

Returns the webhook with a new secret, shown once. The previous secret stops working at once. The webhook and its delivery history are kept.

Send a test event

POST /webhooks/{id}/test

Queues a webhook.test delivery:

{ "event": "webhook.test", "timestamp": "2026-10-22T10:31:00Z", "data": { "message": "This is a test webhook delivery" } }

Delivery history

GET /webhooks/{id}/deliveries?page=1&pageSize=50
{
  "items": [
    {
      "id": "7a6b5c4d-3e2f-4a1b-9c8d-7e6f5a4b3c2d",
      "event": "document.completed",
      "status": "Success",
      "attempts": 1,
      "lastAttemptAt": "2026-10-22T11:45:02Z",
      "lastError": null,
      "responseStatusCode": 200,
      "createdAt": "2026-10-22T11:45:00Z"
    }
  ],
  "totalCount": 1,
  "page": 1,
  "pageSize": 50,
  "totalPages": 1
}

status is Pending, Success or Failed. A Failed delivery may still be retried until it reaches its last attempt. Finished deliveries are kept for 30 days.

Envelope

Every delivery body has the same envelope; data depends on the event:

{
  "event": "document.completed",
  "timestamp": "2026-10-22T11:45:00Z",
  "data": { "documentId": "6b0f7c1e-...", "fileName": "invoice.pdf", "status": "Completed", "completedVia": "review" }
}

In payloads, documentType is the document’s kind id, such as Invoice, and status is a document status.

Events and payloads

Documents

Event When data
document.uploaded A file was received and stored documentId, fileName, fileSize, contentType, status
document.pending_approval Read with nothing held for a reviewer documentId, status, documentType, pageCount, fieldCount
document.requires_review Read and held for a person, or sent back to review by a check After reading: documentId, status, documentType, pageCount, fieldCount. Sent back by a check: documentId, fileName, status, reason (document_blocking_issue, document_problems or shipment_inconsistency), severity (error or warning)
document.recognized Identified as a kind CargoLint recognizes but does not read documentId, status (Recognized), documentType, pageCount
document.split An upload held several documents and was split documentId (the upload), status (Split), documents: each part’s documentId, documentType, fileName and pages (first, last)
document.failed Could not be processed, permanently documentId, status, error
document.reviewed A reviewer approved or corrected the document documentId, fileName, reviewedBy (user id), fieldsCorrected, status
document.completed The document was approved documentId, fileName, status, completedVia (review or approval)
document.generated A packing list was generated from an invoice documentId, sourceDocumentId, generatedType, status
document.cloned A document was cloned documentId, sourceDocumentId, clonedType, status
document.skipped A reviewer deferred the document documentId, fileName, status

Each part of a split upload is then read like an upload of its own and sends its own processing events, such as document.pending_approval; parts do not send document.uploaded. Approving a document sends document.reviewed (with fieldsCorrected 0) and document.completed. A shipment is settled only once none of its documents waits for review or approval, so settling approves nothing.

Shipments

Event When data
shipment.created A new shipment was created shipmentId, reference
shipment.document_linked A document was attached to a shipment shipmentId, reference, documentId, fileName
shipment.evaluated A cross-document evaluation completed shipmentId, reference, overallStatus (Error, Warning or Pass), reportId, ruleResultCount
shipment.settled A shipment was settled shipmentId, reference

overallStatus never counts the expected-documents checklist. Fetch GET /shipments/{id} after shipment.evaluated for the findings, the checklist and the coverage.

Documents the Export Compliance Desk sends for your organization go into your own shipments, one shipment for each of the Desk’s transactions under the transaction’s reference, so they send these document and shipment events to your webhooks like any other upload. They do not count toward your monthly documents.

Compliance

Event When data
compliance.completed A document’s checks stored a result: after CargoLint read it, and again after a correction, a review or a reprocess documentId, fileName, overallStatus, issueCount, documentType, qualityScore (0 to 100) and qualityLevel (none, warning or serious): the document’s Quality score once its checks have run

Reading a document’s results never sends the event. A document held back by a blocking finding, or by problems that add up to one that needs fixing, or two warnings, once its checks have run, also sends document.requires_review, with reason document_blocking_issue or document_problems and severity the worst counted level (error for a problem that needs fixing, warning).

Pushes

A connection sends exactly one of these per push, named for how the push ended. A push still sending, accepted by the target or with an outcome being confirmed sends nothing until it ends. Each carries the push’s operation: create, link, fill, patch or update.

Event When data
push.sent The record was created, values were written to the job and read back, the job was linked by its reference, or the file was rendered pushId, shipmentId, connectionId, operation, outcome (sent), externalIds (the target’s identifiers; for a file, pushId and fileName), error (null)
push.unchanged Nothing new to send: the job already holds the approved values, the values it does not hold wait for a review, or the file’s record did not change The same fields, with outcome unchanged
push.changes_pending The record changed since the last send and the target cannot be updated safely: a second file waits for an acknowledged push, a full update for an approval The same fields, with outcome changes_pending
push.needs_review Nothing was written and a person has to look: no job was found and a create can be reviewed, the search was refused, the data, the connection or the job changed after an approval, or a write’s outcome could not be confirmed The same fields, with outcome needs_review and the reason in error
push.failed The target refused the push, every attempt failed, or the connection was disabled, deleted or locked first The same fields, with outcome failed and the reason in error
{
  "event": "push.sent",
  "timestamp": "2026-11-05T14:02:00Z",
  "data": { "pushId": "9a4e2c10-...", "shipmentId": "3f1b7d22-...", "connectionId": "c52e9a01-...", "operation": "fill", "outcome": "sent", "externalIds": { "ref": "A2300905" }, "error": null }
}

Fetch GET /shipments/{id}/pushes for the values written and left alone, the changed fields and the file.

Test

webhook.test is sent only by Send a test event.

Delivery headers

Header Description
X-CargoLint-Signature v1={hex}, the HMAC-SHA256 signature
X-CargoLint-Timestamp Unix time in seconds, part of the signed string
X-CargoLint-Event The event name
X-CargoLint-DeliveryId The delivery id; retries reuse it

Verify the signature

The signature is HMAC-SHA256 over "{timestamp}.{body}", where timestamp is the X-CargoLint-Timestamp header and body is the raw request body. The signing secret is base64-encoded: decode it to bytes and use those bytes as the key. The result is hex-encoded, lowercase, after v1=.

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 a constant-time function such as hmac.compare_digest(), never ==. To refuse replays, also reject deliveries whose X-CargoLint-Timestamp is far from the current time, for example more than five minutes.

Delivery and retries

  • Pending deliveries are sent within a few seconds.
  • Each attempt times out after 10 seconds.
  • A non-2xx response or a network error is retried. A delivery gets 3 attempts in all: the second about 5 seconds after the first, the third about 15 seconds after the second.
  • After the third failed attempt the delivery stays Failed. The webhook stays active, and later events are still delivered.
  • Deliveries can arrive out of order and, after a retry, more than once.

Best practices

  • Verify the signature on every delivery.
  • Answer with a 2xx within 10 seconds and do the work afterwards.
  • Deduplicate on X-CargoLint-DeliveryId.
  • Subscribe only to the events you use, and check the spelling of each.
  • Read the current state with the API when an event arrives, rather than relying on the payload alone.