Skip to content

Roles API

The Roles API allows you to create and manage roles with custom permissions for your business.

Create a new role.

await arky.role.createRole({
name: 'Editor',
parentRoles: ['viewer-role-id'],
permissions: [{ action: 'WRITE', resource: 'cms' }]
});

Parameters:

  • name (string, required): Role name
  • parentRoles (string[], optional): Parent role IDs to inherit from
  • permissions (array, optional): Permission definitions

Get all roles for the business.

const roles = await arky.role.getRoles({
action: 'READ'
});

Parameters:

  • action (string, required): Filter by action type (e.g., 'READ', 'WRITE')

Get a single role by ID.

const role = await arky.role.getRole({ id: 'role-id' });

Parameters:

  • id (string, required): Role ID

Update an existing role.

await arky.role.updateRole({
id: 'role-id',
name: 'Updated Name',
permissions: [{ action: 'WRITE', resource: 'cms' }]
});

Parameters:

  • id (string, required): Role ID
  • name (string, optional): New role name
  • parentRoles (string[], optional): Updated parent roles
  • permissions (array, optional): Updated permissions

Delete a role.

await arky.role.deleteRole({ id: 'role-id' });

Parameters:

  • id (string, required): Role ID to delete

Base URL: /v1/roles

Authentication: Required