Authentication
Authenticate with API keys or a portal session.
Postbound accepts two customer auth mechanisms on most routes.
API key (recommended for servers)
Send the key as a Bearer token:
Authorization: Bearer pb_…Keys are created in the portal or via POST /api-keys (full-access key or session required). Each key belongs to exactly one workspace.
Permissions
| Value | Access |
|---|---|
sending_access | Only POST /emails and POST /emails/batch. Optional domain_id restricts the key to that domain. |
full_access | Manage domains, keys, webhooks, audiences, billing (read / checkout flows), list and retrieve emails, receiving API, and other manage routes. |
If a sending key calls a manage route, the API responds with a restricted-key error.
Portal session
The Postbound portal uses an HTTP-only cookie (pb_session) after login, OAuth, or passkey sign-in. Session requests must come from an allowed portal origin.
Sessions behave like full access for the selected workspace, and also unlock user-scoped routes such as profile, appeals, and privacy exports. API keys cannot call those user-only routes.
Switch workspace (session only):
POST /auth/workspace
Content-Type: application/json
{ "workspace_id": "…" }Choosing the right credential
| Use case | Use |
|---|---|
| Application servers sending mail | API key (sending_access when possible) |
| Backend admin tooling / sync jobs | API key (full_access) |
| Browser portal UI | Session cookie |
| CI scripts | API key stored as a secret |
Missing or invalid credentials
Unauthenticated calls receive an error such as missing_api_key or invalid_api_key. See Errors.