Why Extract Customs Declaration with JavaScript
Logistics companies process thousands of Customs Declaration documents monthly. Using JavaScript to automate Customs Declaration data extraction eliminates manual entry, reduces errors, and speeds up document processing from minutes to seconds. With the Cargoffer OCR API, you can integrate Customs Declaration extraction into any JavaScript application in under 10 lines of code.
Setting Up the JavaScript Client
First, get your free API key from the dashboard. Then install the HTTP client for JavaScript and configure authentication. The API uses Bearer token auth — pass your key in the Authorization header.
Uploading a Customs Declaration Document
Use the POST /api/upload endpoint to send the document file. The system auto-detects Customs Declaration format and routes it to the best extraction model. Upload in PDF, image, or Excel format.
Extracted Data Fields
declaration_number, customs_office, exporter, importer, hs_code, goods_description, gross_weight, invoice_value, incoterm, country_of_origin, duties, total_duties.
JavaScript Code Example
The complete JavaScript integration code handles file upload, extraction request, polling for results, and error management. Error types: 401 (invalid key), 402 (quota exceeded — upgrade your plan), 429 (rate limit — wait and retry), 422 (malformed request).
Pricing & Volume
Each Customs Declaration extraction costs from 0.002 EUR per page. The free plan includes 1 page. The Pro plan (49 EUR/month) covers 1,000 pages — enough for 500000 Customs Declaration documents. Manual Customs Declaration data entry costs 3-15 EUR per document — OCR saves 99%.
Related Integrations
See also: [Customs Declaration with Python](https://ocr.cargoffer.com/tutorials/documents/customs-declaration-extraction/integration/python) | [Customs Declaration with JavaScript](https://ocr.cargoffer.com/tutorials/documents/customs-declaration-extraction/integration/javascript) | [Customs Declaration with Java](https://ocr.cargoffer.com/tutorials/documents/customs-declaration-extraction/integration/java) | [Customs Declaration via REST API](https://ocr.cargoffer.com/tutorials/documents/customs-declaration-extraction)