2026 customs changesWhat it means

API Reference

API Overview
CargoLint REST API.

Base URL, authentication, plan access, rate limits, pagination, value conventions and errors for the CargoLint REST API.

REST API Overview

The CargoLint API is the same API the web app uses. Through it you can upload documents, read what CargoLint extracted and found, work with shipments and their expected-documents checklist, classify HS codes and manage webhooks. This page covers what every endpoint shares: authentication, limits, paging, the values you will see in responses, and errors.

Base URL

https://api.cargolint.com/api/v1

Every path in this reference is relative to that base. Requests and responses are JSON (application/json), except file uploads (multipart/form-data) and file downloads (the file itself).

Authentication

There are two ways to authenticate. See Authentication for how to obtain each.

API key

Send the organization’s API key in the X-API-Key header:

curl https://api.cargolint.com/api/v1/documents \
  -H "X-API-Key: cl_YOUR_API_KEY"
  • An organization has one API key. An Owner or Admin generates it in Settings > Integrations > API Keys. Generating a new key replaces the old one, and the key is shown once.
  • Keys can be generated on the Business and Enterprise plans.
  • A key acts for the organization, not for a person. Shipment facts, checklist marks, line links and destinations it sets are shown as set by “the organization’s API key”.

JWT bearer token

Send a token from POST /auth/login in the Authorization header:

curl https://api.cargolint.com/api/v1/documents \
  -H "Authorization: Bearer YOUR_JWT"

A token carries the user’s organization and role and expires after 60 minutes. There is no refresh token; sign in again for a new one.

Which endpoints need a user

An API key carries no user and no role, so endpoints that check either refuse it:

Endpoint group API key Why
Documents, shipments, checklist, HS codes, destination profiles Yes Organization scope is enough
DELETE /documents/{id} No (403) Owner or Admin role required
Webhooks (/webhooks) No (403) Owner or Admin role required
Sharing links (/documents/{id}/share, /shipments/{id}/share) No (401) A sending user is required
Partners (/partners, /shipments/{id}/partner-grants) No (401) A user is required
Audit log, team, billing, profile, 2FA, GDPR No User session endpoints

GET /config needs no authentication at all.

Rate limits

Requests made with an API key are limited per organization, in a fixed one-minute window:

Plan Requests per minute
Business 60
Enterprise 300

Every API-key response carries:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 55
X-RateLimit-Reset: 23

X-RateLimit-Reset is the number of seconds left in the current window. Over the limit, the API returns 429 Too Many Requests with a Retry-After header (seconds) and this body:

{
  "error": "API rate limit exceeded. Please slow down and retry after the current window resets.",
  "code": "RATE_LIMIT_EXCEEDED",
  "limit": 60,
  "retryAfterSeconds": 23
}

JWT requests are not counted against this limit. Some endpoints have limits of their own, such as document reprocessing (20 per organization per hour by default) and sharing links (100 recipients per user per day).

Usage limits

Uploads and other actions that create a document count against the plan’s monthly document allowance. On the Starter plan, an upload past the allowance returns 402 Payment Required with "code": "USAGE_LIMIT_EXCEEDED". Paid plans continue past the allowance at the plan’s overage rate. See Billing and Plans.

Pagination

List endpoints page with page (from 1) and pageSize. Each family returns its own envelope:

Endpoint Default pageSize Maximum Envelope
GET /documents 20 100 items, totalCount, page, pageSize, statusCounts, allTotal
GET /shipments 25 100 items, total, page, pageSize
GET /webhooks/{id}/deliveries 50 100 items, totalCount, page, pageSize, totalPages
GET /hs-codes/browse 50 200 items, totalCount

Values you will see

  • Identifiers are GUIDs, such as 3f1c1b2a-8d4e-4c3a-9b51-2f6d0e7a1c44.
  • Timestamps are ISO 8601 in UTC.
  • Document kinds are registry ids such as Invoice, AirWaybill or PhytosanitaryCertificate, in detectedDocumentType. The field named documentType on a document is the file’s media type, such as application/pdf. See Document Kinds and Statuses.
  • Document statuses are strings such as PendingApproval, Recognized or Split. See Document Kinds and Statuses.
  • Severities are Error, Warning and Info. A document’s or shipment’s overall status is Error, Warning or Pass.
  • Countries are ISO 3166-1 alpha-2 codes, such as DE.
  • Reason and status codes added for destination checks and the checklist are snake_case, such as default_no_profile or cannot_tell.
  • Shared vocabularies (document kinds, party roles, field labels, trade blocs) come from GET /config, so a client never has to hard-code them.

New fields are added to responses over time. Ignore fields you do not recognize.

Errors

Most errors return a JSON body with an error message:

{ "error": "Document not found" }

Some add a machine-readable code: RATE_LIMIT_EXCEEDED, USAGE_LIMIT_EXCEEDED, PLAN_FEATURE_UNAVAILABLE and EMAIL_NOT_VERIFIED. A request body that fails validation returns 400 as RFC 7807 problem details (application/problem+json) with an errors object listing each field. An unexpected server error returns problem details with a traceId.

Status Meaning
400 The request is invalid; the message says what to change
401 Missing or invalid credentials, or the endpoint needs a user
402 The Starter plan’s monthly document allowance is used up
403 The caller’s role or plan does not allow this
404 Not found in your organization, or the feature is not available
409 Conflicts with the current state, such as adding a document to a settled shipment
429 Rate limited
500 Server error
503 A dependency is unavailable (HS search) or the service is in maintenance

A document or shipment that belongs to another organization returns 404.

Correlation id

Send an X-Correlation-ID header to tag a request; the API echoes it back on the response and generates one when you do not send it. Quote it when you contact support about a request.

Endpoint map

Getting help

For API support, write to support@cargolint.com.