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"
}
						

PDF to Text

Convert pdf documents into plain text. This endpoint accepts pdf files, URLs, or base64 data.

Allowed Upload Methods

Image

Allowed Upload Formats

PDF only

Base URL

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

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

file:     (file)
						

You can use only file method.

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

Excel to CSV

Convert excel sheets into csv files. This endpoint accepts excel files, URLs, or base64 data.

Allowed Upload Methods

Image

Allowed Upload Formats

XLS, XLSX

Base URL

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

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

file:     (file)
						

You can use only file method.

Response (Success)
{
	"error": false,
	"result": "CSV file URL"
}
						

CSV to Excel

Convert csv files into excel sheets. This endpoint accepts csv files, URLs, or base64 data.

Allowed Upload Methods

Image

Allowed Upload Formats

CSV only

Base URL

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

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

file:     (file)
						

You can use only file method.

Response (Success)
{
	"error": false,
	"result": "Excel file URL"
}