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

NameTypeRequiredMaxDescription
textstringYes2500The text to translate
sourceLanguagestringNo-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
targetLanguagestringYes-The language to translate the text to. Supported languages: en, es, fr, de, zh, ja, ko, pt, it, ru, ar, hi

Response

NameTypeDescription
dataobjectThe data of the text translation
data.originalTextstringThe original text
data.translatedTextstringThe translated text
data.sourceLanguagestringThe source language code
data.targetLanguagestringThe target language code
metadataobjectMetadata about the text translation process
metadata.costnumberThe cost of the text translation request

Errors

{
   "error": "string", 
   "code": "string"
}
HTTP StatusError CodeMessage
400INVALID_PAYLOADOccurs when the payload is invalid.
400INVALID_REQUESTEx.: The request is invalid.
400TEXT_TRANSLATION_ERROREx: could not translate the text | parsing error
400HARM_CONTENTEx.: The content is harmful and cannot be processed.
400INSUFFICIENT_BALANCEThe user has insufficient balance
401UNAUTHORIZEDEx.: The token is invalid.
429TOO_MANY_REQUESTSEx.: The request limit has been reached.