Resource roles
A role on one resource, such as editor of one report, held by a principal, by every principal that is not a guest, or by every guest.
Roles explains resource roles beside project and workspace roles.
Paths are relative to https://api.agentpost.tools/v1/identity, and every request follows the API basics. Who may call explains each kind of caller.
Assign a resource role
POST /resource-roles
Gives a principal, every principal that is not a guest, or every guest a role on a resource.
- Who may call: Your server or a signed-in principal.
- Access: Needs
identity.resource_role:assignin the resource’s workspace. Without a workspace, only a trusted caller. - Credential: the examples send your project’s
devsecret key,sk_test_…, asAuthorization: Bearer <token>. - SDK:
client.resourceRoles.assign(input) - Idempotency-Key: optional. Retrying a write has the rule.
Body
| Name | Type | Required | Description |
|---|---|---|---|
resource |
object |
Yes | |
resource. |
string |
Yes | |
resource. |
string |
Yes | |
resource. |
string |
No | The workspace the resource belongs to. Workspace roles count only when it is set, so leave it out only for a resource outside any workspace. |
holder |
object |
Yes | |
holder. |
"principal" or "all" |
Yes | |
holder. |
string |
No | With kind: "principal". A principal ID, prn_…. |
holder. |
"principal" or "guest" |
No | With kind: "all". principal: every principal that is not a guest. guest: every guest. |
role |
string |
Yes | A role key from the config, such as “member”. |
expiresAt |
string |
No | An ISO 8601 date and time. |
Response
201 Created, with:
| Name | Type | Present | Description |
|---|---|---|---|
resourceRole |
ResourceRole |
Always |
Errors
conflict(409)forbidden(403)not_found(404)role_not_assignable(422)trusted_caller_required(403)
Any operation can also answer with the codes Conventions lists.
List resource roles
GET /resource-roles
The roles on one resource, or the roles one holder holds.
- Who may call: Your server or a signed-in principal.
- Access: By resource, needs
identity.resource_role:view. By holder, a principal may list only its own. - Credential: the examples send your project’s
devsecret key,sk_test_…, asAuthorization: Bearer <token>. - SDK:
client.resourceRoles.list(query) - Pages:
limit, 1 to 500, default 100, withnextandafter. Lists has the rule.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit |
integer |
No | 1–500; default 100. |
after |
string |
No | 1–64 characters. |
resourceType |
string |
No | |
resourceId |
string |
No | |
workspaceId |
string |
No | A workspace ID, wsp_…. |
holder |
string |
No |
Response
200 OK, with:
| Name | Type | Present | Description |
|---|---|---|---|
resourceRoles |
ResourceRole array |
Always | |
next |
string |
When set |
Errors
forbidden(403)trusted_caller_required(403)
Any operation can also answer with the codes Conventions lists.
Remove a resource role
DELETE /resource-roles/:id
Removes a resource role.
- Who may call: Your server or a signed-in principal.
- Access: Needs
identity.resource_role:remove. - Credential: the examples send your project’s
devsecret key,sk_test_…, asAuthorization: Bearer <token>. - SDK:
client.resourceRoles.remove(id) - Idempotency-Key: optional. Retrying a write has the rule.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
Yes | A resource role ID, rro_…. The id of a ResourceRole. |
Response
204 No Content, with no body.
Errors
forbidden(403)not_found(404)trusted_caller_required(403)
Any operation can also answer with the codes Conventions lists.
The ResourceRole object
A role held on one resource (ih_resource_roles).
| Name | Type | Present | Description |
|---|---|---|---|
id |
string |
Always | A resource role ID, rro_…. |
resource |
object |
Always | |
resource. |
string |
Always | |
resource. |
string |
Always | |
workspaceId |
string |
When set | The resource’s home workspace, if any. Assignments without one are managed by trusted callers. |
holder |
object |
Always | A resource role’s holder: a principal, every guest, or every principal that is not a guest; never a workspace. |
holder. |
"principal" or "all" |
Always | |
holder. |
string |
When set | With kind: "principal". A principal ID, prn_…. |
holder. |
"principal" or "guest" |
When set | With kind: "all". What a role, a grant, a resource role, or an invitation may say about who holds or accepts it: guest for a guest, or principal for every principal that is not a guest. A declared kind never counts. |
role |
string |
Always | |
assignedBy |
string |
Always | A principal ID, prn_…, or "trusted_caller". |
createdAt |
string |
Always | An ISO 8601 date and time. |
expiresAt |
string |
When set | An ISO 8601 date and time. |