OCRAny API Documentation

Integrate our OCR API into your applications, implement text recognition functionality with just a few lines of code

Get API Key

Quick Start

OCRAny API uses RESTful design and supports text recognition from images via HTTP requests.

Authentication

All API requests require authentication using an API key. You can obtain your API key in the console.

Authorization: Bearer YOUR_API_KEY

Base Endpoint

The base URL for the API is:

https://api.ocrany.com

Recognize Text from Images

Send a POST request to the /ocr endpoint, upload an image file or provide an image URL.

curl -X POST https://api.ocrany.com/ocr \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@/path/to/image.jpg"import requests

url = "https://api.ocrany.com/ocr"
headers = {
    "Authorization": "Bearer YOUR_API_KEY"
}

with open("image.jpg", "rb") as f:
    files = {"file": f}
    response = requests.post(url, headers=headers, files=files)

print(response.json())const form = new FormData();
form.append('file', fileInput.files[0]);

fetch('https://api.ocrany.com/ocr', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY'
  },
  body: form
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

Response Example

{
 "code": 0,
 "text": "This is the text content recognized from the image..."
}

Using Image URL

You can also recognize text by providing an image URL.

curl -X POST https://api.ocrany.com/v1/ocr \
 - H "Authorization: Bearer YOUR_API_KEY" \
 - H "Content-Type: application/json" \
 - d '{"url": "https://example.com/image.jpg"}' 

Parameter Options

You can customize OCR recognition behavior with the following parameters:

Parameter
Type
Description
imagestringBase64 encoded string of the image
formatstringOutput format, options include "text", "json", "xml"

Error Handling

The API uses standard HTTP status codes to indicate request status. Error responses include error codes and description information.

{
 code: -1,
 msg: "error"
}

Usage Limits

API requests have different limits based on your subscription plan:

Plan
Request Limit
File Size Limit
Free-10MB
Basic1,000 requests/day10MB
Professional10,000 requests/day20MB