apyhub
ARTIFICIAL INTELLIGENCE · STANDARD DATA

Detect Text Language Probabilities API

What it does

Language Detector identifies the language of a text string and returns the most likely ISO 639-1 code plus a probability breakdown for candidate languages.

Send text in the request body and get back a detected value for the primary language, along with probabilities for the languages the model considered. The input text is limited to 512 characters, so it fits short messages, snippets, comments, or user-generated content.

Use Language Detector when you need to route support tickets, pick a translation workflow, choose the right NLP model, or apply language-specific rules before processing content. Because the response includes per-language probabilities, you can inspect borderline cases instead of relying only on a single label.

The API is a good fit for systems that ingest mixed-language text and need a lightweight classification step before search, moderation, analytics, or translation.

POST
Detect the language of a text with per-language probability breakdown
http://localhost:8080/dosvak/detect-text-language
QUICKSTARTGUIDE

Quickstart

Detect the language of a short text string.

curl -X POST "http://localhost:8080/dosvak/detect-text-language" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text":"Bonjour tout le monde"}'

What you'll get back

Returns a JSON object with two top-level fields: detected is an ISO 639-1 language code, and probabilities is an array of objects with lang and prob values showing the language scores.

{
  "detected": "fr",
  "probabilities": [
    { "lang": "fr", "prob": 0.99 },
    { "lang": "en", "prob": 0.01 }
  ]
}
TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
Input text (truncated to 512 tokens)

About this endpoint

What it does

Detects the language of the input text and returns the most likely language code along with a per-language probability breakdown.

Request Body

ParameterTypeMandatoryDescription
textStringYesInput text. Maximum length: 512 characters.

Response

Returns a JSON object with a detected string field and a probabilities array field. detected is the ISO 639-1 language code for the most likely language, and probabilities contains per-language objects with lang and prob fields.

ParameterTypeMandatoryDescription
detectedStringNoISO 639-1 language code.
probabilitiesObject ArrayNoArray of per-language probability objects.
probabilities[].langStringNoLanguage code for the candidate language.
probabilities[].probNumberNoProbability associated with the candidate language.

Body

Name
Type
Description
bodyREQUIRED
object
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.