Invoice Parser API
v1.0Transform 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/v1Authentication
X-API-Key: YOUR_API_KEYGet 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
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:
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
/fieldsGet list of all available fields that can be extracted.
Response
{
"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"
]
}/healthHealth check endpoint. Returns service status.
Response
{ "status": "ok", "service": "invoice-parser", "version": "0.1.0" }/extract-invoiceExtract structured data from an invoice PDF.
Request
Content-Type: multipart/form-datafile(required): PDF invoice filefields(optional): Array of invoice fields to extract. Omit for all fields.item_fields(optional): Array of line item fields to extract whenitemsis included.
Response
{
"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
| Field | Description | Example |
|---|---|---|
invoice_number | Unique invoice ID | "INV-2024-001" |
date | Invoice date (ISO format) | "2024-03-15" |
due_date | Payment due date | "2024-04-15" |
vendor_name | Seller/vendor name | "Acme Corp" |
vendor_address | Vendor full address | "123 Main St, NYC" |
buyer_name | Buyer/customer name | "John Smith LLC" |
buyer_address | Buyer full address | "456 Oak Ave, LA" |
subtotal | Amount before tax and discounts | 1000.00 |
total_amount | Final total | 1080.00 |
currency | 3-letter ISO currency code | "USD" |
tax_amount | Total tax charged | 80.00 |
discount | Discount amount (if present) | 50.00 |
payment_terms | Payment terms | "Net 30" |
po_number | Purchase order number | "PO-12345" |
items | Line items array | See below |
Line Item Fields
| Field | Description | Example |
|---|---|---|
description | Item description | "Consulting Services" |
quantity | Quantity | 10 |
unit | Unit of measure | "hours" |
price | Unit price | 125.00 |
amount | Line total | 1250.00 |
sku | Product code | "SVC-001" |
tax_rate | Tax rate applied (%) | 20.0 |
Error Handling
| Status | Error | Solution |
|---|---|---|
| 400 | invalid_file_type | Ensure file is a PDF |
| 400 | no_text_content | Scanned PDF detected — use a text-based PDF or enable OCR |
| 401 | Authentication required | Pass X-API-Key header with a valid key |
| 413 | file_too_large | Reduce the file size and retry |
| 429 | rate_limit_exceeded | Wait before retrying |
| 500 | internal_error | Unexpected 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_amountgives 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
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)
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);