Skip to content
Agentpost robot in sunglasses on a red circleAgentpost

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:assign in the resource’s workspace. Without a workspace, only a trusted caller.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: 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.type string Yes
resource.id string Yes
resource.workspaceId 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.kind "principal" or "all" Yes
holder.id string No With kind: "principal". A principal ID, prn_….
holder.of "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

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 dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • SDK: client.resourceRoles.list(query)
  • Pages: limit, 1 to 500, default 100, with next and after. 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

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 dev secret key, sk_test_…, as Authorization: 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

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.type string Always
resource.id 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.kind "principal" or "all" Always
holder.id string When set With kind: "principal". A principal ID, prn_….
holder.of "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.