Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.
openapi: 3.2.0
info:
title: Postfleet Mailboxes API
version: 1.0.0
description: Hand-authored OpenAPI description of the Postfleet `/api/v1/**` REST surface. Every path, method, status code, request field, and error `code` is transcribed from the shipped route handlers under `src/app/api/v1/`; a drift test asserts this file stays in sync with the code. All endpoints authenticate with a bearer `pf_` API key. This spec documents shipped behavior only — see the `/docs` pages for narrative guides and current limitations.
servers:
- url: /
description: Same-origin (relative). Prefix every path with your deployment origin, e.g. https://your-app.example.com
security:
- bearerAuth: []
tags:
- name: mailboxes
description: Mailbox provisioning (account-plane).
paths:
/api/v1/mailboxes:
get:
operationId: listMailboxes
tags:
- mailboxes
summary: List mailboxes
description: 'Lists the mailboxes the key can use, newest first — the way an agent discovers the `mailbox_id` every other endpoint needs. An account-scoped key gets every mailbox on the account; a mailbox-bound key gets only its own (this route is the one account-plane read a bound key may make, so it can identify itself rather than being stranded). `domain_id: null` means the shared platform domain.'
responses:
'200':
description: Mailboxes.
content:
application/json:
schema:
type: object
properties:
mailboxes:
type: array
items:
$ref: '#/components/schemas/Mailbox'
required:
- mailboxes
additionalProperties: false
'401':
$ref: '#/components/responses/Unauthorized'
post:
operationId: createMailbox
tags:
- mailboxes
summary: Create a mailbox
description: 'Provisions a mailbox. Account-plane: a mailbox-bound key is rejected (`code:key_scope`). Accepts `bootstrap`, `api`, or `mcp` scope. Without `domain_id` the address is `agent-{slug}@{shared-domain}`; with a verified `domain_id` (paid plan) it is `{slug}@{your-domain}`.'
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/CreateMailboxRequest'
responses:
'201':
description: Mailbox created.
content:
application/json:
schema:
type: object
properties:
id:
type: string
address:
type: string
required:
- id
- address
additionalProperties: false
'400':
description: Invalid `slug`, or the referenced domain is not verified.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
description: Mailbox-bound key on an account-plane route (`code:key_scope`), the account is at its plan mailbox limit (`code:mailbox_limit`), or custom domains require a paid plan.
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/KeyScopeError'
- $ref: '#/components/schemas/Error'
'404':
description: Referenced `extraction_schema_id` or `domain_id` not found for this account.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
Error:
type: object
properties:
error:
type: string
required:
- error
additionalProperties: false
KeyScopeError:
type: object
properties:
error:
type: string
code:
type: string
const: key_scope
required:
- error
- code
additionalProperties: false
Mailbox:
type: object
properties:
id:
type: string
address:
type: string
display_name:
anyOf:
- type: string
- type: 'null'
domain_id:
anyOf:
- type: string
- type: 'null'
description: Custom domain id, or null for the shared platform domain.
domain_name:
anyOf:
- type: string
- type: 'null'
description: Custom domain name, or null for the shared platform domain.
created_at:
type: string
extraction_schema_id:
description: Omitted for mailbox-bound keys — it is an account-plane identifier they cannot act on.
anyOf:
- type: string
- type: 'null'
required:
- id
- address
- display_name
- domain_id
- domain_name
- created_at
additionalProperties: false
CreateMailboxRequest:
type: object
properties:
slug:
description: Local-part slug, `[a-z0-9][a-z0-9-]{0,40}`. Random hex if omitted.
type: string
pattern: ^[a-z0-9][a-z0-9-]{0,40}$
display_name:
type: string
extraction_schema_id:
description: Must belong to this account.
type: string
domain_id:
description: A verified custom domain (paid plan). Omit to use the shared domain.
type: string
additionalProperties: false
responses:
Unauthorized:
description: Missing or invalid bearer token, or a key whose scope is not permitted for this endpoint.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: 'A Postfleet API key, e.g. `Authorization: Bearer pf_...`. Keys carry a scope (`api`/`mcp`/`bootstrap`), optional mailbox binding, and `can_read`/`can_send` capabilities.'