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 all 49 APIs.
- Languages
- 187
- Detection Speed
- <1ms
- Uptime SLA
- 99.9%
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
Try it
Build the request for your data
Edit the parameters below and see the exact curl command and JSON response you will get. No key required to preview.
Parameters
GET /language/v1/detect?text=El+rapido+zorro+marron+salta+sobre+el+perro+perezoso.&apikey=YOUR_KEY HTTP/1.1
Host: api.apicodex.io
{
"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
https://api.apicodex.ioAuthentication
Authenticate by passing your API key as a query parameter on every request, or by sending it in an X-Api-Key header.
GET /language/v1/detect?text=Bonjour&apikey=YOUR_KEYRequest and response
Illustrative values. Confirm current endpoint behavior, quotas, and data freshness in the API documentation before production use.
GET /language/v1/detect?text=El%20rapido%20zorro%20marron%20salta%20sobre%20el%20perro%20perezoso.&apikey=YOUR_KEY HTTP/1.1{
"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 --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 /language/v1/detect
Detect the language of the `text` query parameter. Returns the top language, a reliability flag, and ranked alternatives.
/language/v1/detect?text=Bonjour le monde&apikey=YOUR_KEYPOST /language/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`.
/language/v1/detectGET /language/health
Liveness probe that returns a simple OK payload.
/language/healthRequest Parameters
Required parameters
textThe input string to analyze. Required for both GET (query) and POST (body).
Optional parameters
min_lengthfranc minLength threshold. Default 10, clamped to 1..1000. Text shorter than this is reported as `und` and not reliable.onlyPOST only. An array of ISO 639-3 codes restricting the candidate languages, e.g. ["fra","eng","deu"].apikeyYour API key, passed as a query parameter. An X-Api-Key header works too.
Pricing
Language Detection API Pricing
One key, one subscription, all 49 APIs. Start free and upgrade when you grow. No minimums, no lock-in.
This API costs 1 credit per request. Credits are shared across every API on your plan.
Estimate your monthly cost
Drag the slider to match your expected request volume. We will recommend the cheapest plan that covers it.
Recommended plan
Starter
$29.99 /month
Free
- All 49 APIs included
- No credit card required
- Full documentation and examples
Starter
Popular- All 49 APIs included
- Email support
- Usage dashboard and analytics
Pro
- All 49 APIs included
- Priority support
- Up to 5 API keys
Need a different plan?
Tell us about your API, volume, or support requirements.
Coming soon · MCP
Use the Language Detection API from your AI agent
The API Codex MCP server will expose this API, and the other 39, to Claude, Cursor and any MCP client as tools. Same key, same credits, one config entry.
FAQ
Frequently asked questions
The Language Detection API covers 187 languages, identified by their standard ISO 639-3 codes. Every pricing tier includes all 187 languages — higher tiers only raise your monthly request quota and lower overage rates, they never restrict which languages you can detect.
When the input text is too short, too ambiguous, or mixes multiple languages, there isn't enough signal for a confident answer. Instead of guessing or throwing an error, the API returns the language code `und` (undetermined) and sets `reliable` to false. This is intentional so your pipeline always receives a well-formed JSON response it can branch on. Send longer or more representative text, lower the `min_length` threshold, or use the `only` constraint to improve results.
Use the GET endpoint for quick lookups and short strings that fit in a query string. Use the POST endpoint for long or multiline text, content with characters that are awkward to URL-encode, and any request where you want to constrain candidate languages with the `only` array. Both endpoints share identical detection logic and return the same response shape.
`min_length` maps to franc's minimum-length threshold. It defaults to 10 and is clamped between 1 and 1000. Text shorter than this threshold is reported as `und` with `reliable: false`. Lower it to attempt detection on very short snippets (accepting more undetermined results), or raise it if you only want confident answers from longer text.
The `only` parameter (available on the POST endpoint) accepts an array of ISO 639-3 codes that restricts detection to those candidate languages. If you already know your text belongs to a small known set — for example English, French, and German — constraining the candidates dramatically improves accuracy on short text because the detector no longer has to distinguish your languages from the other 184.
Detection runs entirely on Cloudflare's global edge network using lightweight trigram analysis with no model downloads and no cold starts. Detection itself completes in well under a millisecond, and because it executes close to your users at 300+ edge locations worldwide, end-to-end latency stays low everywhere. This makes the API suitable for real-time, high-volume pipelines.
Pass your API key as a query parameter: `?apikey=YOUR_KEY`. You can also send it in an X-Api-Key header. A missing or invalid key returns a 401 response.
Keep building
Related APIs
Comprehensive NLP with pattern detection, named entity recognition, sentiment analysis, and content moderation.
AI-powered PII detection and redaction for GDPR/CCPA compliance across multilingual text.
Extract and categorize skills from resumes and job descriptions with multi-language support.