---
title: "Agentpost errors"
description: "Look up an error code from the Platform API to learn what it means and what to do next."
url: "https://agentpost.tools/docs/errors"
kind: errors
---

# Agentpost errors

Every error code the Platform API answers with has an entry here, with its HTTP status in bold, what it means, and what to do. Act on the error’s `error.code`. The body’s `error.docs` links straight to the entry. [API basics](/docs/platform/api-basics.md#errors) describes the body and says which errors page an error from a route under `/v1/platform` links to.

## Error codes

### `invalid_request`

**400.** The body, a query parameter, or a field in it is missing or not valid, such as a project with no name or a key with no environment. The message names the field. When a list of values was checked, `details` names each one that failed, such as `details.invalid` for allowed origins. A workspace key that names no project, or something other than one project ID, and a credential other than a workspace key that names a project other than its own, get this with `details.header` set to `x-agentpost-project`.

**What to do:** Fix the request as the message says and send it again. Retrying it unchanged fails the same way.

### `unauthenticated`

**401.** The request has no credential, or its credential is unknown, expired, or revoked. A workspace key whose workspace is archived answers this too. The message says which credential the route needs.

**What to do:** Send the credential the [reference](/docs/platform/reference.md) names for the route as `Authorization: Bearer <token>`; [Credentials](/docs/platform/concepts/credentials.md) explains each one. A principal whose session ended signs in again, and one whose API key was revoked uses another; a server whose key was revoked needs a new key.

### `secret_key_invalid`

**401.** A project’s secret key, `sk_test_…` or `sk_live_…`, was refused: it is unknown, revoked, or past its rotation grace, belongs to the other environment, or its project was deleted. Only a secret key gets this code, so it always means the server’s configuration, never a visitor’s ended session, which answers `unauthenticated`.

**What to do:** Send a current secret key for the environment you call: `sk_test_…` for `dev` and `sk_live_…` for `prd`. If it was revoked or rotated out, issue a new one with `POST /v1/projects/{id}/keys`. Retrying with the same key fails the same way.

### `forbidden`

**403.** The credential is valid but doesn’t reach this operation. Either it is the wrong kind, such as a project’s secret key on a Platform route, or its holder lacks the permission: a member’s role in the workspace doesn’t hold it, or a delegated token’s delegation doesn’t list it. Only an owner deletes a project, archives a workspace, or adds, invites, or removes an owner. A refused permission check names the permission, the workspace, and IdentityHound’s check reason in `details`. A workspace key reaches only the reads its permissions name; refused anything else, `details.permissions` lists what it holds and `details.operations` what those allow.

**What to do:** Use the credential the route asks for. For a missing permission, ask a workspace owner or admin for a role that holds it. A delegate asks its delegator for a delegation that lists it. The reason’s entry on [IdentityHound’s errors page](/docs/identityhound/errors.md#check-reasons) says more.

### `origin_not_allowed`

**403.** A publishable key was sent from a browser origin it doesn’t list, in `details.origin`, or with no `Origin` header, as a native app or a server sends it, when the key doesn’t allow native apps.

**What to do:** For a website, add its origin to the key with `PATCH /v1/projects/{id}/keys/{keyId}` and `allowedOrigins`. For a native app, such as an iOS, Android, or Expo app, set `allowNativeApps: true` with the same call, or issue a key for the app with it. Either change takes effect on the next request. A native app never sets `Origin` by hand. A server sends a secret key instead.

### `not_found`

**404.** There is no such route, record, or token, or it belongs to a workspace the caller has no part in. A project that hasn’t adopted a service answers this on that service’s routes. A workspace key gets this for a project that isn’t in its workspace, the same as for an ID that doesn’t exist.

**What to do:** Check the path and the ID. List what the caller can reach, such as `GET /v1/projects`, or `GET /v1/workspace-keys/current` for a workspace key, to find the right one. Adopt the service before calling it.

### `conflict`

**409.** The record changed in a way that rules this request out, such as rotating a key that was already rotated or revoked.

**What to do:** Read the record again and act on what it says now. To rotate, rotate the key that replaced this one, named in its `replacedBy`.

### `confirmation_required`

**400.** The operation can’t be undone, such as deleting a project or rotating a key with no grace window, so it needs a confirmation. `details.confirm` holds the value to send.

**What to do:** Make sure that is what you mean, then send the request again with `confirm` set to the value in `details.confirm`, such as the project’s name.

### `throttled`

**429.** Too many requests came from one place in a short window, such as more than 10 signups from one address in an hour. `details.retryAfter` is how many seconds to wait.

**What to do:** Wait `details.retryAfter` seconds, then try again.

### `quota_exceeded`

**403.** The workspace reached a limit. A workspace holds 100 projects unless Agentpost changed its limit. `details.projects` says how many it holds and the most it may hold.

**What to do:** An owner deletes a project the workspace no longer needs, which frees its place, then creates the new one. `GET /v1/workspaces/{workspaceId}` shows the count and the limit.

### `balance_exhausted`

**402.** The workspace’s prepaid balance is at $0 or below, and it has no grace or its grace is over, so the services’ billable operations are refused. `details.balance` is the balance and `details.workspaceId` the workspace. Nothing else changes: its data stays, and reading its balance and usage and adding credit still work.

**What to do:** An owner or admin adds credit to the workspace. Calls work again within about a minute of the balance going above $0. Retrying before then fails the same way.

### `internal_error`

**500.** Something went wrong on Agentpost’s side. Nothing you sent caused it.

**What to do:** Retry with backoff. Agentpost’s own routes take no `Idempotency-Key`, so before you retry one of their writes, read the resource to see whether the first one happened. If you sent a write under `/v1/platform` with an `Idempotency-Key`, send it again with the same key. If it keeps failing, contact Agentpost.

### `not_ready`

**503.** The API is starting up after a deploy and hasn’t finished updating its databases.

**What to do:** Retry after a few seconds, with backoff.

### `unavailable`

**503.** Agentpost isn’t set up for the operation, such as a sending domain while its email provider is missing, or a workspace’s events while Agentpost isn’t recording them.

**What to do:** Contact Agentpost.
