v52

latestOpenAPI 3.1.0raw.githubusercontent.com2026-07-311,1941,9384.1 MB
Messages

Send a message

Send a message with a Phone Number, Alphanumeric Sender ID, Short Code or Number Pool.

This endpoint allows you to send a message with any messaging resource. Current messaging resources include: long-code, short-code, number-pool, and alphanumeric-sender-id.

post/messages

Request body

auto_detectboolean

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.

fromstring

Sending address (+E.164 formatted phone number, alphanumeric sender ID, or short code).

Required if sending with a phone number, short code, or alphanumeric sender ID.

media_urlsstring[]

A list of media URLs. The total media size must be less than 1 MB.

Required for MMS

messaging_profile_idstring

Unique identifier for a messaging profile.

Required if sending via number pool or with an alphanumeric sender ID.

send_atstring date-time nullable

ISO 8601 formatted date indicating when to send the message - accurate up till a minute.

subjectstring

Subject of multimedia message

textstring

Message body (i.e., content) as a non-empty string.

Required for SMS

tostring 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_webhooksboolean

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_urlstring url

The failover URL where webhooks related to this message will be sent if sending to the primary URL fails.

webhook_urlstring url

The URL where webhooks related to this message will be sent.

Example request

{
  "from": "+18445550001",
  "media_urls": [
    "http://example.com"
  ],
  "messaging_profile_id": "abc85f64-5717-4562-b3fc-2c9600000000",
  "subject": "From Telnyx!",
  "text": "Hello, World!",
  "to": "+18445550001",
  "type": "MMS",
  "use_profile_webhooks": true,
  "webhook_failover_url": "https://backup.example.com/hooks",
  "webhook_url": "http://example.com/webhooks"
}

Response

Successful response with details about a message.

Example response

{
  "data": {
    "cc": [],
    "completed_at": null,
    "cost": {
      "amount": "0.0051",
      "currency": "USD"
    },
    "cost_breakdown": {
      "carrier_fee": {
        "amount": "0.00305",
        "currency": "USD"
      },
      "rate": {
        "amount": "0.00205",
        "currency": "USD"
      }
    },
    "direction": "outbound",
    "encoding": "GSM-7",
    "errors": [],
    "from": {
      "carrier": "TELNYX LLC",
      "line_type": "VoIP",
      "phone_number": "+18445550001"
    },
    "id": "40385f64-5717-4562-b3fc-2c963f66afa6",
    "media": [
      {
        "content_type": null,
        "sha256": null,
        "size": null,
        "url": "https://pbs.twimg.com/profile_images/1142168442042118144/AW3F4fFD_400x400.png"
      }
    ],
    "messaging_profile_id": "4000eba1-a0c0-4563-9925-b25e842a7cb6",
    "num_chars": 13,
    "organization_id": "b448f9cc-a842-4784-98e9-03c1a5872950",
    "parts": 1,
    "received_at": "2019-01-23T18:10:02.574Z",
    "record_type": "message",
    "sent_at": null,
    "subject": "From Telnyx!",
    "tags": [
      "Greetings"
    ],
    "tcr_campaign_billable": true,
    "tcr_campaign_id": "TCPA3X7",
    "tcr_campaign_registered": "REGISTERED",
    "text": "Hello, World!",
    "to": [
      {
        "carrier": "T-MOBILE USA, INC.",
        "line_type": "Wireless",
        "phone_number": "+18665550001",
        "status": "queued"
      }
    ],
    "type": "MMS",
    "valid_until": null,
    "wait_seconds": 0.5,
    "webhook_failover_url": "https://backup.example.com/hooks",
    "webhook_url": "https://www.example.com/hooks"
  }
}