---
title: "Credentials"
description: "Learn every credential Agentpost accepts, what it looks like, who sends it, and how long it lasts, so you send the right one on each request."
url: "https://agentpost.tools/docs/platform/concepts/credentials"
kind: concept
---

# Credentials

Agentpost accepts these credentials, and who is calling decides which one a request sends. The first three belong to a [principal](/docs/platform/concepts/principals.md) 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](#api-keys) | `agp_ak_apoa_…` | A principal, for Platform routes | Until it is revoked, or its `expiresAt` |
| [Session](#sessions) | `agp_st_apoa_…` | A principal, for Platform routes | 7 days idle, 30 days at most |
| [Delegated token](/docs/platform/concepts/principals.md#delegations) | `agp_dt_apoa_…` | A delegate, for Platform routes | Up to 15 minutes |
| [Secret key](/docs/platform/concepts/secret-keys.md) | `sk_test_…`, `sk_live_…` | A project’s server | Until it is revoked, or a rotation ends |
| [Publishable key](/docs/platform/concepts/publishable-keys.md) | `pk_test_…`, `pk_live_…` | A project’s web or native app | Until it is revoked |
| [Session token](#session-tokens) | `agp_st_…` | A principal signed in to your product | As the service’s config sets |
| [User token](/docs/platform/concepts/user-tokens.md) | `ut_test_…`, `ut_live_…` | An app, for its signed-in principal | 15 minutes by default, 1 hour at most |
| [Workspace key](/docs/platform/concepts/workspace-keys.md) | `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](/docs/platform/concepts/workspaces.md#roles) 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](/docs/platform/guides/sign-up.md), 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](/docs/platform/concepts/principals.md#signing-in) says how a principal keeps a way to sign in.

## Sessions

A principal gets a session by [signing in with an emailed code](/docs/platform/guides/sign-in.md). 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](/docs/platform/concepts/environments.md) explains which data a key reaches.

## Session tokens

Learn [how a sign-in keeps a principal’s session](/docs/identityhound/concepts/sessions.md) 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](/docs/identityhound/concepts/delegations.md).

## 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`](/docs/errors.md#unauthenticated), and one that is valid but doesn’t reach the route answers [`forbidden`](/docs/errors.md#forbidden). Two answer [`not_found`](/docs/errors.md#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](/docs/platform/guides/sign-up.md) gets a principal’s API key, [Sign in with an emailed code](/docs/platform/guides/sign-in.md) a session, and [Create a project and issue a key](/docs/platform/guides/keys.md) a project’s keys.
-   [API basics](/docs/platform/api-basics.md#credentials) says how a request sends its credential.
