{"product_id":"n8n-invoice-text-to-json-extractor-openai-chat-completions","title":"n8n Invoice Text to JSON Extractor (OpenAI Chat Completions)","description":"\u003ch3\u003eTurn messy invoice text into clean JSON with OpenAI (with error routing)\u003c\/h3\u003e\n\u003cp\u003ePaste an invoice’s raw text into this n8n workflow and use \u003cstrong\u003eOpenAI Chat Completions\u003c\/strong\u003e to extract \u003cstrong\u003enormalized, schema-based invoice fields\u003c\/strong\u003e as clean JSON—while automatically routing any parse or extraction failures to a separate error output.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRuns manually\u003c\/strong\u003e (start when you click “Run workflow”).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eLoads the invoice body\u003c\/strong\u003e as plain text.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eBuilds a strict extraction prompt\u003c\/strong\u003e (including the model to use) and sends the prompt + invoice text to the \u003cstrong\u003eOpenAI Chat Completions API\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eParses and cleans the response\u003c\/strong\u003e into valid JSON, including stripping any \u003cem\u003ecode fences\u003c\/em\u003e returned by the model.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eValidates extraction quality\u003c\/strong\u003e, ensuring meaningful invoice fields were captured and normalizing \u003cstrong\u003eline items\u003c\/strong\u003e into an array.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRoutes results\u003c\/strong\u003e: successful extractions go to the success output; failures include diagnostic details on the error output.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eExtract invoice totals, dates, parties, and line items from emails or PDFs that you’ve already converted to text.\u003c\/li\u003e\n  \u003cli\u003eFeed structured invoice JSON into downstream automations (ERPs, CRMs, or internal approval tools) without hand-parsing.\u003c\/li\u003e\n  \u003cli\u003eBuild resilient invoice processing by separating “works” vs. “needs review” cases using the workflow’s error output.\u003c\/li\u003e\n  \u003cli\u003eCustomize the extraction schema to match your own invoice format and data requirements.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003en8n\u003c\/strong\u003e: requires \u003cstrong\u003en8n 1.0 or later\u003c\/strong\u003e (self-hosted or Cloud).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOpenAI\u003c\/strong\u003e: use an \u003cstrong\u003eOpenAI API key\u003c\/strong\u003e added as an \u003cstrong\u003eHTTP Header Auth credential\u003c\/strong\u003e for the OpenAI request.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNodes used\u003c\/strong\u003e: \u003ccode\u003eif\u003c\/code\u003e, \u003ccode\u003eset\u003c\/code\u003e, \u003ccode\u003ecode\u003c\/code\u003e, \u003ccode\u003eno op\u003c\/code\u003e, \u003ccode\u003esticky note\u003c\/code\u003e, and an \u003cstrong\u003eHTTP Request\u003c\/strong\u003e node for Chat Completions.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eCustomization\u003c\/strong\u003e: the extraction schema is defined as plain text in the \u003cstrong\u003e“Set Extraction Prompt”\u003c\/strong\u003e node—edit fields, rules, or output shape before running.\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eWith automated extraction and failure diagnostics, this n8n invoice text to JSON workflow helps you move from unstructured invoice text to reliable, schema-driven data.\u003c\/p\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":45938156077235,"sku":"N8N-19052","price":57.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/lnQbFpiwTCh9smQ6qUgo_MHRwWDG7.png?v=1788339728","url":"https:\/\/buyflowscripts.com\/products\/n8n-invoice-text-to-json-extractor-openai-chat-completions","provider":"N8N Commerce","version":"1.0","type":"link"}