Tutorials
Extract Invoices & Receipts with OCR
Extract structured tables, key-value pairs, and text from PDF invoices or multi-image receipts.
Learn how to batch-upload receipt photos or invoices and extract tabular line items with document.extract. Ideal for accounting automations and expense management.
Multi-Image Receipt Batching in Python
import uuid, requests
# Upload 3 receipts
upload_ids = []
for receipt in ["receipt_p1.jpg", "receipt_p2.jpg", "receipt_p3.jpg"]:
init = requests.post(
"https://transpera-api-dev-vv55i7vbvq-el.a.run.app/v1/uploads",
headers={"authorization": "Bearer tp_live_..."},
json={"fileName": receipt, "contentType": "image/jpeg"}
).json()
with open(receipt, "rb") as f:
requests.put(init["url"], headers={"content-type": "image/jpeg"}, data=f)
upload_ids.append(init["uploadId"])
# Extract as one structured batch
res = requests.post(
"https://transpera-api-dev-vv55i7vbvq-el.a.run.app/v1/jobs",
headers={"authorization": "Bearer tp_live_...", "idempotency-key": str(uuid.uuid4())},
json={
"operation": "document.extract",
"input": {
"uploadIds": upload_ids,
"ocr": True
}
}
)
print("Extraction started:", res.json()["job"]["id"])