2026 customs changesWhat it means

API Reference

Documents and Results Endpoints
CargoLint REST API.

List documents, read extracted fields and check results, review and correct, download files and exports, and share results.

Documents and Results Endpoints

Once a document is uploaded, these endpoints return what CargoLint read from it and what its checks found, and let you review, correct, export and share it. For the checks across a shipment’s documents, see Shipments.

All endpoints are scoped to your organization. A document of another organization returns 404.

List documents

GET /documents
Parameter Default Description
status - One or more document statuses, comma-separated, such as RequiresReview,PendingApproval; a replaced document is left out
documentType - One kind id, such as Invoice
language - Detected language code
search - Words to find in titles, file names, references, parties and extracted values; every word must match
startDate, endDate - Upload date range
sortBy newest first filename, status, type, date, shipper, consignee, qualityScore or shipmentStatus
sortDirection desc asc or desc
page, pageSize 1, 20 Paging; pageSize is at most 100
curl "https://api.cargolint.com/api/v1/documents?status=PendingApproval&documentType=Invoice&page=1&pageSize=20" \
  -H "X-API-Key: cl_YOUR_API_KEY"
{
  "items": [
    {
      "id": "6b0f7c1e-2d1a-4a8e-9f0e-1c2b3d4e5f60",
      "fileName": "invoice.pdf",
      "title": "Commercial Invoice INV-2026-0042",
      "titleSetByUser": false,
      "number": "INV-2026-0042",
      "status": "PendingApproval",
      "documentType": "application/pdf",
      "detectedDocumentType": "Invoice",
      "detectedLanguage": "en",
      "createdAt": "2026-10-22T10:30:00Z",
      "processedAt": "2026-10-22T10:30:41Z",
      "shipmentId": "0c9a7b6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
      "reference": "Shipment-2026-10-22-004",
      "shipper": "Global Logistics Ltd",
      "consignee": "Midwest Imports Inc",
      "qualityScore": 90,
      "qualityLevel": "warning",
      "checksPending": false,
      "shipmentOverallStatus": "Warning",
      "shipmentEvaluationPending": false
    }
  ],
  "totalCount": 1,
  "page": 1,
  "pageSize": 20,
  "statusCounts": { "PendingApproval": 12, "Completed": 140 },
  "allTotal": 152
}

Items also carry source (Email for a document that arrived by email, null for an upload; the detail returns it too), uploadBatchId, shipmentLabel, generatedFromId, splitFromDocumentId, supersededByDocumentId, shipmentIsSettled, shipmentDocumentCount, processingTimeMs, waitingSinceUtc and holdReason (why a document in RequiresReview is held: reading, hs, ocr, blocking or shipment; null otherwise). qualityScore is the Quality score, 0 to 100, qualityLevel its worst problem: none, warning or serious, and problemCount the problems that need fixing and warnings it counts; all three are null for a document not scored. checksPending is true while the document has been read but its own checks have not run yet. statusCounts and allTotal count the documents of the whole organization, not only the filtered ones: statusCounts leaves out replaced documents, as a status filter does, and allTotal counts every document.

GET /documents/suggest?q=...&limit=8 returns up to 20 quick matches for type-ahead search, each with the field that matched and its shipmentReference (null for a document in no shipment).

Get a document

GET /documents/{id}

Returns the document with its status and context: status, detectedDocumentType, title, number (its own number, as the lists show it beside its kind), shipper, titleSetByUser (true once a person renamed it), shipmentId, reference, processedAt, extractionStatus, failureReason (for a Failed document, why it could not be read: not English, naming the language, a blank or unreadable scan, a pack over the split limit or one that could not be split, the five-minute limit, or a generic reason), failure (the same with its code: not_english, pack_too_large, pack_not_split, unreadable, unclassified, timeout, not_recognized or unknown, a title, the reason, and the action that may help: upload_clearer_scan, upload_in_parts, upload_separately, rerun or null), the shipment’s shipmentOverallStatus, shipmentIsSettled and shipmentEvaluationPending, and, when it was replaced, supersededByDocumentId and supersededByFileName. A pack (status Split) lists its parts in splitDocuments; a part carries splitFromDocumentId.

Get extraction results

GET /documents/{id}/extractions

Returns the latest extraction: its fields, the AI’s rating of each, the line items with their HS suggestions, the raw text and the Quality score. 404 means the document has not been read yet; a Recognized document has no extracted fields.

