Apinoa Docs

OCR Only

Detect and read text in a product image. Returns recognised regions with polygons, bounding boxes, text, and confidence — no inpainting, no translation, no rendering.

View raw .mdx

Endpoint

POST /v1/image-translate/ocr

Run only the OCR step from the full pipeline. Returns recognised text regions with their geometry and confidence scores. No image is modified, nothing is translated, no final image is produced. Use this when you only need text coordinates and content — for example, to pre-screen images or to drive a custom downstream workflow.

Cheaper per call than /translate.

Request Format

The endpoint accepts raw image bytes in the HTTP body. JSON-with-base64 is not accepted.

HeaderRequiredNotes
Content-TypeYesimage/jpeg, image/png, image/webp, or application/octet-stream
x-api-keyYesYour API key

All other parameters travel in the query string:

ParameterTypeRequiredDefaultDescription
source_languagestringYesOne of ch, zh, zh-CN, zh-TW, chinese_cht, ja, japan, en, or auto.

Response

{
  "success": true,
  "requestId": "550e8400e29b41d4a716446655440000",
  "data": {
    "regions": [
      {
        "polygon": [[10, 20], [210, 20], [210, 60], [10, 60]],
        "bbox": { "x": 10, "y": 20, "w": 200, "h": 40 },
        "text": "免费送货",
        "confidence": 0.98
      }
    ],
    "src_w": 790,
    "src_h": 1158,
    "regions_found": 1
  }
}
FieldTypeDescription
regions[].polygonnumber[][]4-point polygon in original image coordinates.
regions[].bboxobjectAxis-aligned bounding box {x, y, w, h} in original coordinates.
regions[].textstringRecognised text.
regions[].confidencenumberRecognition confidence, 0–1.
src_w, src_hintegerOriginal image width and height in pixels.
regions_foundintegerNumber of recognised regions returned.

Examples

cURL

curl -X POST "https://gateway.apinoa.com/v1/image-translate/ocr?source_language=zh-CN" \
  -H "x-api-key: $APINOA_API_KEY" \
  -H "Content-Type: image/jpeg" \
  --data-binary @product.jpg

Python

import requests

with open("product.jpg", "rb") as f:
    img_bytes = f.read()

r = requests.post(
    "https://gateway.apinoa.com/v1/image-translate/ocr",
    headers={
        "x-api-key": "YOUR_API_KEY",
        "Content-Type": "image/jpeg",
    },
    params={"source_language": "zh-CN"},
    data=img_bytes,
    timeout=60,
)
r.raise_for_status()
for region in r.json()["data"]["regions"]:
    print(region["text"], region["confidence"])

Limits

LimitValue
Max image dimensions8192 × 8192 px
Max request body20 MB
Image formatJPEG, PNG, WebP

Errors

CodeHTTPWhen
BAD_REQUEST400Empty body or invalid query params
UNAUTHORIZED401Missing or invalid API key
UNSUPPORTED_MEDIA_TYPE415Content-Type is not a binary image type
PAYLOAD_TOO_LARGE413Body > 20 MB
INSUFFICIENT_BALANCE402Your balance does not cover the call
UPSTREAM_ERROR502Recognition temporarily unavailable

Pricing

Each call is charged against your balance at the image-translate rate on the pricing page.

On this page