POST /receipts/extract-sync
Synchronous Receipt Extraction (Low-Latency)
Extracts receipt metadata, line items, and proof of payment synchronously in real time (<6s). Best suited for interactive end-user upload experiences where immediate UI feedback is required without polling or webhooks. **Extraction vs. Line Item Processing**: - When `categorizeItems: false` (default), executes fast Vision AI extraction returning raw items, totals, dates, vendor, and payment proof. - When `categorizeItems: true`, executes Phase 2 guideline categorization on the line items using the designated `programKey`. Accepts either `application/json` (with `receiptUrl` or `fileBase64`) or `multipart/form-data` (with a direct file upload or `receiptUrl`). For multi-page PDFs or heavy bursts, use the asynchronous endpoint `POST /receipts/extract`.
Headers
HTTP Headers| Parameter | Type | Description |
|---|---|---|
Authorizationrequired | string | Bearer token format: Bearer <API_KEY> (hp_test_...) or X-API-Key header. Example: Bearer hp_test_99281a8b |
X-Tenant-IDoptional | string | B2B Tenant identifier. Example: stepup |
Content-Typerequired | string | application/json (or multipart/form-data). Example: application/json |
Request Body
application/json| Field | Type | Description |
|---|---|---|
receiptUrloptional | string (URI) | Public or pre-signed URL of the receipt image or single-page PDF. Required if fileBase64 or multipart upload is not provided. Example: https://storage.googleapis.com/partner-uploads/staples_store_receipt.jpg |
fileBase64optional | string (base64) | Base64-encoded file data if sending document content directly. |
fileNameoptional | string | Original receipt filename. Defaults to receipt.pdf. Example: staples_store_receipt.jpg |
mimeTypeoptional | string | MIME type of the uploaded file. Defaults to application/pdf. Example: image/jpeg |
categorizeItemsoptional | boolean | Whether to execute purchasing policy guideline categorization on extracted line items. Defaults to false. Set to true to classify items against scholarship rules. Example: false |
includeCoordinatesoptional | boolean | Opt-in flag to return normalized bounding coordinates (0.0 to 1.0) locating extracted fields on the document. Uses native PDF layout tokens for digital PDFs (Approach 2) and Vision AI visual grounding for images/scans (Approach 1). Example: true |
programKeyoptional | string | Target scholarship program guideline rules (e.g. PEP, UA) used when categorizeItems is true. Example: PEP |
studentCandidatesoptional | array<StudentCandidate> | Optional students for name matching. |
metadataoptional | object | Optional passthrough metadata echoed back in the response. |
Responses
4 status codes{
"success": true,
"tenantId": "stepup",
"latencyMs": 2450,
"metadata": {},
"data": {
"extractedData": {
"vendor": "Staples Office Supplies",
"amount": 67.48,
"subtotal": 63.74,
"taxAmount": 3.74,
"discountAmount": null,
"transactionDate": "2026-09-08",
"invoiceType": "retail",
"items": [
{
"description": "TI-84 Plus CE Graphing Calculator Case",
"price": 19.99,
"quantity": 1,
"coordinates": {
"page": 1,
"top": 0.352,
"left": 0.125,
"width": 0.745,
"height": 0.024,
"ymin": 0.352,
"xmin": 0.125,
"ymax": 0.376,
"xmax": 0.87
}
},
{
"description": "College Ruled Spiral Notebook 5-Pack",
"price": 12.5,
"quantity": 1,
"coordinates": {
"page": 1,
"top": 0.38,
"left": 0.125,
"width": 0.745,
"height": 0.024,
"ymin": 0.38,
"xmin": 0.125,
"ymax": 0.404,
"xmax": 0.87
}
},
{
"description": "Fiskars Student Scissors & Glue Sticks",
"price": 31.25,
"quantity": 1,
"coordinates": {
"page": 1,
"top": 0.408,
"left": 0.125,
"width": 0.745,
"height": 0.024,
"ymin": 0.408,
"xmin": 0.125,
"ymax": 0.432,
"xmax": 0.87
}
}
],
"paymentDetails": {
"isPaid": true,
"paymentMethod": "card",
"cardLast4": "4021",
"proofOfPaymentType": "card"
},
"studentDetails": {
"detectedStudentName": "Emma Davis",
"matchedChildId": "stu_1002",
"matchedChildName": "Emma Davis",
"matchConfidence": 0.94
},
"serviceDetails": null,
"confidence": 0.96,
"auditResult": {
"summary": "Document contains valid proof of payment.",
"isServiceBased": false,
"isUnpaidInvoice": false,
"hasLineItems": true,
"hasTransactionDate": true,
"hasProviderName": true,
"hasTotalPrice": true,
"hasPaidIndication": true,
"hasPaymentMethod": true,
"hasServicePeriod": false,
"hasServiceRate": false
},
"coordinates": {
"method": "vision_ai",
"vendor": {
"page": 1,
"top": 0.085,
"left": 0.28,
"width": 0.44,
"height": 0.035,
"ymin": 0.085,
"xmin": 0.28,
"ymax": 0.12,
"xmax": 0.72
},
"amount": {
"page": 1,
"top": 0.625,
"left": 0.68,
"width": 0.18,
"height": 0.028,
"ymin": 0.625,
"xmin": 0.68,
"ymax": 0.653,
"xmax": 0.86
},
"transactionDate": {
"page": 1,
"top": 0.135,
"left": 0.62,
"width": 0.24,
"height": 0.022,
"ymin": 0.135,
"xmin": 0.62,
"ymax": 0.157,
"xmax": 0.86
},
"subtotal": {
"page": 1,
"top": 0.575,
"left": 0.68,
"width": 0.18,
"height": 0.025,
"ymin": 0.575,
"xmin": 0.68,
"ymax": 0.6,
"xmax": 0.86
},
"taxAmount": {
"page": 1,
"top": 0.6,
"left": 0.68,
"width": 0.18,
"height": 0.025,
"ymin": 0.6,
"xmin": 0.68,
"ymax": 0.625,
"xmax": 0.86
},
"discountAmount": null,
"studentName": {
"page": 1,
"top": 0.18,
"left": 0.125,
"width": 0.25,
"height": 0.024,
"ymin": 0.18,
"xmin": 0.125,
"ymax": 0.204,
"xmax": 0.375
},
"paymentMethod": {
"page": 1,
"top": 0.665,
"left": 0.125,
"width": 0.32,
"height": 0.025,
"ymin": 0.665,
"xmin": 0.125,
"ymax": 0.69,
"xmax": 0.445
}
}
},
"fileInfo": {
"isPdf": false,
"convertedToImage": false,
"fileSize": 184500
}
}
}