DEV Community

Cover image for I built a free API to extract invoice data using Claude AI — no templates needed
Alan
Alan

Posted on

I built a free API to extract invoice data using Claude AI — no templates needed

If you've ever had to parse invoices manually — or build a system that does — you know how painful it is.
Every vendor has a different format. Traditional OCR tools require custom templates per layout.
Enterprise solutions (Azure Document Intelligence, AWS Textract) work, but they're expensive and complex to set up.

I built InvoiceAI API to solve this: submit any invoice image URL or base64 image, get back structured JSON. No templates. No training. Powered by Claude AI.

What it does

  • Extracts vendor, customer, line items, totals, tax, dates
  • Works on invoices, receipts, and purchase orders
  • Accepts image URL or base64
  • Returns clean, structured JSON every time

Quick example (Node.js)

const response = await fetch('https://invoiceai-api.p.rapidapi.com/invoice', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-RapidAPI-Key': 'YOUR_API_KEY',
    'X-RapidAPI-Host': 'invoiceai-api.p.rapidapi.com'
  },
  body: JSON.stringify({
    url: 'https://example.com/invoice.jpg'
  })
});

const data = await response.json();
console.log(data);
Enter fullscreen mode Exit fullscreen mode

Example output

{
  "vendor": {
    "name": "Acme Corp",
    "address": "123 Main St, New York, NY"
  },
  "invoice_number": "INV-2024-0042",
  "date": "2024-03-15",
  "due_date": "2024-04-15",
  "line_items": [
    { "description": "Web Development Services", "quantity": 1, "unit_price": 1500.00, "total": 1500.00 },
    { "description": "Hosting (Annual)", "quantity": 1, "unit_price": 200.00, "total": 200.00 }
  ],
  "subtotal": 1700.00,
  "tax": 153.00,
  "total": 1853.00,
  "currency": "USD"
}
Enter fullscreen mode Exit fullscreen mode

Python example

import requests

url = "https://invoiceai-api.p.rapidapi.com/invoice"
payload = { "url": "https://example.com/invoice.jpg" }
headers = {
    "Content-Type": "application/json",
    "X-RapidAPI-Key": "YOUR_API_KEY",
    "X-RapidAPI-Host": "invoiceai-api.p.rapidapi.com"
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
Enter fullscreen mode Exit fullscreen mode

Use cases

  • Accounting automation — auto-import invoices into your ERP or bookkeeping system
  • Expense management apps — let users snap a receipt and auto-fill expense reports
  • Procurement workflows — extract PO data without manual data entry
  • Freelance invoicing tools — parse client invoices for payment tracking

Free tier available

There's a free plan on RapidAPI — no credit card needed to get started.

👉 Try InvoiceAI on RapidAPI

Would love feedback — what other fields would be useful to extract?

Top comments (0)