---
title: "Send a long code message"
method: POST
path: "/messages/long_code"
tags: ["Messages"]
---

# Send a long code message

`POST /messages/long_code`

Queues an outbound SMS or MMS using a long-code sender. Delivery progress and final disposition are reported asynchronously through messaging webhooks.

## Request body

- CreateLongCodeMessageRequest
  - `auto_detect` boolean — Automatically detect if an SMS message is unusually long and exceeds a recommended limit of message parts.
  - `encoding` 'auto' | 'gsm7' | 'ucs2' — Encoding to use for the message. `auto` (default) uses smart encoding to automatically select the most efficient encoding. `gsm7` forces GSM-7 encoding (returns 400 if message contains characters that cannot be encoded). `ucs2` forces UCS-2 encoding and disables smart encoding. When set, this overrides the messaging profile's `smart_encoding` setting.
  - `from` string, required — Phone number, in +E.164 format, used to send the message.
  - `media_urls` string[] — A list of media URLs. The total media size must be less than 1 MB. **Required for MMS**
  - `subject` string — Subject of multimedia message
  - `text` string — Message body (i.e., content) as a non-empty string. **Required for SMS**
  - `to` string, required — Receiving address (+E.164 formatted phone number or short code).
  - `type` 'SMS' | 'MMS' — The protocol for sending the message, either SMS or MMS.
  - `use_profile_webhooks` boolean — If the profile this number is associated with has webhooks, use them for delivery notifications. If webhooks are also specified on the message itself, they will be attempted first, then those on the profile.
  - `webhook_failover_url` string, url — The failover URL where webhooks related to this message will be sent if sending to the primary URL fails.
  - `webhook_url` string, url — The URL where webhooks related to this message will be sent.

## Response `200`

Successful response with details about a message.

- object
  - `data` MessagingOutboundMessagePayload
    - `cc` object[]
      - `carrier` string — The carrier of the receiver.
      - `line_type` 'Wireline' | 'Wireless' | 'VoWiFi' | 'VoIP' | 'Pre-Paid Wireless' | '' — The line-type of the receiver.
      - `phone_number` string — Receiving address (+E.164 formatted phone number or short code).
      - `status` 'queued' | 'sending' | 'sent' | 'delivered' | 'sending_failed' | 'delivery_failed' | 'delivery_unconfirmed'
    - `completed_at` string, date-time, nullable — ISO 8601 formatted date indicating when the message was finalized.
    - `cost` object, nullable
      - `amount` string — The amount deducted from your account.
      - `currency` string — The ISO 4217 currency identifier.
    - `cost_breakdown` object, nullable — Detailed breakdown of the message cost components.
      - `carrier_fee` object
        - `amount` string — The carrier fee amount.
        - `currency` string — The ISO 4217 currency identifier.
      - `rate` object
        - `amount` string — The rate amount applied.
        - `currency` string — The ISO 4217 currency identifier.
    - `direction` 'outbound' — The direction of the message. Inbound messages are sent to you whereas outbound messages are sent from you.
    - `encoding` string — Encoding scheme used for the message body.
    - `errors` MessagingError[] — These errors may point at addressees when referring to unsuccessful/unconfirmed delivery statuses.
      - `code` string, required
      - `detail` string
      - `meta` object
      - `source` object
        - `parameter` string — Indicates which query parameter caused the error.
        - `pointer` string, json-pointer — JSON pointer (RFC6901) to the offending entity.
      - `title` string, required
    - `from` object
      - `carrier` string — The carrier of the receiver.
      - `line_type` 'Wireline' | 'Wireless' | 'VoWiFi' | 'VoIP' | 'Pre-Paid Wireless' | '' — The line-type of the receiver.
      - `phone_number` string — Sending address (+E.164 formatted phone number, alphanumeric sender ID, or short code).
    - `id` string, uuid — Identifies the type of resource.
    - `media` object[]
      - `content_type` string, nullable — The MIME type of the requested media.
      - `sha256` string, nullable — The SHA256 hash of the requested media.
      - `size` integer, nullable — The size of the requested media.
      - `url` string, url — The url of the media requested to be sent.
    - `messaging_profile_id` string — Unique identifier for a messaging profile.
    - `num_chars` integer — The number of characters in the message text
    - `organization_id` string, uuid — The id of the organization the messaging profile belongs to.
    - `parts` integer — Number of parts into which the message's body must be split.
    - `received_at` string, date-time — ISO 8601 formatted date indicating when the message request was received.
    - `record_type` 'message' — Identifies the type of the resource.
    - `sent_at` string, date-time, nullable — ISO 8601 formatted date indicating when the message was sent.
    - `smart_encoding_applied` boolean — Indicates whether smart encoding was applied to this message. When `true`, one or more Unicode characters were automatically replaced with GSM-7 equivalents to reduce segment count and cost. The original message text is preserved in webhooks.
    - `subject` string, nullable — Subject of multimedia message
    - `tags` string[] — Tags associated with the resource.
    - `tcr_campaign_billable` boolean — Indicates whether the TCR campaign is billable.
    - `tcr_campaign_id` string, nullable — The Campaign Registry (TCR) campaign ID associated with the message.
    - `tcr_campaign_registered` string, nullable — The registration status of the TCR campaign.
    - `text` string — Message body (i.e., content) as a non-empty string. **Required for SMS**
    - `to` object[]
      - `carrier` string — The carrier of the receiver.
      - `line_type` 'Wireline' | 'Wireless' | 'VoWiFi' | 'VoIP' | 'Pre-Paid Wireless' | '' — The line-type of the receiver.
      - `phone_number` string — Receiving address (+E.164 formatted phone number or short code).
      - `status` 'queued' | 'sending' | 'sent' | 'expired' | 'sending_failed' | 'delivery_unconfirmed' | 'delivered' | 'delivery_failed' — The delivery status of the message.
    - `type` 'SMS' | 'MMS' — The type of message.
    - `valid_until` string, date-time, nullable — Message must be out of the queue by this time or else it will be discarded and marked as 'sending_failed'. Once the message moves out of the queue, this field will be nulled
    - `wait_seconds` number, float, nullable — Seconds the message is queued due to rate limiting before being sent to the carrier. Represents the maximum wait across all applicable rate limits (account, carrier, campaign). 0.0 = no queuing delay.
    - `webhook_failover_url` string, url, nullable — The failover URL where webhooks related to this message will be sent if sending to the primary URL fails.
    - `webhook_url` string, url, nullable — The URL where webhooks related to this message will be sent.

## Other responses

- `4XX` — Unexpected error

---

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