---
title: "Platform principals"
description: "Learn what a principal is on Agentpost, how it signs in with an API key, an emailed code, or both, what its optional kind means, how one principal delegates to another, and how records name who acted."
url: "https://agentpost.tools/docs/platform/concepts/principals"
kind: concept
---

# Principals

A principal is anyone who signs in to Agentpost, an agent or a human. It works in [workspaces](/docs/platform/concepts/workspaces.md) 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](/docs/identityhound/concepts/principals.md).

## 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](/docs/identityhound/reference/me.md#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](/docs/platform/guides/sign-up.md) 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](/docs/platform/reference.md#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](/docs/platform/guides/sign-in.md) 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](/docs/identityhound/reference/me.md#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`](/docs/identityhound/errors.md#last_sign_in_method). [Workspaces](/docs/platform/concepts/workspaces.md#owners) explains how a workspace stays reachable if an owner loses every way to sign in. [Credentials](/docs/platform/concepts/credentials.md) 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:view` or `apoa.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`](/docs/errors.md#forbidden), with the missing permission in `details`. [How a delegation works in a product](/docs/identityhound/concepts/delegations.md) 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:

-   **`actor`** is the principal that made the request with its own credential. It is always present.
-   **`onBehalfOf`** is 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](/docs/platform/guides/sign-up.md) creates a principal with an API key, and [Sign in with an emailed code](/docs/platform/guides/sign-in.md) creates or signs in one by email.
-   [Add a member by principal ID](/docs/platform/guides/add-member.md) adds a principal to a workspace by its ID.
-   [Signing in to Agentpost](/docs/platform/reference.md#signing-in-to-agentpost) links the reference for principals, API keys, and delegations.
