Users

get

Returns all users

Authorizations
Responses
curl -L \
  --url 'https://api.example.com/api/v1/users' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "items": [
    {
      "name": "text",
      "display_name": "text",
      "lrn": "text",
      "id": "text",
      "created_at": "2025-03-26T06:40:54.425Z",
      "groups": [
        {
          "name": "text",
          "display_name": "text",
          "lrn": "text",
          "id": "text",
          "created_at": "2025-03-26T06:40:54.425Z",
          "description": "text",
          "user_count": 1,
          "sa_count": 1,
          "role_count": 1,
          "metadata": {
            "ANY_ADDITIONAL_PROPERTY": "text"
          }
        }
      ],
      "last_seen_at": "2025-03-26T06:40:54.425Z",
      "profile": {
        "full_name": "text",
        "email_address": "text"
      },
      "is_admin": true,
      "metadata": {
        "ANY_ADDITIONAL_PROPERTY": "text"
      }
    }
  ]
}
post

Creates a new user.

Authorizations
Body
namestring · min: 1 · max: 100required

Sets the unique name of the new user. It must be a valid HQ resource name: it can only contain lowercase alphanumeric characters or hyphens; hyphens cannot appear at the end or start; the length is 63 characters at most.

display_namestring · min: 1 · max: 150optional

Sets the display name of the new user. If not provided, the value of "name" will be used.

metadataobjectoptional

Allows attaching custom string key/values to resources. The following maxima apply:

  • 50 keys/values;
  • 40 bytes key length;
  • 500 bytes value length.

Responses
curl -L \
  --request POST \
  --url 'https://api.example.com/api/v1/users' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "text",
    "display_name": "text",
    "metadata": {
      "ANY_ADDITIONAL_PROPERTY": "text"
    }
  }'
{
  "name": "text",
  "display_name": "text",
  "lrn": "text",
  "id": "text",
  "created_at": "2025-03-26T06:40:54.425Z",
  "groups": [
    {
      "name": "text",
      "display_name": "text",
      "lrn": "text",
      "id": "text",
      "created_at": "2025-03-26T06:40:54.425Z",
      "description": "text",
      "user_count": 1,
      "sa_count": 1,
      "role_count": 1,
      "metadata": {
        "ANY_ADDITIONAL_PROPERTY": "text"
      }
    }
  ],
  "last_seen_at": "2025-03-26T06:40:54.425Z",
  "profile": {
    "full_name": "text",
    "email_address": "text"
  },
  "is_admin": true,
  "metadata": {
    "ANY_ADDITIONAL_PROPERTY": "text"
  }
}
get

Returns a specific user

Authorizations
Path parameters
namestringrequired
Responses
curl -L \
  --url 'https://api.example.com/api/v1/users/{name}' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "name": "text",
  "display_name": "text",
  "lrn": "text",
  "id": "text",
  "created_at": "2025-03-26T06:40:54.425Z",
  "groups": [
    {
      "name": "text",
      "display_name": "text",
      "lrn": "text",
      "id": "text",
      "created_at": "2025-03-26T06:40:54.425Z",
      "description": "text",
      "user_count": 1,
      "sa_count": 1,
      "role_count": 1,
      "metadata": {
        "ANY_ADDITIONAL_PROPERTY": "text"
      }
    }
  ],
  "last_seen_at": "2025-03-26T06:40:54.425Z",
  "profile": {
    "full_name": "text",
    "email_address": "text"
  },
  "is_admin": true,
  "metadata": {
    "ANY_ADDITIONAL_PROPERTY": "text"
  }
}
patch

Updates a user.

Authorizations
Path parameters
namestringrequired
Body
display_namestring · min: 1 · max: 150optional

Updates the display name of the user.

metadataobjectoptional

Patches metadata. It has the following semantics:

  • Absent keys are left untouched;
  • Null values are deleted;
  • Non-null values are replaced.

Responses
curl -L \
  --request PATCH \
  --url 'https://api.example.com/api/v1/users/{name}' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "display_name": "text",
    "metadata": {
      "ANY_ADDITIONAL_PROPERTY": "text"
    }
  }'
{
  "name": "text",
  "display_name": "text",
  "lrn": "text",
  "id": "text",
  "created_at": "2025-03-26T06:40:54.425Z",
  "groups": [
    {
      "name": "text",
      "display_name": "text",
      "lrn": "text",
      "id": "text",
      "created_at": "2025-03-26T06:40:54.425Z",
      "description": "text",
      "user_count": 1,
      "sa_count": 1,
      "role_count": 1,
      "metadata": {
        "ANY_ADDITIONAL_PROPERTY": "text"
      }
    }
  ],
  "last_seen_at": "2025-03-26T06:40:54.425Z",
  "profile": {
    "full_name": "text",
    "email_address": "text"
  },
  "is_admin": true,
  "metadata": {
    "ANY_ADDITIONAL_PROPERTY": "text"
  }
}
delete

