Back to the main blog

Best API for extracting data from customs clearance invoices (2026)

Kushal Byatnal

Kushal Byatnal

8 min read

Nov 20, 2026

Blog Post

A customs clearance invoice records what crossed a border, who shipped and received it, and what duties and taxes were charged. Brokers, freight forwarders, and importers re-key these fields into customs, ERP, and audit systems. At Nuvocargo, a cross-border freight platform, one missing document, incorrect HTS code, or mismatched consignee could hold a truck at the US-Mexico border for weeks. A customs invoice extraction API reads each document, scanned or digital, and returns those fields as structured data. This guide lists the fields that matter, compares five APIs, and shows how to start from a ready-made schema.

The short answer

Extend is the best fit for brokers, forwarders, and importers whose customs documents vary by broker and country, and who need the fields they file, such as HS codes and declared values, with evidence for each value.

  • Your fields, not a fixed invoice model. You define the schema, so HS codes, declared values, origin, and each duty line are fields like any other. Extract returns them as JSON.
  • Every value is traceable. With citationsEnabled: true, each field comes back with an OCR confidence score and a citation to its place on the page.
  • Packets become documents. The Split API separates a shipment packet into its invoice, packing list, and bill of lading before extraction.
  • A schema to start from. The customs clearance invoice template runs Parse then Extract with a 13-field schema.

Nuvocargo uses Extend's classification and extraction APIs to pull consignee, SKU, invoice number, HTS codes, quantities, unit values, and currency from invoices, pedimentos, packing lists, and customs forms, reaching 97–99% accuracy across classification, extraction, and shipment attribution.

Other options fit teams with different starting points:

  • Azure AI Document Intelligence for teams on Azure that want a pre-built invoice model across 27 languages, with custom models for customs fields.
  • Google Document AI for teams on Google Cloud that want the Invoice Parser plus a Custom Extractor for customs fields.
  • Veryfi for freight teams that also process bills of lading and freight invoices.
  • Mindee for teams that want a pre-built invoice API plus a custom data extractor, with a free trial.

Fields in a customs clearance invoice

FieldWhere it appearsNotes
Invoice and customs declaration numbersHeaderThe declaration number links the invoice to the filed entry
Shipper, consignee, and customs agentHeader or parties blockAgent address is often separate from the agent name
Origin and destination countriesHeader or per lineDrives duty rates and trade agreement eligibility
Goods: description and quantityLine-item tableQuantity may be units, weight, or volume
HS codeLine-item tableOften 6 to 10 digits
Declared value and currencyLine-item table and totalsDeclared value per line and in total
Customs chargesCharges tableEach import duty, VAT, processing, or inspection fee, with its amount
Total customs charges and payment statusTotals blockWhether duties are paid, pending, or deferred

Start from the template, then add tariff fields

The customs clearance invoice template targets the broker's clearance bill: the document that lists the goods cleared, the duties charged, the customs agent, and whether the charges are paid. It returns goods with description and quantity, invoice date and number, shipper, consignee, origin and destination countries, payment status, customs charges, customs agent name and address, total customs charges, and customs declaration number.

Because the schema is yours, tariff fields are a small edit. Add three properties to the goods line items:

"goods": {
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "description": { "type": ["string", "null"] },
      "quantity": { "type": ["number", "null"] },
      "hs_code": { "type": ["string", "null"], "description": "Harmonized System code for this line, as printed" },
      "declared_value": { "type": ["number", "null"], "description": "Declared customs value for this line" },
      "currency": { "type": ["string", "null"], "description": "ISO 4217 currency code of the declared value" }
    }
  }
}

Commercial invoices, where HS codes and declared values usually originate, use the same approach with a schema for their own fields.

A sample customs clearance invoice with the declaration number, origin country, and goods description highlighted as template fields, and the HS code, declared value, and currency outlined as fields added to the line-item schema, mapped to JSON output
Template fields, plus hs_code, declared_value, and currency added to the goods line items. With citations enabled, each field path also gets an OCR confidence and a citation. Fictional companies and values.

Customs clearance invoice extraction APIs compared

Extend publishes this guide and makes Extend, one of the tools compared. Every claim below comes from the vendor's public documentation or pricing page, checked in November 2026.

ExtendAzure AI Document IntelligenceGoogle Document AIVeryfiMindee
Best forVariable customs documents with fields you defineTeams on Azure wanting a pre-built invoice modelTeams on Google Cloud combining pre-built and custom extractionFreight teams also processing bills of ladingA pre-built invoice API with a custom extractor
ApproachParse and Extract with your schema; customs template includedPrebuilt invoice model, plus custom extraction modelsInvoice Parser, plus Custom ExtractorFreight and customs document OCR with line itemsPre-built invoice model, plus a custom data extractor
Customs-specific fieldsAny field you define, such as HS code, origin, and dutiesCustom model for fields outside the invoice modelCustom Extractor for fields outside the Invoice ParserLine-item cargo detail for customs declarationsCustom extractor for fields outside the invoice model
Multi-document packetsSplit returns page ranges and a file per documentCustom classification modelsCustom classifier and custom splitterPDF split into document page rangesSplitter for multi-page files
Evidence per valueOCR confidence and citation with citationsEnabled: trueConfidence scores with bounding boxesConfidence per entityOptional confidence details and bounding boxesConfidence score and position per field
PriceAbout 1.2¢ (Light) to 5¢ (Performance) per page for Extract, parsing includedSee pricing3¢ per page (Custom Extractor)16¢ per invoice on Starter ($500 monthly minimum)See pricing

