# Batch get message metadata

Retrieves metadata summaries for up to 200 messages in a single request.

## `POST /api/v1/mailboxes/{mailboxId}/messages/batch`

### Path parameters

- `mailboxId` (string, required) — Mailbox ULID identifier

### Request body (required)

`application/json`

- `ids` (string[], required, min 1 items, max 200 items) — Array of message IDs to retrieve

### Responses

**200** — Dictionary of message metadata objects keyed by message ID

`application/json` → MessageBatch

- `messages` (object, required) — Map of message ID to message metadata

**400** — validation_failed

`application/json` → ErrorOrValidation

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

`application/json` → ErrorBody

**404** — Mailbox not found or not accessible to this principal

`application/json` → ErrorBody

**413** — too_large: JSON request body exceeds 1 MiB or 500,000 values (object keys included), checked before parsing

`application/json` → ErrorBody

**503** — 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 POST 'https://api.open.email/api/v1/mailboxes/{mailboxId}/messages/batch' \
  -H 'Authorization: Bearer oek_…' \
  -H 'Content-Type: application/json' \
  -d '{
    "ids": [
      "string"
    ]
  }'
```

## TypeScript SDK

[`openemail.messages.getMany`](/docs/sdks/typescript/messages/get-many)

```ts
const messageBatch = await openemail.messages.getMany(mailboxId, { ids: ['…'] })
```
