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 · no credit card · billed on RapidAPI
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`
Perfect 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
Language Detection API Documentation
Everything you need to integrate — base URL, auth, and copy-paste examples.
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://edge-apis.e9736.workers.devAuthentication
Authenticate by passing your API key as a query parameter on every request. When calling via RapidAPI, the proxy secret is injected automatically.
GET /language/v1/detect?text=Bonjour&apikey=YOUR_KEYRequest & response
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://edge-apis.e9736.workers.dev/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://edge-apis.e9736.workers.dev/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
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. Injected automatically when calling via RapidAPI.
Language Detection API Pricing
Choose the right plan for your language detection needs. Every tier includes all endpoints and all 187 languages — higher tiers simply raise quotas and lower overage rates.
Basic
- All 187 languages
- GET & POST detection
- Ranked alternatives
Pro
- All 187 languages
- 100× more requests
- $0.20 / 1k overage
Ultra
- All 187 languages
- 20× more than Pro plan
- $0.10 / 1k overage
Need higher volume or a custom SLA?
Talk to us about enterprise rates, dedicated support, and compliance docs.
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`. When you call the API through the RapidAPI marketplace, the proxy secret is injected automatically and you authenticate with your standard RapidAPI key headers instead. A missing or invalid key returns a 401 response.
Related APIs & tools
Other services that pair well — all on the same key.
Text Analysis API
Comprehensive NLP with pattern detection, named entity recognition, sentiment analysis, and content moderation.
Learn more→Text Anonymization API
AI-powered PII detection and redaction for GDPR/CCPA compliance across multilingual text.
Learn more→Skill Parser API
Extract and categorize skills from resumes and job descriptions with multi-language support.
Learn more→Every week you build in-house is a week you don't ship product
2,500+ teams already made the switch. Start with a free tier today, or talk to us about your enterprise needs.
For developers
Free tier, no credit card. Integrate your first API in under 30 minutes.
Get API keys freeRead the docsFor teams and enterprise
Custom volumes, SLA guarantees, dedicated support, and compliance documentation.
Talk to salesor email sales@apicodex.io