Automation

Invoice Parsing in n8n — Automate Receipt & Invoice Extraction (No Code)

If invoices arrive in your inbox and you're still typing the data out manually, this workflow eliminates that entirely.

By Othmane M., founder of DocuParse API · Last reviewed: 2026-10-20

The guide

  1. 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. 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. 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/Binary
    Need your API key first?
    20 free documents/month — no credit card
    Sign up — get a free API key
  4. 4

    Add a Wait node

    Wait 5 seconds so extraction can finish.

  5. 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. 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. 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. 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

json
{
  "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

FieldDescription
merchantThe vendor or store name
totalThe final charged amount including tax
subtotalThe pre-tax amount
taxThe tax amount charged
dateInvoice or transaction date (ISO 8601)
due_datePayment due date, or null if not present
invoice_idInvoice number or receipt ID from the document
currencyISO 4217 currency code (USD, EUR, GBP, etc.)
payment_methodCard type, cash, or other payment method
line_itemsArray of items with description, quantity, price, line_total, vat_rate

Common errors and fixes

MISSING_API_KEYAuthorization header missingAdd header: Authorization: Bearer YOUR_KEY
INVALID_API_KEYKey not recognisedCheck key in dashboard — regenerate if needed
LIMIT_EXCEEDEDMonthly document limit reachedUpgrade at docuparseapi.com/pricing
UNSUPPORTED_FILE_TYPEFile format not supportedUse PDF, JPG, PNG or CSV
FILE_TOO_LARGE_AUTHENTICATEDThe file is too largeCompress the image or split the PDF
TOO_MANY_PAGESMore than 20 pagesSplit the PDF into parts of up to 20 pages
EXTRACTION_FAILEDDocument could not be parsedTry 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.

Sign up — get a free API key