Developer Reference

API Documentation

The TextLift Image To Text API allows developers to convert images containing text into machine-readable text. This documentation explains how to authenticate requests, send images to the API, and understand success and error responses.

Base URL

https://www.textlift.info/api/image-to-text

Authentication

To access the TextLift Image To Text API, include your API key in the request header.

http
Authorization: Bearer YOUR_API_KEY
Replace 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.

POSThttps://www.textlift.info/api/image-to-text

Headers

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

Form Data

FieldTypeSupported Formats
imagefileJPG, JPEG, PNG, WEBP, TIFF, BMP

Example

bash
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.

POSThttps://www.textlift.info/api/image-to-text

Headers

http
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

JSON Body

json
{
  "image_url": "https://example.com/image.jpg"
}

Example

bash
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.

POSThttps://www.textlift.info/api/image-to-text

Headers

http
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

JSON Body

json
{
  "base64": "data:image/png;base64,BASE64_ENCODED_IMAGE_DATA"
}

Example

bash
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

php
$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

json
{
  "error": false,
  "result": "Extracted text appears here."
}
  • error: false — Request was successful.
  • result — Contains the extracted text from the image.

Error Response

json
{
  "error": true,
  "message": "Error occurred. Please try again."
}

Validation Error

Returned when no image file, URL, or Base64 data is provided.

json
{
  "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.

json
{
  "type": "invalid_request",
  "message": "Unauthorized or not on an API-enabled plan."
}

Incorrect API Key Error

json
{
  "type": "invalid_request",
  "message": "Incorrect API key provided."
}

Throttle Error

Returned when too many requests are made.

json
{
  "type": "invalid_request",
  "message": "You are temporarily blocked for 1 hour due to too many requests."
}

Ready to start building?

Generate your API key and start extracting text from images today.

base44
Edit with Base44