{
  "id": "a1b2c3d4-0000-4000-8000-000000000001",
  "documentId": "6b0f7c1e-2d1a-4a8e-9f0e-1c2b3d4e5f60",
  "pageCount": 2,
  "fieldsCount": 38,
  "status": "Completed",
  "detectedDocumentType": "Invoice",
  "documentTypeConfidence": 0.98,
  "detectedLanguage": "en",
  "qualityScore": 100,
  "qualityLevel": "none",
  "requiresReview": false,
  "confidenceReasons": [],
  "fields": [
    { "fieldName": "InvoiceId", "value": "INV-2026-0042", "confidence": 0.95, "boundingBox": null },
    { "fieldName": "VendorName", "value": "Global Logistics Ltd", "confidence": 0.95, "boundingBox": null },
    { "fieldName": "Items[0].Description", "value": "Cotton hooded sweatshirts", "confidence": 0.95, "boundingBox": null },
    { "fieldName": "Items[0].HsCode", "value": "6110.20", "confidence": 0.95, "boundingBox": null }
  ],
  "lineItems": [
    {
      "index": 0,
      "description": "Cotton hooded sweatshirts",
      "quantity": 400,
      "unitPrice": 12.5,
      "amount": 5000,
      "originalHsCode": "6110.20",
      "existingCodeScore": 0.95,
      "countryOfOrigin": "CN",
      "hsCodeSuggestions": []
    }
  ],
  "destinationCountry": "US",
  "destinationSource": "document:6b0f7c1e-2d1a-4a8e-9f0e-1c2b3d4e5f60:CustomerAddressCountry",
  "versionStamp": { "extractionVersion": 1, "engineVersion": "...", "generatedAt": "2026-10-22T10:30:41Z", "contentChecksum": "9f3a1c2e" }
}
  • Field names are the names in the field manifest for the document’s kind, with line fields indexed from 0 (Items[0].Description). Each kind’s fields, their labels and groups are listed in fieldDisplay from GET /config.
  • confidence on a field is the AI’s rating of how clearly it read the value: 0.95 clearly readable, 0.75 may be garbled, 0.50 a guess. confidenceReasons lists the problems found in the reading; qualityScore and qualityLevel sum up every problem on the document, which GET /documents/{id}/issues lists.
  • Corrections a reviewer submitted are part of the fields returned, except a stale one. GET /documents/{id}/corrections lists each correction with its fieldPath, correctedValue, originalValue and conflictState (stale when a reprocess read a value that matches neither the value corrected nor the correction). PATCH /documents/{id}/corrections/{correctionId} resolves a stale correction with {"action": "keep"}, {"action": "use_new"} or {"action": "overwrite", "correctedValue": "..."}; each records the new reading as the correction’s originalValue, so the next reprocess compares with it.
  • HS codes on the lines carry the declared code (originalHsCode) and CargoLint’s view of it: existingCodeScore, nationalEvaluation (whether the national suffix matches a line of the destination’s tariff schedule), repairCandidate (a likely misread) and hsCodeSuggestions. CargoLint flags a doubtful code and suggests alternatives; it does not change the declared code on its own.
  • rawText holds the text read from the pages. boundingBox, when present, gives the page and position a value was read from.

Get the document’s check results

GET /documents/{id}/compliance

Returns the stored result of the document’s own checks on its latest extraction. CargoLint runs them after reading the document, and again after a correction, a review or a reprocess. Until they have run, overallStatus is "Pending" and issues is empty. Reading the result changes nothing and sends no webhook.

