Base URL
Authentication
To access the TextLift Image To Text API, include your API key in the request header.
Authorization: Bearer YOUR_API_KEY
YOUR_API_KEY with the API key from your TextLift account dashboard.API Endpoints
1. Image File Upload
This endpoint allows users to upload an image file directly for OCR text extraction.
Headers
Authorization: Bearer YOUR_API_KEY Content-Type: multipart/form-data
Form Data
| Field | Type | Supported Formats |
|---|---|---|
| image | file | JPG, JPEG, PNG, WEBP, TIFF, BMP |
Example
curl -X POST "https://www.textlift.info/api/image-to-text" \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "image=@/path/to/image.jpg"
2. Image URL
This endpoint allows users to submit an image URL for OCR text extraction.
Headers
Authorization: Bearer YOUR_API_KEY Content-Type: application/json
JSON Body
{
"image_url": "https://example.com/image.jpg"
}Example
curl -X POST "https://www.textlift.info/api/image-to-text" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"image_url":"https://example.com/image.jpg"}'3. Base64 Image Data
This endpoint allows users to submit image data as a Base64-encoded string.
Headers
Authorization: Bearer YOUR_API_KEY Content-Type: application/json
JSON Body
{
"base64": "data:image/png;base64,BASE64_ENCODED_IMAGE_DATA"
}Example
curl -X POST "https://www.textlift.info/api/image-to-text" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"base64":"data:image/png;base64,BASE64_ENCODED_IMAGE_DATA"}'Curl Request Example
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://www.textlift.info/api/image-to-text',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 60,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array(
'base64' => 'data:image/png;base64,BASE64_ENCODED_IMAGE_DATA'
),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer YOUR_API_KEY'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;Response Format
All API responses return JSON.
Success Response
{
"error": false,
"result": "Extracted text appears here."
}error: false— Request was successful.result— Contains the extracted text from the image.
Error Response
{
"error": true,
"message": "Error occurred. Please try again."
}Validation Error
Returned when no image file, URL, or Base64 data is provided.
{
"error": true,
"message": "Image file, image URL, or Base64 data URI string is required."
}Authorization Error
Returned when the user is not authorized or not on an API-enabled plan.
{
"type": "invalid_request",
"message": "Unauthorized or not on an API-enabled plan."
}Incorrect API Key Error
{
"type": "invalid_request",
"message": "Incorrect API key provided."
}Throttle Error
Returned when too many requests are made.
{
"type": "invalid_request",
"message": "You are temporarily blocked for 1 hour due to too many requests."
}