Text Language API
The Text Language API detects the language of any given text, supporting over 50 different languages.
From 9,370 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 306ms | 343ms | 365ms | 795ms | 1139ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
/v1/textlanguage GET
https://api.api-ninjas.com/v1/textlanguage
Returns the language name and 2-letter ISO language code for a given block of text string.
Parameters
textrequiredInput text (10 words or more recommended). Maximum 1000 characters.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON object with the following fields or an error if the request is unsuccessful.
isoISO 639-1 language code (e.g.,
en,es,fr).languageFull name of the detected language (e.g.,
English,Spanish,French).
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/textlanguage?text=Hello world!Headers
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/textlanguage?text=Hello%20world!" \
-H "X-Api-Key: YOUR_API_KEY"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 Text Language API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Text Language 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 Text Language 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 Text Language 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.How do I detect the language of a piece of text?
Send a GET request to the/v1/textlanguageendpoint with your text passed in the requiredtextquery parameter; the API supports over 50 different languages. You can try it on the live demo on this page or register for a free API key to get started.What does the Text Language API response include?
The response is a JSON object containing two fields:iso, the ISO 639-1 two-letter language code (e.g.en,es,fr), andlanguage, the full name of the detected language (e.g.English,Spanish,French). If a request is unsuccessful, you will receive an error instead, documented on our error codes page.Are there any limits on the input text?
Thetextparameter accepts a maximum of 1000 characters, and we recommend supplying at least 10 words for the most accurate detection. For higher request volumes, see our pricing plans.What are some use cases for the Text Language API?
It is ideal for routing multilingual support tickets, tagging user-generated content by language, and pre-processing text before downstream NLP tasks. You can pair it with our Sentiment API or Spell Check API to build a complete text analysis pipeline.