Skip to content

Languages ​

Languages a project can use. Ten ship with Layota (en, de, fr, es, it, nl, da, pt, ar, zh) with default UI translations; an organisation can add custom languages for codes we do not ship. Shipped languages are read-only; custom ones belong to the organisation that created them and are visible only to it.

List languages ​

http
GET /api/languages/
Authorization: Bearer <token or sk_… write key>

Returns the shipped languages plus the caller's organisation's custom ones. With a JWT or a write API key; a read key gets 403 (a published map already carries its own languages in the public API).

json
[
  { "id": 1, "code": "en", "name": "English", "native_name": "English", "direction": "ltr", "is_custom": false, "organization": null,
    "default_translations": { "search.placeholder": "Search...", "...": "..." } },
  { "id": 42, "code": "eu", "name": "Basque", "native_name": "Euskara", "direction": "ltr", "is_custom": true, "organization": "9f1c…",
    "default_translations": { "search.placeholder": "Buscar...", "...": "..." } }
]

direction is the reading direction of the map in that language — ltr or rtl. Shipped languages are fixed by their code (ar is rtl); a custom language is set when it is created and can be changed later. In an rtl language the viewer mirrors its interface, never the plan — see Right-to-left languages.

Create a custom language ​

With a JWT or a write API key (a read key gets 403). Members and up; Pro and Enterprise plans. A key acts for its own organisation, so a script that fills a project over the API can add the language first — see Filling a project over the API.

http
POST /api/languages/
Authorization: Bearer <token or sk_… write key>
Content-Type: application/json

{ "code": "eu", "name": "Basque", "native_name": "Euskara", "copy_from": "es" }
Field
codeBCP-47, lower-case language subtag, optional region: eu, cy, pt-BR. At most 10 characters (sr-Latn-RS fits, es-Latn-419 does not). Must not be a shipped code or an existing custom code of your organisation. Fixed after creation — projects, embeds (?lang=) and the SDK (setLanguage()) key on it.
nameName as shown in the editor.
native_nameName in the language itself, shown to visitors.
copy_fromCode of a language whose default UI translations are copied as the starting point (default en). Translate them per project afterwards.
directionltr or rtl. Optional: left out, it follows the code — rtl for fa, he, ur, ps, ckb (region variants included), ltr otherwise.

Responds 201 with the language object. Validation errors come back as 400 with the field name; a viewer role or a plan without the languages feature gets 403.

Rename, change the direction, delete ​

http
PATCH  /api/languages/{id}/      { "name": "Basque (EU)", "native_name": "Euskara" }
PATCH  /api/languages/{id}/      { "direction": "rtl" }
DELETE /api/languages/{id}/

Only your organisation's custom languages, with a JWT or a write key. A changed direction reaches the published maps that use the language at once. DELETE answers 400 while any project still uses the language — remove it from the project first.

Creating, renaming and deleting a custom language is recorded in the organisation's audit log (Dashboard → Audit Log, entity Language); a change made with an API key shows as made by the organisation's owner.

Using a language in a project ​

Add it to languages_data on a project PATCH like any shipped code; see Projects. Project and public payloads list each language with languageCode, languageName, nativeName, isCustom, direction and linkCode, and translations[code] carries the merged UI strings (your overrides on top of the copied defaults).

Filling a project over the API ​

The same write key creates the language and then adds it to the project:

http
POST /api/languages/
Authorization: Bearer sk_…
Content-Type: application/json

{ "code": "eu", "name": "Basque", "native_name": "Euskara", "copy_from": "es" }
http
PATCH /api/projects/{id}/
Authorization: Bearer sk_…
Content-Type: application/json

{ "languages_data": [
    { "languageCode": "es", "customTranslations": {} },
    { "languageCode": "eu", "customTranslations": { "search.placeholder": "Bilatu..." } }
] }

languages_data replaces the project's language list: a language left out is removed (the default language always stays).

linkCode (optional, per language): what {lang} in a card button's URL becomes for that language — for a booking system that names it differently, e.g. { "languageCode": "de", "linkCode": "ger" }. Up to 20 letters, digits, - or _; "" puts the language back on its own code; a payload without the key keeps the stored value. See A button link per language.

Layota Documentation