Detect the language of a text

Detects the language of a text and returns the most likely languages with confidence scores.

Request

POSThttps://language-detection.p.apihiver.com/v1/detect

JSON object. Required: text.

Request Body

Edit the values below to test different scenarios.

Parameters and body structure are inherited from this endpoint's definition. Changes here only apply to this test run.

Language
Client
1curl --request POST \
2  --url https://language-detection.p.apihiver.com/v1/detect \
3  --header 'Accept: application/json' \
4  --header 'Content-Type: application/json' \
5  --header 'X-API-Key: YOUR_API_KEY' \
6  --data '{
7  "text": "Bonjour tout le monde"
8}'

Detect the language of a text: Language Detection & Transliteration API reference

Detects the language of a text and returns the most likely languages with confidence scores. This endpoint is part of the Language Detection & Transliteration API: Detect the language of any text (55 languages), transliterate Indian scripts (नमस्ते → namaste) and identify writing scripts.

Example response (200, application/json)

Success.

1{
2  "language": "fr",
3  "reliable": true,
4  "candidates": [
5    {
6      "language": "fr",
7      "confidence": 1,
8      "language_name": "French"
9    }
10  ],
11  "confidence": 1,
12  "language_name": "French"
13}

Errors

  • 400 — A required parameter is missing or a value has the wrong format.
    1{
    2  "error": {
    3    "code": "INVALID_INPUT",
    4    "message": "text: Field required"
    5  }
    6}

Gateway errors (missing key, no subscription, rate limits) are listed in Error codes.