New The MCP server is live: all 45 APIs in Claude, Cursor or any MCP client. Connect your agent

Know what language any text is in — 187 languages, one fast call

Language Detection API

The Language Detection API identifies the language of any text snippet using proven trigram analysis, covering 187 languages by their standard ISO 639-3 codes. Send a sentence, a paragraph, or a full document and get back the most likely language, a human-readable name, a reliability flag, and a ranked list of close alternatives.

Detection runs entirely on Cloudflare's global edge network, so latency is tiny no matter where your users are. The API is forgiving by design — short, mixed, or ambiguous input is reported as `und` (undetermined) with `reliable: false` instead of throwing errors, so your pipeline never breaks.

Free tier included, no credit card required. One key works across every API.

At a glance

Language Detection API

1 credit / call
Free calls / month
1,000
Languages
187
Detection Speed
<1ms
Uptime SLA
99.9%
Get your free API key

1,000 free calls on the free plan

Key features

  • Detects 187 languages by ISO 639-3 code
  • Trigram-based detection powered by franc
  • Human-readable language names in the response
  • Reliability flag for confident vs. ambiguous results
  • Up to 5 ranked alternative candidates with scores
  • GET for quick queries and POST for long or multiline text
  • Constrain candidates with the `only` parameter and tune with `min_length`

Built for

  • Route support tickets to the right language team
  • Pick the correct translation engine automatically
  • Filter and tag user-generated content
  • Localize emails and notifications
  • Enrich and label text datasets
  • Detect language before running NLP pipelines
  • Moderate multilingual community content
  • Improve search relevance with per-language indexing

MCP · for your agent

Hand the Language Detection API to your agent

Connect Claude, Cursor or any MCP client once, then ask in plain words. Your agent finds this API, reads its docs and makes the call: 1 credit per call, the same as REST, from your team's balance.

Route tickets by language

“Tag each of this morning's 60 support tickets with its language so they land in the right regional queue.”

list_apis · get_api_docsfree

api_request POST /language/v1/detect 1 cr

A language code, name and reliability flag per ticket, grouped into regional queues.

Identify and translate a review

“Which language is this review in: 'Werkt prima, maar de app crasht soms bij het opstarten'? Then translate it.”

list_apis · get_api_docsfree

api_request GET /language/v1/detect?text=Werkt+prima,+maar+de+app+crasht+soms+bij+het+opstarten 1 cr

Dutch, with a reliability flag and close alternatives, followed by an English translation.

Sort survey answers for translators

“Our survey answers are in French, German or English. Label each one so the right translator gets it.”

list_apis · get_api_docsfree

api_request POST /language/v1/detect 1 cr

Each answer labeled French, German or English, with short, unreliable ones set aside.

$ claude mcp add --transport http apicodex https://mcp.apicodex.io

Illustrative asks; the calls and prices are real. Claude, Cursor, VS Code and Windsurf setup: mcp.apicodex.io

Try it

Build the request for your data

Edit the parameters below and see the exact request and curl command you'd send. No key required to preview.

GET /language/v1/detect
Open in Playground

Parameters

Request · HTTP
GET /language/v1/detect?text=El%20rapido%20zorro%20marron%20salta%20sobre%20el%20perro%20perezoso.&apikey=YOUR_KEY HTTP/1.1
Host: api.apicodex.io
Response · JSON 200 OK
{
"text_length": 52,
"language": "spa",
"language_name": "Spanish",
"reliable": true,
"alternatives": [
  { "code": "spa", "name": "Spanish", "score": 1 },
  { "code": "por", "name": "Portuguese", "score": 0.913 },
  { "code": "glg", "name": "glg", "score": 0.871 },
  { "code": "ita", "name": "Italian", "score": 0.842 },
  { "code": "cat", "name": "Catalan", "score": 0.808 }
]
}

Documentation

Language Detection API Documentation

