apyhub
Back
▣ ARTIFICIAL INTELLIGENCE · STANDARD DATA

Language Detection API

Hosted on ApyHub

What it does

The Language Detection API automatically identifies the language of a piece of text. Send any text of at least 50 characters and get back the language name, its ISO codes, its writing script and how confident the detection is, so you know what language you are dealing with before you translate, route or moderate it.

It is one POST endpoint with a single text field. The response comes back in a data object with five fields: language with the name, such as English, iso_code with the two-letter ISO 639-1 code, such as en, code with the three-letter ISO 639-3 code, such as eng, script with the writing system, such as Latin, and confidence as a score between 0 and 1. Use the ISO codes to pass the result straight into translation, search or localization tools, and use the confidence score to send uncertain results for review instead of acting on them.

The 50-character minimum is there for accuracy: a single word like "gift" means different things in English and German, while a full sentence gives the detector enough context to be sure. Common uses include routing support tickets to the right team, choosing the translation pipeline for incoming text, tagging user reviews and posts by language, applying language-specific search and moderation rules, and checking that content is in the language it claims to be.

To see every possible language with its probability instead of one answer, use the Detect Text Language Probabilities API. To detect the language spoken in a video, use the AI Video Language Detection API. Once you know the language, translate the text with the Translate Text API or screen it for offensive words with the CheckText Profanity API.

You can try it right here in the playground. Start for free with 5 API calls a day, no card required, and find out what language your own text is in before you commit.

The API is also available through ApyHub MCP, so AI agents can check the language of incoming text directly before deciding how to handle it.

POST
Detect language from text
https://api.eu.apyhub.com/apyhub/detect-language

QUICKSTART

GUIDE

Quickstart

Detect the language of a text sample by sending the text in the request body.

curl -X POST "https://api.eu.apyhub.com/apyhub/detect-language" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text":"This word checker is free and easy to use, and you can choose which language to base this word checker on for better results in your application."}'

What you'll get back

Returns a JSON object with a data object containing language, code, iso_code, script, and confidence.

{
  "data": {
    "language": "English",
    "code": "eng",
    "iso_code": "en",
    "script": "Latin",
    "confidence": 0.9821
  }
}
TRY ITLIVE · 50 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*
Text sample for language detection (minimum 50 characters).

About this endpoint

What it does

Detects the language of the text you send in the request body. It returns a JSON object containing the detected language details inside a data object.

Request Body

ParameterTypeMandatoryDescription
textStringYesText sample for language detection (minimum 50 characters).

Response

Returns a JSON object with a data object field. The data object contains the detected language details: language (String), code (String), iso_code (String), script (String), and confidence (Number). This endpoint returns the detection result in the data object on success.

ParameterTypeMandatoryDescription
dataObjectYesDetected language details.
data.languageStringYesDetected language name.
data.codeStringYesISO 639-3 code.
data.iso_codeStringYesISO 639-1 code.
data.scriptStringYesWriting script used by the detected language.
data.confidenceNumberYesConfidence score as a float.
▣ 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.