{"product_id":"n8n-invoice-pdf-extract-validate-via-webhook-deepseek-json","title":"n8n Invoice PDF Extract \u0026 Validate via Webhook + DeepSeek JSON","description":"\u003ch3\u003eExtract, validate, and return invoice JSON automatically—via a secured webhook + DeepSeek\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow accepts invoice PDF uploads through a protected webhook, extracts the text, converts the invoice into a single validated JSON object using DeepSeek (OpenAI-compatible), and responds with a clear \u003cem\u003evalid\u003c\/em\u003e vs \u003cem\u003eneeds_review\u003c\/em\u003e result.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReceives invoice PDFs via webhook:\u003c\/strong\u003e A POST webhook endpoint accepts an uploaded file and requires header authentication.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eValidates file type early:\u003c\/strong\u003e If the upload is not a PDF, the workflow immediately flags the result as \u003ccode\u003eneeds_review\u003c\/code\u003e and includes a reason.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eDetects missing\/usable text:\u003c\/strong\u003e It extracts the PDF text layer and flags scanned or image-only PDFs (where text is not usable) as \u003ccode\u003eneeds_review\u003c\/code\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eExtracts invoice fields using DeepSeek JSON:\u003c\/strong\u003e The cleaned invoice text is sent to an OpenAI-compatible \u003ccode\u003e\/chat\/completions\u003c\/code\u003e endpoint (DeepSeek by default) to produce a \u003cem\u003esingle JSON object\u003c\/em\u003e of invoice fields.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNormalizes and validates:\u003c\/strong\u003e Dates and numbers are normalized, required fields are checked, totals and line-item math are validated, currencies are validated, and date plausibility is applied.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReturns one JSON response row:\u003c\/strong\u003e The webhook response includes \u003ccode\u003estatus\u003c\/code\u003e (\u003ccode\u003evalid\u003c\/code\u003e or \u003ccode\u003eneeds_review\u003c\/code\u003e), \u003ccode\u003eissues\u003c\/code\u003e, and the extracted invoice fields.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eAutomatic invoice ingestion for SaaS back offices where PDFs arrive from customers.\u003c\/li\u003e\n  \u003cli\u003ePre-validation before pushing invoice data into accounting or fulfillment systems.\u003c\/li\u003e\n  \u003cli\u003eReducing OCR\/scan failures by detecting image-only PDFs and routing them for manual review.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details (n8n + integrations)\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003en8n nodes:\u003c\/strong\u003e \u003ccode\u003ewebhook\u003c\/code\u003e, \u003ccode\u003ehttp request\u003c\/code\u003e, \u003ccode\u003eset\u003c\/code\u003e, \u003ccode\u003ecode\u003c\/code\u003e, \u003ccode\u003eswitch\u003c\/code\u003e, plus a \u003ccode\u003esticky note\u003c\/code\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eWebhook security:\u003c\/strong\u003e Header authentication (e.g., \u003ccode\u003eX-Api-Key\u003c\/code\u003e).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eLLM extraction:\u003c\/strong\u003e OpenAI-compatible \u003ccode\u003e\/chat\/completions\u003c\/code\u003e using DeepSeek (Authorization: Bearer API key).\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46359772004531,"sku":"N8N-22153","price":44.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/lJD5tuK0KYqNende-TBbR_3rCEybqR.png?v=1793697567","url":"https:\/\/buyflowscripts.com\/products\/n8n-invoice-pdf-extract-validate-via-webhook-deepseek-json","provider":"N8N Commerce","version":"1.0","type":"link"}