OCR API Documentation
Learn how to use the ImageToTextConverter OCR API to extract text from images.
Authentication
All API endpoints require authentication using an API token. Include a valid API token in the Authorization header as a Bearer token. Each user is allowed only one active API token at a time, which can be generated or regenerated from the dashboard. API access is restricted to verified accounts (email-verified users), with a limit of 100 requests per day.
Authorization: Bearer your-api-token
To obtain an API token, log in to your account at ImageToTextConverter, verify your email, and generate your token in the dashboard's API Token section.
Base URL
https://imagetotextconverter.org/api/ocr
Endpoints
1. Extract Text from Base64 Image
Extracts text from a base64-encoded image.
- URL:
/api/ocr/extract-text - Method:
POST - Headers:
Authorization: Bearer your-api-tokenContent-Type: application/jsonAccept: application/json
- Request Body:
{ "image": "data:image/jpeg;base64,/9j/4AAQSkZJRg..." } - Response (Success):
{ "success": true, "data": { "success": true, "text": "Extracted text from image", "processing_time": 0.45, "confidence": 99, "language": null, "raw_response": { ... } } } - Response (Error):
{ "success": false, "message": "Invalid base64 image format" } - Status Codes:
200: Success401: Unauthorized (Invalid or expired token)403: Forbidden (Unverified account)422: Validation error429: Too Many Requests (Daily limit exceeded)500: Server error
2. Extract Text from Uploaded File
Extracts text from an uploaded image file.
- URL:
/api/ocr/extract-text-from-file - Method:
POST - Headers:
Authorization: Bearer your-api-tokenContent-Type: multipart/form-dataAccept: application/json
- Request Body:
file: The image file (Supported formats: jpeg, png, gif, bmp, webp; Max size: 5MB)
- Response (Success):
{ "success": true, "data": { "success": true, "text": "Extracted text from image", "processing_time": 0.45, "confidence": 99, "language": null, "raw_response": { ... } } } - Response (Error):
{ "success": false, "message": "Invalid file format" } - Status Codes:
200: Success401: Unauthorized (Invalid or expired token)403: Forbidden (Unverified account)422: Validation error429: Too Many Requests (Daily limit exceeded)500: Server error
Example Usage (cURL)
Extract Text from Base64
curl -X POST https://imagetotextconverter.org/api/ocr/extract-text \
-H "Authorization: Bearer your-api-token" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"image": "data:image/jpeg;base64,/9j/4AAQSkZJRg..."}'
Extract Text from File
curl -X POST https://imagetotextconverter.org/api/ocr/extract-text-from-file \
-H "Authorization: Bearer your-api-token" \
-H "Accept: application/json" \
-F "file=@/path/to/image.jpg"
Notes
- Ensure the base64 string includes the correct MIME type prefix (e.g.,
data:image/jpeg;base64,). - File uploads are limited to 5MB and must be in one of the supported formats.
- Only one active API token is allowed per user. Regenerating a token in the dashboard deactivates the previous token.
- API tokens expire after 6 months but can be regenerated earlier if needed.
- Only email-verified accounts can generate tokens and access the API, with a limit of 100 requests per day.
- For pricing details or to upgrade your account, visit our pricing page.
Support
For issues or inquiries, contact our support team at [email protected].