API: Language API

Last updated: September 23, 2024Author: Jakub Pomykała

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

All endpoints here require authorization.

Table of contents

Create language

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

Sample request

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 languages

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

Sample request

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"
    }
  ]
}

Update language

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

Sample request

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 language

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

Sample request

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
}

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

Was this helpful?