How to create users

This example shows you how to create users and assign them their appropriate roles. This helps you in building a joiners, movers and leavers (JML) process by efficiently onboarding joiners to your organization.

1. List role types 

We can create a new user called Jane Smith who will have the following roles: 

  • 'Global user admin' 
  • 'Workspace manager' of 01_Sandbox 

With an authenticated call, we will need to perform a GET request to the List Role Types endpoint. This will retrieve the IDs for the roles mentioned above. The GET request will look like this:

https://api.client_name.cutover.com/core/role_types

The Global user admin role has an ID of 2 and the Workspace Manager role has an ID of 4.  

To get the workspace ID for 01_sandbox, we will need to use the List Workspaces endpoint. The GET request will look like this: 

https://api.client_name.cutover.com/core/workspaces

The response will show 01_sandbox has an ID of 2. These IDs are needed to apply the roles when we create a user.  

2. Create a new user

With an authenticated call, we can use the Create a new User endpoint to create a new user called jane.smith@cutover.com, who has the 'Global user admin' and 'Workspace manager' access to 01_sandbox. The request body can be found below: 

{
 "data": {
   "type": "user",
   "attributes": {
     "first_name": "Jane",
     "last_name": "Smith",
     "email": "jane.smith@cutover.com",
     "unique_id": "jane.smith@cutover.com",
     "provider": "email",
     "roles_attributes": [
       {
         "role_type_id": "2",
       },
       {
         "role_type_id": "4",
         "resource_id": "2",
         "resource_type": "workspace"
       }
     ]
   }
 },
 "meta": {
   "invitation": {
     "message": "Welcome to Cutover",
     "skip": false
  }
 }
}

This is how it would look in Cutover when searching for our new user.