Receipt Parser API

v1.0

Transform 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/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

Upload a receipt and extract all fields:

cURL

bash
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:

bash
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

GET/fields

Returns all available receipt and line item fields that can be extracted.

Response
json
{
  "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)" },
    "..."
  ]
}
GET/health

Health check endpoint. Returns service status.

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

Parse a receipt file and return structured JSON data.

Request
  • Content-Type: multipart/form-data
  • file (required): PDF, JPEG, PNG, or DOCX receipt file
  • fields (optional): Array of receipt 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,
    "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

FieldTypeDescription
merchant_namestringName of the merchant or store
merchant_addressstringFull address of the merchant
merchant_phonestringPhone number of the merchant
receipt_numberstringReceipt or transaction number
datestringReceipt date β€” ISO format (YYYY-MM-DD)
timestringTime of purchase β€” 24h format (HH:MM)
subtotalnumberSubtotal before tax
taxnumberTotal tax amount
tipnumberTip amount (if present)
discountnumberDiscount amount (if present)
totalnumberFinal total amount
currencystring3-letter ISO currency code (USD, EUR, GBP…)
payment_methodstringNormalized method: VISA, MASTERCARD, CASH, AMEX…
card_last_fourstringLast 4 digits of card used
categorystringGroceries, Dining, Fuel, Shopping, Travel, Healthcare, Services, or Entertainment
is_tax_inclusivebooleantrue if prices include tax (UK/EU VAT), false if tax added at bottom (US/CA)
cashier_namestringName of the cashier or server
register_numberstringRegister or terminal ID
transaction_idstringUnique transaction or invoice ID
itemsarrayLine items β€” see below

Line Item Fields

FieldTypeDescription
descriptionstringItem name or description
quantitynumberDiscrete count (e.g. 2 cans, 1 bag)
measured_amountnumberContinuous measure value β€” e.g. 2.3 for "2.3 lbs". null for standard items
unit_of_measurestringNormalized unit β€” lb, kg, g, oz, gal, l, ml, ft, m, cm, in. null for standard items
unit_pricenumberPrice per unit or per unit of measure
total_pricenumberFinal line total
skustringItem SKU or product code (if present)

Error Handling

StatusErrorSolution
400invalid_file_typeEnsure file is PDF, DOCX, JPEG, or PNG
400no_text_contentPDF is scanned β€” pre-process with OCR before uploading
413file_too_largeReduce the file size and retry
413too_many_pagesSplit the document and retry
413image_too_largeImage width or height exceeds 2048px β€” resize before uploading
415image_not_supportedUse a text-based PDF or DOCX file
429rate_limit_exceededWait before retrying
500internal_errorUnexpected 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_name for faster, cheaper responses.
  • Use item_fields for line items β€” When including items, scope which item fields you need via item_fields.
  • Measured items β€” For grocery or fuel receipts, measured_amount and unit_of_measure capture weighted goods separately from quantity.

πŸ”’ 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

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)

javascript
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);