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 datasets.
  • 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

For example:

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

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://api.axiom.co/v2/users' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer API_TOKEN'

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/ID endpoint where ID is the unique ID of the user. For example:

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

Example response:

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

For more information, see the API reference.

Update users

To update a user, send a PUT request to the users/ID endpoint where ID is the unique ID of the user. In the body of the request, specify the properties you want to update. Include the name field even if you don’t want to change it. For example:

curl -X 'PUT' 'https://api.axiom.co/v2/users/abc123' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer API_TOKEN' \
-d '{
    "name": "test_user",
    "email": "example2@abc.com",
  }'

Example response:

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

For more information, see the API reference.

Delete users

To delete a user, send a DELETE request to the users/ID endpoint where ID is the unique ID of the user. For example:

curl -X 'DELETE' 'https://api.axiom.co/v2/users/abc123' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer API_TOKEN'

For more information, see the API reference.