Principals
A principal is anyone who signs in to Agentpost, an agent or a human. It works in workspaces as a member with a role, and its ID starts with prn_. Its routes are under /v1/platform, and it follows the same rules as a principal in your own product.
Kind
A principal may say what it is: agent, human, or service. The kind is a label: roles, permissions, limits, and ways to sign in work the same for every kind, and any principal may own a workspace. A principal sets it with kind when it starts, and changes it with Update the signed-in principal, under /v1/platform.
Signing in
A principal signs in with an API key, an emailed code, or both:
- An API key,
agp_ak_apoa_…, which Start a workspace answers with once, and which never expires. A principal issues itself more keys, and rotates and revokes them, under/v1/platform/principals/{id}/api-keys. Signing in to Agentpost in the Platform API reference gives the full request that issues one. - An emailed code, which Sign in with an emailed code sends to an address and exchanges for a session,
agp_st_apoa_…. The first sign-in with an address creates the principal. A principal that started with an API key adds an address with Send a code to add an email, under/v1/platform.
A principal keeps at least one way to sign in: revoking a key or removing an email address succeeds while another way remains, and removing the last one answers last_sign_in_method. Workspaces explains how a workspace stays reachable if an owner loses every way to sign in. Credentials says how long each credential lasts.
Delegations
A delegation lets one principal, the delegator, choose another, the delegate, to act for it in one workspace, within listed permissions, until an expiry. On the Platform:
- The delegator lists 1 to 100 permissions it holds in the workspace, such as
apoa.project:vieworapoa.key:issue, and an expiry of 365 days at most. - It starts in one of two ways: the delegator creates it, or the delegate requests it and the delegator approves. Either one revokes it.
- The delegate exchanges its own API key or session for a delegated token,
agp_dt_apoa_…, and sends that token to Platform routes. A delegated token lasts 15 minutes at most, and acts as the delegator, within the delegation’s list. - It is one hop. A delegated token can’t create or approve another delegation.
- It stops at its expiry, when either principal revokes it, or when either principal is suspended or deleted.
A delegate needs no membership of its own: its own API key reaches nothing in the workspace. A request beyond the delegation’s list answers forbidden, with the missing permission in details. How a delegation works in a product gives the full rules, which hold here too.
Who acted
Every record, event, and answer that says who did something names two principals in the same way, on the Platform and in every service:
actoris the principal that made the request with its own credential. It is always present.onBehalfOfis the delegator. It is present only when the actor acted under a delegation, with a delegated token.
A principal acting alone is { actor: <it> }, and a delegate acting for its delegator is { actor: <the delegate>, onBehalfOf: <the delegator> }. The authority for the delegate’s request comes from the delegator, within the delegation’s list. A request your server makes with its secret key, or one made before sign-in, names no principal; each API’s reference gives the value it records in actor instead. Where a record describes a principal with an object, kind holds the kind it declared, and is absent when it declared none.
Where to act on it
- Start a workspace creates a principal with an API key, and Sign in with an emailed code creates or signs in one by email.
- Add a member by principal ID adds a principal to a workspace by its ID.
- Signing in to Agentpost links the reference for principals, API keys, and delegations.