API: Add translations

Last updated: October 05, 2023Author: Jakub Pomykała

In this section, you will learn how to add translations to your project using the API. You can use the API to add translations to your project from your CI/CD pipeline or from your application.

Looking for a previous version of the API? Check out v1.

Create translation key endpoint

POST
https://api.simplelocalize.io
/api/v1/translation-keys

Description

This endpoint allows you to add new translation keys to your project.

Sample request

curl
    --location
    --request POST 'https://api.simplelocalize.io/api/v1/translation-keys' \
    --header 'X-SimpleLocalize-Token: <API_KEY>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
          "key": "HELLO_WORLD"
    }'

Request body fields

  • key - unique translation key for a project,
  • namespace - namespace for a translation key,
  • description - description for a translation key,
  • codeDescription - code description for a translation key.

Code description is a description that is visible in the translation editor but cannot be changed by translators. It is useful when you want to provide additional information about the translation key from the code level.

Add translation endpoint

PATCH
https://api.simplelocalize.io
/api/v2/translations

Description

This endpoint allows you to set or update translations for a given translation key.

Sample request

curl
    --location
    --request PATCH 'https://api.simplelocalize.io/api/v2/translations' \
    --header 'X-SimpleLocalize-Token: <API_KEY>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "key": "HELLO_WORLD",
        "language": "pl_PL",
        "text": "Witaj świecie""
    }'

Request body fields

  • key - translation key,
  • namespace - namespace for a translation key,
  • language - language key,
  • text - translation text,
  • customerId - customer id,
  • reviewStatus - review status, possible values: REVIEWED, NOT_REVIEWED.