---
title: "Fetch the JMAP session object for the mailbox's own Stalwart principal"
method: GET
path: "/v1/jmap/session"
tags: ["jmap"]
---

# Fetch the JMAP session object for the mailbox's own Stalwart principal

`GET /v1/jmap/session`

## Request

- Base URL: `https://mbag.ai/api`
- URL: `https://mbag.ai/api/v1/jmap/session`
- Auth: HTTP bearer

Same mailbox-resolution rules as `POST /v1/jmap`, via `?account=`
instead of `_mailbuttons.account`.

## Query parameters

- `account` string

## Response `200`

The JMAP session object forwarded verbatim from Stalwart (RFC 8620 §2) — not modeled here.

- object

## Other responses

- `400`: The API key owns multiple mailboxes and no `account` hint was given. `error: "ambiguous_account"`.
- `401`: 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.
- `403`: The `account` hint doesn't match any mailbox this API key owns. `error: "account_not_found_or_not_owned"`.
- `404`: This API key has no active mailbox. `error: "no_mailbox"`.
- `409`: The selected mailbox has no JMAP password yet (not provisioned in Stalwart). `error: "mailbox_not_provisioned"`.
- `500`: Database error while looking up the caller's mailboxes. Body has no `detail` key.
- `502`: Failed to reach Stalwart's JMAP `/session` endpoint. `error: "Failed to reach upstream session endpoint"`.

---

[API](https://skmtc.dev/mailbuttons/apis/mailbuttons-agent-mail-api.md) · [All operations](https://skmtc.dev/mailbuttons/apis/mailbuttons-agent-mail-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mailbuttons/apis/mailbuttons-agent-mail-api/revisions/fe2761823978?raw)
