---
title: "Enqueue message"
method: POST
path: "/3rdparty/v1/messages"
tags: ["User", "Messages"]
---

# Enqueue message

`POST /3rdparty/v1/messages`

Enqueues a message for sending. If `deviceId` is set, the specified device is used; otherwise a random registered device is chosen.

## Query parameters

- `skipPhoneValidation` boolean
- `deviceActiveWithin` integer

## Request body

- SmsgatewayMessage
  - `dataMessage` SmsgatewayDataMessage
    - `data` string, byte, required — Data is the base64-encoded payload.
    - `port` integer, required — Port is the destination port.
  - `deviceId` string — Optional device ID for explicit selection
  - `id` string — ID (if not set - will be generated)
  - `isEncrypted` boolean — Is encrypted
  - `message` string — Message content (deprecated, use TextMessage instead)
  - `phoneNumbers` string[], required — Recipients (phone numbers)
  - `priority` -128 | 0 | 100 | 127
  - `scheduleAt` string, date-time — Schedule message delivery at (must be in the future)
  - `simNumber` integer — SIM card number (1-3), if not set - default SIM will be used
  - `textMessage` SmsgatewayTextMessage
    - `text` string, required — Text is the message text.
  - `ttl` integer — Time to live in seconds (conflicts with `ValidUntil`)
  - `validUntil` string, date-time — Valid until (conflicts with `TTL`)
  - `withDeliveryReport` boolean — With delivery report

## Response `202`

Message enqueued

- SmsgatewayGetMessageResponse
  - `dataMessage` SmsgatewayDataMessage
    - `data` string, byte, required — Data is the base64-encoded payload.
    - `port` integer, required — Port is the destination port.
  - `deviceId` string, required — Device ID
  - `hashedMessage` SmsgatewayHashedMessage
    - `hash` string, required
  - `id` string, required — Message ID
  - `isEncrypted` boolean — Encrypted
  - `isHashed` boolean — Hashed
  - `recipients` SmsgatewayRecipientState[], required — Recipients states
    - `error` string — Error (for `Failed` state)
    - `phoneNumber` string, required — Phone number or first 16 symbols of SHA256 hash
    - `state` 'Pending' | 'Cancelling' | 'Cancelled' | 'Processed' | 'Sent' | 'Delivered' | 'Failed', required
  - `state` 'Pending' | 'Cancelling' | 'Cancelled' | 'Processed' | 'Sent' | 'Delivered' | 'Failed', required
  - `states` object — History of states
  - `textMessage` SmsgatewayTextMessage
    - `text` string, required — Text is the message text.

## Other responses

- `400` — Invalid request
- `401` — Unauthorized
- `403` — Forbidden
- `409` — Message with the same ID already exists
- `500` — Internal server error
- `503` — Queue limits exceeded; ensure device is online

---

[API](https://skmtc.dev/sms-gate/apis/smsgate-api.md) · [All operations](https://skmtc.dev/sms-gate/apis/smsgate-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/sms-gate/smsgate-api/revisions/56a6604029f1/schema)
