The guide
- 1
Get your API key
Sign up at docuparseapi.com/signup. Go to Dashboard → API Keys → Create new key. Copy it — starts with dex_.
- 2
Create a new workflow
In n8n click New Workflow. Add a trigger: Gmail Trigger → New Attachment for email invoices, or Manual Trigger for testing.
- 3
Add an HTTP Request node "Submit Document"
Configure it as shown:
Method: POST URL: https://docuparseapi.com/api/v1/extract Authentication: Header Auth Header Name: Authorization Header Value: Bearer YOUR_API_KEY Body Content Type: Multipart/Form-Data Body Parameter Name: file Body Parameter Value: {{ $binary.data }} Body Parameter Type: File/BinarySign up — get a free API keyNeed your API key first?20 free documents/month — no credit card - 4
Add a Wait node
Wait 5 seconds so extraction can finish.
- 5
Add an HTTP Request node "Get Result"
Fetch the document with the same credential:
Method: GET URL: https://docuparseapi.com/api/v1/documents/{{ $('Submit Document').item.json.document_id }} Authentication: Header Auth (same credential) - 6
Add an IF node "Completed?"
Condition: {{ $json.status }} equals completed. True → map fields. False → back to the Wait node (add a second IF that stops with an error when status equals failed).
- 7
Map the fields
Add a Set node on the true branch:
merchant → {{ $json.data.merchant }} total → {{ $json.data.total }} tax → {{ $json.data.tax }} currency → {{ $json.data.currency }} date → {{ $json.data.date }} invoice_id → {{ $json.data.invoice_id }} - 8
Send to your destination
Add Google Sheets → Append Row. Map the Set node fields to your sheet columns. Done — every invoice creates a new row automatically. To handle errors, the IF node with condition {{ $json.status }} equals failed sends a Slack notification or stops the workflow. In the Manual Trigger test, attach a file as binary property "data". In production, replace the trigger with Gmail, Google Drive or a webhook trigger.
Full working example
{
"name": "Invoice Parser — DocuParse API",
"nodes": [
{ "name": "Manual Trigger", "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [240, 300], "parameters": {} },
{ "name": "Submit Document", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4, "position": [460, 300],
"parameters": { "method": "POST", "url": "https://docuparseapi.com/api/v1/extract",
"authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth",
"sendBody": true, "contentType": "multipart-form-data",
"bodyParameters": { "parameters": [ { "parameterType": "formBinaryData", "name": "file", "inputDataFieldName": "data" } ] } } },
{ "name": "Wait", "type": "n8n-nodes-base.wait", "typeVersion": 1, "position": [680, 300], "parameters": { "amount": 5, "unit": "seconds" } },
{ "name": "Get Result", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4, "position": [900, 300],
"parameters": { "method": "GET", "url": "=https://docuparseapi.com/api/v1/documents/{{ $('Submit Document').item.json.document_id }}",
"authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth" } },
{ "name": "Completed?", "type": "n8n-nodes-base.if", "typeVersion": 1, "position": [1120, 300],
"parameters": { "conditions": { "string": [ { "value1": "={{ $json.status }}", "value2": "completed" } ] } } },
{ "name": "Failed?", "type": "n8n-nodes-base.if", "typeVersion": 1, "position": [1120, 500],
"parameters": { "conditions": { "string": [ { "value1": "={{ $json.status }}", "value2": "failed" } ] } } },
{ "name": "Stop on Failure", "type": "n8n-nodes-base.stopAndError", "typeVersion": 1, "position": [1340, 500],
"parameters": { "errorMessage": "DocuParse API extraction failed" } },
{ "name": "Map Fields", "type": "n8n-nodes-base.set", "typeVersion": 1, "position": [1340, 300],
"parameters": { "values": { "string": [
{ "name": "merchant", "value": "={{ $json.data.merchant }}" },
{ "name": "total", "value": "={{ $json.data.total }}" },
{ "name": "tax", "value": "={{ $json.data.tax }}" },
{ "name": "currency", "value": "={{ $json.data.currency }}" },
{ "name": "date", "value": "={{ $json.data.date }}" },
{ "name": "invoice_id", "value": "={{ $json.data.invoice_id }}" } ] } } }
],
"connections": {
"Manual Trigger": { "main": [ [ { "node": "Submit Document", "type": "main", "index": 0 } ] ] },
"Submit Document": { "main": [ [ { "node": "Wait", "type": "main", "index": 0 } ] ] },
"Wait": { "main": [ [ { "node": "Get Result", "type": "main", "index": 0 } ] ] },
"Get Result": { "main": [ [ { "node": "Completed?", "type": "main", "index": 0 } ] ] },
"Completed?": { "main": [ [ { "node": "Map Fields", "type": "main", "index": 0 } ], [ { "node": "Failed?", "type": "main", "index": 0 } ] ] },
"Failed?": { "main": [ [ { "node": "Stop on Failure", "type": "main", "index": 0 } ], [ { "node": "Wait", "type": "main", "index": 0 } ] ] }
}
}What gets extracted
| Field | Description |
|---|---|
merchant | The vendor or store name |
total | The final charged amount including tax |
subtotal | The pre-tax amount |
tax | The tax amount charged |
date | Invoice or transaction date (ISO 8601) |
due_date | Payment due date, or null if not present |
invoice_id | Invoice number or receipt ID from the document |
currency | ISO 4217 currency code (USD, EUR, GBP, etc.) |
payment_method | Card type, cash, or other payment method |
line_items | Array of items with description, quantity, price, line_total, vat_rate |
Common errors and fixes
MISSING_API_KEY | Authorization header missing | Add header: Authorization: Bearer YOUR_KEY |
INVALID_API_KEY | Key not recognised | Check key in dashboard — regenerate if needed |
LIMIT_EXCEEDED | Monthly document limit reached | Upgrade at docuparseapi.com/pricing |
UNSUPPORTED_FILE_TYPE | File format not supported | Use PDF, JPG, PNG or CSV |
FILE_TOO_LARGE_AUTHENTICATED | The file is too large | Compress the image or split the PDF |
TOO_MANY_PAGES | More than 20 pages | Split the PDF into parts of up to 20 pages |
EXTRACTION_FAILED | Document could not be parsed | Try a cleaner scan or different file |
Ready to start?
20 documents a month free, with full API access. No credit card. Webhooks on Starter and Pro.