This page explains how to manage users programmatically via the API.

Prerequisites

  • Create an API token in Axiom with permissions to create, read, update, and delete users.
  • In the code samples below, replace API_TOKEN with the Axiom API token you have generated. For added security, store the API token in an environment variable.

Create users

To create a user, send a POST request to the users endpoint. In the body of the request, specify the following:

  • name
  • email
  • role

For example:

curl -X 'POST' 'https://AXIOM_DOMAIN/v2/users' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer API_TOKEN' \
-d '{
    "name": "test_user",
    "email": "example@abc.com",
    "role": "admin"
  }'

Replace AXIOM_DOMAIN with api.axiom.co if your organization uses the US region, and with api.eu.axiom.co if your organization uses the EU region. For more information, see Regions.

Replace API_TOKEN with the Axiom API token you have generated. For added security, store the API token in an environment variable.

The example response contains the user ID that you can later use to access the user programmatically.

{
  "email": "example@abc.com",
  "id": "abc123",
  "name": "test_user",
  "role": {
    "id": "admin",
    "name": "admin"
  }
}

For more information, see the API reference.

Get information about users

Get information about all users

To get information about all the users in your Axiom organization, send a GET request to the users endpoint. For example:

curl -X 'GET' 'https://AXIOM_DOMAIN/v2/users' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer API_TOKEN'

Replace AXIOM_DOMAIN with api.axiom.co if your organization uses the US region, and with api.eu.axiom.co if your organization uses the EU region. For more information, see Regions.

Replace API_TOKEN with the Axiom API token you have generated. For added security, store the API token in an environment variable.

The example response is a list of user objects. Each object contains a unique user ID that you can later use to access the user programmatically.

[
  {
    "email": "example1@abc.com",
    "id": "abc123",
    "name": "test_user1",
    "role": {
      "id": "admin",
      "name": "admin"
    }
  },
  {
    "email": "example2@abc.com",
    "id": "abc321",
    "name": "test_user2",
    "role": {
      "id": "admin",
      "name": "admin"
    }
  }
]

For more information, see the API reference.

Get information about specific user

To get information about a specific user, send a GET request to the users/USER_ID endpoint where USER_ID is the unique ID of the user. For example:

curl -X 'GET' 'https://AXIOM_DOMAIN/v2/users/abc123' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer API_TOKEN'

Replace AXIOM_DOMAIN with api.axiom.co if your organization uses the US region, and with api.eu.axiom.co if your organization uses the EU region. For more information, see Regions.

Replace API_TOKEN with the Axiom API token you have generated. For added security, store the API token in an environment variable.

Example response:

{
  "email": "example@abc.com",
  "id": "abc123",
  "name": "test_user",
  "role": {
    "id": "admin",
    "name": "admin"
  }
}

For more information, see the API reference.