ReWords.AI API

Quickstart

Replace text in your first image with the ReWords.AI API — OCR, submit an edit, and fetch the results with three curl requests.

You need an API key: buy an API pack, then create a key on your API keys page (see Authentication). Set it in your shell:

export REWORDS_API_KEY=rw_live_your_key

1. Find the text

curl https://api.rewords.ai/v1/ocr \
  -H "Authorization: Bearer $REWORDS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image_url": "https://example.com/banner.png", "language": "en"}'
{
  "image_id": "img_abc123",
  "width": 1080,
  "height": 1350,
  "texts": [
    { "id": "t1", "text": "SALE", "box": [120, 80, 300, 60] },
    { "id": "t2", "text": "50% OFF", "box": [140, 160, 260, 50] }
  ],
  "charged_ocr": 1
}

Boxes are [x, y, width, height] on a 0–1000 scale of the image, so they do not depend on its pixel size. The image_id can be reused for 24 hours, so you do not upload the image again. Set language to the language of the text in the image — ko for Korean, ja for Japanese and so on. It is not detected for you, and without it OCR reads only Chinese and English well (see the FAQ).

2. Submit the edit

Send a box from the OCR result, or only from and to and we locate the text for you.

curl https://api.rewords.ai/v1/edits \
  -H "Authorization: Bearer $REWORDS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "image_id": "img_abc123",
    "replacements": [
      { "from": "SALE", "to": "HOT DEAL", "box": [120, 80, 300, 60] },
      { "from": "50% OFF", "to": "70% OFF" }
    ]
  }'
{
  "id": "edit_9f8e7d",
  "status": "queued",
  "queue_position": 0,
  "estimated_seconds": 120,
  "replacements": [
    { "from": "SALE", "to": "HOT DEAL", "box": [120, 80, 300, 60] },
    { "from": "50% OFF", "to": "70% OFF", "box": [140, 160, 260, 50] }
  ],
  "balance": 4,
  "created_at": "2026-11-04T13:55:33.240Z"
}

replacements shows the box we found for 50% OFF, and one edit is already reserved in balance. Use a new Idempotency-Key for each new job and the same one only to resend that job — a reused key returns the earlier job, not a new edit.

3. Get the results

Poll until status is succeeded or failed: every 5 seconds while it is processing or queued with queue_position 0, and every 30 seconds while it is further back in the queue — see Queue and limits. Or pass callback_url and receive a webhook instead.

curl https://api.rewords.ai/v1/edits/edit_9f8e7d \
  -H "Authorization: Bearer $REWORDS_API_KEY"
{
  "id": "edit_9f8e7d",
  "status": "succeeded",
  "results": {
    "A": { "status": "succeeded", "url": "https://img.rewords.ai/api/edit_9f8e7d_a.jpg" },
    "B": { "status": "succeeded", "url": "https://img.rewords.ai/api/edit_9f8e7d_b.jpg" },
    "C": { "status": "succeeded", "url": "https://img.rewords.ai/api/edit_9f8e7d_c.jpg" }
  },
  "replacements": [
    { "from": "SALE", "to": "HOT DEAL", "box": [120, 80, 300, 60] },
    { "from": "50% OFF", "to": "70% OFF", "box": [140, 160, 260, 50] }
  ],
  "charged": 1,
  "balance": 4,
  "created_at": "2026-11-04T13:55:33.240Z",
  "completed_at": "2026-11-04T13:56:21.808Z"
}

See Examples for complete Node.js and Python clients and every other response.

Download the images you need — results are JPEG files at public links kept for at least 7 days. See Results and refunds for what A, B and C are, and Images for uploading a local file instead of a URL.

On this page