Roles

envless.roles.get()

Fetch one role by id

ts
get(id: string, options?: RequestScope): Promise<RoleResource>

Reads a single role. Unlike products and projects, there is no slug form here: the argument must be the role id taken from list, and a role name or a system key such as owner comes back as 404 role.not_found.

For a system role, permissions is the canonical catalogue list for its systemKey rather than the stored column, so it stays correct as the platform permission set grows. systemKey is null for custom roles, and isSystem is the flag to branch on before offering an edit or delete action, since both are refused on system roles.

Example

ts
const [role] = await envless.roles.listAll({ search: 'deploy' })

const detail = await envless.roles.get(role.id)

console.log(detail.permissions)

Parameters

ParameterTypeRequiredDescription
idstringYesRole id from roles.list, with no name or slug form accepted.
options.signalAbortSignalNoCancels the request.

Returns

RoleResource with permissions, isSystem, systemKey and timestamps.

Worth knowing

  • A soft deleted role is indistinguishable from one that never existed: both answer 404 role.not_found.
  • The role must belong to the workspace the API key is bound to, since ids from another workspace also read as 404.

Required scopes

roles:read

Underlying endpoint

GET /roles/{id}

Request and response schema, every error code, and a live playground.

In Python

envless.roles.get()

The same method in envless-sdk, the Python SDK, with the same request, retries and errors.

In Ruby

Envless.roles.get

The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.

In PHP

$envless->roles->get()

The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.