> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrape.st/llms.txt
> Use this file to discover all available pages before exploring further.

# OCR Image

> Extract text from an image URL or base64 payload

Runs OCR (RapidOCR/ONNX) against an image and returns the extracted text.

This same engine also runs automatically on images attached to tracked posts:
each image produces an `ocr_result` event delivered through your configured
channels, keyword-filtered like any other delivery — so a keyword that only
appears **inside** an image still triggers a delivery.

## Request

Provide exactly one of:

<ParamField body="imageUrl" type="string">
  The http(s) URL of the image to process (max 10 MB).
</ParamField>

<ParamField body="image" type="string">
  The image itself, as a `data:` URI (`data:image/png;base64,...`) or a raw
  base64 string.
</ParamField>

## Response

<ResponseField name="data" type="object">
  `text` (all lines joined with newlines), `lines` (per-line `text` + `score`),
  `elapsed_ms` (OCR service time), `total_ms` (end-to-end time).
</ResponseField>

<ResponseField name="message" type="string">
  Status message describing the result
</ResponseField>

<RequestExample>
  ```bash URL theme={null}
  curl -X POST https://scrape.st/ocr \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "imageUrl": "https://pbs.twimg.com/media/example.jpg"
    }'
  ```

  ```bash Base64 theme={null}
  curl -X POST https://scrape.st/ocr \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "image": "data:image/png;base64,iVBORw0KGgo..."
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "data": {
      "text": "$PEPE presale live\n0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
      "lines": [
        { "text": "$PEPE presale live", "score": 0.98 },
        { "text": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D", "score": 0.95 }
      ],
      "elapsed_ms": 412,
      "total_ms": 561
    },
    "message": "Text extracted successfully"
  }
  ```
</ResponseExample>

## ocr\_result event payload

Automatic OCR results are dispatched as their own flat events — `source` is
the discriminator — with `ref` pointing back at the originating post:

```json theme={null}
{
  "source": "ocr_result",
  "image_url": "https://pbs.twimg.com/media/example.jpg",
  "text": "$PEPE presale live\n0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
  "ref": {
    "source": "x",
    "mid": "1943512345678901234",
    "sid": "44196397",
    "link": "https://x.com/elonmusk/status/1943512345678901234"
  },
  "buy_ca": [
    {
      "network": "evm",
      "address": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
    }
  ],
  "keyword_matches": ["pepe"]
}
```

`keyword_matches` appears only for API keys with registered
[keywords](/rest-api-reference/keywords/add-keywords).
