Receipt Parser API
v1.0Transform any receipt (photo, scanned PDF, or digital document) into structured JSON data in seconds using AI.
Overview
Stop manually entering receipt data. The Receipt Parser API uses advanced AI and OCR to accurately extract 20+ fields from any receipt and returns clean, structured JSON β ready for your expense management software, accounting platform, or automation workflow.
π€ AI-Powered
Frontier models for high-accuracy extraction from any receipt format
πΈ OCR Included
Process JPEG/PNG photos and scanned PDFs directly β no pre-processing needed
βοΈ Measurement-Aware
Handles weighted grocery items, fuel by volume, and other measured goods
π‘ Perfect For
- β’ Expense management apps automating employee reimbursement
- β’ Accounting and bookkeeping platforms streamlining data entry
- β’ Personal finance apps offering automated spending insights
- β’ Loyalty and cashback platforms verifying purchases
- β’ Tax preparation tools gathering deductible expenses
Quick Start
Base URL
https://api.cparse.com/receipt/v1Authentication
X-API-Key: YOUR_API_KEYGet your API key from the dashboard. New accounts include free credit β no credit card required.
Quick Example
Upload a receipt and extract all fields:
cURL
curl --request POST \
--url https://api.cparse.com/receipt/v1/parse \
--header 'X-API-Key: YOUR_API_KEY' \
--form 'file=@receipt.jpg'Select Specific Fields
Extract only what you need for faster, leaner responses:
curl --request POST \
--url 'https://api.cparse.com/receipt/v1/parse?fields=merchant_name&fields=total&fields=date&fields=category' \
--header 'X-API-Key: YOUR_API_KEY' \
--form 'file=@receipt.pdf'Endpoints
/fieldsReturns all available receipt and line item fields that can be extracted.
Response
{
"receipt_fields": [
{ "name": "merchant_name", "description": "Name of the merchant/store" },
{ "name": "date", "description": "Receipt date (YYYY-MM-DD)" },
{ "name": "total", "description": "Total amount" },
{ "name": "category", "description": "Inferred expense category" },
"..."
],
"item_fields": [
{ "name": "description", "description": "Item name/description" },
{ "name": "quantity", "description": "Discrete count of the line item" },
{ "name": "measured_amount", "description": "Continuous measurement (e.g. 2.3 for lbs)" },
{ "name": "unit_of_measure", "description": "The unit (e.g. lb, kg, gal)" },
"..."
]
}/healthHealth check endpoint. Returns service status.
Response
{ "status": "ok", "service": "receipt-parser", "version": "0.1.0" }/parseParse a receipt file and return structured JSON data.
Request
Content-Type: multipart/form-datafile(required): PDF, JPEG, PNG, or DOCX receipt filefields(optional): Array of receipt fields to extract. Omit for all fields.item_fields(optional): Array of line item fields to extract whenitemsis included.
Response
[
{
"success": true,
"file_name": "receipt.jpg",
"data": {
"merchant_name": "Super Save Grocery",
"merchant_address": "123 Main Street, Anytown, CA 90210",
"merchant_phone": "+1-555-234-5678",
"date": "2024-05-15",
"time": "14:32",
"receipt_number": "R-00482",
"subtotal": 31.76,
"tax": 2.54,
"tip": null,
"discount": null,
"total": 34.30,
"currency": "USD",
"payment_method": "VISA",
"card_last_four": "4242",
"category": "Groceries",
"is_tax_inclusive": false,
"cashier_name": "Jessica",
"register_number": "REG 3",
"transaction_id": "TXN-20240515-00482",
"items": [
{
"description": "Organic Bananas",
"quantity": 1,
"measured_amount": 2.3,
"unit_of_measure": "lb",
"unit_price": 0.87,
"total_price": 1.99
},
{
"description": "Whole Milk",
"quantity": 1,
"measured_amount": null,
"unit_of_measure": null,
"unit_price": 4.49,
"total_price": 4.49
}
]
},
"ocr_used": true,
"pages_processed": 1,
"fields_requested": null,
"item_fields_requested": null
}
]Available Fields
Receipt Fields
| Field | Type | Description |
|---|---|---|
merchant_name | string | Name of the merchant or store |
merchant_address | string | Full address of the merchant |
merchant_phone | string | Phone number of the merchant |
receipt_number | string | Receipt or transaction number |
date | string | Receipt date β ISO format (YYYY-MM-DD) |
time | string | Time of purchase β 24h format (HH:MM) |
subtotal | number | Subtotal before tax |
tax | number | Total tax amount |
tip | number | Tip amount (if present) |
discount | number | Discount amount (if present) |
total | number | Final total amount |
currency | string | 3-letter ISO currency code (USD, EUR, GBPβ¦) |
payment_method | string | Normalized method: VISA, MASTERCARD, CASH, AMEX⦠|
card_last_four | string | Last 4 digits of card used |
category | string | Groceries, Dining, Fuel, Shopping, Travel, Healthcare, Services, or Entertainment |
is_tax_inclusive | boolean | true if prices include tax (UK/EU VAT), false if tax added at bottom (US/CA) |
cashier_name | string | Name of the cashier or server |
register_number | string | Register or terminal ID |
transaction_id | string | Unique transaction or invoice ID |
items | array | Line items β see below |
Line Item Fields
| Field | Type | Description |
|---|---|---|
description | string | Item name or description |
quantity | number | Discrete count (e.g. 2 cans, 1 bag) |
measured_amount | number | Continuous measure value β e.g. 2.3 for "2.3 lbs". null for standard items |
unit_of_measure | string | Normalized unit β lb, kg, g, oz, gal, l, ml, ft, m, cm, in. null for standard items |
unit_price | number | Price per unit or per unit of measure |
total_price | number | Final line total |
sku | string | Item SKU or product code (if present) |
Error Handling
| Status | Error | Solution |
|---|---|---|
| 400 | invalid_file_type | Ensure file is PDF, DOCX, JPEG, or PNG |
| 400 | no_text_content | PDF is scanned β pre-process with OCR before uploading |
| 413 | file_too_large | Reduce the file size and retry |
| 413 | too_many_pages | Split the document and retry |
| 413 | image_too_large | Image width or height exceeds 2048px β resize before uploading |
| 415 | image_not_supported | Use a text-based PDF or DOCX file |
| 429 | rate_limit_exceeded | Wait before retrying |
| 500 | internal_error | Unexpected server error β retry or contact support |
Tips
π Best Practices
- Images and scanned PDFs β JPEG/PNG receipts use OCR. Images must be 2048px or smaller on each side.
- Image size limit β Resize images to 2048px or smaller before uploading to avoid a 413 error.
- Text-based PDFs work best β For scanned PDFs, ensure they contain selectable text, or pre-process with an OCR tool before uploading.
- Select only needed fields β Pass
?fields=total&fields=merchant_namefor faster, cheaper responses. - Use item_fields for line items β When including
items, scope which item fields you need viaitem_fields. - Measured items β For grocery or fuel receipts,
measured_amountandunit_of_measurecapture weighted goods separately fromquantity.
π Security & Privacy
- β Files processed in memory, never written to disk or stored
- β All requests over HTTPS
- β API key authentication required on every request
- β GDPR and CCPA compliant
Code Examples
Python
import requests
url = "https://api.cparse.com/receipt/v1/parse"
headers = {
"X-API-Key": "YOUR_API_KEY",
}
# Extract all fields from an image receipt
with open("receipt.jpg", "rb") as f:
response = requests.post(url, files={"file": f}, headers=headers)
print(response.json())
# Extract specific fields only
with open("receipt.pdf", "rb") as f:
response = requests.post(
url,
files={"file": f},
params={"fields": ["merchant_name", "total", "date", "category", "items"]},
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('receipt.jpg'));
const response = await axios.post(
'https://api.cparse.com/receipt/v1/parse',
form,
{
headers: {
...form.getHeaders(),
'X-API-Key': 'YOUR_API_KEY',
},
}
);
console.log(response.data);