Skip to content
Agentpost robot in sunglasses on a red circleAgentpost

Project roles

Roles a principal holds across the project. Only your server assigns or removes them. Read them in the principal’s projectRoles.

Roles explains the three places a role is held, and how a check tries them.

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 project role

POST /principals/:id/project-roles

Gives an active principal a configured role with scope: "project", when the role’s assignableTo opens it to the principal: a guest only where it lists guest. Answers with the principal. Assigning a role it already holds changes nothing.

  • Who may call: Your server.
  • Access: Emits project_role.assigned with principalId and role only when the role is added.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • SDK: client.projectRoles.assign(principalId, input)
  • Idempotency-Key: optional. Retrying a write has the rule.

Path parameters

Name Type Required Description
id string Yes A principal ID, prn_…. The id of a Principal.

Body

Name Type Required Description
role string Yes A configured project role, such as “support”.

Response

200 OK, with:

Name Type Present Description
principal Principal Always

Errors

Any operation can also answer with the codes Conventions lists.

Remove a project role

DELETE /principals/:id/project-roles/:role

Removes a project role, including from a suspended principal or after the role leaves the config. Removing a role it does not hold changes nothing.

  • Who may call: Your server.
  • Access: Emits project_role.removed with principalId and role only when the role is removed. A deleted or missing principal answers not_found.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • SDK: client.projectRoles.remove(principalId, role)
  • Idempotency-Key: optional. Retrying a write has the rule.

Path parameters

Name Type Required Description
id string Yes A principal ID, prn_…. The id of a Principal.
role string Yes A project role: a key of the config’s roles whose scope is project, such as support.

Response

204 No Content, with no body.

Errors

Any operation can also answer with the codes Conventions lists.