POST /models/{model_slug}/ocr

POST multipart/form-data: required file field named exactly image (not file). model_slug in the path: alpha-digit-max, alpha-digit-fast or alpha-digit-handwritten. Optional: pdf_password (string) for a protected PDF. Advanced option (boolean as a string true/false or 1/0): enable_bbox for bounding boxes (layout / regions). Any other field name is forbidden; no model field in the form → HTTP 422 if non-compliant. Do not set Content-Type manually: multipart/form-data and the boundary are generated by the client.

POST /models/{model_slug}/ocr

Request body

The following parameters can be included in the request body:

Parameters

image
file
Required

Image or PDF file to analyze (multipart/form-data, exact name: image).

pdf_password
string

Optional. Password for a protected PDF.

enable_bbox
boolean
Default value: false

Optional. Enables bounding box output (regions / layout) to locate each text block on the page. Accepted values: true, false, 1, 0. Not billed.

Successful response

The following fields are returned in a successful response:

Response fields

model_slug
string
Required

Slug of the model used for inference.

text
string
Required

Text extracted from the image.

inference_seconds
number
Required

Inference time in seconds.

global_confidence
number null

Global confidence score (0–1), or null if not applicable.

words
array<object>
Required

List of detected words with their individual confidence score.

page_size
object null

Page dimensions (width, height) in the bounding box coordinate system. Notably present when enable_bbox=true.

layout
object null

Present if enable_bbox=true. Contains regions[]: text blocks with bbox_xyxy coordinates [x_min, y_min, x_max, y_max], label and confidence.

image_filename
string null

Name of the provided file, or null.

Examples

Code examples for using this endpoint:

curl
curl -X POST "https://api-endpoints.alphaedge-ai.com/models/alpha-digit-max/ocr" \
  -H "X-API-Key: YOUR_KEY" \
  -F "image=@/path/to/invoice.png" \
  -F "enable_bbox=true"
python
import requests

url = "https://api-endpoints.alphaedge-ai.com/models/alpha-digit-max/ocr"
headers = {"X-API-Key": "YOUR_KEY"}
with open("/path/to/invoice.png", "rb") as f:
    files = {"image": ("invoice.png", f, "image/png")}
    data = {
        "enable_bbox": "true",
    }
    r = requests.post(url, headers=headers, files=files, data=data, timeout=300)
print(r.status_code)
print(r.json())
typescript
import fs from "node:fs";

const form = new FormData();
form.append("image", new Blob([fs.readFileSync("/path/to/invoice.png")]), "invoice.png");
form.append("enable_bbox", "true");

const res = await fetch("https://api-endpoints.alphaedge-ai.com/models/alpha-digit-max/ocr", {
  method: "POST",
  headers: { "X-API-Key": "YOUR_KEY" },
  body: form
});
console.log(res.status, await res.json());

Response

Sample API response:

json
{
  "model_slug": "alpha-digit-max",
  "text": "Invoice no. 2026-0042\nTotal incl. tax 123.45 EUR",
  "inference_seconds": 0.42,
  "global_confidence": 0.91,
  "words": [
    { "w": "Invoice", "confidence": 0.99 },
    { "w": "n°", "confidence": 0.95 },
    { "w": "2026-0042", "confidence": 0.98 }
  ],
  "page_size": { "width": 1240, "height": 1754 },
  "layout": {
    "regions": [
      {
        "text": "Invoice no. 2026-0042",
        "label": "title",
        "confidence": 0.97,
        "bbox_xyxy": [80, 120, 620, 168]
      },
      {
        "text": "Total incl. tax 123.45 EUR",
        "label": "text",
        "confidence": 0.94,
        "bbox_xyxy": [80, 980, 540, 1024]
      }
    ]
  },
  "image_filename": "invoice.png"
}