API Documentation

Note This page is available only in English

Getting an API token

Go to Project Settings > General Settings to get project's API token. Only project creators have access to the API token.

Setting a Webhook

Go to Project Settings > General Settings to set a webhook. Webhook will get a POST request with updates info when translations are updated and language files have to be rebuilt. Webhook should answer with with a 200 http status code.
Check HTTP_X_LOCALIZATION header to validate incoming requests. It will contain a HMAC-sha256 hash, where your project API Token is used as a message and your webhook url address is used as a key.
[{"type":"translation_update","language":"19","date":1723746786,"string_id":"1428","category_id":"182"}]

Making requests

Use this url for making API requests:
Replace {api_token} with API token for your project and {method_name} with one of the following methods found below.
The response contains a JSON object, which always has a Boolean field 'ok' and may have an optional String field 'description' with a human-readable description of the result. If 'ok' equals True, the request was successful and the result of the query can be found in the 'result' field. In case of an unsuccessful request, 'ok' equals false and theerror is explained in the 'description'.

Types

Label

This object represents a label
Field Type Required Description
label_id String Yes md5 string representing an id of a label obtained from getLabels method
label_value Integer or String Yes Value of the label. Can be 0 or 1 for checkbox or String for input and select labels

Methods

Get languages

Use this method to get project languages list
{"ok":"true","result":[{"id":"17","name":"English","localized_name":"English","code":"en","translated_percent":"0","translated_strings":"0","emoji":"🇬🇧"},{"id":"18","name":"Ukrainian","localized_name":"Українська мова","code":"uk","translated_percent":"0","translated_strings":"0","emoji":"🇺🇦"}]}

Get categories

Use this method to get project categories list
{"ok":"true","result":{"3":{"id":"3","parent_id":"2","name":"Header","description":"","strings":"3"},"2":{"id":"2","parent_id":"0","name":"Website","description":"","strings":"3"},"4":{"id":"4","parent_id":"3","name":"Menu","description":"","strings":"3"}}}

Get labels

Use this method to get project labels list
{"ok":"true","result":[{"label_name":"Checkbox Label 1","label_id":"980a32e552108631daaf0ee071d80fbd","type":"checkbox","default_value":1},{"label_name":"Checkbox Label 2","label_id":"548a3a61a58232fb0f34ef438f0035f9","type":"checkbox","default_value":0},{"label_name":"Select Label","label_id":"1915d8178fc1f289ec79f1021ed665b0","type":"select","options":[{"option_name":"Option 1","option_value":"option_1_value"},{"option_name":"Option 2","option_value":"option_2_value"}]},{"label_name":"Input Label","label_id":"3975342df1406e0c53af446255104472","type":"input","default_value":"Input value"}]}

Create a New Category

Use this method to create a new category. Returns a new category id on success
Parameter Type Required Description
name String Yes Name for the category. Must be unique in parent directory
parent_id Integer Optional id of parent category. Pass 0 or ignore to create a new category in the root directory
description String Optional Description for the category
{"ok":true,"result":6}

Create a New String

Use this method to create a new string with a default string translation. Returns a new string id and string key on success
Parameter Type Required Description
string_id Integer Optional id of the string. Must be unique for the project
category_id Integer Yes id of category
string_key String Yes String key (slug). Must be unique for a category
default_translation_language Integer Optional id of default translation language. Can be ignored if copy_translations_from is provided
default_translation_value String Optional Default translation text. Can be ignored if copy_translations_from is provided
copy_translations_from Integer Optional id of another string which translations will be copied to this string
labels String Optional A JSON-serialized list of labels
{"ok":"true","result":{"string_id":80,"string_key":"test-key"}}

Add a translation

Use this method to add a new string translation. Returns a new translation id on success
Parameter Type Required Description
string_id Integer Yes id of the string
translation_language Integer Yes id of the translation language
translation_value String Yes Translation text
approve Boolean Optional Pass 'true' to approve this translation immideatly. If string is already has approved translation for selected language, it will be disapproved
{"ok":true,"result":6}

Get strings Translations

Use this method to get string(s) translations for a selected language
Parameter Type Required Description
translation_language Integer Yes id of the translation language
category_id Integer Optional Pass a category_id to get all translations for strings in selected category
string_id Integer Optional Pass a string_id to get a translation for selected string
format Mixed Optional Pass a format to get a translation in one of the following formats: json (or 0) - Default JSON format, xml-android (or 1) - Android Strings XML, ios-strings (or 2) - iOS (.strings), json-clean (or 3) - React Clean JSON, php-array (or 4) - Laravel (PHP Array), arb (or 5) - Flutter (.arb), csv (or 6) - Excel (.csv), po (or 7) - Gettext (.po), properties (or 8) - Java Properties (.properties)
{"ok":"true","result":[{"string_id":"22","string_key":"test-kry","category_id":"158","translation":"Test","labels":[{"name":"Label Name 1","value":"1"},{"name":"Label Name 2","value":"0"}]}]}