Skip to main content

userRoles

Requires permission users:user:read.

Lists the roles assigned to a user, or an empty list if the user does not exist. A user in another organization is refused unless you hold the cross-organization user read permission. Needs users:user:read.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

query UserRoles($userId: String!) {
userRoles(userId: $userId) {
id
name
displayName
createdAt
deletedAt
deletedBy
permissions {
id
name
createdAt
action
description
direct
}
}
}

Variables:

{
"userId": "string"
}

Response:

{
"data": {
"userRoles": [
{
"id": "id",
"name": "string",
"displayName": "string",
"createdAt": "2025-01-15T00:00:00Z",
"deletedAt": "2025-01-15T00:00:00Z",
"deletedBy": "string",
"permissions": [
{
"id": "id",
"name": "string",
"createdAt": "2025-01-15T00:00:00Z",
"action": "string",
"description": "string",
"direct": true
}
]
}
]
}
}
userRoles(
userId: String!
): [Role!]!

Arguments​

userRoles.userId ● String! non-null scalar​

The ID of the user.

Type​

Role object​

A role: a named set of permissions that can be given to users.