---
title: "Preview message"
method: GET
path: "/api/v2/messages/preview"
tags: ["Outbound Messages"]
---

# Preview message

`GET /api/v2/messages/preview`

<a class="try-sandbox-link" href="https://sandbox.textmagic.com/#/Messages%3A%20Send%0A/getMessagePreview" target="_blank">Try in sandbox</a><br>Get a messages preview (with dynamic fields merged) of up to 100 messages per session.

## Query parameters

- `text` string
- `templateId` integer
- `sendingTime` integer
- `sendingDateTime` string
- `sendingTimezone` string
- `contacts` string
- `lists` string
- `phones` string
- `cutExtra` 0 | 1
- `partsCount` integer
- `referenceId` integer
- `from` string
- `rule` string
- `createChat` 0 | 1
- `tts` 0 | 1
- `local` 0 | 1
- `localCountry` string

## Response `200`

Returned when successful.

- GetMessagePreviewResponse
  - `messages` MessageOut[]
    - `id` integer, required — Message ID.
    - `sender` string, nullable — Message sender (phone number or alphanumeric Sender ID).
    - `receiver` string — Recipient`s phone number.
    - `text` string, required
    - `status` 'q' | 's' | 'e' | 'r' | 'a' | 'd' | 'b' | 'f' | 'u' | 'j' | 'i' | 'p' | 'h', required — Delivery status of the message. See [message delivery statuses](https://docs.textmagic.com/#section/Delivery-status-codes) for details.
    - `rejectReason` 'a' | 'f' | 'l' | 'c' | 'u' | 'b' | 's' | 'm' | 'n' | 'i' | 'if' | 'd' | 't' | 'e' | 'h' | 'k' | 'r' | 'g' | 'j' | 'w' | 'v' | 'q' | 'x' | 'o' | 'p' — Rejection reason.
    - `contactId` integer, nullable, required — Recipient contact ID.
    - `sessionId` integer, nullable, required — Message Session ID of a message.
    - `messageTime` string, date-time, required — Sending time.
    - `avatar` string, nullable, required
    - `deleted` boolean — Indicates that the message has been deleted.
    - `deliveredAt` string, date-time, nullable — Time when message was delivered.
    - `charset` string, nullable, required — Message charset. Could be: * **ISO-8859-1** for plaintext SMS; * **UTF-16BE** for Unicode SMS.
    - `charsetLabel` string, nullable, required — Human-readable message charset label. Could be: * **ISO-8859-1** for plaintext SMS; * **UTF-16BE** for Unicode SMS; * **Voice** for voice services (Text-to-Speech or Voice Broadcast) messages.
    - `firstName` string, nullable, required — Contact first name. Could be substituted from your [Contacts](https://docs.textmagic.com/#tag/Contacts) (even if you submitted the phone number instead of the contact ID).
    - `lastName` string, nullable, required — Contact last name.
    - `country` string, nullable, required — The 2-letter ISO country code of the recipient's phone number.
    - `phone` string, nullable — Receipent`s phone number.
    - `price` number, float, nullable — Message price.
    - `partsCount` integer, nullable, required — Message parts (multiples of 160 characters) count.
    - `fromEmail` string, nullable — The user email which this message came from. For Email2SMS and Distribution Lists the messages, it is an original email address - in other cases, it is an account email address.
    - `fromNumber` string, nullable — The Phone number used to send the SMS.
    - `senderSource` object
      - `id` integer, nullable
      - `phone` string, nullable
      - `type` string, nullable
      - `countryId` string, nullable
      - `label` string, nullable
      - `status` string, nullable
      - `carrierStatus` string, nullable
    - `session` object
      - `id` integer, nullable
      - `startTime` string, nullable
      - `text` string, nullable
      - `price` number, float, nullable
      - `numbersCount` integer, nullable
      - `destination` string, nullable
      - `source` string, nullable
      - `referenceId` string, nullable
      - `initiatorId` integer, nullable

## Other responses

- `400` — Bad request.
- `401` — Unauthorized request.

---

[API](https://skmtc.net/textmagic/apis/textmagic-api.md) · [All operations](https://skmtc.net/textmagic/apis/textmagic-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/textmagic/textmagic-api/revisions/3e4029d19684/schema)
