Translate Text

POST
https://libretranslate.com/translate

Body

application/x-www-form-urlencoded
qstring | Array<any>required

Text(s) to translate

Show child attributes
One of
string
Example
Hello world!
Array<any>
Example
[
  "Hello world!"
]
sourcestringrequired

Source language code or “auto” for auto detection

Example
en
targetstringrequired

Target language code

Example
es
formatstringtexthtmltext

Format of source text:

  • text - Plain text
  • html - HTML markup
Example
text
alternativesinteger0

Preferred number of alternative translations

Example
3
api_keystring

API key

Example
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Response

Translation

Response fields application/json
alternativesArray<string> | Array<Array<string>>

Alternative translations

Show child attributes
One of
Array<string>
Array<Array<string>>
detectedLanguageobject | Array<object>
Show child attributes
One of
confidencenumber<float>[0, 100]

Confidence value

Example
100
languagestring

Language code

Array<object>
Show child attributes
confidencenumber<float>[0, 100]

Confidence value

Example
100
languagestring

Language code

translatedTextstring | Array<any>required

Translated text(s)

Show child attributes
One of
string
Array<any>
400Bad Requesterror-response

Invalid request

Response fields application/json
errorstring

Error message

403Forbiddenerror-response

Banned

Response fields application/json
errorstring

Error message

429Too Many Requestserror-slow-down

Slow down

Response fields application/json
errorstring

Reason for slow down

500Internal Server Errorerror-response

Translation error

Response fields application/json
errorstring

Error message