Skip to content
Peal
Esc
↑↓navigate↵open⌘Jpreview
On this page

API conventions

What every endpoint has in common: request ids, the answers' shape, authentication and the workspace a request acts in.

Every endpoint of the API follows the same rules, so a client written for one handles them all. The API reference has what each endpoint takes and answers. The pages below cover what they share.

Requests and answers

Requests go to the address you open Peal at, under /api, and a workspace’s endpoints under /api/v1 (The workspace of a request). Bodies are JSON, sent with Content-Type: application/json. So are answers, except those with no body (204). A body of another type answers 415 unsupported_content_type.

Every answer carries an X-Request-Id header, whatever answered it and whether or not it succeeded. Here’s how the id works:

  • Send your own X-Request-Id and Peal keeps it, as long as it’s 8 to 128 characters of letters, digits, ., _, : and -. Otherwise the server issues one, a UUIDv7.
  • The id is on every line the server logs for the request (peal.request_id), in the body of every error (requestId) and in the workspace’s activity log.
  • Log it on your side, and quote it when you ask for help.

This request sends its own id:

curl -i https://api.example.com/api/v1/channels \
  -H "Authorization: Bearer $PEAL_API_KEY" \
  -H "X-Request-Id: nightly-sync:2026-11-16:0042"

The answer keeps it:

HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: nightly-sync:2026-11-16:0042
RateLimit-Policy: "default";q=600;w=60
RateLimit: "default";r=599;t=42
Peal-Version: 2026-11-09

The API only adds to what it answers (Versioning), so ignore the fields, values and errors your client doesn’t know.

Authentication

Every endpoint of the API needs a credential, sent as Authorization: Bearer …. The exceptions are the health checks, the changelog and the discovery documents. A few other endpoints answer someone who isn’t a member, by other means:

  • the pages of a connect link or a review link, which answer the link’s token;
  • the platforms’ data deletion callbacks, which the platform signs;
  • what the web app’s own pages send before anyone signs in: its error reports, the captcha’s site key, the sign-in routes under /api/auth.

Two credentials call the API:

Credential Acts as Allowed
An API key, peal_… The key itself, in the one workspace it belongs to The permissions chosen when it was created, such as post:read or post:schedule (API keys)
An OAuth access token The member who signed the application in What the member’s role allows, within the scopes they granted (What each permission allows)

The web app’s session cookie is for the web app only. A request whose credential in Authorization: Bearer … is refused gets a 401, whatever else it carries. Peal never falls back to a session cookie sent with it. Authentication, in the overview, describes each credential.

Each endpoint’s reference names the permission it needs. An OAuth token also needs the scope that carries it:

Scope Needed for
workspace:read Reading
workspace:write Changing something
workspace:publish Whatever needs post:schedule
workspace:ads What reaches an ad network: beside workspace:write for ads:manage, beside workspace:publish for ads:spend (Ads)

Every authorization names the resource it is for, the API or the MCP endpoint. A grant without one gets no token (invalid_target): Peal isn’t an identity provider for other applications.

When the credential doesn’t get through, you’ll see one of these:

Status Code When
400 workspace_required The request names no workspace, and the credential belongs to none (The workspace of a request).
401 unauthenticated No credential, or one that no longer works: a key revoked or expired, or a token past its time.
403 forbidden The credential works but doesn’t allow the request. reason says why (Errors).
404 not_found No such resource, or a workspace the caller doesn’t belong to.

The workspace of a request

A workspace’s endpoints are under /api/v1, and their paths don’t name the workspace. Each request acts in one workspace, decided in this order:

  1. The workspace whose id the Peal-Workspace header gives, when the request sends one.
  2. Otherwise, the workspace the credential belongs to: an API key’s, or the one an application’s OAuth token is bound to, as an MCP client’s is.
  3. Otherwise none, and the API answers 400 workspace_required without doing anything.
Credential Without Peal-Workspace With Peal-Workspace
An API key Its own workspace Its own workspace. Another one answers 403 forbidden (wrongWorkspace)
An application bound to a workspace That workspace That workspace. Another one answers 403 forbidden (wrongWorkspace)
The command line’s sign-in 400 workspace_required Any workspace its user belongs to
A partner key 400 workspace_required Any workspace its partner account owns
The web app’s session 400 workspace_required Any workspace its user belongs to

The header is optional for an API key, so its first call is POST /api/v1/posts with the key and nothing else. A workspace the caller doesn’t belong to answers 404 workspace_not_found, and so does a value that isn’t a workspace’s id. A blank header names no workspace, as if it weren’t sent.

A partner key names the customer’s workspace on every request inside it:

curl https://api.example.com/api/v1/channels \
  -H "Authorization: Bearer $PEAL_PARTNER_KEY" \
  -H "Peal-Workspace: 7b1f6c1e-2d4a-4f0b-9c3e-5a8d2e6f1b90"

The partner API keeps a workspace’s id in the path where the workspace is the thing it acts on, as in DELETE /api/v1/partner/workspaces/{workspaceId} (Embedding Peal).

Was this page helpful?