Entity users
Learn how to manage your customers' employees.
Overview
Once the customers are mapped out as entities, the next step is to start mapping out their employees to the corresponding entity users in the Monite platform.
Learn more about entities, entity users, and the Monite account structure.
Create a user role
Every entity user must have a role. A role defines the permissions that a user has to access and update the entity’s resources in Monite.
Roles are created by calling POST /roles
. The partner-level token and the entity ID are required for this action.
In the example below, a new role is created to allow read
access to the comment
and payable
objects:
The successful response contains the information about the role, including the role ID that you will require later.
For the full list of permissions, see List of permissions. The information about the created role can be retrieved later by calling GET /roles/{role_id}
.
Create an entity user
To create an entity user, call POST /entity_users
. Specify the entity ID in the X-Monite-Entity-Id
request header and the user data in the request body. The role_id
field must be populated by the ID of the role created earlier. The request must be authorized using a partner-level access token:
The successful response contains the created entity user:
List all entity users
To get information about all the entity users managed by the entity, call GET /entity_users
.
Retrieve an entity user
To get information about a specific entity user, call GET /entity_users/{entity_user_id}
.
Edit an entity user
To edit an existing entity user, call PATCH /entity_users/{entity_user_id}
.
Delete an entity user
To delete an existing entity user, call DELETE /entity_users/{entity_user_id}
.
Get an entity user token
To make API calls on behalf of an entity user, you need to use an access token of that user. To get this token, call POST /auth/token
with the following request body:
For example:
The successful response contains the access token for the specified user:
This token can be sent in the Authorization: Bearer TOKEN
request header as an alternative to using a partner-level token.
Get and update the authenticated user info
The authenticated entity user can check all its own information by calling GET /entity_users/me
. The request must be authorized using an entity user level-access token:
The successful response returns the information about the authenticated entity user, including the user ID, role, and other details:
The authenticated entity user can also make changes to its own information by calling PATCH /entity_users/me
, passing the information they wish to update. In the example below, the last_name
field is being updated. The request must be authorized using an entity user level-access token:
The successful response returns the updated user object.
Get the role of the authenticated entity user
To retrieve information about the role and permissions assigned to the authenticated entity user, call GET /entity_users/my_role
:
The successful response returns the role object associated with the authenticated entity user.