Skip to main content

Admin API: Roles

Operations on roles in the Odudu admin API, one section each. Every request carries a bearer token; the index says which audience it needs and how a refusal is shaped.

GET /admin/tenants/{tenant}/roles​

Requires the "manage-tenant" capability, or "view-users".

Also readable with view-users, and so with manage-users, whose holder assigns roles and picks them from this list. Nothing else under /roles is.

Path parameters​

NameTypeRequiredDetails
tenantstringyesThe tenant being administered, addressed by name.

Query parameters​

NameTypeRequiredDetails
cursorstringnoThe next value of the previous page, to continue after it.
limitintegernoHow many items to return. A value over 200 is treated as 200; the default is 50. Constraints: at least 1.
namestringnoOnly roles whose name starts with this. Constraints: at least 1 character.
clientstringnoOnly the roles of one owner: tenant for the tenant’s own roles, or a client’s internal id for the roles scoped to it.

Responses​

200 OK​

Body: application/json

FieldTypeRequiredDetails
itemsarray of objectyesThe entries of this answer.
items[]objectyes
items[].idstringyesThe role’s identifier, a UUID.
items[].namestringyesThe role’s name, which a token carries. Fixed once the role is made.
items[].descriptionstring or nullyesWhat the role is for, or null.
items[].client_idstring or nullyesThe internal identifier of the client the role is scoped to, or null for a tenant role.
items[].client_keystring or nullyesThe client_id of that client, the name it is told apart by, or null for a tenant role. A token carries a client role as this, a colon and the role’s name.
items[].default_for_new_subjectsbooleanyesWhether every subject created from now on is given the role. Subjects that already exist are not changed.
items[].created_atstringyesWhen the role was created.
items[].admin_reacharray of stringyesThe admin capabilities the role hands out, however deep it nests them, as the capability ceiling judges them.
nextstringnoAn opaque cursor for the next page; absent on the last page.

401 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

403 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

POST /admin/tenants/{tenant}/roles​

Requires the "manage-tenant" capability.

Path parameters​

NameTypeRequiredDetails
tenantstringyesThe tenant being administered, addressed by name.

Request body​

Body: application/json

FieldTypeRequiredDetails
namestringyesThe role’s name, which a token carries. It cannot be changed afterwards. Constraints: no bidirectional control characters, at least 1 character.
descriptionstring or nullnoWhat the role is for. Constraints: no bidirectional control characters, at least 1 character, at most 1000 characters.
client_idstringnoThe internal identifier of the client to scope the role to; omit it for a tenant role.
default_for_new_subjectsbooleannoGive the role to every subject created from now on.

Responses​

201 Created​

Body: application/json

FieldTypeRequiredDetails
idstringyesThe role’s identifier, a UUID.
namestringyesThe role’s name, which a token carries. Fixed once the role is made.
descriptionstring or nullyesWhat the role is for, or null.
client_idstring or nullyesThe internal identifier of the client the role is scoped to, or null for a tenant role.
client_keystring or nullyesThe client_id of that client, the name it is told apart by, or null for a tenant role. A token carries a client role as this, a colon and the role’s name.
default_for_new_subjectsbooleanyesWhether every subject created from now on is given the role. Subjects that already exist are not changed.
created_atstringyesWhen the role was created.
admin_reacharray of stringyesThe admin capabilities the role hands out, however deep it nests them, as the capability ceiling judges them.

401 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

403 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

GET /admin/tenants/{tenant}/roles/count​

Requires the "manage-tenant" capability.

Path parameters​

NameTypeRequiredDetails
tenantstringyesThe tenant being administered, addressed by name.

Query parameters​

NameTypeRequiredDetails
namestringnoOnly roles whose name starts with this. Constraints: at least 1 character.
clientstringnoOnly the roles of one owner: tenant for the tenant’s own roles, or a client’s internal id for the roles scoped to it.

Responses​

200 OK​

Body: application/json

