Credentials
Agentpost accepts these credentials, and who is calling decides which one a request sends. The first three belong to a principal and reach Platform routes: workspaces, projects, keys, sending domains, and /v1/platform. The rest belong to a project and reach its services.
| Credential | Looks like | Sent by | Lasts |
|---|---|---|---|
| API key | agp_ak_apoa_… |
A principal, for Platform routes | Until it is revoked, or its expiresAt |
| Session | agp_st_apoa_… |
A principal, for Platform routes | 7 days idle, 30 days at most |
| Delegated token | agp_dt_apoa_… |
A delegate, for Platform routes | Up to 15 minutes |
| Secret key | sk_test_…, sk_live_… |
A project’s server | Until it is revoked, or a rotation ends |
| Publishable key | pk_test_…, pk_live_… |
A project’s web or native app | Until it is revoked |
| Session token | agp_st_… |
A principal signed in to your product | As the service’s config sets |
| User token | ut_test_…, ut_live_… |
An app, for its signed-in principal | 15 minutes by default, 1 hour at most |
| Workspace key | wk_test_…, wk_live_… |
A tool that spans a workspace | Until it is revoked or expires, or a rotation ends |
Choosing a credential
The table’s “Sent by” column says which credential each caller sends. Two more rules:
- On Platform routes, an API key, a session, and a delegated token reach the same routes. A principal’s API key and session act as that principal, within its role in each workspace. A delegated token acts as the delegator, within its delegation’s list.
- Platform routes never take a project’s keys, its principals’ session or user tokens, or a workspace key.
API keys
A principal gets its first API key when it starts a workspace, shown once, and issues itself more under /v1/platform/principals/{id}/api-keys. Each works until the principal revokes it, or until the expiresAt it was issued with. Principals says how a principal keeps a way to sign in.
Sessions
A principal gets a session by signing in with an emailed code. It ends after 7 days without use, 30 days after sign-in at the latest, or at sign-out.
Project keys
Each project key’s ID starts with key_; Environments explains which data a key reaches.
Session tokens
Learn how a sign-in keeps a principal’s session in your product, from the session token to what ends it.
Agents in your product
An agent in your product uses a delegated token, agp_dt_…, to act for another principal within permissions that principal approved.
Open streams
A live stream checks its credential again every 15 seconds. When the credential stops working, such as a revoked key or an expired token, the stream stops within 30 seconds and sends nothing after that.
When a credential is refused
On a route that takes a credential, one that is missing, unknown, expired, or revoked answers unauthenticated, and one that is valid but doesn’t reach the route answers forbidden. Two answer not_found instead: a project in a workspace the caller has no part in, and a service the project hasn’t adopted.
Where to act on it
- Start a workspace gets a principal’s API key, Sign in with an emailed code a session, and Create a project and issue a key a project’s keys.
- API basics says how a request sends its credential.