{
  "id": "c0ffee00-1111-4222-8333-444455556666",
  "overallStatus": "Warning",
  "issues": [
    {
      "ruleId": "missing_required_field",
      "severity": "Error",
      "message": "Country of origin is not on the invoice on line 2.",
      "field": "Items[1].CountryOfOrigin",
      "expectedValue": null,
      "actualValue": null,
      "detail": "...",
      "verifySteps": null,
      "taxHints": [],
      "citation": "19 CFR 141.86(a)(10); 19 CFR 143.21(a)",
      "citationUrl": "https://www.ecfr.gov/current/title-19/section-141.86",
      "citations": [ { "text": "19 CFR 141.86(a)(10)", "link": "https://www.ecfr.gov/current/title-19/section-141.86" } ],
      "source": "US"
    }
  ],
  "route": { "destination": { "code": "US", "source": "document" }, "export": { "code": "CN", "source": "document" } },
  "profileId": "US",
  "profileVersion": "2026.11.06.1+baseline-...",
  "coverage": { "profileId": "US", "reason": "destination_profile", "checksNotRun": [], "requirements": [ ... ] }
}
  • overallStatus is Error when any issue is an Error, Warning when any is a Warning, and Pass otherwise. A document not read yet returns {"overallStatus": "Pass", "issues": []}. A Recognized document returns a pass with no issues and a coverage whose reason is kind_not_read: the checks did not run, because nothing was read.
  • missing_required_field is a field the document’s kind or form asks for and does not carry: an Error where the field is required, a Warning where it is customary or where the condition it depends on cannot be told. The rows come from the document requirements, with a country’s rows replacing the general ones where its rules differ.
  • citation, citationUrl, citations and conversion appear on findings from the document requirements and other checks that rest on a source: the sources the finding rests on and, for a value threshold, how the invoice total was converted. A citation has a link only when the source can be read online.
  • source names the country package that set the requirement (US); it is absent on any other finding.
  • route, profileId, profileVersion and coverage say which destination the document was checked against and what the checks covered. See Coverage.

Findings flag and explain; they do not rule on whether a document is acceptable to customs. This endpoint returns the checks alone; GET /documents/{id}/issues combines them with the reading problems and the HS verdicts.

Get document issues

GET /documents/{id}/issues
GET /public/shared-documents/issues           (the link's token in the X-Link-Token header)

Returns what the document’s Document Issues panel shows: every problem the reading, the document checks and the HS verdicts found, each with its one level, and the Quality score they add up to. Like /compliance, it reads the stored check result and sends no webhook. The second form serves the same answer for a shared link, without an API key.

{
  "qualityScore": 80,
  "qualityLevel": "warning",
  "counts": { "serious": 0, "warning": 2, "note": 1 },
  "reviewed": false,
  "checksPending": false,
  "holdReason": null,
  "route": { "destination": { "code": "US", "source": "document" }, "export": { "code": "CN", "source": "document" } },
  "coverage": { "profileId": "US", "reason": "destination_profile", "checksNotRun": [] },
  "issues": [
    {
      "code": "total_mismatch",
      "owner": "checks",
      "kind": "document",
      "level": "warning",
      "countsInScore": true,
      "costPercent": 10,
      "message": "Invoice total (5,000.00) does not match sum of line items (5,250.00)",
      "fields": ["InvoiceTotal"]
    }
  ]
}
  • qualityScore is 0 to 100: 100% less 10% for each counted warning and 20% for each counted problem that needs fixing, down to 0; notes cost nothing, and HS problems count once, at their worst level. It is null, with no issues, while nothing can be judged yet (not read, mid-processing, or a kind CargoLint does not read).
  • qualityLevel is the worst counted problem (none, warning, serious), the colour the app shows; serious is shown as Needs fixing.
  • checksPending is true while the document checks have not run yet: the score and issues then cover only what the reading and the HS verdicts found.
  • Each issue names its code, owner (reading, checks, hs or app), kind, level, whether it countsInScore and its costPercent, the fields it is about (Items[n] is a whole line), a lineIndex for line problems, a check’s detail and an HS problem’s verdict in hs. The list of problem types with their levels is in problemTypes from GET /config.
  • reviewed is true once a person signed the document off; the reading problems no longer apply and are left out.
  • holdReason says why a document in Review is there: problems (its counted problems add up to one that needs fixing, or two warnings, a Quality score below 90%), reading (the reading found them), hs (HS codes to confirm), ocr (a degraded scan), blocking (an exact sanctions match, a CITES Appendix I species, or a check that could not run) or shipment (a shipment finding that needs fixing). It is null when the document is not in Review.
  • route and coverage are what /compliance returns for the same document: the destination it was checked against and what the checks covered. A shared link returns them as null.

See Quality Score for a fuller example.

Get the document’s shipment findings

GET /documents/{id}/shipment-findings

Returns the findings of the shipment’s latest evaluation that involve this document: shipmentId, shipmentReference, isSettled, overallStatus, generatedAt and findings (the same rows as the shipment detail). A document with no evaluated shipment returns an empty findings list.

Review

These endpoints act on a document in PendingApproval, RequiresReview, Skipped or Completed; any other status returns 400.

POST /review/{documentId}/approve        - approve as read; status becomes Completed
POST /review/{documentId}                - submit corrections; status becomes Completed
POST /review/{documentId}/skip           - defer; status becomes Skipped

Submitting corrections:

curl -X POST "https://api.cargolint.com/api/v1/review/{documentId}" \
  -H "X-API-Key: cl_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "correctedFields": [
      { "fieldName": "InvoiceId", "originalValue": "INV-2026-0O42", "correctedValue": "INV-2026-0042" }
    ],
    "removedLineItemIndices": []
  }'

