Language API
Detect text in 32 languages, or look up an ISO language code.
Detect the language of a message or paragraph, then use its code in your application. Text detection and language-code lookups are available on every plan. Each successful request, including an unidentified result, uses one pooled request.
Detect textCopy link
POST /language/detectAPI Explorer ↗Language names, script and direction from a JSON text body
Parameters
- prettyboolean · query · optional
Indent the JSON response.
JSON body required
Send Content-Type: application/json.
textstring · requiredAt most 20,000 UTF-16 code units before normalization, and 10,000 code points after normalization. Send one language per request.
Length: 0 to 20000 characters
Use only the fields listed for this format. Put these inputs in the body.
curl -X POST 'https://api.parseapi.com/language/detect' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'X-API-Version: 2.2.0' \
-H 'Content-Type: application/json' \
-d '{"text":"明日の午後に新しい請求書を事務所まで送ってください。"}'{
"language": "ja",
"name": "Japanese",
"name_local": "日本語",
"script": "Jpan",
"direction": "ltr",
"iso_alpha3": "jpn",
"countries": [
"JP"
]
}Send Content-Type: application/json, your X-API-Key and X-API-Version: 2.2.0. The body is an object containing only the required text string. Keep the text in the request body. Detection returns language, English name, name_local, script and direction, using the same reference details as language-code lookup. Script and direction describe the detected language's conventions.
Every plan includes iso_alpha3 and countries. Country links identify country records that list the detected language. The response uses one pooled request. Language has no additional profile fields.
An unidentified, unsupported or ambiguous input can return HTTP 200 with the language fields set to null, including iso_alpha3 and countries. Empty text and text with only numbers return this same result. Send one language per request. Short or mixed-language text can be ambiguous.
Input accepts at most 20,000 UTF-16 code units before normalization and 10,000 code points after Unicode normalization, lowercasing and whitespace cleanup. The complete JSON body must be at most 131,072 bytes. Over-limit text returns 400, an over-limit body returns 413, and malformed JSON or a missing or non-string text returns 400.
A busy detector returns 503 with Retry-After. Honor Retry-After on 429 and 503 responses. An HTTP 200 null result is a completed detection. This operation is available in API 2.2.0.
Detection coverageCopy link
Detection returns these 32 language codes. Chinese uses zh and Norwegian Bokmål uses nb. Reference lookup coverage is separate.
- Arabic
- ar
- Catalan
- ca
- Chinese
- zh
- Croatian
- hr
- Czech
- cs
- Danish
- da
- Dutch
- nl
- English
- en
- Finnish
- fi
- French
- fr
- German
- de
- Greek
- el
- Hebrew
- he
- Hindi
- hi
- Hungarian
- hu
- Indonesian
- id
- Italian
- it
- Japanese
- ja
- Korean
- ko
- Malay
- ms
- Norwegian Bokmål
- nb
- Polish
- pl
- Portuguese
- pt
- Romanian
- ro
- Russian
- ru
- Slovak
- sk
- Spanish
- es
- Swedish
- sv
- Thai
- th
- Turkish
- tr
- Ukrainian
- uk
- Vietnamese
- vi
LookupCopy link
Pass en, ja, or gsw. The English name, the language's own name for itself, the script it writes in, and whether it reads left-to-right or right-to-left. Both code lengths work: /language/en and /language/eng return the same thing.
/country already returns languages as these codes. Come here for the full record.
GET /language/{code}API Explorer ↗By ISO 639 code. Name, native name, script and direction
Parameters
- codestring · path · required
ISO 639 language code, 2 or 3 letters
- langstring · query · optional
Display language as one BCP 47 tag, such as fr or zh-Hant. Changes supported display labels only; IDs, codes, native names, facts, parsing and deep access stay unchanged. Omit for the original response. Unsupported regions use the supported language base; unsupported languages or scripts use English. Missing labels retain their source value. Accept-Language is not read automatically. Available on the current API contract; frozen 1.0.0 is unchanged.
Length: 2 to 64 characters
import { parseAPI } from '@parseapi/sdk';
const parse = parseAPI("YOUR_API_KEY");
const result = await parse.language("en");
console.log(result);{
"language": "en",
"iso_alpha3": "eng",
"name": "English",
"name_local": null,
"script": "Latn",
"direction": "ltr",
"countries": [
"AG",
"AI",
"AS",
"AU",
"BB"
]
}Response fields
- languageLink to languagestring
- BCP 47 shortest code. ISO 639-1 when it exists (en), ISO 639-3 otherwise (gsw)
- iso_alpha3Link to iso_alpha3string or null
- ISO 639-3 code
- nameLink to namestring or null
- English name
- name_localLink to name_localstring or null
- The language's own name for itself (日本語 for ja), null when absent or identical to name
- scriptLink to scriptstring or null
- ISO 15924 script code (Latn, Jpan, Arab)
- directionLink to directionstring
- ltr or rtl
- countriesLink to countriesarray or null
- ISO2 countries listing this language
/language/eng resolves to the same en row.
import { parseAPI } from '@parseapi/sdk';
const parse = parseAPI("YOUR_API_KEY");
const result = await parse.language("eng");
console.log(result);{
"language": "en",
"iso_alpha3": "eng",
"name": "English",
"name_local": null,
"script": "Latn",
"direction": "ltr",
"countries": [
"AG",
"AI",
"AS",
"AU",
"BB"
]
}Display languageCopy link
Pass lang with a language tag such as fr, pt-BR, or zh-Hant. Language name. Each choice covers 194–206 of the 225 current language records.
Omitting lang preserves the original response. Codes, IDs, numeric facts and native-name fields stay unchanged. Missing translations keep their existing source value; unknown values stay null. A preserved name_local may equal the translated name.
Send a chosen browser preference explicitly, for example { lang: navigator.language } in your JavaScript SDK options. The API does not read Accept-Language automatically. Unsupported regions fall back to their supported base language; unsupported languages or scripts use English. Empty, invalid or repeated tags return 400.
Content-Language identifies languages used in translated display fields and known English fallbacks. Display language is available on API 2.1.0; requests selecting frozen 1.0.0 retain their original contract. See API versions.
33 display language choices
| Language tag | Language |
|---|---|
| en | English |
| ar | العربية |
| ca | català |
| hr | hrvatski |
| cs | čeština |
| da | dansk |
| nl | Nederlands |
| fi | suomi |
| fr | français |
| de | Deutsch |
| el | Ελληνικά |
| he | עברית |
| hi | हिन्दी |
| hu | magyar |
| id | Indonesia |
| it | italiano |
| ja | 日本語 |
| ko | 한국어 |
| ms | Melayu |
| nb | norsk bokmål |
| pl | polski |
| pt | português |
| ro | română |
| ru | русский |
| zh-Hans | 简体中文 |
| sk | slovenčina |
| es | español |
| sv | svenska |
| th | ไทย |
| zh-Hant | 繁體中文 |
| tr | Türkçe |
| uk | українська |
| vi | Tiếng Việt |