Extend

Best for: brokers, forwarders, and importers whose customs documents vary by country and broker.

A scanned packet split into a commercial invoice, packing list, bill of lading, and customs clearance bill with page ranges, each sent to its own extraction schema, with the customs clearance bill sent to the customs invoice template
Split a shipment packet into its documents first, then extract each one with the schema that fits it. Page ranges are illustrative.

Azure AI Document Intelligence

Best for: teams on Azure that want a pre-built invoice model.

The Azure invoice model extracts key fields and line items from invoices, utility bills, sales orders, and purchase orders, including phone photos and scans, in 27 languages, with confidence scores and bounding boxes. Custom extraction models cover fields the invoice model doesn't return, and custom classification models sort mixed files.

Google Document AI

Best for: teams on Google Cloud that want a pre-built invoice parser plus custom extraction for customs fields.

Google Document AI offers an Invoice Parser, a Form Parser for key-value pairs and tables, a Custom Extractor that uses generative AI or trained models, and custom classifier and splitter processors, with a confidence score per extracted entity.

Veryfi

Best for: freight and logistics teams that process bills of lading, freight invoices, and customs forms together.

Veryfi's freight and customs OCR extracts line-item detail such as cargo descriptions, SKUs, quantities, and weights for freight auditing and customs declarations. Its document API can return confidence details and bounding boxes, and a split endpoint breaks a PDF into document page ranges.

Mindee

Best for: teams that want a pre-built invoice API and will add a custom extractor for customs fields.

Mindee's invoice API extracts supplier, totals, taxes, and line items, and every field carries a confidence score and its position on the page. Mindee lists customs clearance among its use cases and offers a custom data extractor and a splitter for fields and files its invoice model doesn't cover, with a 14-day free trial.

How to choose

  1. List the fields you file. If you need HS codes, origin, and duty lines, pick a tool where you define the schema, or plan for a custom model.
  2. Check your packets. If invoices arrive bundled with packing lists and bills of lading, you need splitting or classification before extraction.
  3. Plan the review step. Customs errors are costly, so prefer per-field confidence and evidence that let a reviewer check values against the page.
  4. Test on your own documents. Run every candidate on 50 to 100 documents from your real brokers and countries, including scans, and score HS codes and declared values separately.

FAQ

What is the best API for extracting data from customs clearance invoices?

Extend is the best fit for brokers, forwarders, and importers whose customs documents vary by broker and country and who need fields they define, such as HS codes and declared values, with evidence for each value. Extend Extract returns the schema you define as JSON, with an OCR confidence score and a citation per value when citations are enabled, Split separates shipment packets into individual documents, and the customs clearance invoice template gives you a 13-field schema to start from. Nuvocargo uses Extend's classification and extraction APIs on invoices, pedimentos, packing lists, and customs forms. Azure's invoice model and Google's Invoice Parser fit teams that want a pre-built model on their cloud, with custom models for customs fields, and Veryfi fits freight teams that also process bills of lading.

Can an API extract HS codes from a customs invoice?

Yes, if HS codes are in the schema. HS codes usually sit in the line-item table next to the description, quantity, and value. In Extend you add an hs_code property to the goods line items, and with citations enabled each extracted code comes back with a citation so a reviewer can check it against the page. Pre-built invoice models without a tariff field need a custom model to return HS codes.

How do you split a shipment packet into separate customs documents?

Split before extraction. Extend's Split API returns page ranges and a file for each sub-document, so a packet holding a commercial invoice, packing list, bill of lading, and customs clearance bill becomes separate files, each sent to the schema that fits it. Google offers a custom splitter processor, Azure offers custom classification models, and Veryfi offers PDF splitting into document page ranges.

How should customs invoices be reviewed before filing?

Route on evidence. Send any field below a confidence threshold, such as an unreadable HS code or declared value, to a reviewer with the citation that shows where the value came from, and auto-approve the rest. Check that line values add up to the invoice total and that the consignee matches the shipment before filing.

What does the customs clearance invoice template extract?

Extend's customs clearance invoice template targets the broker's clearance bill. It parses the file with agentic OCR, then extracts 13 fields: goods with description and quantity, invoice date and number, shipper, consignee, origin and destination countries, payment status, customs charges, customs agent name and address, total customs charges, and customs declaration number. Commercial invoices use the same approach with a schema for their own fields.

Sources

Checked in November 2026:

More guides

Get an API key to run the customs clearance invoice template on your own documents.

cta-background

( fig.11 )

Turn your documents into high quality data