Skip to main content

Creating a new user

Create User

curl '<base_url>/api/v2/user' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <user_token>' \
--data '{
"email": "str (Required)",
"password": "str (Required)",
"first_name": "str (Optional)",
"phone: "str (Optional)",
"last_name": "str (Optional)",
"groups": [
//list of permission groups ids
]
}'

Response includes the detailed user informations.

{
"id": "user_uuid",
"first_name": "first name",
"username": "username",
"last_name": "last name",
"phone": "phone",
"email": "email",
"company": "company_uuid",
"groups": [
{
"id": role_id,
"name": "Role Name",
"permissions": [
// list of permissions in this role
]
}
],
"mfa": true/false,
"reset_pw": true/false,
"reset_2fa": true/false,
"is_active": true/false,
"permissions": [
// list of actions the user has the permission to perform
]
}

Assigning Roles to Users

Role is a permission group the user belongs to. To assign a role to a user, you must specify the id of the role inside the "groups" array during creation or you can update it by calling the "User Update" API.

Getting the list of all the roles

curl '<base_url>/api/v2/group' \
-H 'Authorization: Bearer user_token'

Response data has all the information related to groups.

[
{
"id": role_id,
"name": "Role Name",
"permissions": [
// list of actions this role has
]
},
{
"id": role_id,
"name": "Role Name",
"permissions": [
// list of actions this role has
]
}
]

User Update


curl --request PATCH '<base_url>/api/v2/user/<user_uuid>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <user_token>' \
--data '{
"email": "str (Required)",
"password": "str (Required)",
"first_name": "str (Optional)",
"phone: "str (Optional)",
"last_name": "str (Optional)",
"groups": [
//list of permission groups ids
]
}'

Response data is similar to user create request.

{
"id": "user_uuid",
"first_name": "first name",
"username": "username",
"last_name": "last name",
"phone": "phone",
"email": "email",
"company": "company_uuid",
"groups": [
{
"id": role_id,
"name": "Role Name",
"permissions": [
// list of permissions in this role
]
}
],
"mfa": true/false,
"reset_pw": true/false,
"reset_2fa": true/false,
"is_active": true/false,
"permissions": [
// list of actions the user has the permission to perform
]
}