Integrating Invofox
The core integration — the happy path, from upload to JSON.
Invofox is one API to extract structured data from PDFs and images — send any document (invoices, receipts, bank statements, delivery notes, contracts and many more, including custom document types) and get back clean, structured JSON. Under the hood it’s an intelligent document processing (IDP) platform: OCR + AI that classify each document and extract its fields automatically — no templates, no manual data entry.
This page is the core integration — the happy path, from upload to JSON. For use cases, accuracy and pricing, see invofox.com →
Using an AI coding agent? Connect to the Invofox MCP server so your agent can search these docs in real time. Integrate with an AI agent →
Step 1 — Get your API key
API keys are scoped to an environment. To create one:
- Log in to app.invofox.com and open your environment — create a free account if you don’t have one yet.
- Click API and Webhooks in the left menu.
- Create a new API key and copy it.
Step 2 — Upload a document
Send your file as multipart/form-data with an info JSON field. The response returns a documentId — that’s all you need. Full API reference →
The info field
Where to find Document Type IDs
- Open Document Types in the left menu of Invofox.
- Each Document Type shows a card with its
idandalias. - Use the
aliasif it has one; otherwise use theid. - Need a Document Type that isn’t there? Invofox can define custom Document Types for your use case — contact support@invofox.com.
Upload response
The upload returns immediately with a documentId — not the extracted data. Invofox processes the document asynchronously. Save the documentId from files[0] and use it in Step 3 to retrieve the results.
Step 3 — Get the extracted data
Processing is asynchronous. Webhooks are the recommended approach; polling is fine for quick tests and prototyping.
Invofox pushes a document.processed event to your server when extraction is complete. Event-driven, no polling overhead. Recommended for all production integrations.
No infrastructure needed — great for prototyping and quick tests. Not recommended for production.
Option A · Webhooks (recommended for production)
In Invofox, open your environment and go to API and Webhooks → Webhooks to add your endpoint URL. Your server will then receive a document.processed event the moment extraction finishes.
For the complete list of events and their payload schemas (plus signing and verification), see the Webhooks Reference →. The example below shows a document.processed payload.
A file can also fail before producing any document (password-protected, corrupt, unsupported format). Listen for the file.rejected webhook so you don’t wait forever for a document that never arrives — this applies whether you use webhooks or polling. See Rejected files.
Option B · Polling
Poll GET /documents/{documentId} using exponential backoff (start at 5 s, double each retry). The endpoint may return 404 for the first several seconds — that’s expected, keep polling. Stop when you get a 200 with publicState set to approved, pendingCorrection, or discarded.
Final response fields live under result.data. The example below is illustrative.
The set of fields is defined by the Document Type configured in your environment — it is not fixed. The structure is always the same: every field is a { "value": ... } object, which can be nested, with arrays for line items. To see the exact fields for your Document Type, check Document Types in the dashboard or process a sample document.
Further optional steps
Give feedback on extracted values
If an extracted value is missing or incorrect, you can send the right value back via PUT /documents/{id}. Every correction feeds directly into model training, improving extraction accuracy over time — automatically, with no extra configuration. See the Feedback loop page for the full reference.
Additional Features
The core integration is complete. These features are available if your use case requires them: