2026 customs changesWhat it means

Batch Operations

Upload a set of documents as one shipment, list and download a batch, and reprocess it, through the API.

Overview

A batch is a set of documents uploaded together under one uploadBatchId. Documents of the same batch land in the same shipment, so CargoLint checks them against each other. This page covers batch uploads, downloads and reprocessing through the API.

Upload a batch

Give every file of the set the same uploadBatchId, any GUID you choose:

BATCH_ID="550e8400-e29b-41d4-a716-446655440000"

curl -X POST "https://api.cargolint.com/api/v1/documents?uploadBatchId=$BATCH_ID" \
  -H "X-API-Key: cl_YOUR_API_KEY" -F "file=@invoice.pdf"

curl -X POST "https://api.cargolint.com/api/v1/documents?uploadBatchId=$BATCH_ID" \
  -H "X-API-Key: cl_YOUR_API_KEY" -F "file=@packing_list.pdf"

curl -X POST "https://api.cargolint.com/api/v1/documents?uploadBatchId=$BATCH_ID" \
  -H "X-API-Key: cl_YOUR_API_KEY" -F "file=@bill_of_lading.pdf"

The first file starts a shipment and the others join it. Wait for the first upload’s response before sending the rest, so they find its shipment. To name the shipment, add shipmentLabel=YOUR-REFERENCE to the first upload. To add files to a shipment that already exists, send them together to POST /shipments/{id}/documents, which accepts several files in one request:

curl -X POST "https://api.cargolint.com/api/v1/shipments/{id}/documents" \
  -H "X-API-Key: cl_YOUR_API_KEY" \
  -F "files=@phytosanitary.pdf" \
  -F "files=@certificate_of_origin.pdf"

File limits

  • Up to 20 MB per file; up to 50 MB per request to POST /shipments/{id}/documents
  • PDF, PNG, JPEG and TIFF
  • Each file counts as one document against your plan

Each document is read on its own. A PDF holding several documents is split into them, and the parts stay in the same batch and shipment. See What happens after upload.

List a batch

curl "https://api.cargolint.com/api/v1/documents/{document_id}/batch" \
  -H "X-API-Key: cl_YOUR_API_KEY"

Returns the other documents uploaded with the same batch id as {document_id}, each with its id, fileName, title, status, detectedDocumentType and createdAt.

Download a batch as a ZIP

curl "https://api.cargolint.com/api/v1/documents/batch/{batch_id}/download" \
  -H "X-API-Key: cl_YOUR_API_KEY" \
  -o shipment_documents.zip

The ZIP holds the original files of the batch’s Completed documents. A batch with no completed document returns 404.

Reprocess a batch

curl -X POST "https://api.cargolint.com/api/v1/documents/batch/{batch_id}/reprocess" \
  -H "X-API-Key: cl_YOUR_API_KEY"

Sends every document of the batch through extraction again, each as a single reprocess would, and returns totalDocuments, queuedCount, failedCount and error. Each document counts toward the hourly reprocess limit; once it is reached, the rest are left as they are and error says why. Reprocessing counts against your plan like an upload, except within 15 minutes of a document’s first extraction when nobody has reviewed it yet.

Follow the shipment

The batch’s shipment carries the cross-document findings and the expected-documents checklist. Read it with GET /shipments/{id}, or subscribe to the shipment.evaluated webhook.

Best practices

  • Use one batch id per shipment, so the documents are checked together.
  • Watch shipment.evaluated rather than polling each document.
  • Download batch ZIPs for archiving once the documents are approved.