Invoice Parser API

v1.0

Transform any invoice PDF into structured JSON data in seconds using AI.

Overview

Stop manually copying invoice data. The Invoice Parser API uses frontier AI models to accurately extract invoice information and return clean, structured JSON, ready for your accounting software, database, or automation workflow.

🤖 AI-Powered

Advanced AI for high-accuracy extraction from any invoice format

📦 Line Items

Full itemized invoice support with quantities, units, and prices

📸 Auto OCR

Handles scanned PDFs automatically

💡 Perfect For

  • • Accounting automation (QuickBooks, Xero, FreshBooks)
  • • Expense management and reporting
  • • AP automation workflows
  • • ERP integration (SAP, Oracle, NetSuite)
  • • Audit & compliance data archiving

Quick Start

Base URL

https://api.cparse.com/invoice/v1

Authentication

http
X-API-Key: YOUR_API_KEY

Get your API key from the dashboard. New accounts include free credit — no credit card required.

Quick Example

Extract all fields from an invoice (default behavior):

cURL

bash
curl --request POST \
  --url https://api.cparse.com/invoice/v1/extract-invoice \
  --header 'X-API-Key: YOUR_API_KEY' \
  --form 'file=@invoice.pdf'

Custom Field Selection

Extract only specific fields for faster responses:

bash
curl --request POST \
  --url 'https://api.cparse.com/invoice/v1/extract-invoice?fields=invoice_number&fields=total_amount&fields=vendor_name' \
  --header 'X-API-Key: YOUR_API_KEY' \
  --form 'file=@invoice.pdf'

Endpoints

GET/fields

Get list of all available fields that can be extracted.

Response
json
{
  "invoice_fields": [
    "invoice_number", "date", "due_date", "vendor_name",
    "vendor_address", "buyer_name", "buyer_address",
    "subtotal", "total_amount", "currency", "tax_amount",
    "discount", "payment_terms", "po_number", "items"
  ],
  "item_fields": [
    "description", "quantity", "unit", "price",
    "amount", "sku", "tax_rate"
  ]
}
GET/health

Health check endpoint. Returns service status.

Response
json
{ "status": "ok", "service": "invoice-parser", "version": "0.1.0" }
POST/extract-invoice

Extract structured data from an invoice PDF.

Request
  • Content-Type: multipart/form-data
  • file (required): PDF invoice file
  • fields (optional): Array of invoice fields to extract. Omit for all fields.
  • item_fields (optional): Array of line item fields to extract when items is included.
Response
json
{
  "success": true,
  "data": {
    "invoice_number": "INV-2024-001",
    "date": "2024-03-15",
    "due_date": "2024-04-15",
    "vendor_name": "Acme Corporation",
    "vendor_address": "123 Main St, NYC, NY 10001",
    "buyer_name": "John Smith LLC",
    "buyer_address": "456 Oak Ave, LA, CA 90001",
    "subtotal": 1000.00,
    "total_amount": 1250.00,
    "currency": "USD",
    "tax_amount": 80.00,
    "discount": 50.00,
    "payment_terms": "Net 30",
    "po_number": "PO-12345",
    "items": [
      {
        "description": "Consulting Services",
        "quantity": 10,
        "unit": "hours",
        "price": 125.00,
        "amount": 1250.00,
        "sku": "SVC-001",
        "tax_rate": 20.0
      }
    ]
  }
}

Available Fields

Invoice Fields

FieldDescriptionExample
invoice_numberUnique invoice ID"INV-2024-001"
dateInvoice date (ISO format)"2024-03-15"
due_datePayment due date"2024-04-15"
vendor_nameSeller/vendor name"Acme Corp"
vendor_addressVendor full address"123 Main St, NYC"
buyer_nameBuyer/customer name"John Smith LLC"
buyer_addressBuyer full address"456 Oak Ave, LA"
subtotalAmount before tax and discounts1000.00
total_amountFinal total1080.00
currency3-letter ISO currency code"USD"
tax_amountTotal tax charged80.00
discountDiscount amount (if present)50.00
payment_termsPayment terms"Net 30"
po_numberPurchase order number"PO-12345"
itemsLine items arraySee below

Line Item Fields

FieldDescriptionExample
descriptionItem description"Consulting Services"
quantityQuantity10
unitUnit of measure"hours"
priceUnit price125.00
amountLine total1250.00
skuProduct code"SVC-001"
tax_rateTax rate applied (%)20.0

Error Handling

StatusErrorSolution
400invalid_file_typeEnsure file is a PDF
400no_text_contentScanned PDF detected — use a text-based PDF or enable OCR
401Authentication requiredPass X-API-Key header with a valid key
413file_too_largeReduce the file size and retry
429rate_limit_exceededWait before retrying
500internal_errorUnexpected server error — retry or contact support

Tips

📌 Best Practices

  • Text-based PDFs work best. For scanned invoices, ensure the PDF has selectable text, or use an OCR pre-processing step before uploading.
  • Select only needed fields. Passing ?fields=invoice_number&fields=total_amount gives faster, leaner responses.
  • Check the /fields endpoint. Use it to discover all available extraction options before building your integration.

🔒 Security & Privacy

  • ✅ PDFs are processed in memory and never stored
  • ✅ All requests over HTTPS
  • ✅ API key authentication required on every request
  • ✅ No invoice data is logged or retained

Code Examples

Python

python
import requests

url = "https://api.cparse.com/invoice/v1/extract-invoice"
headers = {"X-API-Key": "YOUR_API_KEY"}

with open("invoice.pdf", "rb") as f:
    response = requests.post(url, files={"file": f}, headers=headers)

print(response.json())

# Extract specific fields only
with open("invoice.pdf", "rb") as f:
    response = requests.post(
        url,
        files={"file": f},
        params={"fields": ["invoice_number", "total_amount", "vendor_name"]},
        headers=headers,
    )

print(response.json())

JavaScript (Node.js)

javascript
import FormData from 'form-data';
import fs from 'fs';
import axios from 'axios';

const form = new FormData();
form.append('file', fs.createReadStream('invoice.pdf'));

const response = await axios.post(
  'https://api.cparse.com/invoice/v1/extract-invoice',
  form,
  {
    headers: {
      ...form.getHeaders(),
      'X-API-Key': 'YOUR_API_KEY',
    },
  }
);

console.log(response.data);