Sites & Organisation

Permissions

Endpoints to manage user permissions in Trybe.

put/users/{userId}/roles

Assign a role to the user

actionAssignUserRole

Specify the role ID to assign to the user.

Path parameters

  • userIduuidrequired

    The ID of the user

Request body

  • role_iduuidrequired

    Identifier of the organisation role to assign or remove. Roles grant a bundle of permissions across the user's organisation; for per-site permissions use the site-roles endpoint instead.

Responses

  • 204

    The role was successfully assigned.

  • 401

    The user is unauthenticated

  • 403

    The authenticated user does not have permission.

  • 404

    The resource couldn't be found

  • 422

    The request didn't pass validation

delete/users/{userId}/roles

Remove a role from the user

actionRemoveUserRole

Specify the role ID to remove from the user.

Path parameters

  • userIduuidrequired

    The ID of the user

Request body

  • role_iduuidrequired

    Identifier of the organisation role to assign or remove. Roles grant a bundle of permissions across the user's organisation; for per-site permissions use the site-roles endpoint instead.

Responses

  • 204

    The role was successfully removed.

  • 401

    The user is unauthenticated

  • 403

    The authenticated user does not have permission.

  • 404

    The resource couldn't be found

  • 422

    The request didn't pass validation

get/roles

List Roles

listRoles

This endpoint retrieves a list of all the roles for the given organisation. The roles are assigned to users to grant them permissions.

Query parameters

  • querystringoptional

    A search query to filter roles by. This will search the role name.

  • archivedbooleanoptional

    Whether to include archived resources in the response. When true, archived resources are returned; when false or omitted, only non-archived resources are returned.

  • pageintegeroptional

    The page to retrieve results from

  • per_pageintegeroptional

    The number of results to return per page

Responses

  • 200

    The roles were successfully retrieved.

  • 401

    The user is unauthenticated

  • 404

    The resource couldn't be found

post/roles

Create a Role

createRole

This endpoint creates a role for the given organisation.

Request body

  • namestringrequired

    Display name of the role, shown in the admin UI when managing user permissions. Pick a name that summarises the role's responsibilities (e.g. "Spa Manager"). 1-120 characters.

  • organisation_iduuidrequired

    Identifier of the organisation that owns this role. Roles are scoped per organisation so each customer can define its own permission bundles; the role can be assigned to any user in the same organisation.

Responses

  • 201

    The role was successfully retrieved.

  • 401

    The user is unauthenticated

  • 403

    The authenticated user does not have permission.

  • 422

    The request didn't pass validation

get/roles/{roleId}

Show a Role

getRole

This endpoint retrieves a role for the given organisation.

Path parameters

  • roleIduuidrequired

    The ID of the Role

Responses

  • 200

    The role was successfully retrieved.

  • 401

    The user is unauthenticated

  • 404

    The resource couldn't be found

put/roles/{roleId}

Update a Role

updateRole

This endpoint updates a role for the given organisation.

Path parameters

  • roleIduuidrequired

    The ID of the Role

Request body

  • namestringoptional

    Display name of the role, shown in the admin UI when managing user permissions. Pick a name that summarises the role's responsibilities (e.g. "Spa Manager"). 1-120 characters.

  • descriptionstringoptionalnullable

    Free-text description of what the role is for, shown underneath the role name in the admin UI. Use it to record the scope and intent of the permission bundle. Plain text, up to 500 characters.

  • permissionsstring[]optionalnullable

    The permissions assigned to this role.

Responses

  • 200

    The role was successfully retrieved.

  • 401

    The user is unauthenticated

  • 403

    The authenticated user does not have permission.

  • 404

    The resource couldn't be found

  • 422

    The request didn't pass validation

delete/roles/{roleId}

Archive a Role

deleteRole

This endpoint soft deletes a role for the given organisation.

Path parameters

  • roleIduuidrequired

    The ID of the Role

Responses

  • 204

    The role was successfully archived.

  • 401

    The user is unauthenticated

  • 403

    The authenticated user does not have permission.

  • 404

    The resource couldn't be found

post/roles/{roleId}/copy

Copy a Role

actionCopyRole

This endpoint copies an existing role by ID.

Path parameters

  • roleIduuidrequired

    The ID of the Role

Request body

  • namestringrequired

    Display name for the duplicated role. The new role inherits the source role's permissions and description; the name distinguishes the copy from the original. 1-120 characters.

Responses

  • 200

    The role was successfully retrieved.

  • 401

    The user is unauthenticated

  • 403

    The authenticated user does not have permission.

  • 404

    The resource couldn't be found

  • 422

    The request didn't pass validation

post/roles/{roleId}/restore

Restore a Role

restoreRole

This endpoint restores an archived (soft-deleted) role by ID.

Path parameters

  • roleIduuidrequired

    The ID of the Role

Responses

  • 200

    The role was successfully retrieved.

  • 401

    The user is unauthenticated

  • 403

    The authenticated user does not have permission.

  • 404

    The resource couldn't be found

get/permissions

List Permissions

listPermissions

This endpoint retrieves a list of all possible permissions which can be assigned to a role.

Responses

  • 200

    The permissions were successfully retrieved.

  • 401

    The user is unauthenticated

  • 404

    The resource couldn't be found