Query Project Languages
Returns the source language and enabled target languages of the project bound to the current AppKey. It is recommended to call this before Create Translation Task so you can cross-check the user's requested target_languages against what the project actually supports, and avoid 422 rejections.
Endpoint
GET {BASE_URL}/api/open/v1/languagesPOST is also accepted (body should be empty).
Authentication Headers
Identical to the other Open Platform endpoints (see Signing):
| Header | Value |
|---|---|
X-Loxily-AppKey | Project App Key |
X-Loxily-Timestamp | Unix seconds (valid 5 minutes) |
X-Loxily-Sign | MD5(timestamp + "" + appSecret) — GET has no body, so body is signed as the empty string |
Parameters
None. The project is resolved from the X-Loxily-AppKey header.
Response
Success (HTTP 200):
{
"success": true,
"code": 0,
"msg": "ok",
"trace_id": "...",
"data": {
"project_id": "ls-dev-96ai",
"source_language": "zh-hans",
"target_languages": ["en", "ja", "ko", "zh-tw"],
"all_languages": ["zh-hans", "en", "ja", "ko", "zh-tw"]
}
}Field reference
| Field | Type | Description |
|---|---|---|
project_id | string | Echoes the current project ID |
source_language | string | null | Source language code; null when the project has no language tree configured |
target_languages | string[] | Enabled target languages (excluding source), in language-tree pre-order |
all_languages | string[] | Full list (including source), same ordering |
Empty configuration
If the project has never been configured with a language tree in the console, the endpoint still returns HTTP 200 with source_language = null and target_languages = []. Surface this to end users as "please configure languages in the console first".
Error Codes
| code | Description |
|---|---|
| 401 | Signature invalid or timestamp expired |
| 404 | Invalid AppKey |
| 500 | Internal error |
Examples
cURL
APP_KEY="5685414646a54423c891d87194d87f3f"
APP_SECRET="<your App Secret>"
BASE_URL="https://api.loxily.com"
TIMESTAMP=$(date +%s)
SIGN=$(printf '%s' "${TIMESTAMP}${APP_SECRET}" | md5)
curl -s "${BASE_URL}/api/open/v1/languages" \
-H "X-Loxily-AppKey: ${APP_KEY}" \
-H "X-Loxily-Timestamp: ${TIMESTAMP}" \
-H "X-Loxily-Sign: ${SIGN}"Node.js
import crypto from 'crypto';
const timestamp = Math.floor(Date.now() / 1000).toString();
const sign = crypto.createHash('md5')
.update(`${timestamp}${process.env.LOXILY_APP_SECRET}`, 'utf8')
.digest('hex');
const resp = await fetch(`${process.env.LOXILY_BASE_URL}/api/open/v1/languages`, {
headers: {
'X-Loxily-AppKey': process.env.LOXILY_APP_KEY,
'X-Loxily-Timestamp': timestamp,
'X-Loxily-Sign': sign,
},
});
const { data } = await resp.json();
console.log('Source:', data.source_language);
console.log('Targets:', data.target_languages);Integration Tips
Typical flow:
- On process start (or hourly cron), call this endpoint once and cache
target_languages. - When building a Create Translation Task request, cross-check the user's requested target languages against the cached list.
- If a requested language is not in
target_languages, reject it early instead of sending it to/tasks/create.
Global language code reference
Below are the codes Loxily supports globally. All API parameters expecting a language code (e.g. target_languages) must be a value from this table. Which subset is actually usable for a given project is governed by the target_languages returned by this endpoint.
| Code | English | Native | 中文 |
|---|---|---|---|
zh-hans | Chinese (Simplified) | 简体中文 | 简体中文 |
en | English | English | 英语 |
ja | Japanese | 日本語 | 日语 |
ko | Korean | 한국어 | 韩语 |
de | German | Deutsch | 德语 |
fr | French | Français | 法语 |
es | Spanish | Español | 西班牙语 |
es-419 | Spanish (Latin America) | Español (Latinoamérica) | 西班牙语(拉丁美洲) |
zh-tw | Chinese (Traditional) | 繁體中文 | 繁体中文 |
zh-cn | Simplified Chinese | 中文 | 中文(大陆) |
pt | Portuguese | Português | 葡萄牙语 |
pt-pt | Portuguese (Portugal) | Português (Portugal) | 葡萄牙语(葡萄牙) |
pt-br | Portuguese (Brazil) | Português (Brasil) | 葡萄牙语(巴西) |
ru | Russian | Русский | 俄语 |
it | Italian | Italiano | 意大利语 |
ar | Arabic | العربية | 阿拉伯语 |
th | Thai | ไทย | 泰语 |
vi | Vietnamese | Tiếng Việt | 越南语 |
id | Indonesian | Bahasa Indonesia | 印尼语 |
tr | Turkish | Türkçe | 土耳其语 |
pl | Polish | Polski | 波兰语 |
hi | Hindi | हिन्दी | 印地语 |
ms | Malay | Bahasa Melayu | 马来语 |
fa | Persian | فارسی | 波斯语 |
fil | Filipino | Filipino | 菲律宾语 |
ro | Romanian | Română | 罗马尼亚语 |
af | Afrikaans | Afrikaans | 南非荷兰语 |
Conventions
- Case: Codes are lowercase, e.g.
zh-hans,es-419 - Separator: Regional variants use a hyphen
-(not underscore), e.g.pt-brnotpt_br - Variants vs. base:
es(generic Spanish) andes-419(Latin American Spanish) are distinct — translations are not interchangeable. Pick the one matching your audience - Source language: Controlled by project configuration; not accepted as an API parameter
Common Errors
| Symptom | Cause |
|---|---|
422 Unsupported target language: en-US | Codes must be lowercase → use en-us or simply en |
422 Unsupported target language: zh_CN | Use hyphen → zh-cn (but zh-hans is the recommended explicit form) |
422 Unsupported target language: xxx with valid-looking code | The language isn't enabled in the current project's language tree — enable it in the console first, or call this endpoint to confirm what's actually available |