Approve and submit return documentId, status, fieldsCorrected, reviewedAt, nextDocumentId and remainingReviewCount. Approving or submitting queues a new evaluation of the document’s shipment. GET /review lists the review queue.

Files and exports

GET  /documents/{id}/download                 - the original file, as an attachment
GET  /documents/{id}/content                  - the same bytes, for display
GET  /review/{documentId}/export-pdf          - a clean PDF built from the corrected fields
GET  /documents/{id}/export?format=xlsx|csv   - the corrected fields and line items as one table
POST /documents/{id}/audit-packet             - a ZIP with everything behind the result
POST /shipments/{id}/audit-packet             - the same for a whole shipment
GET  /documents/batch/{batchId}/download      - the Completed documents of an upload batch, as a ZIP
  • The PDF export is available for every kind CargoLint reads; other kinds return 400.
  • The table export has a row per line item, the header fields repeated on each, with labels from fieldDisplay; format other than xlsx or csv returns 400.
  • The audit packet contains document.json (with the document’s source, quality_score and quality_level), exported.pdf (for kinds CargoLint reads), extraction.json (the fields with corrections applied), corrections.json, compliance.json, shipment-consistency.json when the document is in a shipment, and version-stamp.json.

See Export Formats.

Reprocess

POST /documents/{id}/reprocess
POST /documents/batch/{batchId}/reprocess

Sends the document (or every document of the batch) through extraction again. The limit is 20 reprocess requests per organization per hour by default; over it, 429. A reprocess counts as a document against the plan, except within 15 minutes of the first extraction when nobody has reviewed the document yet. Once the new reading is in, each correction is compared with it, ignoring case, spacing and how a number is written: it stays when the new reading matches the value corrected or the correction, and is marked stale otherwise. A batch reprocesses each document the same way, keeping its corrections, and each one counts toward the hourly limit: once the limit is reached, the rest are left as they are, counted in failedCount, and error says why.

Rename, delete and navigate

PUT    /documents/{id}/title          - { "title": "..." }, up to 200 characters; sets titleSetByUser until the next reprocess
DELETE /documents/{id}                - Owner or Admin user only; returns 204
GET    /documents/{id}/batch          - the other documents of the same upload batch
GET    /documents/{id}/adjacent       - the previous and next document ids (?status=&documentType=)

A deleted document disappears at once and its shipment is evaluated again without it. Its rows and file are purged after a one-day grace period. Deleting needs an Owner or Admin session; an API key receives 403.

Generate a packing list

POST /documents/{id}/generate-packing-list

Creates a packing list from an invoice: the parties and line items are copied, the weights and dimensions are left blank for review. Returns the new documentId, status, detectedDocumentType, title and generatedFromId. A source that is not an invoice returns 400.

Clone a document

POST /documents/{id}/clone?shipmentId={shipmentId}
POST /documents/{id}/clone?shipmentReference={reference}

Creates an editable copy of the same kind with the corrected values, and the values unique to a consignment (numbers, dates, container and seal numbers, weights, marks) left blank for review. Pass a shipmentId or a shipmentReference to place the copy; without either it starts a new shipment. Any kind CargoLint reads can be cloned. A clone counts as a document against the plan.

Sharing sends read-only results to people outside your organization. It needs a user session; an API key receives 401.

POST /documents/{id}/share          - { "recipients": [ { "email": "...", "company": "..." } ] }
GET  /documents/shares/quota        - the sending user's daily allowance

Each recipient gets their own link, valid for 3 days. Up to 20 recipients per request and 100 per user per day; the same recipient is skipped for 15 minutes after a share. The response lists successCount, rejectedEmails, cooldownEmails and remainingDaily.

Recipients open the link without an account:

GET /public/shared-documents
GET /public/shared-documents/content
GET /public/shared-documents/compliance

A share link's token goes in the `X-Link-Token` header, never in the URL, so it never reaches a request log.

What’s next