API: Language API

Last modified: March 04, 2022Author: Jakub Pomykała

In this section, you will learn how to create, query, update and delete languages.

All endpoints here require authorization.

POST Create language

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

Example cURL

curl 
    --location 
    --request POST 'https://api.simplelocalize.io/api/v1/languages' \
    --header 'X-SimpleLocalize-Token: <API_KEY>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "key": "pl-PL",
        "name": "Polish"
    }'

Request fields

  • key (required) - language key, must be unique for the project (max 20 characters),
  • name (optional) - language name (max 200 characters),

Example response

{
  "msg": "OK",
  "status": 200,
  "data": {
    "key": "pl-PL",
    "name": "Polish"
  }
}

GET Get languages

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

Example cURL

curl 
    --location 
    --request GET 'https://api.simplelocalize.io/api/v1/languages' \
    --header 'X-SimpleLocalize-Token: <API_KEY>' \
    --header 'Content-Type: application/json'

Example response

{
  "msg": "OK",
  "status": 200,
  "data": [
    {
      "key": "pl",
      "description": "Polski"
    },
    {
      "key": "fr",
      "description": "French"
    }
  ]
}

PATCH Update language

https://api.simplelocalize.io/api/v1/languages/{languageKey}

Example cURL

curl 
    --location 
    --request PATCH 'https://api.simplelocalize.io/api/v1/languages/pl' \
    --header 'X-SimpleLocalize-Token: <API_KEY>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "key": "pl-PL",
        "name": "Polish Locale"
    }'

Example response

{
  "msg": "OK",
  "status": 200,
  "data": {
    "key": "pl-PL",
    "name": "Polish Locale"
  }
}

DELETE Delete language

Important: by removing language, you also remove all translations for a given language!

https://api.simplelocalize.io/api/v1/languages/{languageKey}

Example cURL

curl 
    --location 
    --request DELETE 'https://api.simplelocalize.io/api/v1/languages/pl' \
    --header 'X-SimpleLocalize-Token: <API_KEY>' \
    --header 'Content-Type: application/json'

Example response

{
  "msg": "OK",
  "status": 200
}