Drop Files Here

API Documentation

Welcome! This page contains everything you need to integrate with our REST APIs — one unified plan unlocks multiple tools.

Authentication

To access the API, include your API key in the request header:

Authorization: Bearer YOUR_API_KEY

Replace YOUR_API_KEY with your actual API key obtained from your dashboard.

Common Examples

Examples below show how to consume our API using various methods:

cURL
curl -X POST "https://ocr.ac/example-endpoint" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@path/to/file.jpg"
						
JavaScript (Fetch)
fetch("https://ocr.ac/example-endpoint", {
	method: "POST",
	headers: {
		"Authorization": "Bearer YOUR_API_KEY"
	},
	body: formData
})
.then(res => res.json())
.then(data => console.log(data));
						

Common Errors

Examples below show the common errors can happen using this API:

Incorrect API (Error)
{
	"error": true,
	"message": "Invalid / Missing API key"
}
						
Validation (Error)
{
	"error": true,
	"message": "File (Object), File URL, or Base64 Data URI string is required."
	OR
	"message": "File (Object) is required."
}
						
Authorization (Error)
{
	"error": true,
	"message": "Unauthorized / Not Premium"
}
						
Other (Error)
{
	"error": true,
	"message": "Something went wrong! Please try again."
}
						

Online OCR (Image to Text)

Convert images into plain text. This endpoint accepts image files, URLs, or base64 data.

Allowed Upload Methods

Image, Image URL, Base64 String

Allowed Upload Formats

JPG, JPEG, PNG, WEBP, BMP

Base URL

POST https://ocr.ac/api/image-to-text

Request
Authorization: Bearer YOUR_API_KEY
Content-Type: multipart/form-data

image:     (file)
image_url: (string) The URL of the image to be converted.
base64:    (string) The base64-encoded image data, including the data URI prefix.
						

You can use any of these input methods: image, image_url, base64

Response (Success)
{
	"error": false,
	"result": "Extracted text"
}
						

Handwriting to Text

Convert handwritten text images into plain text. This endpoint accepts image files, URLs, or base64 data.

Allowed Upload Methods

Image, Image URL, Base64 String

Allowed Upload Formats

JPG, JPEG, PNG, WEBP, BMP

Base URL

POST https://ocr.ac/api/handwriting-to-text

Request
Authorization: Bearer YOUR_API_KEY
Content-Type: multipart/form-data

image:     (file)
image_url: (string) The URL of the image to be converted.
base64:    (string) The base64-encoded image data, including the data URI prefix.
						

You can use any of these input methods: image, image_url, base64

Response (Success)
{
	"error": false,
	"result": "Extracted text"
}
						

JPG to Excel

Extract table data from images. This endpoint accepts images, URLs, or base64 data.

Allowed Upload Methods

Image, Image URL, Base64 String

Allowed Upload Formats

JPG, JPEG, PNG

Base URL

POST https://ocr.ac/api/jpg-to-excel

Request
Authorization: Bearer YOUR_API_KEY
Content-Type: multipart/form-data

image:     (file)
image_url: (string) The URL of the image to be converted.
base64:    (string) The base64-encoded image data, including the data URI prefix.
						

You can use any of these input methods: image, image_url, base64

Response (Success)
{
	"error": false,
	"result": "Extracted table data (JSON Encoded)"
}