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.assignedwithprincipalIdandroleonly when the role is added. - Credential: the examples send your project’s
devsecret key,sk_test_…, asAuthorization: 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
forbidden(403)not_found(404)role_not_assignable(422)trusted_caller_required(403)
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.removedwithprincipalIdandroleonly when the role is removed. A deleted or missing principal answersnot_found. - Credential: the examples send your project’s
devsecret key,sk_test_…, asAuthorization: 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
not_found(404)trusted_caller_required(403)
Any operation can also answer with the codes Conventions lists.