Serverless AI Language Detection
AI powered language detection service that accurately identifies the language of any given text. It returns the language name, ISO code, and confidence score for precise language identification.
Endpoint
Detect the language of provided text
POSThttps://api.xtartapp.com/text/language-detection
*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 detect the language of |
Response
Name | Type | Description |
---|---|---|
data | object | The data of the language detection |
data.language | string | The full name of the detected language (e.g., 'English', 'French') |
data.code | string | The ISO 639-1 language code (2 letters, e.g., 'en', 'fr') |
data.confidence | number | The confidence score for the language detection (0-1) |
metadata | object | Metadata about the language detection process |
metadata.cost | number | The cost of the language detection 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_LANGUAGE_DETECTION_ERROR | Ex: could not detect the language of 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. |