API: Read translations

Last modified: May 06, 2022Author: Jakub Pomykała

This is split into two sections, Translation Hosting (CDN) and API. The CDN offers free, fast and public access to your translations, it can be used in client-side application. API offers filter and query options, and uses your API Key which can be used also for modifying translations, so it should be used only in server-side applications and integrations.

Fetching translations from CDN

Fetching from CDN is available for everyone. It's fast and safe to share the link to the public.

Each request for Translation Hosting resources requires a project token.

GET Get all translations

https://cdn.simplelocalize.io/:projectToken/:environment/_index

Example response

{
  "de": {
    "SALE": "Verkauf",
    "ADDRESS": "Adresse"
  },
  "fr": {
    "SALE": "soldes",
    "ADDRESS": "adresse"
  }
}

GET Get translations by language key

https://cdn.simplelocalize.io/:projectToken/:environment/:languageKey

Example response

{
  "SALE": "Verkauf",
  "ADDRESS": "Adresse"
}

GET Get languages

https://cdn.simplelocalize.io/:projectToken/:environment/_languages

Example response

[
   {
      "key": "de",
      "name": "Deutsch"
   },
   {
      "key": "en",
      "name": "English"
   },
   {
      "key": "es",
      "name": "Español"
   }
]

Link variables:

  • :environment values: _latest or _production, 'Hosting' tab
  • :projectToken value is the project token, 'Integrations > Project credentials' tab
  • :languageKey value is the language key set in 'Languages' tab

Fetching translations from API

If you are using this endpoint, the authorization is required. Add API Key for your project as a X-SimpleLocalize-Token request header.

GET Query all translations

https://api.simplelocalize.io/api/v1/translations

Available query parameters

Query parameter Description
text query for translated text, uses 'contains with ignore case'
key filter by given translation key, uses 'equals'
language filter by given language key, uses 'equals'
customerId filter by given customer id, uses 'equals'; see customer-specific translations

GET Query translations with language 'de' and translation key 'hello'

https://api.simplelocalize.io/api/v1/translations?languageKey=de&key=hello

Example response

{
    "msg": "OK",
    "status": 200,
    "data": {
        "content": [
            {
                "key": "CREATE.TAGS",
                "language": "en",
                "text": "Tags"
            },
            //...
        ]
    }
}