Mailbuttons Policy API
The policy API from Mailbuttons — 1 operation(s) for policy.
The policy API from Mailbuttons — 1 operation(s) for policy.
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-policy-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 Policy API
version: 1.0.0
servers:
- url: https://mbag.ai/api
- url: https://mailbuttons.com/api
security:
- apiKey: []
tags:
- name: Policy
paths:
/v1/mailboxes/{mailbox_id}/policy:
get:
operationId: getPolicy
parameters:
- in: path
name: mailbox_id
required: true
schema:
format: int32
type: integer
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/PolicyResponse'
description: The stored policy. `warnings` is always empty on GET.
'401':
$ref: '#/components/responses/Unauthorized'
'403':
content:
text/plain:
schema:
type: string
description: Mailbox exists but is owned by another user. Plain-text body.
'404':
content:
text/plain:
schema:
type: string
description: Mailbox not found, or the mailbox has no policy row. Plain-text body.
'500':
content:
text/plain:
schema:
type: string
description: Database error. Plain-text body.
security:
- apiKey: []
summary: Get a mailbox's mail policy
tags:
- Policy
put:
description: 'Validated before write: hard errors (regex won''t compile, a
`contentGuards[].reject` over 1024 chars, `auditLog.retentionDays` <
1, a `senders[].match` with neither `address` nor `domain`, an
`address`/`domain` of the wrong shape) reject the whole PUT with 400.
Unknown `capabilities` values are warnings only — they pass through
and are echoed back in `warnings`, not rejected. On success the
stored `version` is incremented by 1.'
operationId: putPolicy
parameters:
- in: path
name: mailbox_id
required: true
schema:
format: int32
type: integer
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/MailPolicy'
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/PolicyResponse'
description: The new stored policy, with the bumped `version` and any non-fatal `warnings`.
'400':
content:
application/json:
schema:
properties:
errors:
items:
type: string
type: array
required:
- errors
type: object
description: Policy failed validation.
'401':
$ref: '#/components/responses/Unauthorized'
'403':
content:
text/plain:
schema:
type: string
description: Mailbox exists but is owned by another user. Plain-text body.
'404':
content:
text/plain:
schema:
type: string
description: 'Mailbox not found, or (rarely) the mailbox''s policy row is
missing at write time even though ownership checked out. Plain-text
body.
'
'500':
content:
text/plain:
schema:
type: string
description: Database error, or the validated policy failed to serialise back to JSON. Plain-text body.
security:
- apiKey: []
summary: Replace a mailbox's mail policy
tags:
- Policy
components:
schemas:
PolicyResponse:
description: Field names are snake_case here (this wrapper predates the camelCase `MailPolicy` convention); only `policy`'s own fields are camelCase.
properties:
mailbox_id:
format: int32
type: integer
policy:
$ref: '#/components/schemas/MailPolicy'
version:
format: int32
type: integer
warnings:
description: Non-fatal validation warnings from PUT (e.g. unknown capability names). Omitted when empty; always empty on GET.
items:
type: string
type: array
required:
- mailbox_id
- version
- policy
type: object
MailPolicy:
description: 'camelCase on the wire. On PUT, `senders`/`contentGuards`/`blocklist`
default to empty and `mode` defaults to `live` when omitted; the GET/PUT
response always includes all of them (`blocklist` omitted when empty).
'
properties:
auditLog:
$ref: '#/components/schemas/AuditConfig'
blocklist:
description: Recipient addresses/bare domains this mailbox may never send to. Omitted when empty.
items:
type: string
type: array
contentGuards:
items:
$ref: '#/components/schemas/ContentGuard'
type: array
defaultAction:
enum:
- bounce
- drop
type: string
mode:
enum:
- live
- supervised
- shadow
type: string
senders:
items:
$ref: '#/components/schemas/SenderRule'
type: array
required:
- defaultAction
- senders
- contentGuards
- mode
- auditLog
type: object
SenderRule:
properties:
allowedHosts:
items:
type: string
type: array
capabilities:
description: Opaque capability strings; unknown values warn but don't reject at PUT time.
items:
type: string
type: array
match:
$ref: '#/components/schemas/SenderMatch'
passive:
description: When true, matching mail is accepted and audited but never invokes the agent.
type: boolean
rateLimit:
$ref: '#/components/schemas/RateLimit'
tokenBudget:
$ref: '#/components/schemas/TokenBudget'
required:
- match
- capabilities
- passive
type: object
SenderMatch:
properties:
address:
type: string
domain:
type: string
requireDkim:
type: boolean
requireSpf:
type: boolean
required:
- requireDkim
- requireSpf
type: object
AuditConfig:
properties:
includeBodyHash:
type: boolean
retentionDays:
format: int32
type: integer
required:
- retentionDays
- includeBodyHash
type: object
RateLimit:
properties:
perDay:
format: int32
type: integer
perHour:
format: int32
type: integer
type: object
ContentGuard:
properties:
reason:
type: string
reject:
description: Regex source (Rust `regex` crate flavour); compiled at PUT time.
type: string
required:
- reject
- reason
type: object
TokenBudget:
properties:
perDay:
format: int32
type: integer
perThread:
format: int32
type: integer
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