Sign Up

Roles

List organization roles

GET
/orgs/{org_id}/roles

Returns the built-in roles in catalog order, then the organization's custom roles by name.

Authorization

user_jwt read:organization
headerAuthorizationBearer <token>

Bearer access token for a signed-in user.

Scope: read:organization

Path Parameters

org_id*string

The organization ID

Formatuuid

Response Body

The organization roles

application/json
  1. response
max_custom_roles*integer

The most custom roles the organization can define.

Formatint64
roles*array<>

The built-in roles, then the organization's custom roles.

curl -X GET 'https://example.com/orgs/497f6eca-6276-4993-bfeb-53cbbbba6f08/roles'
{  "max_custom_roles": 0,  "roles": [    {      "created_at": "2019-08-24T14:15:22Z",      "description": "string",      "id": "string",      "kind": "built_in",      "name": "string",      "organization_permissions": [        "string"      ],      "permissions": [        "string"      ],      "project_permissions": [        "string"      ],      "updated_at": "2019-08-24T14:15:22Z"    }  ]}
POST
/orgs/{org_id}/roles

Defines a custom role from the permission vocabulary. The role can grant only permissions the current member holds.

Authorization

user_jwt write:roles
headerAuthorizationBearer <token>

Bearer access token for a signed-in user.

Scope: write:roles

Path Parameters

org_id*string

The organization ID

Formatuuid

Request Body

application/json
  1. body
description?string

The role's purpose.

Lengthlength <= 256
name*string

The role name, unique in the organization ignoring case. Leading and trailing whitespace is removed and internal whitespace runs collapse to one space; the result must be 1 to 64 characters.

Length1 <= length
organization_permissions*array<string>

The organization permissions the role grants.

project_permissions*array<string>

The project permissions the role grants.

Response Body

The created organization role

application/json
  1. response
created_at?|

When the role was created, or null for a built-in role.

Formatdate-time
description*string

The role's purpose.

id*string

The role ID: a built-in role's identifier, or a custom role's UUID.

kind*OrganizationRoleKind

Whether the role is built in or defined by the organization.

Value in"built_in""custom"
name*string

The display name.

organization_permissions*array<string>

The organization permissions the role grants.

permissions*array<string>

Every permission the role grants: the project permissions, then the organization permissions.

project_permissions*array<string>

The project permissions the role grants.

updated_at?|

When the role was last changed, or null for a built-in role.

Formatdate-time
curl -X POST 'https://example.com/orgs/497f6eca-6276-4993-bfeb-53cbbbba6f08/roles' \  -H 'Content-Type: application/json' \  -d '{  "name": "string",  "organization_permissions": [    "string"  ],  "project_permissions": [    "string"  ]}'
{  "created_at": "2019-08-24T14:15:22Z",  "description": "string",  "id": "string",  "kind": "built_in",  "name": "string",  "organization_permissions": [    "string"  ],  "permissions": [    "string"  ],  "project_permissions": [    "string"  ],  "updated_at": "2019-08-24T14:15:22Z"}

Get an organization role

GET
/orgs/{org_id}/roles/{role_id}

Authorization

user_jwt read:organization
headerAuthorizationBearer <token>

Bearer access token for a signed-in user.

Scope: read:organization

Path Parameters

org_id*string

The organization ID

Formatuuid
role_id*string

The role ID

Response Body

The organization role

application/json
  1. response
created_at?|

When the role was created, or null for a built-in role.

Formatdate-time
description*string

The role's purpose.

id*string

The role ID: a built-in role's identifier, or a custom role's UUID.

kind*OrganizationRoleKind

Whether the role is built in or defined by the organization.

Value in"built_in""custom"
name*string

The display name.

organization_permissions*array<string>

The organization permissions the role grants.

permissions*array<string>

Every permission the role grants: the project permissions, then the organization permissions.

project_permissions*array<string>

The project permissions the role grants.

updated_at?|

When the role was last changed, or null for a built-in role.

Formatdate-time
curl -X GET 'https://example.com/orgs/497f6eca-6276-4993-bfeb-53cbbbba6f08/roles/string'
{  "created_at": "2019-08-24T14:15:22Z",  "description": "string",  "id": "string",  "kind": "built_in",  "name": "string",  "organization_permissions": [    "string"  ],  "permissions": [    "string"  ],  "project_permissions": [    "string"  ],  "updated_at": "2019-08-24T14:15:22Z"}
PATCH
/orgs/{org_id}/roles/{role_id}

