Receipt OCR API

Automate your expense tracking and reimbursement workflows with our specialized Receipt OCR API. Built to handle the messy reality of physical receipts—including crumpled paper, faded thermal ink, and complex multi-item retail layouts. Instantly extract the merchant name, date, total amount, taxes, and purchased items. Perfect for expense management apps, loyalty programs, and personal finance tracking.


Endpoint

POSThttps://api.structocr.com/v1/receipt

Request Parameters

Note: Receipts are often long and narrow. Ensure the image captures the top (Merchant) and bottom (Total Amount) clearly. We automatically handle perspective distortion and rotation.

ParameterInRequiredDescription
x-api-keyHeaderRequiredYour unique API key generated from the dashboard.
Content-TypeHeaderRequiredMust be set to application/json.
imgBody (JSON)RequiredThe Base64 encoded string of the receipt image.
  • Supports standard Data URI scheme
  • Supports raw Base64 strings
  • Max file size: 4.5MB
  • Formats: JPG, PNG, WebP

Response Schema

The API returns a clean, structured JSON object containing the essential details required for expense reporting.

FieldDescription
Metadata & Validation
is_validBoolean indicating if core data (like total_amount) was successfully found.
confidenceExtraction confidence level. Returns 'high', 'medium', or 'low'.
Receipt Details
merchant_nameName of the store, restaurant, or vendor.
dateTransaction date (formatted as YYYY-MM-DD if recognizable).
timeTransaction time (e.g., '14:30' or '02:30 PM').
currencyCurrency symbol or ISO code (e.g., 'USD', '$', '¥').
total_amountThe final total amount paid (Float).
tax_amountTotal tax or VAT amount applied (Float).
Line Items (Array)
items[].nameDescription of the purchased product or service.
items[].quantityNumber of units purchased (Number).
items[].priceLine total for this item (String format).

Code Examples

Request Implementation

curl -X POST https://api.structocr.com/v1/receipt \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "img": "data:image/jpeg;base64,/9j/4AAQSkZJRg..."
  }'

Success Response (200 OK)

JSON EXAMPLE
{
  "success": true,
  "data": {
    "is_valid": true,
    "confidence": "high",
    "merchant_name": "Blue Bottle Coffee",
    "date": "2026-04-22",
    "time": "08:45 AM",
    "currency": "USD",
    "total_amount": 14.5,
    "tax_amount": 1.25,
    "items": [
      {
        "name": "Caffe Latte - Large",
        "quantity": 2,
        "price": "11.00"
      },
      {
        "name": "Butter Croissant",
        "quantity": 1,
        "price": "3.50"
      }
    ],
    "validation_error": null
  }
}

Error Responses

400 Bad Request

{
  "status": 400,
  "code": "INVALID_REQUEST_FORMAT",  
  "message":"Invalid payload or image data."
}

402 Payment Required

Each successful receipt extraction costs 1 credit.

{
  "success": false,
  "error": "INSUFFICIENT_CREDITS",
  "message": "Insufficient account balance."
}

503 Service Unavailable

{
  "success": false,
  "error": "SYSTEM_BUSY",
  "message": "Receipt OCR is currently busy. Please try again."
}

Status Code Definitions

CodeError CodeDescription
200SUCCESSRecognition success
400INVALID_REQUEST_FORMATInvalid payload or corrupted Base64. Ensure the image string has no whitespace, newlines, or illegal characters.
402INSUFFICIENT_CREDITSInsufficient credits (Cost: 1/req)
413FILE_TOO_LARGEDecoded image exceeds 4.5MB
503SYSTEM_BUSYAPI Rate limit reached or upstream AI provider is busy.