Docs › Language and text
Translation API
Translate between English and 22 Indian languages with IndicTrans2.
Machine translation by AI4Bharat's IndicTrans2 (distilled models), between English and Assamese, Bengali, Bodo, Dogri, Gujarati, Hindi, Kannada, Kashmiri, Konkani, Maithili, Malayalam, Manipuri, Marathi, Nepali, Odia, Punjabi, Sanskrit, Santali, Sindhi, Tamil, Telugu and Urdu. Between two Indian languages the text goes through English. Web and e-mail addresses and long numbers are kept as they are. Nothing you send is kept or logged.
Translate text
GET/v1/translatePOST
Translates a sentence at a time and returns the whole translation and each sentence. Up to 2,000 characters and 30 sentences. Write Indian languages in their own script.
Also takes POST: The text to translate. Send it as text/plain, or as JSON {"text": "..."} with the other options beside it, up to 256 KB.
What you send here is never written to the log, and the answer is not cached.
| Parameter | Description |
|---|---|
textquery | The text (or POST it). |
fromquery, required | The language of the text: en, or a code from /v1/translate/languages such as hi or ta. |
toquery, required | The language to translate into. |
curl
curl "https://api.dharun.dev/v1/translate?from=en&to=ta&text=The+train+to+Chennai+leaves+at+6+pm.+Please+reach+the+station+early."JavaScript
const response = await fetch("https://api.dharun.dev/v1/translate?from=en&to=ta&text=The+train+to+Chennai+leaves+at+6+pm.+Please+reach+the+station+early.");
const body = await response.json();
if (!response.ok) throw new Error(body.error.message);
console.log(body.data);Python
import requests
response = requests.get("https://api.dharun.dev/v1/translate?from=en&to=ta&text=The+train+to+Chennai+leaves+at+6+pm.+Please+reach+the+station+early.", timeout=10)
body = response.json()
if not response.ok:
raise RuntimeError(body["error"]["message"])
print(body["data"])Response
{
"data": {
"from": "eng_Latn",
"to": "tam_Taml",
"sentences": [
"சென்னைக்கு செல்லும் ரயில் மாலை 6 மணிக்கு புறப்படுகிறது.",
"தயவுசெய்து முன்கூட்டியே நிலையத்தை அடையவும்."
],
"via_english": false,
"truncated": [],
"translation": "சென்னைக்கு செல்லும் ரயில் மாலை 6 மணிக்கு புறப்படுகிறது. தயவுசெய்து முன்கூட்டியே நிலையத்தை அடையவும்."
},
"meta": {
"source": {
"name": "IndicTrans2 distilled 200M (int8)",
"url": "https://github.com/AI4Bharat/IndicTrans2",
"licence": "MIT",
"version": "indictrans2-dist-200M@models-2026-10",
"retrieved": "2026-10-15T12:28:44Z",
"attribution": "Translation by IndicTrans2 (AI4Bharat, Gala et al., 2023), MIT."
},
"note": "Machine translation by IndicTrans2; names, numbers and technical terms deserve a check."
}
}Languages
GET/v1/translate/languages
Every language with its short code and FLORES-200 code; either can be used as from and to.
curl
curl "https://api.dharun.dev/v1/translate/languages"JavaScript
const response = await fetch("https://api.dharun.dev/v1/translate/languages");
const body = await response.json();
if (!response.ok) throw new Error(body.error.message);
console.log(body.data);Python
import requests
response = requests.get("https://api.dharun.dev/v1/translate/languages", timeout=10)
body = response.json()
if not response.ok:
raise RuntimeError(body["error"]["message"])
print(body["data"])Response, with lists and long text shortened
{
"data": [
{
"code": "asm_Beng",
"short": "as",
"name": "Assamese"
},
{
"code": "ben_Beng",
"short": "bn",
"name": "Bengali"
},
{
"code": "brx_Deva",
"short": "brx",
"name": "Bodo"
}
],
"meta": {
"total": 26,
"note": "Use short or code as from and to. Between two Indian languages the text is translated through English."
}
}Data source
IndicTrans2 distilled 200M (int8), indictrans2-dist-200M@models-2026-10. Retrieved 2026-10-15T12:28:44Z. Licence: MIT. Translation by IndicTrans2 (AI4Bharat, Gala et al., 2023), MIT.
Using an AI assistant? Connect the MCP server and it can call this API by itself.