Language Detection API

Detect the language of a text among 80+ languages with a confidence score, scripts and candidates, including Vietnamese written without accents.

GETPOSThttps://apibox.io.vn/v1/lang-detect

The language detection API identifies the language of a text using trigram statistics (the franc model, covering the 82 most spoken languages) and returns the ISO 639-1 and 639-3 codes, the language name in English and Vietnamese, a confidence score, whether the result is reliable, the scripts found (Latin, Han, Cyrillic, Thai…) and the next candidates.

Vietnamese gets special rules: text with tone marks is recognised with certainty, and text typed without accents (“xin chao cac ban”), which general detectors confuse with other languages, is detected from frequent Vietnamese syllables and flagged in note. Up to 100 texts can be sent at once with texts.

Very short texts (a few words) are inherently ambiguous: check reliable before acting on the result. Everything runs locally without AI models, so it is fast and free of per-token costs.

Parameters

NameInTypeRequiredDefault
textquery|bodystringyesText (max 100,000 characters; the first 20,000 are analysed).
textsbodyarraynoUp to 100 texts at once.

Example

curl "https://apibox.io.vn/v1/lang-detect?text=Xin chao cac ban, hom nay troi dep qua" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "length": 38,
  "language": "vi",
  "iso639_3": "vie",
  "name": {
    "en": "Vietnamese",
    "vi": "Tiếng Việt"
  },
  "confidence": 1,
  "reliable": true,
  "note": "Vietnamese written without accents (không dấu)",
  "scripts": [
    "Latin"
  ],
  "candidates": [
    {
      "language": "vi",
      "iso639_3": "vie",
      "score": 1
    },
    "…"
  ]
}

Use cases

  • Route support tickets and chats to the right team
  • Pick the right search index or spell checker
  • Tag user-generated content by language
  • Detect unaccented Vietnamese to suggest adding accents

FAQ

How many languages?

About 82 (franc-min), all the major languages of the world and of South-East Asia.

Why is a short text unreliable?

One or two words do not carry enough statistics; reliable is true only from about 5 words with a clear winner.

Can it detect Vietnamese without accents?

Yes, from frequent unaccented syllables (khong, duoc, nguoi…); note says so.

Related APIs

Start with 1,000 free requests every month. Get free API key →