{"slug": "i-built-a-document-extraction-api-that-runs-on-regex-no-llm-needed", "title": "I built a document extraction API that runs on regex (no LLM needed)", "summary": "A developer built Invoice to JSON Extractor, a public API that parses invoices, receipts, resumes, and bank statements into structured JSON using a regex heuristic engine rather than an LLM. The base path handles roughly 70% of typical invoices in under 50ms at zero ongoing cost, escalating to DeepSeek or Groq only when the regex extractor returns a low confidence score, so about 95% of requests never hit an LLM. The service, built on FastAPI and Pydantic and billed through RapidAPI, offers a free tier of 500 calls per month with paid tiers starting at $9/month for 2,000 calls.", "body_md": "I kept rewriting invoice parsing code on every freelance project. Same regex, same edge cases, same pain. So I made it a public API instead.\n\nIt's called **Invoice to JSON Extractor**. Four endpoints, one auth, text in, structured JSON out.\n\nThe interesting part: the base path doesn't use an LLM. It's a regex heuristic engine that handles ~70% of typical invoices in under 50ms, for zero ongoing cost.\n\n| Endpoint | Input | Output | \n|---|---|---|\n| `POST /v1/invoice/extract` | Invoice text | number, dates, vendor, VAT, totals, line items | \n| `POST /v1/receipt/extract` | Receipt text | store, date, items, total, payment method | \n| `POST /v1/resume/extract` | CV/resume text | name, email, phone, skills, experience | \n| `POST /v1/bank-statement/extract` | Bank statement text | account, transactions, running balance | \n\nBilingual out of the box (English + Vietnamese).\n\nWhen I started, I assumed I'd need an LLM for this. But most invoices follow one of maybe 15 common layouts. Regex handles these in 40-60ms with zero API calls.\n\nThe LLM is a **fallback**, not the primary engine. If the regex extractor returns a low confidence score, the API escalates to DeepSeek or Groq for that specific request.\n\nResult: ~95% of requests never hit an LLM. Average cost per request rounds to zero.\n\nInput:\n\n```\nINVOICE\nInvoice #: INV-2024-001\nDate: 15/03/2024\nVendor: Acme Supplies Ltd.\nVAT: GB123456789\nBill To: Widget Corp\n\nWidget A  10  5.00  50.00\nWidget B  3   20.00 60.00\n\nSubtotal: 110.00\nVAT 20%: 22.00\nTotal: 132.00 GBP\n```\n\nOutput:\n\n```\n{\n  \"success\": true,\n  \"invoice\": {\n    \"invoice_number\": \"INV-2024-001\",\n    \"invoice_date\": \"2024-03-15\",\n    \"currency\": \"GBP\",\n    \"vendor_name\": \"Acme Supplies Ltd.\",\n    \"vendor_tax_id\": \"GB123456789\",\n    \"customer_name\": \"Widget Corp\",\n    \"subtotal\": 110.0,\n    \"tax_amount\": 22.0,\n    \"total\": 132.0,\n    \"line_items\": [\n      {\"description\": \"Widget A\", \"quantity\": 10.0, \"unit_price\": 5.0, \"amount\": 50.0},\n      {\"description\": \"Widget B\", \"quantity\": 3.0, \"unit_price\": 20.0, \"amount\": 60.0}\n    ],\n    \"confidence\": 0.9\n  },\n  \"model\": \"heuristic:v1\",\n  \"processing_ms\": 42\n}\ncurl -X POST \"https://invoice-to-json-extractor1.p.rapidapi.com/v1/invoice/extract\" \\\n  -H \"content-type: application/json\" \\\n  -H \"X-RapidAPI-Key: YOUR_KEY\" \\\n  -H \"X-RapidAPI-Host: invoice-to-json-extractor1.p.rapidapi.com\" \\\n  -d '{\"content\":\"Invoice #: INV-1\\nDate: 2024-01-15\\nTotal: 132.00 USD\"}'\n```\n\nGet a free key here: [Invoice to JSON Extractor](https://rapidapi.com/tuyentn23/api/invoice-to-json-extractor1)\n\nFree tier: 500 calls/month. Paid tiers start at $9/month for 2,000 calls.\n\nIf you build anything that processes invoices or receipts, I'd love feedback on what fields you actually need. The API is small and I can iterate fast.\n\n*Stack: FastAPI + Pydantic, deployed on Render free tier, billing via RapidAPI. Total monthly cost so far: $0.*", "url": "https://wpnews.pro/news/i-built-a-document-extraction-api-that-runs-on-regex-no-llm-needed", "canonical_source": "https://dev.to/tuyentn23dot/i-built-a-document-extraction-api-that-runs-on-regex-no-llm-needed-3b0g", "published_at": "2026-09-22 04:44:18+00:00", "updated_at": "2026-09-22 05:22:57.299553+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "ai-products"], "entities": ["Invoice to JSON Extractor", "FastAPI", "Pydantic", "Render", "RapidAPI", "DeepSeek", "Groq"], "alternates": {"html": "https://wpnews.pro/news/i-built-a-document-extraction-api-that-runs-on-regex-no-llm-needed", "markdown": "https://wpnews.pro/news/i-built-a-document-extraction-api-that-runs-on-regex-no-llm-needed.md", "text": "https://wpnews.pro/news/i-built-a-document-extraction-api-that-runs-on-regex-no-llm-needed.txt", "jsonld": "https://wpnews.pro/news/i-built-a-document-extraction-api-that-runs-on-regex-no-llm-needed.jsonld"}}