Skip to content
NEWMeet Alaaddin, your AI genie with a voice. trig8n launches 1 January 2027. See what is new

Library / Documents, PDF & OCR

Documents, PDF & OCR

Extract structured invoice data from text with OpenAI

When you run it, it reads and extracts data from documents with OpenAI / ChatGPT.

What it does

## Extract structured invoice data from text with OpenAI ### Who's it for Freelancers, bookkeepers and small business owners who retype invoice details into a spreadsheet, and developers building finance automation for clients. ### How it works You paste an invoice as plain text. The workflow sends it to OpenAI with a strict schema and returns clean JSON: vendor, invoice number, issue and due dates, total, currency, tax, and every line item with quantity and unit price. Fields that are not on the document come back as null rather than as guesses. Dates are normalised to YYYY-MM-DD and amounts to plain numbers, so the result drops into a sheet or a database without post-processing. Parse failures route to a separate branch rather than being mistaken for a valid extraction. ### How to set up 1. Paste an invoice into Set Invoice Text — a sample is filled in so you can run it immediately 2. Connect an OpenAI credential on Extract Invoice Data 3. Run. Clean JSON appears on Extracted Invoice. ### Requirements n8n 1.0 or later and an OpenAI API key. A fraction of a cent per invoice. No Gmail, no Google account, no database. ### How to customize The whole extraction schema is a plain text field in Set Extraction Prompt — add fields, tighten rules or change the output shape without touching the HTTP node. The model is a separate field in the same node. A fuller version with a Gmail trigger, PDF and scanned-image reading, duplicate detection and Sheets or PostgreSQL output is at https://enzosoftware.gumroad.com/l/ai-invoice-processor-n8n

The steps

  1. Manual Trigger
  2. Set Invoice Text
  3. Set Extraction Prompt
  4. Extract Invoice Data (OpenAI)
  5. Parse AI Response
  6. Route Error or Success
  7. Extracted Invoice
  8. Extraction Error

Similar automations