Mailbuttons Jmap API

The jmap API from Mailbuttons — 2 operation(s) for jmap.

GitHub OpenAPI

Operations 2

POST /v1/jmap Forward a raw JMAP method-call request to the mailbox's own Stalwart principal #
GET /v1/jmap/session Fetch the JMAP session object for the mailbox's own Stalwart principal #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • 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.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/mailbuttons-com:mailbuttons-com-jmap-api"
All apis
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.

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.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

mailbuttons-com-jmap-api-openapi.yml Raw ↑
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 Jmap API
  version: 1.0.0
servers:
- url: https://mbag.ai/api
- url: https://mailbuttons.com/api
security:
- apiKey: []
tags:
- name: jmap
paths:
  /v1/jmap:
    post:
      description: 'A thin tenant-isolation proxy: resolves which of the caller''s

        mailboxes to act as, then forwards the request to Stalwart''s JMAP

        endpoint authenticated as that mailbox (HTTP Basic), rewriting any

        client-supplied `accountId` in each method call to the resolved

        principal''s own account id (defense in depth — Stalwart''s own

        per-principal auth is the real isolation boundary).'
      operationId: jmapRequest
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              description: 'A raw JMAP request object per RFC 8620 (`using`,

                `methodCalls`, optional `createdIds`) — not modeled here; see

                RFC 8620 (core) and RFC 8621 (mail). Each `methodCalls` entry

                may be given as JMAP''s native `[name, arguments, id]` triple,

                or as `{"name":...,"arguments":...,"id":...}` objects, which

                are transformed into triples before forwarding. An optional

                top-level `_mailbuttons` object — `{"account": "<email or

                mailbox id>"}` — selects which of the caller''s mailboxes to

                act as when the API key owns more than one; it is stripped

                before forwarding and never reaches Stalwart.

                '
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
          description: 'The JMAP response forwarded verbatim from Stalwart on success

            (`methodResponses` etc., per RFC 8620) — not modeled here.

            '
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
          description: 'The API key owns multiple mailboxes and no `_mailbuttons.account` hint was given to disambiguate. `error: "ambiguous_account"`.'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
          description: 'The `_mailbuttons.account` hint doesn''t match any mailbox this API key owns. `error: "account_not_found_or_not_owned"`.'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
          description: 'This API key has no active mailbox. `error: "no_mailbox"`.'
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
          description: 'The selected mailbox has no JMAP password yet (not provisioned in Stalwart). `error: "mailbox_not_provisioned"`.'
        '500':
          content:
            application/json:
              schema:
                properties:
                  error:
                    enum:
                    - database_error
                    type: string
                required:
                - error
                type: object
          description: Database error while looking up the caller's mailboxes. Body has no `detail` key (unlike the other error responses here).
        '502':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
          description: 'Failed to reach Stalwart''s JMAP endpoint. `error: "Failed to reach upstream JMAP"`.'
        default:
          content:
            application/json:
              schema:
                type: object
          description: 'Any non-2xx status Stalwart itself returns is passed through

            verbatim (its status code and JSON body, or `{"error":"Invalid

            JSON from upstream"}` if the body didn''t parse as JSON).

            '
      security:
      - apiKey: []
      summary: Forward a raw JMAP method-call request to the mailbox's own Stalwart principal
      tags:
      - jmap
  /v1/jmap/session:
    get:
      description: 'Same mailbox-resolution rules as `POST /v1/jmap`, via `?account=`

        instead of `_mailbuttons.account`.'
      operationId: jmapSession
      parameters:
      - description: Email address or numeric mailbox id; only needed when the API key owns more than one mailbox.
        in: query
        name: account
        required: false
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
          description: The JMAP session object forwarded verbatim from Stalwart (RFC 8620 §2) — not modeled here.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
          description: 'The API key owns multiple mailboxes and no `account` hint was given. `error: "ambiguous_account"`.'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
          description: 'The `account` hint doesn''t match any mailbox this API key owns. `error: "account_not_found_or_not_owned"`.'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
          description: 'This API key has no active mailbox. `error: "no_mailbox"`.'
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
          description: 'The selected mailbox has no JMAP password yet (not provisioned in Stalwart). `error: "mailbox_not_provisioned"`.'
        '500':
          content:
            application/json:
              schema:
                properties:
                  error:
                    enum:
                    - database_error
                    type: string
                required:
                - error
                type: object
          description: Database error while looking up the caller's mailboxes. Body has no `detail` key.
        '502':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
          description: 'Failed to reach Stalwart''s JMAP `/session` endpoint. `error: "Failed to reach upstream session endpoint"`.'
      security:
      - apiKey: []
      summary: Fetch the JMAP session object for the mailbox's own Stalwart principal
      tags:
      - jmap
components:
  schemas:
    ErrorDetail:
      description: The shape written by the JMAP proxy's `select_error_response` and its upstream-unreachable branches.
      properties:
        detail:
          type: string
        error:
          type: string
      required:
      - error
      - detail
      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