Mailbuttons Mailboxes API
The mailboxes API from Mailbuttons — 2 operation(s) for mailboxes.
The mailboxes API from Mailbuttons — 2 operation(s) for mailboxes.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/mailbuttons-com:mailbuttons-com-mailboxes-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a 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.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
description: 'REST API for provisioning and operating governed email accounts for AI
agents, on mbag.ai and mailbuttons.com. Authenticate with a Bearer API
key: `mbk_`-prefixed when obtained via the OTP flow below (see `/auth/otp/cli-exchange`);
dashboard-issued keys carry no prefix.'
title: Mailbuttons Agent Mail Mailboxes API
version: 1.0.0
servers:
- url: https://mbag.ai/api
- url: https://mailbuttons.com/api
security:
- apiKey: []
tags:
- name: mailboxes
paths:
/v1/mailboxes:
get:
operationId: listMailboxes
responses:
'200':
content:
application/json:
schema:
items:
$ref: '#/components/schemas/MailboxWithDomain'
type: array
description: Mailboxes owned by the authenticated user, newest first.
'401':
$ref: '#/components/responses/Unauthorized'
'500':
content:
text/plain:
schema:
type: string
description: Database error. Plain-text body.
security:
- apiKey: []
summary: List the caller's mailboxes
tags:
- mailboxes
post:
description: 'Creates the mailbox row, seeds its default policy, and provisions the
domain/user/mailbox in Stalwart, all inside one transaction — a
Stalwart provisioning failure rolls back the DB row. Subject to the
account tier''s mailbox limit.'
operationId: createMailbox
requestBody:
content:
application/json:
schema:
properties:
description:
type:
- string
- 'null'
domain_id:
format: int32
type: integer
email_local_part:
description: 'Local part of the mailbox address. Lowercased; must be
1-64 chars of alphanumerics, `.`, `-`, `_`. Falls back to
a normalised form of `name` when omitted or invalid.
'
type:
- string
- 'null'
name:
type: string
required:
- name
- domain_id
type: object
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/MailboxRecord'
description: Mailbox created.
'400':
content:
text/plain:
schema:
type: string
description: Invalid domain id, domain not owned by caller, domain not verified, or no usable email handle could be derived.
'401':
$ref: '#/components/responses/Unauthorized'
'403':
content:
text/plain:
schema:
type: string
description: Account's mailbox limit reached.
'409':
content:
text/plain:
schema:
type: string
description: The derived email address is already in use.
'500':
content:
text/plain:
schema:
type: string
description: Database error (tier lookup, count, insert, policy seed, transaction).
'502':
content:
text/plain:
schema:
type: string
description: Stalwart domain/user/mailbox provisioning failed; the DB transaction was rolled back.
security:
- apiKey: []
summary: Provision a new mailbox
tags:
- mailboxes
/v1/mailboxes/{mailbox_id}:
delete:
description: 'Best-effort deletes the Stalwart mailbox and user first (failures
there are ignored), then deletes the DB row.'
operationId: deleteMailbox
parameters:
- in: path
name: mailbox_id
required: true
schema:
format: int32
type: integer
responses:
'204':
description: Deleted.
'401':
$ref: '#/components/responses/Unauthorized'
'404':
content:
text/plain:
schema:
type: string
description: Mailbox not found (or not owned by the caller).
'500':
content:
text/plain:
schema:
type: string
description: Database error deleting the row.
security:
- apiKey: []
summary: Delete a mailbox
tags:
- mailboxes
get:
operationId: getMailbox
parameters:
- in: path
name: mailbox_id
required: true
schema:
format: int32
type: integer
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/MailboxWithDomain'
description: The mailbox.
'401':
$ref: '#/components/responses/Unauthorized'
'500':
content:
text/plain:
schema:
type: string
description: 'Mailbox not found (or not owned by the caller) or a database
error — both surface identically as 500 with a plain-text body,
because the handler uses `fetch_one` without distinguishing
"no row" from other query errors.
'
security:
- apiKey: []
summary: Get a mailbox by id
tags:
- mailboxes
put:
description: Every field is optional; omitted fields are left unchanged.
operationId: updateMailbox
parameters:
- in: path
name: mailbox_id
required: true
schema:
format: int32
type: integer
requestBody:
content:
application/json:
schema:
properties:
description:
type:
- string
- 'null'
is_active:
type:
- boolean
- 'null'
name:
type:
- string
- 'null'
type: object
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/MailboxRecord'
description: The updated mailbox.
'401':
$ref: '#/components/responses/Unauthorized'
'500':
content:
text/plain:
schema:
type: string
description: 'Mailbox not found (or not owned by the caller) or a database
error — both surface identically as 500 with a plain-text body,
because the handler uses `fetch_one` without distinguishing
"no row" from other query errors.
'
security:
- apiKey: []
summary: Update a mailbox's name, description, or active flag
tags:
- mailboxes
components:
schemas:
MailboxWithDomain:
properties:
created_at:
format: date-time
type: string
description:
type:
- string
- 'null'
domain_id:
format: int32
type: integer
domain_name:
type: string
email_address:
type: string
id:
format: int32
type: integer
is_active:
type: boolean
name:
type: string
updated_at:
format: date-time
type: string
user_id:
format: int64
type: integer
required:
- id
- user_id
- domain_id
- domain_name
- name
- email_address
- is_active
- created_at
- updated_at
type: object
MailboxRecord:
properties:
created_at:
format: date-time
type: string
description:
type:
- string
- 'null'
domain_id:
format: int32
type: integer
email_address:
type: string
id:
format: int32
type: integer
is_active:
type: boolean
name:
type: string
updated_at:
format: date-time
type: string
user_id:
format: int64
type: integer
required:
- id
- user_id
- domain_id
- name
- email_address
- is_active
- created_at
- updated_at
type: object
responses:
Unauthorized:
content:
application/json:
schema:
properties:
error:
enum:
- Missing Authorization header
- Bearer authorization required
- Invalid API key
- API key disabled
type: string
required:
- error
type: object
description: 'Missing or invalid credential, raised by the `ApiKeyAuth` extractor
(`backend/src/api_keys.rs`) before the handler runs: no
`Authorization` header, a non-`Bearer` scheme, a key that doesn''t
hash-match any row, or a key whose status isn''t `active`. A header
that isn''t valid UTF-8, has no scheme token, or has `Bearer` with no
key value returns 400 with this same JSON shape instead of 401.
'
securitySchemes:
apiKey:
bearerFormat: API key
scheme: bearer
type: http