# List mailboxes

Lists mailboxes for the authenticated account. Set state=deleted to list restorable tombstones (deleted mailboxes still within the undo window). A SYSTEM caller lists every mailbox on the deployment, and may narrow to one tenant with `accountId`. Under the partitioned directory a system caller's deployment-wide listing walks the accounts in turn: its rows come account by account, its pages are bounded in work, so one may hold fewer than limit rows while more follow, and the list ends only when nextCursor is absent.

## `GET /api/v1/identities`

### Query parameters

- `accountId` (string) — System callers only: list just this account's mailboxes (ignored for account principals, which always see their own)
- `state` ("deleted" | "suspended") — deleted: list restorable tombstones instead of live mailboxes. suspended: only live mailboxes the account owner has suspended, pending ones included (one account's listing: an account key, or a system key with accountId)
- `receiveHold` ("none" | "paused" | "disabled") — Only live mailboxes whose receiveHold is this value (none selects the receiving ones), pending ones included; combines with state=suspended. One account's listing: an account key, or a system key with accountId (400 account_required otherwise). With state=deleted it is refused (400 validation_failed) rather than ignored
- `address` (string) — Exact primary-address match (normalized) — the point lookup that saves a client walking the whole account to resolve one address. Live listing only
- `domain` (string) — Only mailboxes whose primary address is on this domain. Live listing only
- `q` (string) — Case-insensitive substring over the primary address. Live listing only
- `count` ("true" | "false") — Also return `total`: the full COUNT over the same filters, so 'N mailboxes on this domain' is one call instead of a walk. Opt-in because the default keyset page deliberately carries no totals
- `usage` ("true" | "false") — Also return each row's SAMPLED storage (`usedBytes`, `trashBytes`, `pimBytes`, `messageCount`, `databaseSize`, `usageAt`, `usageStale`) from the daily usage ledger — ONE call for the whole page, never a per-row stat read. These are as of `usageAt`, not live: a mailbox the sweep has not reached yet omits them entirely, and a client must render that as blank rather than as zero. Live figures are GET /mailboxes/:id. Live listing only
- `limit` (integer, ≥ 1, ≤ 200) — Page size (default 100)
- `cursor` (string) — Opaque page cursor from a previous response

### Responses

**200** — Mailboxes page (live rows, or restorable tombstones when state=deleted); nextCursor present when a further page exists

`application/json` → object

- _option 1: object_
  - `identities` (MailboxWithUsage[], required)
    - `accountId` (string | null, required) — Account ID owning this mailbox, or null
    - `createdAt` (integer <int64>, required) — Creation timestamp in epoch seconds
    - `ephemeral` (boolean, required) — Whether the mailbox was created DISPOSABLE (ephemeral: true at creation, immutable afterwards): its DELETE destroys it at once — no undo record, no 7-day window, the address free again immediately. False for every ordinary mailbox, whose DELETE keeps the window
    - `groupAddress` (string | null, required) — When this identity is a GROUP PERSONA, the group address whose archive it keeps and which it may send as; null for every other identity. A persona has no primaryAddress, cannot be a route target, refuses its own DELETE (delete the group route instead) and its Sieve/rules writes, and is exempt from max_mailboxes
    - `hasMailStore` (boolean, required) — Whether this identity has the mail capability. False for a calendar/contacts-only identity; true may also have a null primaryAddress. Derived from the directory row without reading or provisioning a store, not an indication that the store has been initialized or contains messages
    - `id` (string, required) — Unique mailbox ULID
    - `permittedRecipients` (array | null, required) — This mailbox's outbound recipient allowlist, written by system callers only. Entries are exact addresses (`jo@acme.dev`) or domain wildcards (`*@acme.dev`). null = unrestricted (the default); [] = may send to nobody. A submission outside the list is refused with 403 recipient_not_permitted (SMTP 550). Egress only: receiving is unaffected. A credential's own permittedRecipients may restrict sending further
    - `primaryAddress` (string | null, required) — Primary email address assigned to this mailbox, or null if none
    - `quotaBytes` (integer | null, required) — Storage quota in bytes, or null for unlimited
    - `receiveHold` ("paused" | "disabled" | null, required) — The account owner's hold on this mailbox's RECEIVING, independent of suspension and of sendHold: 'paused' = senders are told to retry later (429 receiving_paused, SMTP 451; they give up after about four to five days, so a pause is for short interruptions), 'disabled' = mail to it is rejected at once (403 receiving_disabled, SMTP 550), null = receiving. Set with PATCH {"receiveHold": "paused"|"disabled"|null}, or on create
      - _option 1: "paused" | "disabled"_
      - _option 2: null_
      - _option 3: null_
    - `receiveHoldAt` (integer | null, required) — When the current receiveHold was set (epoch seconds), restamped when the mode changes; null while receiving. The age of a pause is what decides whether it is still a pause: warn from the third day
    - `receiveHoldPending` (boolean, required) — Whether the current receiveHold has not yet reached the mailbox's store: true right after a change still being applied (PATCH answered 202), false once it holds. Poll until false
    - `retentionDays` (integer | null, required) — The mailbox's OWN time-based retention window in days (null = none; the account default applies if one is set). The window in force, with a preview, is GET /mailboxes/:id/retention
    - `semantic` (boolean, required) — Whether SEMANTIC (meaning-based) search is enabled for this mailbox: messages are embedded after delivery and GET /mailboxes/:id/search/semantic and …/messages/:id/similar answer. Tenant-set, gated by the account's plan; off by default. Turning it off DELETES the mailbox's embeddings
    - `sendHold` ("disabled" | "paused" | null, required) — This mailbox's own operator enforcement: 'disabled' = permanent stop (403 sending_disabled), 'paused' = reversible hold (429 sending_paused), null = neither. System-written only
      - _option 1: "disabled" | "paused"_
      - _option 2: null_
      - _option 3: null_
    - `sendMsgsPerDay` (integer | null, required) — Daily outbound message limit (null = platform default, 0 = unlimited)
    - `sendMsgsPerHour` (integer | null, required) — Hourly (burst) outbound message limit (null = platform default, 0 = unlimited)
    - `sendRcptsPerDay` (integer | null, required) — Daily outbound recipient limit (null = platform default, 0 = unlimited)
    - `sendRcptsPerHour` (integer | null, required) — Hourly (burst) outbound recipient limit (null = platform default, 0 = unlimited)
    - `suspendedAt` (integer | null, required) — When the account owner suspended this mailbox (epoch seconds), null when it is not suspended. While suspended its logins are refused as a wrong password is, its sending is held (429 sending_paused) and its open sessions end; it still receives mail, and its owner keys can still read and administer it. Set with PATCH {"suspended": true|false}
    - `suspensionPending` (boolean, required) — Whether the current suspendedAt has not yet reached every core gate it must: true right after a change whose enforcement is still being applied (PATCH answered 202), false once it holds everywhere. Poll until false
    - `provisioningPending` (boolean) — Present, true, only while this identity's creation with messageWebhook or eventWebhook is still setting up: mail to its address and its calendar and contact writes are refused as temporary (503 temporary_failure) until it is, and the setup completes in the background. Absent for every other identity
    - `databaseSize` (integer | null) — Sampled size of the store's own metadata database in bytes — the axis the store_metadata_full ceiling guards (metadata + search index, not message bytes); null when the sample predates this measure
    - `messageCount` (integer | null) — Total number of active messages
    - `pimBytes` (integer | null) — Storage used by calendar and contact objects in bytes
    - `trashBytes` (integer | null) — Storage used by messages in trash in bytes
    - `usageAt` (integer <int64>) — Timestamp when usage was sampled in epoch seconds
    - `usageStale` (boolean) — True if the sampled usage figures could not be refreshed recently
    - `usedBytes` (integer <int64>) — Total active message storage used in bytes
  - `nextCursor` (string) — Opaque cursor for the next page; absent on the last page
  - `total` (integer <int64>) — Full filtered COUNT — present only when count=true was requested
- _option 2: object_
  - `identities` (DeletedMailbox[], required)
    - `accountId` (string | null, required) — Account ID owning this mailbox, or null
    - `deletedAt` (integer <int64>, required) — Deletion timestamp in epoch seconds
    - `id` (string, required) — Unique mailbox ULID
    - `primaryAddress` (string | null, required) — Primary email address assigned to this mailbox, or null
    - `quotaBytes` (integer | null, required) — Storage quota in bytes, or null
    - `restorable` (boolean, required) — True if the mailbox can still be restored
    - `wipeDueAt` (integer <int64>, required) — Scheduled timestamp when data will be permanently wiped in epoch seconds
    - `wipeOverdue` (boolean, required) — True if permanent wipe is overdue
    - `restorableUntil` (integer <int64>) — Timestamp until which restore is allowed in epoch seconds
  - `nextCursor` (string) — Opaque cursor for the next page; absent on the last page

**400** — validation_failed (also receiveHold with state=deleted); or account_required (state=suspended or receiveHold from a system key without accountId)

`application/json` → ErrorOrValidation

**401** — unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a `WWW-Authenticate: Bearer` challenge

`application/json` → ErrorBody

**503** — Identity inventory temporarily unavailable; retry the same cursor. Or temporary_failure: the platform's storage could not answer just now; retry after the Retry-After window. Any operation can answer this. A write that got it may have been applied, so retry it with the same idempotency key where it takes one, or read the state back first (see Transient failures in the API description)

`application/json` → ErrorBody

### Example request

```bash
curl -X GET 'https://api.open.email/api/v1/identities' \
  -H 'Authorization: Bearer oek_…'
```

## TypeScript SDK

[`openemail.identities.list`](/docs/sdks/typescript/identities/list)

```ts
for await (const mailboxWithUsage of openemail.identities.list()) {
  // every item of every page (await the call instead for one page)
}
```