FieldTypeRequiredDetails
countintegeryesHow many items match, up to a cap.
cappedbooleanyesTrue when more match than count says, because counting stops at the cap.

401 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

403 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

GET /admin/tenants/{tenant}/roles/{id}​

Requires the "manage-tenant" capability.

Path parameters​

NameTypeRequiredDetails
tenantstringyesThe tenant being administered, addressed by name.
idstringyesA row id. Constraints: a UUID.

Responses​

200 OK​

Body: application/json

FieldTypeRequiredDetails
idstringyesThe role’s identifier, a UUID.
namestringyesThe role’s name, which a token carries. Fixed once the role is made.
descriptionstring or nullyesWhat the role is for, or null.
client_idstring or nullyesThe internal identifier of the client the role is scoped to, or null for a tenant role.
client_keystring or nullyesThe client_id of that client, the name it is told apart by, or null for a tenant role. A token carries a client role as this, a colon and the role’s name.
default_for_new_subjectsbooleanyesWhether every subject created from now on is given the role. Subjects that already exist are not changed.
created_atstringyesWhen the role was created.
admin_reacharray of stringyesThe admin capabilities the role hands out, however deep it nests them, as the capability ceiling judges them.

401 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

403 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

PATCH /admin/tenants/{tenant}/roles/{id}​

Requires the "manage-tenant" capability.

Path parameters​

NameTypeRequiredDetails
tenantstringyesThe tenant being administered, addressed by name.
idstringyesA row id. Constraints: a UUID.

Request body​

Body: application/json

FieldTypeRequiredDetails
(body)objectyesConstraints: other fields accepted.

Responses​

200 OK​

Body: application/json

FieldTypeRequiredDetails
idstringyesThe role’s identifier, a UUID.
namestringyesThe role’s name, which a token carries. Fixed once the role is made.
descriptionstring or nullyesWhat the role is for, or null.
client_idstring or nullyesThe internal identifier of the client the role is scoped to, or null for a tenant role.
client_keystring or nullyesThe client_id of that client, the name it is told apart by, or null for a tenant role. A token carries a client role as this, a colon and the role’s name.
default_for_new_subjectsbooleanyesWhether every subject created from now on is given the role. Subjects that already exist are not changed.
created_atstringyesWhen the role was created.
admin_reacharray of stringyesThe admin capabilities the role hands out, however deep it nests them, as the capability ceiling judges them.

401 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

403 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

DELETE /admin/tenants/{tenant}/roles/{id}​

Requires the "manage-tenant" capability.

