# POST /v1/detect

Part of the HebrewCore documentation. Web: https://hc.itsbaba.com/docs#detect · Whole docs: https://hc.itsbaba.com/docs.md · Index: https://hc.itsbaba.com/llms.txt

`POST /v1/detect`

Detect the dominant language, script and base direction of a string, with a segment per language (no model). Built for short, code-switched input such as chat messages, search queries and voice transcripts: a brand, product name or acronym inside a Hebrew or Russian sentence ("PayPal", "iPhone", "API") does not change the dominant language, and Hebrew prefixes joined by a hyphen ("ה-API") are split correctly. Links and email addresses are ignored. Latin script is tagged `en`.

```http
POST /v1/detect   { "text": "Можно оплатить через PayPal сегодня?" }

{
  "lang": "ru", "script": "Cyrl", "dir": "ltr", "confidence": 0.941,
  "segments": [
    { "text": "Можно оплатить через ", "start": 0, "end": 21, "script": "Cyrl", "lang": "ru" },
    { "text": "PayPal ", "start": 21, "end": 28, "script": "Latn", "lang": "en" },
    { "text": "сегодня?", "start": 28, "end": 36, "script": "Cyrl", "lang": "ru" }
  ],
  "languages": [ { "lang": "ru", "share": 0.941 }, { "lang": "en", "share": 0.059 } ]
}
```
