Skip to main content

POST /receipts/extract

POST

Submit Receipt for Asynchronous Extraction

https://staging-api.heypeppy.ai/v1
/receipts/extract

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
ParameterTypeDescription
Authorizationrequiredstring
Bearer token format: Bearer <API_KEY> (Sandbox: hp_test_...) or use X-API-Key header.
Example: Bearer hp_test_99281a8b
X-Tenant-IDoptionalstring
B2B Tenant identifier (e.g., stepup, odyssey, classwallet). If omitted, inferred from API key context.
Example: stepup
Content-Typerequiredstring
application/json (or multipart/form-data when uploading files directly).
Example: application/json

Request Body

application/json
FieldTypeDescription
receiptUrloptionalstring (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
fileBase64optionalstring (base64)
Base64-encoded file contents if uploading the file content directly in the JSON payload.
fileNameoptionalstring
Original name of the file for format detection and logging reference. Defaults to receipt.pdf.
Example: kumon_receipt_4421.pdf
mimeTypeoptionalstring
MIME type of the uploaded file (e.g., application/pdf, image/jpeg, image/png). Defaults to application/pdf.
Example: application/pdf
categorizeItemsoptionalboolean
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
includeCoordinatesoptionalboolean
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
programKeyoptionalstring
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
studentCandidatesoptionalarray<StudentCandidate>
List of registered students in the family/account to automatically match receipt beneficiary.
↳idrequiredstring
Unique student identifier in partner portal.
↳namerequiredstring
Student display name.
↳officialNameoptionalstring
Full legal name on scholarship account.
↳gradeLeveloptionalstring
Grade level for eligibility checks.
↳scholarshipProgramoptionalstring
Program code (e.g., PEP, UA).
metadataoptionalobject
Arbitrary client metadata preserved across the job lifecycle, webhooks, and poll results.

Responses

4 status codes
202 AcceptedReceipt extraction job successfully enqueued in the Cloud Tasks queue.
{
  "jobId": "job_stepup_1726590000000_abc123",
  "tenantId": "stepup",
  "status": "queued",
  "pollUrl": "/v1/jobs/job_stepup_1726590000000_abc123",
  "message": "Receipt extraction task queued successfully for processing"
}

Interactive Test Console

https://staging-api.heypeppy.ai/v1Sandbox / Staging
Bearer