Purpose
POST /detect-language names the language of one string. It does not translate.
When to use it
Use it before you choose a from code, or when you only need the language of a string.
Request
POSThttps://edge.harktranslate.com/api/v1/translator/detect-language
Send Content-Type: application/json and authenticate with the x-hark-key header.
| Field | Type | Required | Default | Allowed | Description |
|---|---|---|---|---|---|
| text | string | yes | none | 1 to 1,037,299 characters. | The string to translate, or the text whose language should be identified. |
Payload
Full request
curl -X POST "https://edge.harktranslate.com/api/v1/translator/detect-language" \
-H "x-hark-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'JSON'
{
"text": "Bonjour"
}
JSONSuccess
HTTP 200. This route has no meta block: it does not report quality, grade, or degraded_segments, because it does not translate.
200 body
{
"trust_level": 1,
"source_lang_code": "fr",
"source_lang": "French"
}Common mistakes
Sending from, to, or quality
The body is one field, text. Translate options belong on /text, /texts, /json, or /html.
An empty string
text must be 1 to 1,037,299 characters.