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 · no credit card · billed on RapidAPI

187
Languages
<1ms
Detection Speed
99.9%
Uptime SLA

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
Documentation

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.dev

Authentication

Authenticate by passing your API key as a query parameter on every request. When calling via RapidAPI, the proxy secret is injected automatically.

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

Request & response

Request
http
GET /language/v1/detect?text=El%20rapido%20zorro%20marron%20salta%20sobre%20el%20perro%20perezoso.&apikey=YOUR_KEY HTTP/1.1
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://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_KEY

POST /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/detect

GET /language/health

Liveness probe that returns a simple OK payload.

/language/health

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. Injected automatically when calling via RapidAPI.
Pricing

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.

No credit card to start · cancel anytime

Basic

Free
1,000 Requests / Month
  • All 187 languages
  • GET & POST detection
  • Ranked alternatives
Get Started Free
Most popular

Pro

$9.99/month
100,000 Requests / Month
  • All 187 languages
  • 100× more requests
  • $0.20 / 1k overage
Subscribe Now

Ultra

$49.99/month
2,000,000 Requests / Month
  • All 187 languages
  • 20× more than Pro plan
  • $0.10 / 1k overage
Subscribe

Need higher volume or a custom SLA?

Talk to us about enterprise rates, dedicated support, and compliance docs.

Contact sales
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`. 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.

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 docs

For teams and enterprise

Custom volumes, SLA guarantees, dedicated support, and compliance documentation.

Talk to sales

or email sales@apicodex.io