---
title: "API basics"
description: "Learn the rules Agentpost's APIs follow, from the base URL, the credential header, and JSON bodies to retrying a write, paging a list, and the error body, and where each API differs."
url: "https://agentpost.tools/docs/platform/api-basics"
kind: api-basics
---

# API basics

These are the rules Agentpost’s APIs follow: Agentpost’s own Platform routes and every service’s API. Each rule is written here once. An API’s reference gives that API’s own values, such as which writes take an idempotency key and how many items a list holds, and links here for the rule.

## Base URL

Every request goes to `https://api.agentpost.tools`. Agentpost’s own routes are under `/v1`, such as `/v1/projects`. A service answers under its own path, such as `/v1/identity`, for each project that adopted it, and its reference gives paths relative to that path.

## Credentials

For a request that needs a credential, send one as `Authorization: Bearer <credential>`. [Credentials](/docs/platform/concepts/credentials.md) describes each, and each operation in a reference names the credentials it takes. A [workspace key](/docs/platform/concepts/workspace-keys.md#naming-the-project) also names the project it reads in the `x-agentpost-project` header on service requests.

## Bodies

Send a body as JSON, with `Content-Type: application/json`. A body that isn’t valid JSON, or isn’t a JSON object, answers [`invalid_request`](/docs/errors.md#invalid_request). Every answer with a body is JSON, except a streaming operation’s, which is `text/event-stream`. An answer with no body, such as `204`, has none.

## Retrying a write

An API that takes idempotency keys lets you retry a write without making it twice. Send `Idempotency-Key: <key>` with the write, where the key is a value you choose for this one request, such as an order’s ID. A network error or a timeout doesn’t tell you whether the write happened: send the same request again with the same key.

-   **The same key with the same request** answers with the first answer, for as long as the API keeps the key. A replayed answer carries `Idempotent-Replayed: true`.
-   **Only while you may still make the request.** The API checks the credential’s access again before it gives the saved answer.
-   **The same key with a different request** answers `idempotency_mismatch`. Use a new key for a new request.
-   **A retry while the first request is still running** answers `conflict`. Wait, then retry with the same key.
-   **A key is the caller’s own.** The same value sent with another caller’s credential is another key.

An API’s reference says under Conventions whether its writes take keys. For an API that takes them, each write’s entry says whether its key is required, optional, or not taken, and gives any rule of its own. For an API that takes no keys, read the resource before you retry a write, to see whether the first one happened. Agentpost’s own writes take no keys, and a write under `/v1/platform` follows the key rules of the API that serves it. [Where each API differs](#where-each-api-differs) says which APIs take keys and how long each keeps one.

## Dates, durations, and IDs

-   **Dates** are ISO 8601 strings. An answer gives them in UTC, with milliseconds, such as `2026-11-13T09:30:00.000Z`. A date you send carries its zone, `Z` or an offset such as `+02:00`.
-   **Durations** are strings with a whole number and a unit, `ms`, `s`, `m`, `h`, or `d`, such as `"500ms"`, `"15m"`, or `"30d"`. Each field sets its own range.
-   **IDs** start with a prefix that names their kind, then an underscore: `wsp_` for a workspace, `prj_` for a project, `key_` for a key, `wkey_` for a workspace key, `utk_` for a user token, and `prn_` for a principal, an agent or a human. Each service’s reference lists its own prefixes.

## Lists

A list operation answers with one page of items.

-   **`limit`** sets the most items one answer holds. Each API sets its range and default.
-   **`next`** is the cursor for the next page. While an answer has `next`, send it as `after` with the same filters. An answer without `next` is the last page.
-   **A feed,** such as a change feed, has no last page: every answer has `next`. Send it as `after` on the next read. A read that answers with fewer items than `limit` has caught up.
-   **A list that takes no `limit`** answers with every item in one response.

Each list operation’s entry gives its `limit` and says whether it pages.

## Errors

Every error answers with a `4xx` or `5xx` status and a body with these fields, which hold a stable code to act on and a link to the code’s entry. The one exception is `405`, which has [no body](#unsupported-methods):

```json
{
  "error": {
    "code": "unauthenticated",
    "message": "a principal's API key, session, or delegated token is required",
    "docs": "https://agentpost.tools/docs/errors#unauthenticated"
  }
}
```

-   **`code`** is what to act on. It never changes for a given error; `message` is for reading and may change.
-   **`details`,** when present, holds what the code needs, such as `issues` or `invalid` for `invalid_request`, `confirm` for `confirmation_required`, and `retryAfter`, in seconds, for `throttled`.
-   **`docs`** links to the code’s entry and what to do about it. Agentpost uses [`/docs/errors`](/docs/errors.md), and each service uses `/docs/<service>/errors`. On `/v1/platform`, an error from the operation links to [`/docs/identityhound/errors`](/docs/identityhound/errors.md). If Agentpost answers before the operation runs, such as when it refuses a credential or answers `not_ready`, the error links to `/docs/errors`.
-   **Another field:** an API can add one of its own to `error`, which its errors page describes.

## Unsupported methods

A method a path doesn’t serve answers `405` with no body, and an `Allow` header that lists the methods the path does serve, such as `Allow: GET, POST`.

## Where each API differs

Each API sets its own base path, which writes take an idempotency key, and its page sizes. Each API’s name in the table links to its reference’s Conventions, which give those values in full, with its ID prefixes and its errors page.

| API | Base path | Idempotency-Key | Lists |
| --- | --- | --- | --- |
| [Platform](/docs/platform/reference.md#conventions) | `/v1` | Agentpost’s own writes take none. Under `/v1/platform`, [IdentityHound’s](/docs/identityhound/reference.md#conventions). | `limit` up to 200. Every list pages with `next` and `after`. |
| [IdentityHound](/docs/identityhound/reference.md#conventions) | `/v1/identity` | Every write takes one, [except 6](/docs/identityhound/reference.md#conventions). Kept for 24 hours. | `limit` up to 500. 6 of 8 lists page with `next` and `after`. |
| [EventWolf](/docs/eventwolf/reference.md#conventions) | `/v1/events` | Every write takes one, [except 5](/docs/eventwolf/reference.md#conventions). Kept for 24 hours. | `limit` up to 200. Every list pages with `next` and `after`. |
| [ResourceShark](/docs/resourceshark/reference.md#conventions) | `/v1/resources` | Every write takes one, [except 1](/docs/resourceshark/reference.md#conventions). Kept for 24 hours. | `limit` up to 500. 11 of 13 lists page with `next` and `after`. |
