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:
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 Send API
version: 1.0.0
servers:
- url: https://mbag.ai/api
- url: https://mailbuttons.com/api
security:
- apiKey: []
tags:
- name: Send
paths:
/v1/mailboxes/{mailbox_id}/send:
post:
description: 'Single recipient. Runs the full governance pipeline: ownership, the
mailbox''s policy blocklist, its operating mode (shadow mode refuses),
and the account''s tier send caps. Only a send that actually leaves
consumes quota.'
operationId: sendEmail
parameters:
- in: path
name: mailbox_id
required: true
schema:
format: int32
type: integer
requestBody:
content:
application/json:
schema:
properties:
html_body:
description: Optional HTML part alongside the plain text.
type: string
subject:
type: string
text_body:
minLength: 1
type: string
to:
description: Exactly one recipient email address.
type: string
required:
- to
- subject
- text_body
type: object
required: true
responses:
'200':
content:
application/json:
schema:
properties:
message_id:
description: JMAP id of the created message
type: string
status:
enum:
- sent
type: string
required:
- message_id
- status
type: object
description: Sent.
'400':
description: Invalid `to` or empty `text_body`.
'401':
$ref: '#/components/responses/Unauthorized'
'403':
content:
application/json:
schema:
properties:
error:
enum:
- send_blocked_by_policy
type: string
rule:
type: string
type: object
description: Recipient blocked by the mailbox policy.
'404':
description: Mailbox not found (or not yours).
'409':
description: Mailbox is in shadow assessment mode; sends are suppressed.
'429':
content:
application/json:
schema:
properties:
error:
enum:
- send_cap_daily
- send_cap_monthly
type: string
message:
type: string
type: object
description: Tier send cap reached.
'502':
description: Upstream mail server rejected the send.
security:
- apiKey: []
summary: Compose and send a fresh email from a mailbox you own
tags:
- Send
components:
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