The Language Detection API detects the language of arbitrary text across 187 languages using trigram-based detection (franc). It returns the top ISO 639-3 language code, a human-readable name, a reliability flag, and ranked alternatives. Use GET for quick query-string detection or POST for long, multiline text and to constrain candidates with the `only` parameter.

Base URL

url
https://api.apicodex.io/language

Authentication

Authenticate by passing your API key as a query parameter on every request, or by sending it in an X-Api-Key header.

headers
GET /language/v1/detect?text=Bonjour&apikey=YOUR_KEY

Request and response

Illustrative values. Confirm current endpoint behavior, quotas, and data freshness in the API documentation before production use.

request · http
GET /language/v1/detect?text=El%20rapido%20zorro%20marron%20salta%20sobre%20el%20perro%20perezoso.&apikey=YOUR_KEY HTTP/1.1
Host: api.apicodex.io
response · json
{
"text_length": 52,
"language": "spa",
"language_name": "Spanish",
"reliable": true,
"alternatives": [
  { "code": "spa", "name": "Spanish", "score": 1 },
  { "code": "por", "name": "Portuguese", "score": 0.913 },
  { "code": "glg", "name": "glg", "score": 0.871 },
  { "code": "ita", "name": "Italian", "score": 0.842 },
  { "code": "cat", "name": "Catalan", "score": 0.808 }
]
}

Code examples

cURL
curl --request GET \
  --url 'https://api.apicodex.io/language/v1/detect?text=El%20rapido%20zorro%20marron%20salta%20sobre%20el%20perro%20perezoso.&apikey=YOUR_KEY'

# POST with constrained candidates
curl --request POST \
  --url 'https://api.apicodex.io/language/v1/detect?apikey=YOUR_KEY' \
  --header 'Content-Type: application/json' \
  --data '{ "text": "Le renard brun rapide saute par-dessus le chien paresseux.", "only": ["fra","eng","deu"] }'

API Endpoints

GET /v1/detect

Detect the language of the `text` query parameter. Returns the top language, a reliability flag, and ranked alternatives.

/v1/detect?text=Bonjour le monde&apikey=YOUR_KEY

POST /v1/detect

Same detection logic as GET but accepts a JSON body — ideal for long or multiline text and for constraining candidate languages with `only`.

/v1/detect

Request Parameters

Required parameters

  • text The input string to analyze. Required for both GET (query) and POST (body).

Optional parameters

  • min_length franc minLength threshold. Default 10, clamped to 1..1000. Text shorter than this is reported as `und` and not reliable.
  • only POST only. An array of ISO 639-3 codes restricting the candidate languages, e.g. ["fra","eng","deu"].
  • apikey Your API key, passed as a query parameter. An X-Api-Key header works too.

Pricing

Language Detection API Pricing

This API costs 1 credit per request. Credits are shared across every API on your plan.

Cost estimator

requests per month → cheapest plan that covers it

Estimate your monthly cost

Drag the slider to match your expected request volume. We'll recommend the cheapest plan that covers it.

10,000

Recommended plan

Starter

$29.99 /month

Credits used
Credits included
Cost per 1K requests
Choose Starter

Free

Free
1,000 credits · ~1,000 requests/mo · 2 rps
  • All APIs included
  • No credit card required
  • Full documentation and examples
  • MCP server for your AI agents
  • Up to 5 active API keys
Start for free

Starter

Popular
$29.99 /month
50,000 credits · ~50,000 requests/mo · 10 rps
  • All APIs included
  • Email support
  • Usage dashboard and analytics
  • MCP server for your AI agents
  • Up to 5 active API keys
Start with Starter

Pro

$99.99 /month
250,000 credits · ~250,000 requests/mo · 25 rps
  • All APIs included
  • Priority support
  • MCP server for your AI agents
  • Up to 5 active API keys
Start with Pro

Need a different plan?

Tell us about your API, volume, or support requirements.

Contact us

FAQ

Frequently asked questions

Ready to integrate Language Detection?