Every expense management app has the same problem: users upload photos of receipts, and someone has to manually read the merchant name, total, tax,
tip, and line items. It's tedious, error-prone, and doesn't scale.
I built aPapyr to solve this. It's an API that reads receipts (and invoices, tax forms, bank statements) and returns structured JSON — including per-field confidence scores so you know what to trust.
Here's how to use it in Python and Node.js.
## Python
bash
pip install apapyr
from apapyr import aPapyr
client = aPapyr("sk_live_your_key")
result = client.extract("receipt.jpg", document_type="receipt")
print(result.get_field("merchant_name")) # "Starbucks Coffee"
print(result.get_field("total")) # 15.57
print(result.get_field("tax")) # 1.12
print(result.get_field("tip")) # 2.00
print(result.get_field("payment_method")) # "Visa ending 4242"
Node.js
npm install apapyr
const { aPapyr } = require("apapyr");
const client = new aPapyr("sk_live_your_key");
const result = await client.extract("receipt.jpg", {
documentType: "receipt"
});
console.log(result.getField("merchant_name")); // "Starbucks Coffee"
console.log(result.getField("total")); // 15.57
console.log(result.getField("tip")); // 2.00
What You Get Back
The API doesn't just OCR the text — it understands the receipt. It knows which number is the total, which is the tax, and which is a line item price. Every field includes a confidence score:
print(result.get_field_confidence("total")) # 0.98 — very confident
print(result.get_field_confidence("merchant_name")) # 0.99
print(result.get_field_confidence("tip")) # 0.91 — handwritten, slightly less sure
This lets you build smart automation: auto-process anything above 0.95 confidence, flag the rest for human review.
Line Items
It pulls individual items too:
for item in result.line_items:
name = item.get("description", {}).get("value")
price = item.get("amount", {}).get("value")
print(f" {name}: ${price}")
# Grande Caramel Macchiato: $5.95
# Blueberry Muffin: $3.50
# Bottled Water: $3.00
Handles Messy Photos
Crumpled receipt from your pocket? Blurry phone photo? Faded thermal paper? It uses AI vision models (not old-school OCR), so it understands context. If the "5" in "$15.57" is smudged, it still knows the total because the line items add up to it.
Auto-Detect Document Type
Don't know if the user uploaded a receipt or an invoice? Let the API figure it out:
result = client.extract("mystery_document.pdf") # document_type defaults to "auto"
print(result.document_type) # "receipt"
Works With AI Agents
If you use Claude Code or Cursor, you can skip the SDK entirely:
claude mcp add apapyr -- npx apapyr-mcp-server
Then just say: "Parse this receipt and tell me the total." The AI agent calls aPapyr automatically.
Try It
- https://apapyr.com/demo.html — see real extraction results with sample documents
- https://apapyr.com/free-tool.html — upload your own receipt, no signup needed
- https://apapyr.com/dashboard.html — 50 pages/month free
- https://apapyr.com/docs.html — full reference
The free tier is enough to build and test your integration. Paid plans start at $49/month for 1,000 pages.
---
aPapyr is on https://github.com/AkilaJ?tab=repositories&q=apapyr, https://pypi.org/project/apapyr/, and https://www.npmjs.com/package/apapyr.
Top comments (0)