# Get parsed message content and attachments

Returns decoded email headers, inline plain text and HTML bodies, and attachment metadata for a message.

## `GET /api/v1/mailboxes/{mailboxId}/messages/{messageId}/content`

### Path parameters

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

### Header parameters

- `if-none-match` (string) — Revalidation ETag from a previous response; on match the answer is 304

### Responses

**200** — Parsed message body, headers, and attachments

`application/json` → ContentResult

- `attachments` (AttachmentRef[], required) — List of file attachments
  - `contentId` (string | null, required) — Content-ID header value for inline referencing, or null
  - `contentType` (string, required) — Attachment MIME content type
  - `filename` (string, required) — Attachment filename
  - `inline` (boolean, required) — True if attachment is meant for inline rendering
  - `section` (string, required) — MIME part section identifier to fetch via /parts/:section
  - `size` (integer <int64>, required) — Decoded attachment file size in bytes
  - `degraded` (boolean) — True if attachment was generated from fallback decoding
- `headers` (ContentHeaders, required) — Message headers
  - `cc` (ContentAddress[], required) — Parsed Cc addresses
    - `email` (string, required) — Email address
    - `name` (string | null, required) — Display name or personal name, or null
  - `date` (integer | null, required) — Date header as epoch seconds (message sentAt); null if absent/unparseable
  - `from` (ContentAddress[], required) — Parsed From addresses
    - `email` (string, required) — Email address
    - `name` (string | null, required) — Display name or personal name, or null
  - `inReplyTo` (string | null, required) — In-Reply-To header Message-ID, or null
  - `messageIdHeader` (string | null, required) — Message-ID header value, or null
  - `replyTo` (ContentAddress[], required) — Parsed Reply-To addresses
    - `email` (string, required) — Email address
    - `name` (string | null, required) — Display name or personal name, or null
  - `subject` (string | null, required) — Message subject line, or null
  - `to` (ContentAddress[], required) — Parsed To addresses
    - `email` (string, required) — Email address
    - `name` (string | null, required) — Display name or personal name, or null
- `html` (ContentBody | null, required) — HTML body part, or null if message has no HTML
  - _option 1: ContentBody_
    - `charset` (string | null, required) — Original character set encoding
    - `content` (string | null, required) — Decoded body text content (null if truncated due to large size)
    - `section` (string, required) — MIME section identifier
    - `size` (integer <int64>, required) — Full decoded body size in bytes
    - `truncated` (boolean, required) — True if body content was truncated because it exceeded inline limits
  - _option 2: null_
- `text` (ContentBody | null, required) — Plain-text body part, or null if message has no plain text
  - _option 1: ContentBody_
    - `charset` (string | null, required) — Original character set encoding
    - `content` (string | null, required) — Decoded body text content (null if truncated due to large size)
    - `section` (string, required) — MIME section identifier
    - `size` (integer <int64>, required) — Full decoded body size in bytes
    - `truncated` (boolean, required) — True if body content was truncated because it exceeded inline limits
  - _option 2: null_

**304** — Not modified — If-None-Match matched content ETag

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

`application/json` → ErrorBody

**404** — Mailbox or message not found

`application/json` → ErrorBody

**413** — message_too_large

`application/json` → ErrorBody

**422** — unparseable_message or message_too_complex

`application/json` → ErrorBody

**500** — blob_missing

`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 GET 'https://api.open.email/api/v1/mailboxes/{mailboxId}/messages/{messageId}/content' \
  -H 'Authorization: Bearer oek_…'
```

## TypeScript SDK

[`openemail.messages.getContent`](/docs/sdks/typescript/messages/get-content)

```ts
const contentResult = await openemail.messages.getContent(mailboxId, messageId)
```
