Search by task, endpoint, field, or error.
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 text
Parameters 2
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.
Route a message by language.
Use the returned code to choose a translation or support queue.
Request
curl 'https://api.parseapi.com/language/detect?deep=true' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Parse-Version: 2.0.0' \
-H 'Content-Type: application/json' \
-d '{"text":"明日の午後に新しい請求書を事務所まで送ってください。"}'Example response
{
"language": "ja",
"name": "Japanese",
"name_local": "日本語",
"script": "Jpan",
"direction": "ltr",
"deep": {},
"iso_alpha3": "jpn",
"JP"
]
}Unknown result
For example, send {"text":"12345"}.
{
"language": null,
"name": null,
"name_local": null,
"script": null,
"direction": null,
"deep": {},
"iso_alpha3": null,
"countries": null
}Send Content-Type: application/json, your X-API-Key and Parse-Version: 2.0.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.
Core includes iso_alpha3 and countries on every plan. Country links identify country records that list the detected language. The response uses one pooled request. Adding ?deep=true keeps the same Core answer and returns {"deep":{}}.
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 on API 2.0.0 only.
Detection coverage
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
Lookup
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.
Parameters 3
- 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
- deepboolean · query · optional
Core includes every language fact on every plan. Requesting Deep returns an empty object.
import { parseAPI } from '@parseapi/sdk';
const parse = parseAPI("YOUR_API_KEY");
const result = await parse.language("en", { deep: true });
console.log(result);Run on your server with a secret key. Calling from a browser or app?
{
"language": "en",
"name": "English",
"name_local": null,
"script": "Latn",
"direction": "ltr",
"iso_alpha3": "eng",
"countries": [
"AG",
"AI",
"AS",
"AU",
"BB"
],
"deep": {}
}Response fields
- languagestring
- BCP 47 shortest code. ISO 639-1 when it exists (en), ISO 639-3 otherwise (gsw)
- iso_alpha3string or null
- ISO 639-3 code
- namestring or null
- English name
- name_localstring or null
- The language's own name for itself (日本語 for ja), null when absent or identical to name
- scriptstring or null
- ISO 15924 script code (Latn, Jpan, Arab)
- directionstring
- ltr or rtl
- 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", { deep: true });
console.log(result);Run on your server with a secret key. Calling from a browser or app?
{
"language": "en",
"name": "English",
"name_local": null,
"script": "Latn",
"direction": "ltr",
"iso_alpha3": "eng",
"countries": [
"AG",
"AI",
"AS",
"AU",
"BB"
],
"deep": {}
}Deep
?deep=true Core includes every language fact on every plan. Requesting Deep returns an empty object.
import { parseAPI } from '@parseapi/sdk';
const parse = parseAPI("YOUR_API_KEY");
const result = await parse.language("en", { deep: true });
console.log(result);Run on your server with a secret key. Calling from a browser or app?
{
"language": "en",
"name": "English",
"name_local": null,
"script": "Latn",
"direction": "ltr",
"iso_alpha3": "eng",
"countries": [
"AG",
"AI",
"AS",
"AU",
"BB"
],
"deep": {}
}Deep fields
Display language
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. This option follows the current API contract. Requests selecting frozen 1.0.0 retain that contract. Select API 2.0.0 to use display language.
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 |
Questions? Email