Apinoa Docs

OCR

Read the text in a product image: every region with its polygon, bounding box, text and confidence. No cleaning, no translation.

View raw .mdx
POST /v1/image-translate/ocr

Runs only the reading step of Translate: it returns the text regions and changes nothing. Use it to pre-screen images or to drive your own workflow. Send the image as raw bytes in the body and source_language in the query string.

Request

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

Parameters

Headers

HeaderRequiredNotes
x-api-keyyesYour API key.
Content-Typeyesimage/jpeg, image/png, image/webp or application/octet-stream.

Query string

ParameterTypeRequiredNotes
source_languagestringyesch, zh, zh-CN, zh-TW, chinese_cht, ja, japan, en, or auto.

Response

A real response, shortened to its first region:

{
  "success": true,
  "requestId": "43d899616f8e468aa22368bffaae1953",
  "data": {
    "regions": [
      {
        "index": 0,
        "polygon": [[83, 68], [352, 68], [352, 145], [83, 145]],
        "bbox": { "x": 83, "y": 68, "w": 269, "h": 77 },
        "text": "限时特价",
        "confidence": 0.999354,
        "text_color": { "r": 255, "g": 253, "b": 252 },
        "bg_color": { "r": 211, "g": 40, "b": 43 },
        "bg_std": 0.363554,
        "font_weight": "Regular",
        "is_badge": false
      }
    ],
    "regions_found": 3,
    "src_w": 800,
    "src_h": 600
  }
}
FieldTypeMeaning
regions[].indexintegerThe region's number, starting at 0.
regions[].polygonnumber[][]Four corner points, in the original image's coordinates.
regions[].bboxobjectThe bounding box {x, y, w, h}, in the original image's coordinates.
regions[].textstringThe text that was read.
regions[].confidencenumberRecognition confidence, 0–1.
regions[].text_color, regions[].bg_colorobjectEstimated text and background colours, as RGB.
regions[].bg_stdnumberHow uneven the background is behind the text; near 0 is a flat colour.
regions[].font_weightstringThe detected weight.
regions[].is_badgebooleantrue for text on a filled label, such as a price tag or sale badge.
regions_foundintegerHow many regions were found.
src_w, src_hintegerThe original image's width and height, in pixels.

Errors

StatusCodeMeaning
400BAD_REQUESTThe body is empty, or a query parameter is invalid.
401UNAUTHORIZEDThe x-api-key header is missing, or the key is invalid.
402INSUFFICIENT_BALANCEThe balance does not cover the call. Retrying does not clear it; top up.
413PAYLOAD_TOO_LARGEThe body is over 20 MB.
415UNSUPPORTED_MEDIA_TYPEContent-Type is not an image type.
422INVALID_IMAGEThe bytes are not a readable image.
502UPSTREAM_ERRORReading is briefly unavailable. Retry.

Every code is listed in Errors. Failed calls are not billed.

Pricing

Each call is charged at the image-translate rate on the pricing page, the same as Translate.

Notes

  • Limits. Images up to 8192 × 8192 px and a 20 MB body, as JPEG, PNG or WebP.

On this page