Skip to content

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/languages

POST is also accepted (body should be empty).

Authentication Headers ​

Identical to the other Open Platform endpoints (see Signing):

HeaderValue
X-Loxily-AppKeyProject App Key
X-Loxily-TimestampUnix seconds (valid 5 minutes)
X-Loxily-SignMD5(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):

json
{
  "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 ​

FieldTypeDescription
project_idstringEchoes the current project ID
source_languagestring | nullSource language code; null when the project has no language tree configured
target_languagesstring[]Enabled target languages (excluding source), in language-tree pre-order
all_languagesstring[]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 ​

codeDescription
401Signature invalid or timestamp expired
404Invalid AppKey
500Internal error

Examples ​

cURL ​

bash
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 ​

javascript
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:

  1. On process start (or hourly cron), call this endpoint once and cache target_languages.
  2. When building a Create Translation Task request, cross-check the user's requested target languages against the cached list.
  3. 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.

CodeEnglishNative中文
zh-hansChinese (Simplified)简体中文简体中文
enEnglishEnglish英语
jaJapanese日本語日语
koKorean한국어韩语
deGermanDeutsch德语
frFrenchFrançais法语
esSpanishEspañol西班牙语
es-419Spanish (Latin America)Español (Latinoamérica)西班牙语(拉丁美洲)
zh-twChinese (Traditional)繁體中文繁体中文
zh-cnSimplified Chinese中文中文(大陆)
ptPortuguesePortuguês葡萄牙语
pt-ptPortuguese (Portugal)Português (Portugal)葡萄牙语(葡萄牙)
pt-brPortuguese (Brazil)Português (Brasil)葡萄牙语(巴西)
ruRussianРусский俄语
itItalianItaliano意大利语
arArabicالعربية阿拉伯语
thThaiไทย泰语
viVietnameseTiếng Việt越南语
idIndonesianBahasa Indonesia印尼语
trTurkishTürkçe土耳其语
plPolishPolski波兰语
hiHindiहिन्दी印地语
msMalayBahasa Melayu马来语
faPersianفارسی波斯语
filFilipinoFilipino菲律宾语
roRomanianRomână罗马尼亚语
afAfrikaansAfrikaans南非荷兰语

Conventions ​

  • Case: Codes are lowercase, e.g. zh-hans, es-419
  • Separator: Regional variants use a hyphen - (not underscore), e.g. pt-br not pt_br
  • Variants vs. base: es (generic Spanish) and es-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 ​

SymptomCause
422 Unsupported target language: en-USCodes must be lowercase → use en-us or simply en
422 Unsupported target language: zh_CNUse hyphen → zh-cn (but zh-hans is the recommended explicit form)
422 Unsupported target language: xxx with valid-looking codeThe 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