POST /receipts/extract
Submit Receipt for Asynchronous Extraction
Submits a receipt PDF or image for asynchronous processing. The API immediately enqueues the job into Google Cloud Tasks with tenant isolation and returns a `202 Accepted` response containing a `jobId` and `pollUrl`. **Extraction vs. Line Item Processing**: - By default (`categorizeItems: false`), HeyPeppy executes fast Vision AI extraction of the receipt, extracting vendor name, total amount, subtotal, sales tax, transaction date, proof of payment details, student matching, and itemized descriptions and prices without running policy categorization. - When `categorizeItems: true`, HeyPeppy additionally triggers Phase 2 line item categorization audit against the scholarship program purchasing guidelines (specified by `programKey`, inferred from matched student candidate, or defaulting to `PEP`). Accepts either `application/json` (with `receiptUrl` or `fileBase64`) or `multipart/form-data` (with a direct file upload or `receiptUrl`). Once completed, HeyPeppy sends an HMAC-signed webhook to your configured webhook URL or makes the result available via `GET /jobs/{jobId}`.
Headers
HTTP Headers| Parameter | Type | Description |
|---|---|---|
Authorizationrequired | string | Bearer token format: Bearer <API_KEY> (Sandbox: hp_test_...) or use X-API-Key header. Example: Bearer hp_test_99281a8b |
X-Tenant-IDoptional | string | B2B Tenant identifier (e.g., stepup, odyssey, classwallet). If omitted, inferred from API key context. Example: stepup |
Content-Typerequired | string | application/json (or multipart/form-data when uploading files directly). Example: application/json |
Request Body
application/json| Field | Type | Description |
|---|---|---|
receiptUrloptional | string (URI) | Public or pre-signed URL to the receipt image (JPEG, PNG, HEIC, WebP) or PDF file. Either receiptUrl, fileBase64, or a multipart file upload is required. Example: https://storage.googleapis.com/partner-uploads/kumon_receipt_4421.pdf |
fileBase64optional | string (base64) | Base64-encoded file contents if uploading the file content directly in the JSON payload. |
fileNameoptional | string | Original name of the file for format detection and logging reference. Defaults to receipt.pdf. Example: kumon_receipt_4421.pdf |
mimeTypeoptional | string | MIME type of the uploaded file (e.g., application/pdf, image/jpeg, image/png). Defaults to application/pdf. Example: application/pdf |
categorizeItemsoptional | boolean | Whether to execute Phase 2 purchasing policy audit & guideline categorization on extracted line items. Defaults to false (fast extraction only). Set to true to classify each item against scholarship guidelines. 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: false |
programKeyoptional | string | Target scholarship program guideline rules (e.g., PEP, UA, FTC-FES-EO) for item categorization when categorizeItems is true. Inferred from matched candidate if omitted, or defaults to PEP. Example: PEP |
studentCandidatesoptional | array<StudentCandidate> | List of registered students in the family/account to automatically match receipt beneficiary. |
↳idrequired | string | Unique student identifier in partner portal. |
↳namerequired | string | Student display name. |
↳officialNameoptional | string | Full legal name on scholarship account. |
↳gradeLeveloptional | string | Grade level for eligibility checks. |
↳scholarshipProgramoptional | string | Program code (e.g., PEP, UA). |
metadataoptional | object | Arbitrary client metadata preserved across the job lifecycle, webhooks, and poll results. |
Responses
4 status codes{
"jobId": "job_stepup_1726590000000_abc123",
"tenantId": "stepup",
"status": "queued",
"pollUrl": "/v1/jobs/job_stepup_1726590000000_abc123",
"message": "Receipt extraction task queued successfully for processing"
}