Image to Text API

Image to Text API

Recognizes and reads the text embedded in images.
Free Plan $0.00 Monthly Subscribe
30 Requests / Monthly
Free for Lifetime
No Credit Card Required
MOST POPULAR
Starter Plan $17.99 Monthly Subscribe
10,000 Requests / Monthly
Standard Support
Works with handwriting
Multi-lingual
Lightning speed
Pre-trained models
Pro Plan $34.99 Monthly Subscribe
30,000 Requests / Monthly
Standard Support
Works with handwriting
Multi-lingual
Lightning speed
Pre-trained models
Custom Plan Volume Monthly Contact Us
Any requests volume you need
Works with handwriting
Multi-lingual
Lightning speed
Pre-trained models

Image to Text API uses a neural net (LSTM) based OCR engine which is focused on line recognition, but also supports recognizing the character patterns. It supports both handwriting and printed materials.

Examples

Looking at the following business card, it will extract the text information easily, even though the business card is positioned with angle.

Business Card

The API can be triggered with this few lines of cURL command

curl --request GET \
--url 'https://api.apilayer.com/image_to_text/url?url=IMAGE PATH' \
--header 'apikey: YOUR API KEY'

The output is JSON data with all the text extracted and even the language is auto detected,

{
"lang": "en", 
"all_text": "TREVOR OWENS\nCreative Director\nINFINITY\nINFINITY LTD\n12 Badgers lane\nBt 54 1234\nT 028 1298 1234\nE [email protected]\nW www.infinity.com\n", 
"annotations": ["TREVOR", "OWENS", "Creative", "Director", "INFINITY", "INFINITY", "LTD", "12", "Badgers", "lane", "Bt", "54", "1234", "T", "028", "1298", "1234", "E", "[email protected]", "W", "www.infinity.com"]}

The API will also work for handwritings. Even for non-English texts. Check the following example

The response is surprisingly good.

{
"lang": "fr", 
"all_text": "Les Stdjecifa Brangain Que Je Sain\nLres Marculina: ag\u00e9 beau,blanc,bleu,blond,bon,brun\ner\u00e9atif fort giner\u00e9ia g\u00e9nial,gentil,inbligent,jeune,-\nmarron, m\u00e9chant, aympatique, mime,gros,nois, nouve.\nnelit grand, rouxs\u00e9rieur, morti tmide, et vert.\nLafeminims:ag\u00e9e, leue, belle,blond,bowne,brume,\n\u00e1alive fortie, gin\u00e9reuse g\u00e9niale, gentille, intalligenis\nm\u00e9chante mympatique, mince, gro\npetit\narrante,marron,\nresseuse,p\u00e9nille.\n,grande,rousse,s\u00e9rieus\nNEAT CURSINE VRITING\n", 
"annotations": ["Les", "Stdjecifa", "Brangain", "Que", "Je", "Sain", "Lres", "Marculina:", "ag\u00e9", "beau,blanc,bleu,blond,bon,brun", "er\u00e9atif", "fort", "giner\u00e9ia", "g\u00e9nial,gentil,inbligent,jeune,-", "marron,", "m\u00e9chant,", "aympatique,", "mime,gros,nois,", "nouve.", "nelit", "grand,", "rouxs\u00e9rieur,", "morti", "tmide,", "et", "vert.", "Lafeminims:ag\u00e9e,", "leue,", "belle,blond,bowne,brume,", "\u00e1alive", "fortie,", "gin\u00e9reuse", "g\u00e9niale,", "gentille,", "intalligenis", "m\u00e9chante", "mympatique,", "mince,", "gro", "petit", "arrante,marron,", "resseuse,p\u00e9nille.", ",grande,rousse,s\u00e9rieus", "NEAT", "CURSINE", "VRITING"]}

Image to Text API Reference

This API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

Just Getting Started?

Check out our development quickstart guide.

Authentication

Image to Text API uses API keys to authenticate requests. You can view and manage your API keys in the Accounts page.

Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

All requests made to the API must hold a custom HTTP header named "apikey". Implementation differs with each programming language. Below are some samples.

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

Endpoints

Performs OCR on the image at the URL

Parameters

url (required)

Location: Query, Data Type: string

** A word enclosed with curly brackets "{ }" in the code means that it is a parameter and it should be replaced with your own values when executing. (also overwriting the curly brackets).
Returns

Below is a sample response from the endpoint


If you wish to play around interactively with real values and run code, see...

Performs OCR on the uploaded image

Parameters

body (required)

Location: Body, Data Type: file

** A word enclosed with curly brackets "{ }" in the code means that it is a parameter and it should be replaced with your own values when executing. (also overwriting the curly brackets).
Returns

Below is a sample response from the endpoint


If you wish to play around interactively with real values and run code, see...

Rate Limiting

Each subscription has its own rate limit. When you become a member, you start by choosing a rate limit that suits your usage needs. Do not worry; You can upgrade or downgrade your plan at any time. For this reason, instead of starting with a larger plan that you do not need, we can offer you to upgrade your plan after you start with "free" or "gold plan" options and start using the API.

When you reach a rate limit (both daily and monthly), the service will stop responding and returning the HTTP 429 response status code (Too many requests) for each request with the following JSON string body text.

{
"message":"You have exceeded your daily\/monthly API rate limit. Please review and upgrade your subscription plan at https:\/\/apilayer.com\/subscriptions to continue."
}

A reminder email will be sent to you when your API usage reaches both 80% and 90%, so that you can take immediate actions such as upgrading your plan in order to prevent your application using the API from being interrupted.

You can also programmatically check your rate limit yourself. As a result of each request made to the APILayer, the following 4 fields provide you with all the necessary information within the HTTP Headers.

x-ratelimit-limit-month: Request limit per month
x-ratelimit-remaining-month: Request limit remaining this month
x-ratelimit-limit-day: Request limit per day
x-ratelimit-remaining-day: Request limit remaining today

You can contact our support unit if you need any assistance with your application regarding to handle the returned result by looking at the header information.

Error Codes

APILayer uses standard HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate a clientside error, which means that failed given the information provided (e.g., a missing parameter, unauthorized access etc.). Codes in the 5xx range indicate an error with APILayer's servers (normally this should'nt happen at all).

If the response code is not 200, it means the operation failed somehow and you may need to take an action accordingly. You can check the response (which will be in JSON format) for a field called 'message' that briefly explains the error reported.

Status Code Explanation
400 - Bad Request The request was unacceptable, often due to missing a required parameter.
401 - Unauthorized No valid API key provided.
404 - Not Found The requested resource doesn't exist.
429 - Too many requests API request limit exceeded. See section Rate Limiting for more info.
5xx - Server Error We have failed to process your request. (You can contact us anytime)

You can always contact for support and ask for more assistance. We'll be glad to assist you with building your product.