Receipt Parsing
Extract store information, line items, totals, and payment details from receipts. Parse works with printed receipts, digital receipts, and photographed thermal paper.
Receipt Schema
Define a schema that captures the key fields from a receipt:
{
"name": "receipt",
"description": "Extract data from receipts",
"fields": [
{ "name": "store_name", "type": "string", "description": "Name of the store or business" },
{ "name": "store_address", "type": "string", "description": "Store location or address" },
{ "name": "date", "type": "date", "description": "Date of purchase" },
{ "name": "items", "type": "array", "description": "List of purchased items", "items": {
"type": "object",
"fields": [
{ "name": "name", "type": "string" },
{ "name": "quantity", "type": "number" },
{ "name": "price", "type": "number" }
]
}},
{ "name": "subtotal", "type": "number", "description": "Subtotal before tax" },
{ "name": "tax", "type": "number", "description": "Tax amount" },
{ "name": "total", "type": "number", "description": "Total amount paid" },
{ "name": "payment_method", "type": "string", "description": "Payment method used (e.g. Cash, Visa, Mastercard)" }
]
}Code Examples
cURL
curl -X POST https://api.parse.conversiontools.io/v1/extract \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@receipt.jpg" \
-F "schema=receipt"Python
import requests
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
with open("receipt.jpg", "rb") as f:
response = requests.post(
"https://api.parse.conversiontools.io/v1/extract",
headers=headers,
files={"file": f},
data={"schema": "receipt"}
)
data = response.json()
print(f"Store: {data['data']['store_name']}")
print(f"Total: {data['data']['total']}")
print(f"Paid with: {data['data']['payment_method']}")
for item in data["data"]["items"]:
print(f" - {item['name']}: {item['price']}")Node.js
const fs = require("fs");
const form = new FormData();
form.append("file", fs.createReadStream("receipt.jpg"));
form.append("schema", "receipt");
const response = await fetch("https://api.parse.conversiontools.io/v1/extract", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
},
body: form,
});
const { data } = await response.json();
console.log(`Store: ${data.store_name}`);
console.log(`Total: ${data.total}`);
console.log(`Paid with: ${data.payment_method}`);
data.items.forEach((item) => {
console.log(` - ${item.name}: ${item.price}`);
});Sample Output
{
"success": true,
"id": "ext_rcp_001",
"data": {
"store_name": "Fresh Market Grocery",
"store_address": "456 Oak Street, Portland, OR 97201",
"date": "2024-01-20",
"items": [
{
"name": "Organic Bananas",
"quantity": 1,
"price": 2.49
},
{
"name": "Whole Wheat Bread",
"quantity": 1,
"price": 4.99
},
{
"name": "Almond Milk 64oz",
"quantity": 2,
"price": 7.98
},
{
"name": "Free Range Eggs (12ct)",
"quantity": 1,
"price": 5.49
}
],
"subtotal": 20.95,
"tax": 1.68,
"total": 22.63,
"payment_method": "Visa ending in 4242"
},
"pages_used": 1,
"confidence": 0.94
}Tips for Receipt Parsing
- Thermal paper receipts fade over time — scan or photograph them promptly for best results
- For photographed receipts, ensure even lighting and avoid shadows for best accuracy
- Handwritten receipts are supported but may have lower confidence scores
- JPEG and PNG image formats are both supported — use PNG for higher quality scans