ReWords.AI API

Find text in an image

POST
/ocr

Returns every line of text with its position. Costs 1 OCR call (the same image file within 24 hours is counted once). Every call returns a new image_id, which can be reused in POST /edits for 24 hours.

Authorization

bearerAuth
headerAuthorizationBearer <token>

Send Authorization: Bearer rw_live_.... Create up to 5 keys at https://rewords.ai/developers/keys/ once your account has API balance.

Request Body

  1. body

Provide exactly one of image_id, image_url or image_base64; none or more than one returns 400 invalid_request.

language?Language

Main language of the text: en, zh, ja, ko, fr, de, es, pt, it or ru. Case and a region part are ignored (pt-BR counts as pt). The language is not detected automatically: without it, or with any other value, OCR reads Chinese and English (usually Japanese too), and other languages such as Korean or Russian come out wrong. Send it whenever you know it. In an edit it is also used when we read the text: to find from when a replacement has no box, and to fit the new text into result B.

image_url*string

Public http(s) URL of a JPEG, PNG or WebP image up to 20 MB. We download it once, while handling the request; we follow up to 3 redirects and give up after 15 seconds. A URL that cannot be downloaded, or that points to a private network address (such as localhost, 10.x.x.x or 192.168.x.x), returns 400 invalid_image.

Formaturi

Response Body

Text found in the image.

application/json
  1. response
image_id*string
width*integer

Pixel width after applying EXIF orientation.

height*integer

Pixel height after applying EXIF orientation.

texts*array<>
charged_ocr?integer

OCR calls charged (0 if this image was read in the last 24 hours).

Example Request
curl -X POST 'https://api.rewords.ai/v1/ocr' \  -H 'Authorization: Bearer rw_live_your_key' \  -H 'Content-Type: application/json' \  -d '{  "image_url": "https://example.com/banner.png",  "language": "en"}'
Example Response
{  "image_id": "img_118ba6012ee7",  "width": 2560,  "height": 1302,  "texts": [    {      "id": "t1",      "text": "SALE",      "box": [        120,        80,        300,        60      ]    },    {      "id": "t2",      "text": "50% OFF",      "box": [        140,        160,        260,        50      ]    },    {      "id": "t3",      "text": "Summer Collection",      "box": [        100,        700,        800,        80      ]    }  ],  "charged_ocr": 1}