Extract and validate invoice data from PDFs with DeepSeek and webhooks
Quick Overview
Description
Quick Overview This workflow receives invoice PDFs via a secured webhook, extracts the PDF text, uses an OpenAI-compatible chat completion API (DeepSeek by default) to return invoice fields as JSON, validates the extracted values, and responds with a single JSON result indicating whether the invoice is valid or needs review. How it works Receives a PDF upload via a POST webhook protected by header authentication. Checks the uploaded file type and immediately flags non-PDF uploads as needs_review with a reason. Extracts the PDF text layer and flags scanned or image-only PDFs (no usable text) as needs_review. Sends the cleaned invoice text to an OpenAI-compatible /chat/completions endpoint (DeepSeek by default) to extract invoice fields as a single JSON object. Normalizes dates and numbers, validates required fields, totals and line-item math, allowed currencies, and basic date plausibility. Responds to the webhook with one JSON row containing status (valid or needs_review), issues, and the extracted invoice fields. Setup Create and select a Header Auth credential for the webhook (for example, header name X-Api-Key) and configure the source system to send that header when calling the webhook URL. Create and select an HTTP Header Auth credential for the LLM request (header Authorization: Bearer ) for your OpenAI-compatible provider (DeepSeek by default). Review and update the values in the Settings step, including allowed_currencies, date_order, llm_base_url, llm_model, and llm_extra_body (set llm_extra_body to {} for providers that don’t support the default DeepSeek-specific fields). Activate the workflow and test by POSTing a multipart form upload with the PDF in the file field to the production webhook URL. An n8n automation workflow template by Sirui W..
Community Metrics
Author
Sirui W.
Platform
web
Pricing model
free
Categories
- Automation
Tags
- n8n
- workflow
- http-request
- code
Capabilities
- 2 nodes