Translations
The Translations endpoint is the read-only OpenAPI equivalent of Admin / Translations. It returns the interface texts for one language: the English source text, the page where it is shown, the stored translation and the text users actually see. Each row has a stable ID and a content version, so an integration can detect added, changed and removed texts.
Endpoint and authentication
GET https://pbx.example.com/pbx/openapi.php/translations?language=it-IT
GET https://pbx.example.com/pbx/openapi.php/translations/languages
The query-style equivalents are GET openapi.php?object=translations&language=it-IT and GET openapi.php?object=translations&action=languages. Only GET is supported.
Translations are shared by all tenants, so a full or read-only global API key is required, sent using X-API-Key, Authorization: Bearer, or the key query parameter. Tenant API keys return HTTP 403 and the endpoints are not listed in the tenant specification. The existing API key IP restrictions apply. Reads never change the translation tables.
| Parameter | Meaning |
|---|---|
language | Required for /translations. Language and sublanguage, for example it-IT or he_IL. Use the values returned by /translations/languages; codes containing a dash, such as zh-Hant-TW, are resolved using the configured languages. |
file | Optional. Exact, case-sensitive page name, for example extension.php. An empty value selects the global texts, which are shared by all pages. |
limit | Page size, 1–5000, default 1000. |
cursor | The next_cursor value of the previous page. Omit it to start from the beginning. |
Examples
curl -H "X-API-Key: GLOBAL_READONLY_API_KEY" \
"https://pbx.example.com/pbx/openapi.php/translations/languages"
curl -H "X-API-Key: GLOBAL_READONLY_API_KEY" \
"https://pbx.example.com/pbx/openapi.php/translations?language=it-IT&file=extension.php"
curl -H "X-API-Key: GLOBAL_READONLY_API_KEY" \
"https://pbx.example.com/pbx/openapi.php/translations?language=it-IT&limit=5000&cursor=NEXT_CURSOR"
Response
{
"object": "translations",
"language": "it-IT",
"translations_enabled": true,
"data": [
{
"id": "12e4671110640219437354c03a40ca32",
"file": "extension.php",
"text": "Save",
"language": "it-IT",
"translation": "",
"effective_translation": "Salva",
"version": "94c77638aa4c302e2cb6723f621b5fd7f2de544c"
}
],
"limit": 1000,
"has_more": true,
"next_cursor": "1137920"
}
| Field | Meaning |
|---|---|
id | Stable key of the page and English text. It changes only if the English text or the page changes. |
file, text | Page where the text is shown, and the English source text. An empty file is a global text. |
translation | Value stored for this page and language, as shown on the Translations page. Empty when missing. |
effective_translation | Text users see. When the page has no translation, the PBX uses the global translation, then the first translation of the same text on another page, then the English text. Values are returned unescaped. |
version | Hash of file, text, language, translation and effective translation. It changes whenever any of them changes. |
translations_enabled | False when the global Use translations setting is off. Users then see the English texts, and effective_translation equals text. |
/translations/languages returns language, code, sublanguage, name and enabled (offered in the language selector) for each configured language.
Detecting changes
The translation tables have no update timestamp. To find changes, read every page, following next_cursor until has_more is false, and compare the result with the previous run: a new id is a new text, a different version is a changed text or translation, and a missing id is a removed text. A page can contain fewer rows than limit, or none, while has_more is true. Each page is read from a consistent snapshot.
The PBX records a text the first time a page displays it. The list therefore contains the texts already shown at least once on the system; texts of pages never opened appear after their first use. Clean not translated texts removes texts without a translation in any language, so they disappear until they are displayed again.
Errors
A missing or invalid language returns HTTP 400 invalid_language; invalid file, limit or cursor values return 400. Invalid API keys return 401; tenant keys and denied IP addresses return 403; unknown paths or actions return 404; unsupported HTTP methods return 405. Database read failures return 500.
No comments to display
No comments to display