# Roles

The roles APIs allow users to programmatically manage custom roles for their customer accounts. To manage the custom roles in the admin team, please refer to this document.

# Quick reference

Type Resource Description
GET /api/managed_users/:id/roles List custom roles in a customer account.
POST /api/managed_users/:id/roles/:role_id/copy Makes a copy of a custom role.

# Base path

For all the APIs above, the base path is /api/managed_users/:id where the customer account ID is required in as a URL parameter.

Name Type Description
id string
required
Workato Embedded customer Account ID/External ID.
External id should be prefixed with a E(eg: EA2300) and the resulting id should be URL encoded.

# List custom roles

Lists all custom roles in a customer account.

GET /api/roles

# Sample request

curl  -X GET https://www.workato.com/managed_users/api/roles \
      -H 'x-user-email: <email>' \
      -H 'x-user-token: <token>'

# Response

[
    {
        "id": 478,
        "name": "Developer role",
        "inheritable": false,
        "folder_ids": [],
        "created_at": "2020-05-20T11:54:31.706-07:00",
        "updated_at": "2020-05-20T11:54:31.706-07:00"
    },
    {
        "id": 446,
        "name": "Non-developer role",
        "inheritable": false,
        "folder_ids": [],
        "created_at": "2020-04-12T08:40:11.240-07:00",
        "updated_at": "2020-04-12T08:40:11.240-07:00"
    }
]

# Copy a custom role

Creates a copy of a custom role in a customer account with the ability to change the folders accessible by the role. The folder IDs can be obtained with the GET folders API endpoint.

POST /api/recipes

# Payload

Name Type Description
name string
required
Name of the custom role.
folder_ids array
Array of folder IDs.

# Sample request

curl  -X POST https://www.workato.com/managed_users_api/roles/490/copy \
      -H 'x-user-email: <email>' \
      -H 'x-user-token: <token>' \
      -H 'Content-Type: application/json' \
      -d  '{
            "name": "Customer developer",
            "folder_ids": ["1232", "1224"]
          }'

# Response

{
    "id": 546,
    "name": "Customer developer",
    "inheritable": false,
    "folder_ids": ["1232", "1224"],
    "created_at": "2020-08-14T07:23:19.599-07:00",
    "updated_at": "2020-08-14T07:23:19.599-07:00"
}