API: Customer API

Last modified: January 26, 2023Author: Jakub Pomykała

In this section, you will learn how to create, query, update and delete customers. You can use the Customers feature feature to change translations for one company or user without altering your base translations.

Resources

Create a customer

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

Sample request

curl
    --location
    --request POST 'https://api.simplelocalize.io/api/v1/customers' \
    --header 'X-SimpleLocalize-Token: <API_KEY>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "key": "my-customer-2137",
        "description": "My favourite customer is just reading this text ☺️"
    }'

Request fields

  • key (required) - customer identifier, must be unique for a project (max 40 characters),
  • description (optional) - more details about the customer (max 255 characters),

Example response

{
  "msg": "OK",
  "status": 200,
  "data": {
    "key": "my-customer-2137",
    "description": "My favourite customer is just reading this text ☺️"
  }
}

Get customer

GET
https://api.simplelocalize.io
/api/v1/customers/{customerKey}

Sample request

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

Example response

{
  "msg": "OK",
  "status": 200,
  "data": {
    "key": "my-customer-2137",
    "description": "My favourite customer is just reading this text :)"
  }
}

Get all customers

Endpoint returns all available customers in the project.

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

Sample request

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

Example response

{
  "msg": "OK",
  "status": 200,
  "data": [
    {
      "key": "my-customer-2137",
      "description": "My favourite customer is just reading this text :)"
    },
    {
      "key": "my-customer-1004",
      "description": "Some description for my-customer-1004"
    }
  ]
}

Update customer

PATCH
https://api.simplelocalize.io
/api/v1/customers/{customerKey}

Sample request

curl
    --location
    --request PATCH 'https://api.simplelocalize.io/api/v1/customers/my-customer-2137' \
    --header 'X-SimpleLocalize-Token: <API_KEY>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "key": "my-customer-2137-modified",
        "description": "My favourite customer is just reading this text ☺️"
    }'

Example response

{
  "msg": "OK",
  "status": 200,
  "data": {
    "key": "my-customer-2137-modified",
    "description": "My favourite customer is just reading this text :)"
  }
}

Delete customer

DELETE
https://api.simplelocalize.io
/api/v1/customers/{customerKey}

Sample request

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

Example response

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