const { result, error } = await unkey.permissions.getRole({
  roleId: "role_45TTRKT5Yh28M6Qj",
});

if (error) {
  // handle potential network or bad request error
  // a link to our docs will be in the `error.docs` field
  console.error(error.message);
  return;
}
console.log(result);
{
  "result": {
      "id": "role_45TTRKT5Yh28M6Qj",
      "name": "domain.record.manager",
      "description": "Can manage dns records"
    }
}
const { result, error } = await unkey.permissions.getRole({
  roleId: "role_45TTRKT5Yh28M6Qj",
});

if (error) {
  // handle potential network or bad request error
  // a link to our docs will be in the `error.docs` field
  console.error(error.message);
  return;
}
console.log(result);
{
  "result": {
      "id": "role_45TTRKT5Yh28M6Qj",
      "name": "domain.record.manager",
      "description": "Can manage dns records"
    }
}

To use this function, your root key must have the rbac.*.read_role

Request

roleId
string
required

The id of the role to fetch

Minimum length: 1

Example: "role_123"

Response

id
string
required

The id of the role. This is used internally

Example: "role_123"

name
string
required

The unique name of your role.

Example: "dns.records.manager"

description
string

The description of what this role does. This is just for your team, your users will not see this.

Example:"dns.records.manager can read and write dns records for our domains."