Roles API
Overview
Section titled “Overview”The Roles API allows you to create and manage roles with custom permissions for your business.
Methods
Section titled “Methods”createRole(params, options?)
Section titled “createRole(params, options?)”Create a new role.
await arky.role.createRole({ name: 'Editor', parentRoles: ['viewer-role-id'], permissions: [{ action: 'WRITE', resource: 'cms' }]});Parameters:
name(string, required): Role nameparentRoles(string[], optional): Parent role IDs to inherit frompermissions(array, optional): Permission definitions
getRoles(params, options?)
Section titled “getRoles(params, options?)”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')
getRole(params, options?)
Section titled “getRole(params, options?)”Get a single role by ID.
const role = await arky.role.getRole({ id: 'role-id' });Parameters:
id(string, required): Role ID
updateRole(params, options?)
Section titled “updateRole(params, options?)”Update an existing role.
await arky.role.updateRole({ id: 'role-id', name: 'Updated Name', permissions: [{ action: 'WRITE', resource: 'cms' }]});Parameters:
id(string, required): Role IDname(string, optional): New role nameparentRoles(string[], optional): Updated parent rolespermissions(array, optional): Updated permissions
deleteRole(params, options?)
Section titled “deleteRole(params, options?)”Delete a role.
await arky.role.deleteRole({ id: 'role-id' });Parameters:
id(string, required): Role ID to delete
Endpoint
Section titled “Endpoint”Base URL: /v1/roles
Authentication: Required