> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/deployment/legacy/legacy-serverless/foundation-models/ocr.md).

# OCR

Extract text from images using the hosted DocTR OCR endpoint on the Hosted API (Legacy).

Optical Character Recognition (OCR) is the process of text recognition, used to extract text from images, serving as an easier alternative to manual data entry.

## Perform OCR

<mark style="color:blue;">`GET`</mark> `https://infer.roboflow.com/doctr/ocr`

#### Query Parameters

| Name                                       | Type   | Description                                                                                                        |
| ------------------------------------------ | ------ | ------------------------------------------------------------------------------------------------------------------ |
| api\_key<mark style="color:red;">\*</mark> | String | [A Roboflow API Key](https://docs.roboflow.com/reference/authentication/authentication/find-your-roboflow-api-key) |

#### Request Body

| Name                                          | Type   | Description                                         |
| --------------------------------------------- | ------ | --------------------------------------------------- |
| image<mark style="color:red;">\*</mark>       | Object | A JSON object containing image information and data |
| image.type<mark style="color:red;">\*</mark>  | String | One of the following: "url" or "base64"             |
| image.value<mark style="color:red;">\*</mark> | String | Either a URL or a base64 encoded image              |

{% tabs %}
{% tab title="200: OK " %}

{% endtab %}
{% endtabs %}

To learn about how to deploy an OCR solution locally on your device using Python, [check out this blog post](https://blog.roboflow.com/ocr-api/).

{% hint style="success" %}
You can also deploy an OCR solution on your device using our open-source inference server. [Learn more about deploying DocTR (OCR) locally here.](https://docs.roboflow.com/models/supported-models/doctr)
{% endhint %}
