Developers

Integrate the OCR API server to server

The bearer token gives access to your Easypromos OCR API. Never expose it in public JavaScript, HTML source, browser requests, or frontend environment variables shipped to the client.

Utility

Check available OCR credits

Use the credits endpoint from your backend to check remaining balance before submitting volume traffic.

curl -X GET "https://api.easypromosapp.com/v2/ocr/credits" \
  -H "Authorization: Bearer $TOKEN"

Sample response:

{
    "status": "ok",
    "credits": 1248,
    "currency": "USD",
    "updated_at": "2026-04-08T09:29:00Z"
}

Security

Keep the bearer token private

Your backend should upload receipts, poll events, and receive webhooks directly from Easypromos. The browser must never talk to the OCR API with your account token.

Mode 1

Polling workflow

Upload the receipt, store the returned event_id, then poll the event endpoint until you receive the final structured JSON.

curl -X POST "https://api.easypromosapp.com/v2/ocr/tickets" \
  -H "Authorization: Bearer $TOKEN" \
  -F "ticket=@receipt.jpg"

Upload response with the generated event_id:

{
    "status": "ok",
    "event_id": 987654,
    "created_at": "2026-04-08T09:30:00Z"
}
curl -X GET "https://api.easypromosapp.com/v2/ocr/events/987654" \
  -H "Authorization: Bearer $TOKEN"

Finished poll response:

{
    "status": "finished",
    "event_id": 987654,
    "finished_status": "ok",
    "result": {
        "header": {
            "store_name": "CLAREL",
            "store_address": "AV PRIMERO DE JUNIO 66",
            "tax_id": "A43227628",
            "phone": "+34912345678",
            "date": "2025-09-24",
            "time": "20:08",
            "receipt_number": "00309139",
            "currency": "EUR",
            "city": "Venta de Banos",
            "postal_code": "34200",
            "country": "Spain",
            "country_code": "ES",
            "timezone": "Europe/Madrid",
            "utc_date_time": "2025-09-24T20:08:00+02:00"
        },
        "line_items": [
            {
                "article": "SERUM REVITALIFT LAS",
                "sku": "171752",
                "quantity": 1,
                "total": 24.19
            },
            {
                "article": "CREMA REVITALIF LASE",
                "sku": "155687",
                "quantity": 1,
                "total": 22.09
            },
            {
                "article": "DETER MAQU CAPSULA O",
                "sku": "308872",
                "quantity": 1,
                "total": 9.99
            },
            {
                "article": "ESPUMA PERFECT VOLUM",
                "sku": "290794",
                "quantity": 1,
                "total": 5.49
            },
            {
                "article": "LACA PERFECT VOLUMEN",
                "sku": "290790",
                "quantity": 1,
                "total": 5.29
            }
        ],
        "footer": {
            "total": 37.87
        },
        "controls": {
            "handwritten": 0,
            "text_quality": 95
        }
    },
    "processed_at": "2026-04-08 09:30:18"
}

Mode 2

Webhook workflow

Upload the receipt with webhook_url and webhook_key. Easypromos will call your backend when processing finishes.

curl -X POST "https://api.easypromosapp.com/v2/ocr/tickets" \
  -H "Authorization: Bearer $TOKEN" \
  -F "ticket=@receipt.jpg" \
  -F "webhook_url=https://your-app.example/webhooks/easypromos" \
  -F "webhook_key=your-shared-secret"

Webhook payload sent by Easypromos:

{
    "event_id": 987654,
    "status": "finished",
    "finished_status": "ok",
    "result": {
        "header": {
            "store_name": "CLAREL",
            "store_address": "AV PRIMERO DE JUNIO 66",
            "tax_id": "A43227628",
            "phone": "+34912345678",
            "date": "2025-09-24",
            "time": "20:08",
            "receipt_number": "00309139",
            "currency": "EUR",
            "city": "Venta de Banos",
            "postal_code": "34200",
            "country": "Spain",
            "country_code": "ES",
            "timezone": "Europe/Madrid",
            "utc_date_time": "2025-09-24T20:08:00+02:00"
        },
        "line_items": [
            {
                "article": "SERUM REVITALIFT LAS",
                "sku": "171752",
                "quantity": 1,
                "total": 24.19
            },
            {
                "article": "CREMA REVITALIF LASE",
                "sku": "155687",
                "quantity": 1,
                "total": 22.09
            },
            {
                "article": "DETER MAQU CAPSULA O",
                "sku": "308872",
                "quantity": 1,
                "total": 9.99
            },
            {
                "article": "ESPUMA PERFECT VOLUM",
                "sku": "290794",
                "quantity": 1,
                "total": 5.49
            },
            {
                "article": "LACA PERFECT VOLUMEN",
                "sku": "290790",
                "quantity": 1,
                "total": 5.29
            }
        ],
        "footer": {
            "total": 37.87
        },
        "controls": {
            "handwritten": 0,
            "text_quality": 95
        }
    },
    "processed_at": "2026-04-08 09:30:18"
}