API Documentation

Extract structured invoice data with a single API call. RESTful endpoints, JSON responses, and comprehensive error handling.

Quick Start

Get your API key and make your first extraction in under a minute.

Base URL

https://api.invoiceocr.aileapers.com/v1

Authentication

All requests require an API key passed in the Authorization header.

header
Authorization: Bearer YOUR_API_KEY
POST

/v1/extract

Upload a single invoice document and receive structured data.

Request (curl)

bash
curl -X POST https://api.invoiceocr.aileapers.com/v1/extract \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@invoice.pdf" \
  -F "format=json"

Request (Python)

python
import requests

url = "https://api.invoiceocr.aileapers.com/v1/extract"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
files = {"file": open("invoice.pdf", "rb")}
data = {"format": "json"}

response = requests.post(url, headers=headers, files=files, data=data)
result = response.json()
print(result)

Parameters

Parameter Type Required Description
file file Yes Invoice file (PDF, PNG, JPG). Max 20MB.
format string No Response format: json (default), csv
language string No ISO 639-1 code. Default: en. Auto-detected if omitted.
webhook_url string No URL to POST results to when processing completes (Business plan).

Response (200 OK)

JSON response
{
  "id": "ext_a1b2c3d4",
  "status": "completed",
  "processing_time_ms": 1847,
  "confidence": 0.97,
  "vendor": {
    "name": "Acme Supply Co.",
    "address": "123 Industrial Blvd, Austin, TX 78701",
    "tax_id": "XX-XXXXXXX"
  },
  "invoice_number": "INV-2026-0847",
  "date": "2026-05-15",
  "due_date": "2026-06-14",
  "currency": "USD",
  "line_items": [
    {
      "description": "Widget A - Premium Grade",
      "quantity": 250,
      "unit_price": 4.50,
      "amount": 1125.00
    }
  ],
  "subtotal": 1125.00,
  "tax": 92.81,
  "tax_rate": 0.0825,
  "total": 1217.81,
  "payment_terms": "Net 30",
  "pages_processed": 1
}
POST

/v1/batch/extract

Upload multiple invoices in one request. Pro plan: up to 50 files. Business plan: up to 500 files.

bash
curl -X POST https://api.invoiceocr.aileapers.com/v1/batch/extract \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "files[]=@invoice1.pdf" \
  -F "files[]=@invoice2.pdf" \
  -F "files[]=@invoice3.jpg"

Response (202 Accepted)

JSON response
{
  "batch_id": "bat_x7y8z9",
  "status": "processing",
  "total_files": 3,
  "poll_url": "/v1/batch/bat_x7y8z9",
  "estimated_completion_seconds": 12
}
GET

/v1/batch/{batch_id}

Check the status of a batch extraction job. Returns all completed results when the batch is done.

JSON response
{
  "batch_id": "bat_x7y8z9",
  "status": "completed",
  "completed": 3,
  "failed": 0,
  "results": [
    { "filename": "invoice1.pdf", "status": "completed", "data": { /* ... */ } },
    { "filename": "invoice2.pdf", "status": "completed", "data": { /* ... */ } },
    { "filename": "invoice3.jpg", "status": "completed", "data": { /* ... */ } }
  ]
}
GET

/v1/usage

Check your current month's usage and remaining quota.

JSON response
{
  "plan": "pro",
  "period": "2026-06",
  "invoices_used": 127,
  "invoices_limit": 500,
  "invoices_remaining": 373
}

Error Codes

Status Code Description
400 invalid_file Unsupported file type or corrupt file
401 unauthorized Missing or invalid API key
413 file_too_large File exceeds 20MB limit
429 rate_limited Monthly quota exceeded or too many concurrent requests
500 processing_error Internal processing failure (retry with exponential backoff)
error response example
{
  "error": {
    "code": "rate_limited",
    "message": "Monthly quota exceeded. 500/500 invoices used.",
    "upgrade_url": "https://ocr.aileapers.com/pricing.html"
  }
}

Rate Limits

Free

10 requests/month
1 concurrent request
Single-page only

Pro

500 requests/month
5 concurrent requests
Multi-page PDF

Business

5,000 requests/month
20 concurrent requests
Webhooks + batch

Ready to integrate?

Get your free API key and start extracting invoice data in minutes.

Get your API key