Roles
Role definitions, assignments, and per-role user lookup.
Roles carry a JSONB permissions array. Users can be assigned zero-or-more roles; permission checks are performed in /client/roles/check/:permission against the union of the user's role permission lists.
Source: apps/api/src/routes/admin/roles.ts.
Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /admin/projects/:projectId/roles | Create a role. |
| GET | /admin/projects/:projectId/roles | List roles. |
| PATCH | /admin/projects/:projectId/roles/:roleId | Partial update. |
| DELETE | /admin/projects/:projectId/roles/:roleId | Delete a role. |
| POST | /admin/projects/:projectId/roles/assign | Assign a role to a user. |
| POST | /admin/projects/:projectId/roles/revoke | Revoke a role from a user. |
| GET | /admin/projects/:projectId/roles/:roleId/users | List users with a given role. |
POST /admin/projects/:projectId/roles
Request (CreateRoleInput)
| Field | Type | Required |
|---|---|---|
name | string | yes |
description | string | no |
permissions | string[] | yes |
Response 201
Try it:
POST
developer auth/admin/projects/%7B%7BprojectId%7D%7D/rolescurl -X POST 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/roles'Loading auth… Configure auth in the settings drawer (top-right) to run this request.
Curl:
GET /admin/projects/:projectId/roles
Try it:
GET
developer auth/admin/projects/%7B%7BprojectId%7D%7D/rolescurl -X GET 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/roles'Loading auth… Configure auth in the settings drawer (top-right) to run this request.
Curl:
PATCH /admin/projects/:projectId/roles/:roleId
Allowed fields: name, description, permissions.
Try it:
PATCH
developer auth/admin/projects/%7B%7BprojectId%7D%7D/roles/%7B%7BroleId%7D%7Dcurl -X PATCH 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/roles/%7B%7BroleId%7D%7D'Loading auth… Configure auth in the settings drawer (top-right) to run this request.
Curl:
DELETE /admin/projects/:projectId/roles/:roleId
Try it:
DELETE
developer auth/admin/projects/%7B%7BprojectId%7D%7D/roles/%7B%7BroleId%7D%7Dcurl -X DELETE 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/roles/%7B%7BroleId%7D%7D'Loading auth… Configure auth in the settings drawer (top-right) to run this request.
Curl:
POST /admin/projects/:projectId/roles/assign
Request (AssignRoleInput)
| Field | Type | Required |
|---|---|---|
app_user_id | uuid | yes |
role_id | uuid | yes |
Response 201
Try it:
POST
developer auth/admin/projects/%7B%7BprojectId%7D%7D/roles/assigncurl -X POST 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/roles/assign'Loading auth… Configure auth in the settings drawer (top-right) to run this request.
Curl:
POST /admin/projects/:projectId/roles/revoke
Same request shape as /assign. Deletes the user_roles row.
Response 200
Try it:
POST
developer auth/admin/projects/%7B%7BprojectId%7D%7D/roles/revokecurl -X POST 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/roles/revoke'Loading auth… Configure auth in the settings drawer (top-right) to run this request.
Curl:
GET /admin/projects/:projectId/roles/:roleId/users
Try it:
GET
developer auth/admin/projects/%7B%7BprojectId%7D%7D/roles/%7B%7BroleId%7D%7D/userscurl -X GET 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/roles/%7B%7BroleId%7D%7D/users'Loading auth… Configure auth in the settings drawer (top-right) to run this request.
Curl: