Processing Commercial Invoices
Learn how commercial invoices are processed through the API: the fields extracted, the Quality score, and the checks that run.
Overview
CargoLint extracts structured data from commercial invoices, rates how clearly it read each field, and checks the result. Commercial, proforma and tax invoices are all read as invoices. This guide covers what an integration gets back for an invoice; other kinds follow the same pattern with their own fields.
Supported Invoice Formats
CargoLint accepts invoices in the following file formats:
- PDF - Native or scanned PDF documents, every page read
- TIFF - Multi-page TIFF files
- JPEG/PNG - Single-page images
Maximum file size: 20 MB per document. Invoices must be in English.
Extracted Fields
The field names below are the ones the API returns in fieldName, with the label the app shows.
Document
InvoiceId(Invoice No),InvoiceDate(Date),DueDate,ExportDatePurchaseOrder(P.O. Number),PaymentTerm(Payment Terms),ExportLicenseNumberCurrencyCode(Currency) - an ISO 4217 code, or$,¥or£copied as printed when the invoice names no codeOriginStatement(Statement on Origin),ExporterReferenceNumber, and the terms of sale
Parties
- Shipper / Exporter (
VendorName,VendorAddress, with city, state or province, postal code and country) - Consignee / Importer (
CustomerName,CustomerAddress, and the same address parts) - Buyer, when the invoice names one separately
- Manufacturer (
ProducerName) and Manufacturer Address (ProducerAddress), when the invoice names the producer
Totals
- Subtotal, Tax, Total Due (
InvoiceTotal) and Amount Due
Line Items
Each line item includes, as Items[n].<field>:
- Description and product code
- Quantity and unit of measure
- Unit price and amount
- HS code, as declared
- Country of origin and currency, when the line states them
The Quality Score
Each extracted field carries the AI’s rating of how clearly it read the value (confidence: 0.95 clearly readable, 0.75 may be garbled, 0.50 a guess), and the invoice gets a Quality score. Fetch the fields with GET /documents/{id}/extractions:
{
"detectedDocumentType": "Invoice",
"qualityScore": 90,
"qualityLevel": "warning",
"requiresReview": false,
"fields": [
{ "fieldName": "InvoiceId", "value": "INV-2026-001234", "confidence": 0.95 },
{ "fieldName": "VendorName", "value": "TechExport Co., Ltd", "confidence": 0.95 },
{ "fieldName": "Items[0].Description", "value": "Electronic components", "confidence": 0.95 },
{ "fieldName": "Items[0].HsCode", "value": "8542.31", "confidence": 0.95 }
]
}
What the Score Counts
- The score starts at 100% and loses 10% for each warning and 20% for each problem that needs fixing, down to 0%; notes cost nothing
qualityLevelis the worst problem:none(green),warning(amber) orserious(red, shown as Needs fixing)- HS code problems count once per invoice, at their worst level
GET /documents/{id}/issueslists every problem behind the score
Every document kind is scored the same way. See How the Quality Score Works.
Compliance Checks
Once an invoice is read, CargoLint checks it. Among the checks that run on an invoice:
- Required fields present. “TBA” or “pending” in a box counts as empty, and so does “N/A” or “None” where it cannot be the answer: the invoice number, a date, an amount, the currency or a country
- Line amounts adding up to the total, and the total being the subtotal plus the tax the invoice states
- Declared HS codes checked against each line’s description and, where CargoLint holds the destination’s schedule, its tariff lines
- Lines with no HS code
- Incoterm validity and the tax liability it implies
- Tax and VAT handling for the route, including trade within a customs union
- A currency written only as a symbol, and a date that reads differently in different countries. A currency given only as
$,¥or£is one finding, the ambiguous symbol, not also a missing currency - Sanctions screening of the parties
- Goods on the regulated-goods lists for the route, and CITES-listed species
- The destination’s own field checks, where CargoLint has a profile for the destination
The results come from GET /documents/{id}/compliance, or together with the reading problems and HS verdicts from GET /documents/{id}/issues. Regulated-goods findings are informational: an HS code alone does not establish that a certificate is required.
Handling Invoices That Need a Person
When the reading found problems (one that needs fixing, or two warnings), HS codes await confirmation, the scan is degraded, or a check found something that needs a person:
- Review Queue - The document goes to Review for a person to check
- Manual Correction - Team members correct the fields in a side-by-side editor, in the app or through the Review Queue API
- Learning - Unless a user opts out, corrections feed back into the system to improve future accuracy
Every invoice, however clean, needs a person’s approval before it is marked Completed.
Best Practices
- Ensure invoice images are clear and well-lit
- Avoid blurred or skewed documents
- Provide complete invoices (don’t crop important fields)
- Upload the whole shipment together, so the invoice is checked against the packing list and transport documents
- Scan at 300 DPI minimum for best results
Processing API Endpoint
Upload an invoice for processing:
curl -X POST https://api.cargolint.com/api/v1/documents \
-H "X-API-Key: YOUR_API_KEY" \
-F "file=@invoice.pdf"
The API returns the document ID and its status. Poll GET /documents/{id} until the status leaves Processing, then retrieve the extraction results:
curl -X GET "https://api.cargolint.com/api/v1/documents/{document_id}/extractions" \
-H "X-API-Key: YOUR_API_KEY"
Processing stops at 5 minutes; a document that has not finished by then is marked Failed. See Your First Upload for every status.