Roles
Roles as the core part of Vrite’s Role-Based Access Control (RBAC) model, help you manage users and their permissions in a workspace. With the API you can create and manage available roles.
Retrieve Role
Retrieves details of the role specified by ID.
ID of the role
ID of the role
Name of the role
Description of the role
Permissions assigned to the role
Type of the base role
vieweradmin
curl --request GET \
--url "https://api.vrite.io/roles" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Accept: application/json'
const client = createClient({
token: "<API_TOKEN>",
});
const result = await client.roles.get({
id: "62c23534d77c31b2e067f5dc",
});
{
"id": "62c23534d77c31b2e067f5dc",
"name": "string",
"description": "string",
"permissions": [
"editContent"
],
"baseType": "viewer"
}
List Roles
Lists existing roles. Supports pagination.
Number of roles per page
Page number to fetch
Last role ID to start fetching roles from
ID of the role
Name of the role
Description of the role
Permissions assigned to the role
Type of the base role
vieweradmin
curl --request GET \
--url "https://api.vrite.io/roles/list" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Accept: application/json'
const client = createClient({
token: "<API_TOKEN>"
});
const result = await client.roles.list({
// Optional
page: 1,
// Optional
perPage: 20,
});
[
{
"id": "ea8522a23602d1511c6aa164",
"name": "string",
"description": "string",
"permissions": [
"editContent"
],
"baseType": "viewer"
}
]
Create Role
Creates a role with the specified name, description, and permissions set.
Name of the role
Description of the role
Permissions assigned to the role
ID of the role
curl --request POST \
--url "https://api.vrite.io/roles" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"name": "{NAME}",
"permissions": "{PERMISSIONS}"
}'
const client = createClient({
token: "<API_TOKEN>",
});
const result = await client.roles.create({
name: "string",
permissions: ["editContent"],
// Optional
description: "string",
});
{
"id": "3bbab29594c80288094e35c0"
}
Update Role
Updates the name, description, and permissions of the role matched by ID, using the provided data.
ID of the role
Name of the role
Description of the role
Permissions assigned to the role
curl --request PUT \
--url "https://api.vrite.io/roles" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"id": "{ID}"
}'
const client = createClient({
token: "<API_TOKEN>",
});
await client.roles.update({
id: "b7ab40990fbc00927aef8c8f",
// Optional
name: "string",
// Optional
description: "string",
// Optional
permissions: ["editContent"],
});
Delete Role
Deletes the role specified by ID. Any member of the workspace that was assigned this role will be converted to the base Viewer role.
ID of the role
curl --request DELETE \
--url "https://api.vrite.io/roles?id={ID}" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Accept: application/json'
const client = createClient({
token: "<API_TOKEN>",
});
await client.roles.delete({
id: "b7ab40990fbc00927aef8c8f",
});