Skip to main content

Parse Document in n8n

What this node does

PDF4me Parse Document runs your saved parse template against a PDF inside an n8n workflow and returns the extracted fields as structured data. Feed it binary data from a previous node, a Base64 string, or a public URL, reference the template by Parse ID, and pipe the resulting JSON, XML, or CSV straight into Set, IF, HTTP Request, or any downstream n8n node. The template carries the extraction logic, so the same node extracts invoices, contracts, receipts, and any custom layout you have configured.

Related Blog Posts(1)

Before you run this node: create a parse template in the PDF4me dashboard. Define your capture keys and pick Regex Expression for stable patterns or JavaScript Expression for conditional logic. The n8n node references that template by Parse ID. See Prepare Parse Info for Document for full setup, Regex examples (INV-\d{6,10}, \d{2}/\d{2}/\d{4}), and two working JavaScript Expression classifier samples.

Authenticating Your API Request

The PDF4me node in n8n requires PDF4me API credentials. Create the credential once in n8n with your API key from the dashboard, then reference it from every PDF4me node in your workflow.

Important Facts You Should Not Miss

Parse ID is required (it is your TemplateId)
Parse ID is the GUID assigned by the dashboard at Save Changes on a template. Copy it from the template detail panel and paste it into the n8n node. Without it the node has no map of which fields to extract.
Regex for stable patterns, JavaScript for conditional logic
Capture keys live in the template. Use Regex Expression for invoice numbers, dates, amounts, tax IDs (around 80% of production keys). Use JavaScript Expression with the text variable for classification and fallback rules.
Output is structured data, not a binary PDF
Unlike Compress, Protect, or Convert nodes that return raw PDF bytes, Parse Document returns JSON (default), XML, or CSV in the binary field you name. Wire it into Set or IF nodes to route the values downstream.
Parse Document node configuration in n8n

Parameters

ParameterRequiredWhat it doesExample
Input Data TypeYesHow the PDF reaches the node. Binary Data (from a prior node), Base64 String (inline encoded), or URL (public file URL).Binary Data
Input Binary FieldConditionalName of the binary field on the input item containing the PDF. Required when Input Data Type is Binary Data.data
Base64 PDF ContentConditionalBase64 encoded PDF content. Required when Input Data Type is Base64 String. No data: prefix.JVBERi0xLjQK...
PDF URLConditionalPublicly reachable URL of the PDF. Required when Input Data Type is URL. The PDF4me service downloads and processes it.https://example.com/invoice.pdf
Document NameYesSource filename including .pdf extension. Used for format detection and error tracing.invoice.pdf
Parse IDYesTemplateId GUID from the PDF4me dashboard. Identifies the parse template (capture keys + extraction rules) to apply.12345678-1234-1234-1234-123456789abc
Output FormatYesShape of the returned data. JSON (default, structured object), XML (hierarchical), or CSV (flat tabular). JSON is the right choice for almost every n8n workflow.JSON
Output Binary Field NameYesName of the binary field the node attaches the parsed output to on the output item. Reference it from downstream nodes.data
Custom ProfilesNoAdvanced JSON-style overrides for parsing behaviour (output sub-format, include metadata flag, etc). Leave empty for default behaviour.{ "outputDataFormat": "json", "includeMetadata": true }

Expression types in your parse template

The capture rules live in the template, not in the n8n node. Both expression types ship with every PDF4me account.

Regex ExpressionStable patterns
Invoice numbers (INV-\d{6,10}), dates (\d{2}/\d{2}/\d{4}), amounts ($?\d{1,3}(?:,\d{3})*(?:.\d{2})?). Around 80% of production keys.
JavaScript ExpressionConditional logic and classifiers
The capture area text is passed as text; return a string. Multi-marker classification, fallback rules, date normalization. See Prepare Parse Info for Document for two working samples.

Output

FieldTypeWhat it contains
fileNameStringGenerated output filename with timestamp and extension matching Output Format (.json / .xml / .csv).
mimeTypeStringMIME type of the output (application/json, application/xml, text/csv).
fileSizeNumberSize of the parsed output in bytes.
successBooleantrue on a successful parse, false otherwise. Wire into an IF node for branching.
messageStringStatus message. Document parsed successfully on the happy path, or a descriptive error.
docNameStringOriginal input filename, preserved for audit trails.

The parsed key/value data itself lives on the binary field you named in Output Binary Field Name.

Workflow examples

Common n8n workflow patternsTypical ways to chain Parse Document into an n8n workflow.
Email attachment to Postgres
  1. Gmail Trigger fires on new invoices labelled vendor-invoice.
  2. Filter passes only attachments ending in .pdf.
  3. Parse Document runs the Invoice template against the binary attachment.
  4. Set node maps parsed invoiceNumber, totalAmount, invoiceDate.
  5. Postgres Insert writes the row into the accounts_payable table.
Classify and extract in one workflow
  1. Webhook receives a PDF from a partner upload portal.
  2. Parse Document runs a template with a JavaScript Expression key returning the document type.
  3. Switch node routes on the returned type (invoice / order / receipt) to type-specific downstream branches.
  4. Each branch posts the parsed fields to the right destination system.
Batch parse from S3 to Airtable
  1. Schedule trigger fires every 15 minutes.
  2. S3 List + Get Object loads each new PDF in the inbound bucket.
  3. Parse Document runs the template against each binary item.
  4. Airtable Create Record writes the parsed fields into the tracking base.

Frequently Asked Questions

What is a Parse ID and where do I get it?+
Parse ID is the TemplateId GUID generated by the PDF4me dashboard when you click Save Changes on a parse template. Find it in the template detail panel. Pin it in your n8n node so the same template runs every execution.
Do I need a template, or can the node parse any PDF without one?+
A template is required for field-level extraction in n8n. Without a Parse ID the node has no map of which regions to capture. Build a template once in the dashboard, then reuse the same Parse ID across runs and across platforms (Make, Zapier, Power Automate).
How does the n8n node know what fields to extract?+
The capture keys live in the template, not in n8n. Each capture area gets a key name (camelCase) and an extraction rule: Regex Expression for stable patterns or JavaScript Expression for conditional logic. The output has one field per key.
Which Input Data Type should I pick?+
Binary Data for files arriving from upstream nodes (Read Binary Files, HTTP Request with response format File, Gmail attachment, Dropbox Download). Base64 String when the PDF is encoded inline. URL when the file lives at a public web address.
Can I extract data using JavaScript Expression in addition to regex?+
Yes. The capture area text is passed as the variable text inside your JavaScript Expression and you return a string. Use it for multi-marker classification, fallback rules, or date normalization. See the Prepare Parse Info for Document guide for two working classifier samples.
JSON, XML, or CSV. Which Output Format should I use?+
JSON for almost every n8n workflow. It maps cleanly into Set, IF, and HTTP Request nodes. XML when your downstream system requires it natively. CSV for spreadsheet uploads and bulk imports.
Is the output a file I can save, or just a JSON object?+
Both. The parsed data is attached to the binary field you set under Output Binary Field Name, so you can Write Binary File to disk, send it as an email attachment, or upload it to storage. The structured data is also available on the regular json output for downstream node mapping.

Same task on other platforms

Get Help