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.
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
Get categories
Use this method to get project categories list
Get labels
Use this method to get project labels list
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 |
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 |
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 |
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) |