# Retrieve a message's content

Source: https://kirora.io/docs/api/reference/getMessageContent

`GET /v1/messages/{id}/content`

Requires an API key with the `messages:read` scope. [About keys and scopes](https://kirora.io/docs/api/reference/authentication)

Works with integration, agent and partner keys.

Returns the subject, preview text, sender and body (or the push content) of a transactional send as it was accepted; merge tags appear unrendered. Kept for the workspace retention period, 30 days by default, and not kept once sent for a `sensitive` send: that, and expired content, return 404 `CONTENT_NOT_RETAINED`. So does a campaign or journey message, whose content is the campaign's or the journey version's: read it there.

## Path parameters

- `id` (string, required, uuid) — The message's id.

## Header parameters

- `Kirora-Workspace` (string, optional, pattern `^[A-Za-z0-9._:-]{1,128}$`) — Partner keys only: the child workspace to act in, by the external id the partner gave it. Without it, a partner key acts in its own workspace. Any other key that sends it is refused with 403, and an unknown workspace is 404.

## Returns

Returns `200 OK` with a `MessageContent` in `data`. Otherwise returns an error; [Errors](https://kirora.io/docs/api/reference/errors) lists every code and which to retry.

- `channel` (string, required, one of `email`, `push`)
- `email` (object | null, required)
  - `subject` (string, required, 1–998 characters) — The subject line. Merge tags are allowed.
  - `previewText` (string, optional, 1–255 characters) — Shown by inboxes after the subject. Merge tags are allowed; keep it near 100 characters.
  - `html` (string, required, 1–512,000 characters) — The HTML body. Rendered from the design when one is set.
  - `text` (string, optional, 1–512,000 characters) — The plain-text alternative.
  - `from` (string, required, 1–320 characters) — The sender address, on a verified sending domain.
  - `replyTo` (string, optional, email) — Where replies go; the part before the @ must be ASCII.
- `push` (object | null, required)
  - `title` (string, required, 1–100 characters) — The notification title (up to 100 characters).
  - `body` (string, required, 1–500 characters) — The notification text (up to 500 characters).
  - `actionUrl` (string, optional, uri, up to 2,048 characters) — The HTTPS page opened when the notification is tapped.
  - `imageUrl` (string, optional, uri, up to 2,048 characters) — A large picture: web and Android show it; iOS needs the app's service extension.
  - `iconUrl` (string, optional, uri, up to 2,048 characters) — Web only; iOS and Android show the app's own notification icon.
  - `data` (map<string, string>, optional, at most 10 keys, keys: pattern `^[A-Za-z0-9_.-]{1,64}$`, values: up to 1,024 characters) — Up to 10 string key-value pairs passed to the app untouched, for deep links and in-app routing.
  - `buttons` (object[], optional, at least 1 item, at most 2 items) — Up to 2 action buttons.
    - `title` (string, required, 1–30 characters) — The button label.
    - `url` (string, required, uri, up to 2,048 characters) — The HTTPS page the button opens.
  - `collapseKey` (string, optional, pattern `^[A-Za-z0-9_-]{1,64}$`) — A newer notification with the same key replaces the older one on the device.
  - `sound` (string, optional, 1–64 characters) — The name of a sound the app ships; the device's default if unset.
  - `badge` (integer, optional, min 0, max 99999) — The number shown on the iOS app icon.
  - `ttl` (DurationOrZero, optional) — How long a provider keeps trying an offline device, up to 28 days; zero delivers now or never. Defaults to one day.
    - `value` (integer, required, min 0)
    - `unit` (string, required, one of `seconds`, `minutes`, `hours`, `days`)
  - `urgency` (string, optional, one of `high`, `normal`) — `high` asks the push service to deliver promptly, even to a sleeping device; `normal` lets it wait for a good moment to save battery. Device settings and the app still decide whether and how it is shown. Unset, a transactional push is `high` and any other `normal`.
  - `overrides` (object, optional) — Fields that differ on one platform, each replacing the shared one there (a whole `data` map, not merged key by key). On iOS and Android `actionUrl` may be an app link such as `myapp://orders`; the shared one and the web one must be HTTPS.
    - `ios` (object, optional) — Replaces shared fields on iOS.
      - `title` (string, optional, 1–100 characters) — The notification title (up to 100 characters).
      - `body` (string, optional, 1–500 characters) — The notification text (up to 500 characters).
      - `actionUrl` (string, optional, pattern `^[a-z][a-z0-9+.-]*:\S+$`, up to 2,048 characters)
      - `imageUrl` (string, optional, uri, up to 2,048 characters) — A large picture: web and Android show it; iOS needs the app's service extension.
      - `iconUrl` (string, optional, uri, up to 2,048 characters) — Web only; iOS and Android show the app's own notification icon.
      - `data` (map<string, string>, optional, at most 10 keys, keys: pattern `^[A-Za-z0-9_.-]{1,64}$`, values: up to 1,024 characters) — Up to 10 string key-value pairs passed to the app untouched, for deep links and in-app routing.
      - `buttons` (object[], optional, at least 1 item, at most 2 items) — Up to 2 action buttons.
        - `title` (string, required, 1–30 characters) — The button label.
        - `url` (string, required, uri, up to 2,048 characters) — The HTTPS page the button opens.
      - `collapseKey` (string, optional, pattern `^[A-Za-z0-9_-]{1,64}$`) — A newer notification with the same key replaces the older one on the device.
      - `sound` (string, optional, 1–64 characters) — The name of a sound the app ships; the device's default if unset.
      - `badge` (integer, optional, min 0, max 99999) — The number shown on the iOS app icon.
      - `ttl` (DurationOrZero, optional) — How long a provider keeps trying an offline device, up to 28 days; zero delivers now or never. Defaults to one day.
        - `value` (integer, required, min 0)
        - `unit` (string, required, one of `seconds`, `minutes`, `hours`, `days`)
      - `urgency` (string, optional, one of `high`, `normal`) — `high` asks the push service to deliver promptly, even to a sleeping device; `normal` lets it wait for a good moment to save battery. Device settings and the app still decide whether and how it is shown. Unset, a transactional push is `high` and any other `normal`.
      - `interruptionLevel` (string, optional, one of `passive`, `active`, `time-sensitive`) — How iOS presents it: `passive` arrives silently, `time-sensitive` can break through Focus when the user allows it, and needs the app's Time Sensitive Notifications capability.
      - `threadId` (string, optional, pattern `^[A-Za-z0-9_.-]{1,64}$`) — Notifications with the same thread are grouped together in Notification Center.
    - `android` (object, optional) — Replaces shared fields on Android.
      - `title` (string, optional, 1–100 characters) — The notification title (up to 100 characters).
      - `body` (string, optional, 1–500 characters) — The notification text (up to 500 characters).
      - `actionUrl` (string, optional, pattern `^[a-z][a-z0-9+.-]*:\S+$`, up to 2,048 characters)
      - `imageUrl` (string, optional, uri, up to 2,048 characters) — A large picture: web and Android show it; iOS needs the app's service extension.
      - `iconUrl` (string, optional, uri, up to 2,048 characters) — Web only; iOS and Android show the app's own notification icon.
      - `data` (map<string, string>, optional, at most 10 keys, keys: pattern `^[A-Za-z0-9_.-]{1,64}$`, values: up to 1,024 characters) — Up to 10 string key-value pairs passed to the app untouched, for deep links and in-app routing.
      - `buttons` (object[], optional, at least 1 item, at most 2 items) — Up to 2 action buttons.
        - `title` (string, required, 1–30 characters) — The button label.
        - `url` (string, required, uri, up to 2,048 characters) — The HTTPS page the button opens.
      - `collapseKey` (string, optional, pattern `^[A-Za-z0-9_-]{1,64}$`) — A newer notification with the same key replaces the older one on the device.
      - `sound` (string, optional, 1–64 characters) — The name of a sound the app ships; the device's default if unset.
      - `badge` (integer, optional, min 0, max 99999) — The number shown on the iOS app icon.
      - `ttl` (DurationOrZero, optional) — How long a provider keeps trying an offline device, up to 28 days; zero delivers now or never. Defaults to one day.
        - `value` (integer, required, min 0)
        - `unit` (string, required, one of `seconds`, `minutes`, `hours`, `days`)
      - `urgency` (string, optional, one of `high`, `normal`) — `high` asks the push service to deliver promptly, even to a sleeping device; `normal` lets it wait for a good moment to save battery. Device settings and the app still decide whether and how it is shown. Unset, a transactional push is `high` and any other `normal`.
      - `channelId` (string, optional, pattern `^[A-Za-z0-9_.-]{1,64}$`) — The Android notification channel to post in, which the app creates; it sets the sound and importance a person can tune, e.g. one for offers and one for orders.
    - `web` (object, optional) — Replaces shared fields on web.
      - `title` (string, optional, 1–100 characters) — The notification title (up to 100 characters).
      - `body` (string, optional, 1–500 characters) — The notification text (up to 500 characters).
      - `actionUrl` (string, optional, uri, up to 2,048 characters) — The HTTPS page opened when the notification is tapped.
      - `imageUrl` (string, optional, uri, up to 2,048 characters) — A large picture: web and Android show it; iOS needs the app's service extension.
      - `iconUrl` (string, optional, uri, up to 2,048 characters) — Web only; iOS and Android show the app's own notification icon.
      - `data` (map<string, string>, optional, at most 10 keys, keys: pattern `^[A-Za-z0-9_.-]{1,64}$`, values: up to 1,024 characters) — Up to 10 string key-value pairs passed to the app untouched, for deep links and in-app routing.
      - `buttons` (object[], optional, at least 1 item, at most 2 items) — Up to 2 action buttons.
        - `title` (string, required, 1–30 characters) — The button label.
        - `url` (string, required, uri, up to 2,048 characters) — The HTTPS page the button opens.
      - `collapseKey` (string, optional, pattern `^[A-Za-z0-9_-]{1,64}$`) — A newer notification with the same key replaces the older one on the device.
      - `sound` (string, optional, 1–64 characters) — The name of a sound the app ships; the device's default if unset.
      - `badge` (integer, optional, min 0, max 99999) — The number shown on the iOS app icon.
      - `ttl` (DurationOrZero, optional) — How long a provider keeps trying an offline device, up to 28 days; zero delivers now or never. Defaults to one day.
        - `value` (integer, required, min 0)
        - `unit` (string, required, one of `seconds`, `minutes`, `hours`, `days`)
      - `urgency` (string, optional, one of `high`, `normal`) — `high` asks the push service to deliver promptly, even to a sleeping device; `normal` lets it wait for a good moment to save battery. Device settings and the app still decide whether and how it is shown. Unset, a transactional push is `high` and any other `normal`.

## Example

```bash
curl https://api.kirora.io/v1/messages/018f2a4e-6b1c-7d3e-9f40-37386ae05a6b/content \
  -H "Authorization: Bearer $KIRORA_API_KEY"
```

Response `200`:

```json
{
  "data": {
    "channel": "email",
    "email": {
      "subject": "Your Acme Shop receipt for order {{ data.orderId }}",
      "previewText": "Thanks for your order",
      "html": "<p>Thanks for your order. Total: {{ data.total }}.</p>",
      "text": "Thanks for your order. Total: {{ data.total }}.",
      "from": "Acme Shop <orders@mail.acme-shop.com>",
      "replyTo": "support@acme-shop.com"
    },
    "push": null
  }
}
```
