Image to Text API
The Image to Text API detects and extracts text from images using state-of-the-art optical character recognition (OCR) algorithms. It can detect texts of different sizes, fonts, and even handwriting.
From 7,083 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 301ms | 338ms | 373ms | 672ms | 1130ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
/v1/imagetotext POST
https://api.api-ninjas.com/v1/imagetotext
Given an input image, return all detected texts and their bounding boxes.
| Plan | Image Size Limit |
|---|---|
| Free | 200KB per image |
| Premium | Up to 5MB per image |
Files
imagerequiredImage file to extract text from. Must be either JPEG or PNG format.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Sample Request Live Demo!

Try our APIs in the API playground
Sign up for a free API key to get started — no credit card required.
https://api.api-ninjas.com/v1/imagetotextHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[
{
"text": "API",
"bounding_box": {
"x1": 60,
"y1": 72,
"x2": 163,
"y2": 118
}
},
{
"text": "Ninjas",
"bounding_box": {
"x1": 189,
"y1": 72,
"x2": 373,
"y2": 132
}
},
{
"text": "Image",
"bounding_box": {
"x1": 64,
"y1": 178,
"x2": 170,
"y2": 215
}
}
]
...Code Examples
1
2
3
curl -X POST "https://api.api-ninjas.com/v1/imagetotext" \
-H "X-Api-Key: YOUR_API_KEY" \
-F "image=@YOUR_IMAGE.jpeg"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
Frequently Asked Questions
Can I use the Image to Text API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Image to Text API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.How do I get an API key and start using the Image to Text API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.What happens if a request to the Image to Text API fails?
The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.What are some use cases for the Image to Text API?
The Image to Text API uses state-of-the-art OCR to detect and extract text of different sizes, fonts, and even handwriting from images, making it useful for digitizing scanned documents, reading receipts and signs, and automating data entry. It pairs well with other vision tools like our Object Detection and Face Detect APIs.How do I submit an image and what formats are supported?
Send a POST request to the/v1/imagetotextendpoint with the image attached as a multipart form file namedimage; it must be in JPEG or PNG format. See the API documentation for full code examples in multiple languages.What does the Image to Text response include?
The response returns all detected text strings along with their bounding box coordinates, so you can both read the extracted text and locate where each piece appears in the image. If a request returns an error, refer to our error codes page.What is the maximum image size I can upload?