---
title: "Hebrew Language Detection API for Code-Switched Text"
slug: "hebrew-language-detection-api"
canonical: "https://www.itsbaba.com/hebrew-language-detection-api"
question: "Is there a language detection API that handles Hebrew mixed with English?"
answer: "Yes. baba HebrewCore, the Hebrew API from baba, detects the language of short code-switched text with POST /v1/detect: it returns the dominant language, script, direction and confidence, plus a segment for each language with offsets, and a brand like PayPal or a prefix like ה-API inside a Hebrew sentence does not flip the result. It runs with no model and is not counted against the quota."
description: "Detect Hebrew in mixed Hebrew-English chat, search and voice input: baba HebrewCore /v1/detect returns the dominant language, script and per-language segments."
cluster: "developers"
html_status: "live"
updated: "2026-09-27"
numbers_used: "[]"
competitors_named: "[]"
---

# Hebrew language detection API for code-switched text

baba HebrewCore, the Hebrew API from baba and the engine the baba Hebrew translator app runs on, detects the language of short code-switched text with POST /v1/detect. It returns the dominant language, script, direction and confidence, a segment per language with offsets, and each language's share. 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`.

It is built for chat messages, search queries and voice transcripts, runs with no language model, and is not counted against the character quota on any plan.

## Code

```bash
curl https://hc.itsbaba.com/v1/detect \
  -H "Authorization: Bearer hc_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "text": "Можно оплатить через PayPal сегодня?" }'
```

```json
{
  "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 } ]
}
```

## Routing by language

Read `lang` and `confidence`, then reply in Hebrew or send the text to `/v1/translate` with `source_lang` set. The `segments` array lets you keep an English product name untouched while translating the Hebrew around it. `detect_language` is also a tool on the HebrewCore MCP server.

Related: https://www.itsbaba.com/hebrewcore , https://www.itsbaba.com/hebrew-rtl-api , https://www.itsbaba.com/best-hebrew-api
