Serverless AI Text Translation
AI powered text translation service that translates text between multiple languages while preserving the original formatting, structure, and meaning.
Endpoint
Text translation with language auto-detection
POSThttps://api.xtartapp.com/text/translation
*Authentication
You must use a Bearer token provided by the dashboard to use for authentication. Add the token to the Authorization header.
Request body
Name | Type | Required | Max | Description |
---|---|---|---|---|
text | string | Yes | 2500 | The text to translate |
sourceLanguage | string | No | - | The language of the input text. Use 'auto' for automatic language detection. Supported languages: en, es, fr, de, zh, ja, ko, pt, it, ru, ar, hi |
targetLanguage | string | Yes | - | The language to translate the text to. Supported languages: en, es, fr, de, zh, ja, ko, pt, it, ru, ar, hi |
Response
Name | Type | Description |
---|---|---|
data | object | The data of the text translation |
data.originalText | string | The original text |
data.translatedText | string | The translated text |
data.sourceLanguage | string | The source language code |
data.targetLanguage | string | The target language code |
metadata | object | Metadata about the text translation process |
metadata.cost | number | The cost of the text translation request |
Errors
{
"error": "string",
"code": "string"
}
HTTP Status | Error Code | Message |
---|---|---|
400 | INVALID_PAYLOAD | Occurs when the payload is invalid. |
400 | INVALID_REQUEST | Ex.: The request is invalid. |
400 | TEXT_TRANSLATION_ERROR | Ex: could not translate the text | parsing error |
400 | HARM_CONTENT | Ex.: The content is harmful and cannot be processed. |
400 | INSUFFICIENT_BALANCE | The user has insufficient balance |
401 | UNAUTHORIZED | Ex.: The token is invalid. |
429 | TOO_MANY_REQUESTS | Ex.: The request limit has been reached. |