Refused with 403 when what it removes reaches an admin capability the caller does not hold. Refused with 409 (about:blank#last-administrator) when it would leave no enabled subject holding tenant-admin — manage-tenants in the system tenant.

Path parameters​

NameTypeRequiredDetails
tenantstringyesThe tenant being administered, addressed by name.
idstringyesA row id. Constraints: a UUID.

Responses​

204 OK​

Body: application/json

FieldTypeRequiredDetails
(body)anyyes

401 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

403 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

GET /admin/tenants/{tenant}/roles/{id}/composites​

Requires the "manage-tenant" capability.

The role’s direct children only, not what they in turn include. Unpaged, like GET /groups/:id/roles: the list is one role’s own edges, which an operator edits edge by edge, not a tenant-wide collection.

Path parameters​

NameTypeRequiredDetails
tenantstringyesThe tenant being administered, addressed by name.
idstringyesA row id. Constraints: a UUID.

Responses​

200 OK​

Body: application/json

FieldTypeRequiredDetails
itemsarray of objectyesEvery built-in scope, in the order a new tenant is given them.
items[]objectyes
items[].idstringyesThe role’s identifier, a UUID.
items[].namestringyesThe role’s name, which a token carries. Fixed once the role is made.
items[].descriptionstring or nullyesWhat the role is for, or null.
items[].client_idstring or nullyesThe internal identifier of the client the role is scoped to, or null for a tenant role.
items[].client_keystring or nullyesThe client_id of that client, the name it is told apart by, or null for a tenant role. A token carries a client role as this, a colon and the role’s name.
items[].default_for_new_subjectsbooleanyesWhether every subject created from now on is given the role. Subjects that already exist are not changed.
items[].created_atstringyesWhen the role was created.
items[].admin_reacharray of stringyesThe admin capabilities the role hands out, however deep it nests them, as the capability ceiling judges them.

401 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

403 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

POST /admin/tenants/{tenant}/roles/{id}/composites​

Requires the "manage-tenant" capability.

A role nests at most 200 children; one more is refused with 409. Nests child_role_id under this role. Refused with 403 when the child reaches an admin capability the caller does not hold, or any admin capability at all while a default role or a default group reaches this one; 409 on a cycle, and on a parent belonging to the tenant’s built-in admin client, whose shape provisioning fixes. Answers the composites’ new ETag, the one GET …/composites answers; If-Match is optional, and a stale one is refused with 412.

Path parameters​

NameTypeRequiredDetails
tenantstringyesThe tenant being administered, addressed by name.
idstringyesA row id. Constraints: a UUID.

Request body​

Body: application/json

FieldTypeRequiredDetails
child_role_idstringyesThe role to nest in this one. Whoever holds this role then holds it too.

Responses​

204 OK​

Body: application/json

FieldTypeRequiredDetails
(body)anyyes

401 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

403 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

DELETE /admin/tenants/{tenant}/roles/{id}/composites/{childId}​

Requires the "manage-tenant" capability.

Removes one edge; 404 when there is none. Refused with 409 when the parent belongs to the tenant’s built-in admin client, since every administrator holding it would lose the child. Answers the composites’ new ETag; If-Match is optional, and a stale one is refused with 412. Refused with 403 when what it removes reaches an admin capability the caller does not hold. Refused with 409 (about:blank#last-administrator) when it would leave no enabled subject holding tenant-admin — manage-tenants in the system tenant.

Path parameters​

NameTypeRequiredDetails
tenantstringyesThe tenant being administered, addressed by name.
idstringyesA row id. Constraints: a UUID.
childIdstringyesA row id. Constraints: a UUID.

Responses​

204 OK​

Body: application/json

FieldTypeRequiredDetails
(body)anyyes

401 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

403 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

PUT /admin/tenants/{tenant}/roles/{id}/default​

Requires the "manage-tenant" capability.

At most 200 roles are default at once; one more is refused with 409. Sets whether every subject created afterwards, self-registered ones included, is granted this role. true is refused with 403 when the role reaches any admin capability, whoever the caller is; false is never refused. Answers the role’s ETag; If-Match is optional, and a stale one is refused with 412.

Path parameters​

NameTypeRequiredDetails
tenantstringyesThe tenant being administered, addressed by name.
idstringyesA row id. Constraints: a UUID.

Request body​

Body: application/json

FieldTypeRequiredDetails
defaultbooleanyesTrue to give every subject created from now on this group or role, false to stop. Subjects that already exist are not changed.

Responses​

200 OK​

Body: application/json

FieldTypeRequiredDetails
idstringyesThe role’s identifier, a UUID.
namestringyesThe role’s name, which a token carries. Fixed once the role is made.
descriptionstring or nullyesWhat the role is for, or null.
client_idstring or nullyesThe internal identifier of the client the role is scoped to, or null for a tenant role.
client_keystring or nullyesThe client_id of that client, the name it is told apart by, or null for a tenant role. A token carries a client role as this, a colon and the role’s name.
default_for_new_subjectsbooleanyesWhether every subject created from now on is given the role. Subjects that already exist are not changed.
created_atstringyesWhen the role was created.
admin_reacharray of stringyesThe admin capabilities the role hands out, however deep it nests them, as the capability ceiling judges them.

401 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

403 RFC 9457 problem details​

Body: application/problem+json, an RFC 9457 problem document described under problem details.

Documentation coverage: 65 of 65 fields described (100%).