Updates a custom role; a permission array in the request replaces the stored array. Narrowing a role revokes its holders' API keys that exceed their new permissions. An update that only removes permissions does not require the custom roles entitlement.

Authorization

user_jwt write:roles
headerAuthorizationBearer <token>

Bearer access token for a signed-in user.

Scope: write:roles

Path Parameters

org_id*string

The organization ID

Formatuuid
role_id*string

The role ID

Request Body

application/json
  1. body
description?string

The new role purpose.

Lengthlength <= 256
name?string

The new role name. Whitespace is normalized as on create; the result must be 1 to 64 characters.

Length1 <= length
organization_permissions?array<string>

The complete new set of organization permissions.

project_permissions?array<string>

The complete new set of project permissions.

Response Body

The organization role

application/json
  1. response

A role update's result: the role and the keys the update revoked.

revoked_api_keys*integer

The number of API keys the update revoked.

Formatint64
Range0 <= value
role*

The updated role.

curl -X PATCH 'https://example.com/orgs/497f6eca-6276-4993-bfeb-53cbbbba6f08/roles/string' \  -H 'Content-Type: application/json' \  -d '{}'
{  "revoked_api_keys": 0,  "role": {    "created_at": "2019-08-24T14:15:22Z",    "description": "string",    "id": "string",    "kind": "built_in",    "name": "string",    "organization_permissions": [      "string"    ],    "permissions": [      "string"    ],    "project_permissions": [      "string"    ],    "updated_at": "2019-08-24T14:15:22Z"  }}
DELETE
/orgs/{org_id}/roles/{role_id}

Deletes a custom role that no member, service account, or pending invitation holds.

Authorization

user_jwt delete:roles
headerAuthorizationBearer <token>

Bearer access token for a signed-in user.

Scope: delete:roles

Path Parameters

org_id*string

The organization ID

Formatuuid
role_id*string

The role ID

Response Body

Role deleted

curl -X DELETE 'https://example.com/orgs/497f6eca-6276-4993-bfeb-53cbbbba6f08/roles/string'
Empty
POST
/orgs/{org_id}/roles/{role_id}/update-preview

Reports what the same update would change, without applying it. A preview that only removes permissions does not require the custom roles entitlement.

Authorization

user_jwt write:roles
headerAuthorizationBearer <token>

Bearer access token for a signed-in user.

Scope: write:roles

Path Parameters

org_id*string

The organization ID

Formatuuid
role_id*string

The role ID

Request Body

application/json
  1. body
description?string

The new role purpose.

Lengthlength <= 256
name?string

The new role name. Whitespace is normalized as on create; the result must be 1 to 64 characters.

Length1 <= length
organization_permissions?array<string>

The complete new set of organization permissions.

project_permissions?array<string>

The complete new set of project permissions.

Response Body

The role change impact

application/json
  1. response
affected_members*integer

The number of members who hold the role.

Formatint64
Range0 <= value
affected_service_accounts*integer

The number of active service accounts that hold the role.

Formatint64
Range0 <= value
pending_invitations*integer

The number of pending invitations that grant the role.

Formatint64
Range0 <= value
revoked_api_keys*integer

The number of API keys the update would revoke.

Formatint64
Range0 <= value
curl -X POST 'https://example.com/orgs/497f6eca-6276-4993-bfeb-53cbbbba6f08/roles/string/update-preview' \  -H 'Content-Type: application/json' \  -d '{}'
{  "affected_members": 0,  "affected_service_accounts": 0,  "pending_invitations": 0,  "revoked_api_keys": 0}

List permissions

GET
/permissions

Authorization

headerAuthorizationBearer <token>

Bearer access token for a signed-in user.

Query Parameters

scope?string

Restrict the catalog to one permission scope.

Value in"project""organization"

Response Body

The permission catalog

application/json
  1. response
permissions*array<>

The available permissions.

curl -X GET 'https://example.com/permissions'
{  "permissions": [    {      "category": "string",      "id": "string",      "name": "string"    }  ]}

List roles

GET
/roles

Authorization

headerAuthorizationBearer <token>

Bearer access token for a signed-in user.

Response Body

The role catalog

application/json
  1. response
roles*array<>

The available roles.

curl -X GET 'https://example.com/roles'
{  "roles": [    {      "description": "string",      "id": "string",      "name": "string",      "permissions": [        "string"      ]    }  ]}