Skip to main content

Upload an Invoice, Want Structured Data ? Parse using AI in n8n via PDF4me

· 8 min read
SEO and Content Writer

Upload an invoice PDF to PDF4me, then run it through the AI-Invoice Parser. Two nodes. You get a processInvoiceModel with vendor name, invoice number, totals, line items, bill-to details—everything in a structured format you can map to databases, spreadsheets, or the next workflow step. n8n gives you Schema, Table, and JSON views so you can inspect the output however you like.

In a nutshell: Manual trigger → Upload file to PDF4me (hosts the PDF) → AI-Invoice Parser (uses documentUrl from Upload). Output: processInvoiceModel with invoiceNumber, vendorName, total, lineItems, and more. One credit per invoice.

What You’ll Get

Input: An invoice PDF (e.g. invoice.pdf). Output: A structured object with invoiceNumber (INV-1001), vendorName (ABC Pvt Ltd), invoiceDate, orderId, billTo, lineItems (description, unitPrice, quantity, cgst, sgst), subTotal, total (1180), paymentDeadline, iban, and more. Switch between Schema, Table, and JSON in the output panel to explore the data.

n8n workflow: When clicking Execute workflow → Upload file to PDF4me → AI-Invoice Parser

Workflow: manual trigger, then Upload and AI-Invoice Parser. Each node processes 1 item.


What You Need

  • n8nn8n instance. New workflow with a manual trigger.
  • PDF4me API keyGet your API key. Add a PDF4me Connection credential when you add the first PDF4me node. First time? See Connect PDF4me to n8n.

The Workflow in 2 Nodes

  1. Upload file to PDF4me — Sends your PDF (Base64 or binary) to PDF4me and returns a documentUrl. That URL is what the parser needs.
  2. AI-Invoice Parser — Takes the documentUrl from Upload, runs AI extraction, and returns the processInvoiceModel.
n8n: Execute workflow → Upload file to PDF4me → AI-Invoice Parser

Step 1: Upload file to PDF4me

Workflow so far: Trigger → Upload.

  1. Add a trigger — Manual / When clicking 'Execute workflow' (or use a file trigger from Google Drive, Dropbox, etc.).
  2. Add PDF4me node — Resource: PDF4me → PDF4me Operations: Upload File To PDF4me.
  3. CredentialPDF4me Connection.
  4. Input Data TypeBase64 String or Binary Data (depending on your trigger).
  5. Base64 File Content — Map the PDF from your trigger. For a manual run, use Read Binary File or an expression.
  6. File Retention Hours2 (or your preference). The parser uses the URL before it expires.

The node outputs documentUrl — a URL like https://api.pdf4me.com/api/V2/GetDocument?s=.... The AI-Invoice Parser uses this to fetch and process the PDF.


Step 2: AI-Invoice Parser

Workflow so far: Trigger → Upload → AI-Invoice Parser.

  1. Add another PDF4me node — Resource: AI → AI Operations: AI-Invoice Parser.
  2. CredentialPDF4me Connection.
  3. Input Data TypeURL.
  4. Invoice URL — Map {{ $json.documentUrl }} from the Upload node.
  5. Invoice Nameinvoice.pdf (or map from your trigger).
  6. Custom Fields — Optional. Use Add Custom Field to extract extra fields beyond the standard schema.
AI-Invoice Parser: Input Data Type URL, Invoice URL from documentUrl, Invoice Name invoice.pdf, Add Custom Field

Input wiring

The parser receives the Upload node’s output. The key field is documentUrl:

AI-Invoice Parser input: documentUrl from Upload file to PDF4me

Output: Schema, Table, and JSON

The AI-Invoice Parser returns a single item with processInvoiceModel, _metadata, and other fields. n8n lets you view the output in three formats.

Schema view — Field-by-field structure with types:

Output Schema: processInvoiceModel with invoiceNumber, vendorName, lineItems, subTotal, total

Table view — Spreadsheet-style layout:

Output Table: processInvoiceModel columns, _metadata with success, message, sourceFileName invoice.pdf

JSON view — Raw response for mapping and debugging:

Output JSON: processInvoiceModel with invoiceNumber INV-1001, vendorName ABC Pvt Ltd, total 1180, lineItems

What’s inside processInvoiceModel

FieldExampleNotes
invoiceNumberINV-1001Invoice reference
invoiceDate2026-03-01T00:00:00Issue date
orderIdORD7788Order reference
vendorNameABC Pvt LtdSupplier
vendorAddressDelhi, IndiaFull address
vendorEmail[email protected]Contact
billToJohn SmithCustomer name
billToAddressMumbai, IndiaBilling address
lineItems[description, unitPrice, quantity, …]Line items array
subTotal1000Before tax
cgst, sgst90, 90Tax amounts
total1180Grand total
paymentDeadline2026-03-10T00:00:00Due date
ibanDE89370400440532013000Bank details

_metadata includes success, message (e.g. "Invoice processed successfully using AI"), sourceFileName, and processingTimestamp.


What’s Next?

  • Map processInvoiceModel into Google Sheets, Airtable, or a database with a follow-up node.
  • Replace the manual trigger with Google Drive or Dropbox "new file" to run on every new invoice.
  • Use Set or Code to pick specific fields before sending to your system.
  • Same pattern in Make, Zapier, or Power Automate if you prefer.

Troubleshooting

documentUrl not found

Ensure the Upload node runs first. Use {{ $json.documentUrl }} in the Invoice URL field, or pick it from the expression editor.

Empty or incomplete output

Check that the Upload node returns a valid documentUrl. If the file expired (retention hours passed), re-run the Upload step.

401, 402, or other API errors

PDF4me Troubleshooting covers 401 (API key), 402 (credits), and more.