Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Role API reference


The Role API lets you retrieve the list of roles available within your organization. Roles define a set of permissions that determine what actions a user can perform. To learn more about roles, see types of roles.

Base URL: https://iam.twilio.com/v2/Organizations


Authentication and authorization

authentication-and-authorization page anchor

The Role API is an Organization-level API. You can only access it using OAuth credentials. Account Auth Tokens and API Keys aren't supported.

To create an OAuth app and generate an access token, follow the steps in Set up OAuth.

In subsequent requests, use the returned access_token as a Bearer token:

Authorization: Bearer {access_token}

Required OAuth app permissions

required-oauth-app-permissions page anchor

To call this endpoint, grant your OAuth app the following permission. In the Twilio Console, configure this permission on your OAuth app.

EndpointRequired permission
List rolestwilio/iam/role-assignments/list

PropertyTypeDescription
sidstringThe unique identifier for the role. Starts with IX.
friendly_namestringA human-readable name for the role.
external_descriptionstringA description of what the role provides access to.
product_groupstringThe product group this role belongs to (for example, iam, billing, messaging).
lowest_levelstringThe lowest scope level at which this role can be assigned. One of ORGANIZATION, ACCOUNT, or SUB_ACCOUNT.
role_product_groupobjectThe product group details including product_group and friendly_name.
policyobjectThe permissions policy for this role, containing allow (array of permission strings), deny (array or null), and format (integer).
resource_typesarray or nullThe resource types this role can be scoped to for resource-level role assignments. Null if the role doesn't support resource-level scoping.
date_createdstringThe date and time the role was created, in ISO 8601 format.
date_updatedstringThe date and time the role was last updated, in ISO 8601 format.

Retrieve a paginated list of roles available in your organization.

GET /v2/Organizations/Roles
ParameterTypeNecessityDescription
SearchstringOptionalSearch by role name or SID.
RoleProductGroupstringOptionalFilter by product group.
ExpandbooleanOptionalExpand policy details and permissions.
ResourceTypesstringOptionalFilter by comma-separated resource types.
PageSizeintegerOptionalNumber of results per page. Default: 50, maximum: 1000.
PageTokenstringOptionalToken for fetching the next page of results.

Example request

example-request page anchor
1
curl -X GET 'https://iam.twilio.com/v2/Organizations/Roles' \
2
-H 'Authorization: Bearer {access_token}' \
3
-H 'Accept: application/json'

200 OK

1
{
2
"roles": [
3
{
4
"sid": "IXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"friendly_name": "Example Viewer",
6
"external_description": "View-only access to example resources within the organization",
7
"product_group": "billing",
8
"lowest_level": "ORGANIZATION",
9
"role_product_group": {
10
"product_group": "billing",
11
"friendly_name": "Billing"
12
},
13
"policy": {
14
"allow": [
15
"/twilio/billing/billing-profile/read",
16
"/twilio/billing/payment-methods/list",
17
"/twilio/billing/receipts/list",
18
"/twilio/billing/invoice.statements/list"
19
],
20
"deny": null,
21
"format": 1
22
},
23
"resource_types": null,
24
"date_created": "2025-01-15T10:30:00Z",
25
"date_updated": "2025-02-20T14:45:00Z"
26
}
27
],
28
"meta": {
29
"page_size": 50,
30
"page": 0,
31
"key": "roles",
32
"first_page_url": "https://iam.twilio.com/v2/Organizations/Roles?PageSize=50&Page=0",
33
"previous_page_url": null,
34
"next_page_url": null,
35
"url": "https://iam.twilio.com/v2/Organizations/Roles?PageSize=50&Page=0"
36
}
37
}

Filter by product group example

filter-by-product-group-example page anchor
1
curl -X GET 'https://iam.twilio.com/v2/Organizations/Roles?RoleProductGroup=billing' \
2
-H 'Authorization: Bearer {access_token}' \
3
-H 'Accept: application/json'

Search for roles example

search-for-roles-example page anchor
1
curl -X GET 'https://iam.twilio.com/v2/Organizations/Roles?Search=billing' \
2
-H 'Authorization: Bearer {access_token}' \
3
-H 'Accept: application/json'