Deletes a user.

Authorizations
Path parameters
namestringrequired
Responses
curl -L \
  --request DELETE \
  --url 'https://api.example.com/api/v1/users/{name}' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'

No body

patch

Allows updating fields of the user profile.

Authorizations
Path parameters
namestringrequired
Body
full_namestring · max: 100optional

Contains the users' full name, e.g. Mary Jane Doe.

email_addressstring · max: 100optional

Contains the users' email address, e.g. mary.jane@doe.net. Note that this is not necessarily the same as the user's name, which often looks like an email address, but is not per se.

Responses
curl -L \
  --request PATCH \
  --url 'https://api.example.com/api/v1/users/{name}/profile' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "full_name": "text",
    "email_address": "text"
  }'
{
  "name": "text",
  "display_name": "text",
  "lrn": "text",
  "id": "text",
  "created_at": "2025-03-26T06:40:54.425Z",
  "groups": [
    {
      "name": "text",
      "display_name": "text",
      "lrn": "text",
      "id": "text",
      "created_at": "2025-03-26T06:40:54.425Z",
      "description": "text",
      "user_count": 1,
      "sa_count": 1,
      "role_count": 1,
      "metadata": {
        "ANY_ADDITIONAL_PROPERTY": "text"
      }
    }
  ],
  "last_seen_at": "2025-03-26T06:40:54.425Z",
  "profile": {
    "full_name": "text",
    "email_address": "text"
  },
  "is_admin": true,
  "metadata": {
    "ANY_ADDITIONAL_PROPERTY": "text"
  }
}
put

Assigns the given user exactly to the provided groups, ensuring they are not part of any other groups.

Authorizations
Path parameters
namestringrequired

The name of the user.

Body
add_to_groupsstring[]optional

Adds the user or service account to the groups (specified by their names).

remove_from_groupsstring[]optional

Removes the user or service account from the groups (specified by their names). If a group is specified in both add_to_groups as well in here, removal wins.

set_groupsstring[]optional

Sets the user or service account memberships to those groups (specified by their names) in an absolute fashion (ensures user/sa will be exactly a member of those), if provided. Cannot be combined with the add_to_groups or remove_from_groups.

Responses
curl -L \
  --request PUT \
  --url 'https://api.example.com/api/v1/users/{name}/groups' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "add_to_groups": [
      "text"
    ],
    "remove_from_groups": [
      "text"
    ],
    "set_groups": [
      "text"
    ]
  }'
{
  "name": "text",
  "display_name": "text",
  "lrn": "text",
  "id": "text",
  "created_at": "2025-03-26T06:40:54.425Z",
  "groups": [
    {
      "name": "text",
      "display_name": "text",
      "lrn": "text",
      "id": "text",
      "created_at": "2025-03-26T06:40:54.425Z",
      "description": "text",
      "user_count": 1,
      "sa_count": 1,
      "role_count": 1,
      "metadata": {
        "ANY_ADDITIONAL_PROPERTY": "text"
      }
    }
  ],
  "last_seen_at": "2025-03-26T06:40:54.425Z",
  "profile": {
    "full_name": "text",
    "email_address": "text"
  },
  "is_admin": true,
  "metadata": {
    "ANY_ADDITIONAL_PROPERTY": "text"
  }
}
get

Returns the currently authenticated user

Authorizations
Responses
curl -L \
  --url 'https://api.example.com/api/v1/users/me' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "name": "text",
  "display_name": "text",
  "lrn": "text",
  "id": "text",
  "created_at": "2025-03-26T06:40:54.425Z",
  "groups": [
    {
      "name": "text",
      "display_name": "text",
      "lrn": "text",
      "id": "text",
      "created_at": "2025-03-26T06:40:54.425Z",
      "description": "text",
      "user_count": 1,
      "sa_count": 1,
      "role_count": 1,
      "metadata": {
        "ANY_ADDITIONAL_PROPERTY": "text"
      }
    }
  ],
  "last_seen_at": "2025-03-26T06:40:54.425Z",
  "profile": {
    "full_name": "text",
    "email_address": "text"
  },
  "is_admin": true,
  "metadata": {
    "ANY_ADDITIONAL_PROPERTY": "text"
  }
}
post

Starts a session given a username/password and puts it into a cookie.

Authorizations
Body
usernamestringrequired
passwordstringrequired
Responses
curl -L \
  --request POST \
  --url 'https://api.example.com/api/v1/login' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "username": "text",
    "password": "text"
  }'

No body

delete

Deletes all sessions associated with the current user.

Authorizations
Responses
curl -L \
  --request DELETE \
  --url 'https://api.example.com/api/v1/users/me/sessions' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'

No body

Last updated

Was this helpful?