Skip to main content

Send a message

POST 

/messages

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.

Request

Body

Message payload

    from address

    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.

    messaging_profile_id string

    Unique identifier for a messaging profile.

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

    to addressrequired

    Receiving address (+E.164 formatted phone number or short code).

    text string

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

    Required for SMS

    subject string

    Subject of multimedia message

    media_urls url[]

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

    Required for MMS

    webhook_url url

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

    webhook_failover_url url

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

    use_profile_webhooks boolean

    Default value: true

    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.

    type string

    Possible values: [SMS, MMS]

    The protocol for sending the message, either SMS or MMS.

    auto_detect boolean

    Default value: false

    Automatically detect if an SMS message is unusually long and exceeds a recommended limit of message parts.

Responses

200: Successful response with details about a message.

Schema

    data

    object

    record_type string

    Possible values: [message]

    Identifies the type of the resource.

    direction string

    Possible values: [outbound]

    The direction of the message. Inbound messages are sent to you whereas outbound messages are sent from you.

    id uuid

    Identifies the type of resource.

    type string

    Possible values: [SMS, MMS]

    The type of message.

    messaging_profile_id string

    Unique identifier for a messaging profile.

    organization_id uuid

    The id of the organization the messaging profile belongs to.

    from

    object

    phone_number address

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

    carrier string

    The carrier of the receiver.

    line_type string

    Possible values: [Wireline, Wireless, VoWiFi, VoIP, Pre-Paid Wireless, ``]

    The line-type of the receiver.

    to

    object[]

  • Array [

  • phone_number address

    Receiving address (+E.164 formatted phone number or short code).

    status string

    Possible values: [queued, sending, sent, expired, sending_failed, delivery_unconfirmed, delivered, delivery_failed]

    The delivery status of the message.

    carrier string

    The carrier of the receiver.

    line_type string

    Possible values: [Wireline, Wireless, VoWiFi, VoIP, Pre-Paid Wireless, ``]

    The line-type of the receiver.

  • ]

  • text string

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

    Required for SMS

    subject stringnullable

    Subject of multimedia message

    media

    object[]

  • Array [

  • url url

    The url of the media requested to be sent.

    content_type mime-typenullable

    The MIME type of the requested media.

    sha256 stringnullable

    The SHA256 hash of the requested media.

    size integernullable

    The size of the requested media.

  • ]

  • webhook_url urlnullable

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

    webhook_failover_url urlnullable

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

    encoding string

    Encoding scheme used for the message body.

    parts integer

    Possible values: >= 1 and <= 10

    Number of parts into which the message's body must be split.

    tags string[]

    Tags associated with the resource.

    cost

    object

    nullable

    amount decimal

    The amount deducted from your account.

    currency iso4217

    The ISO 4217 currency identifier.

    received_at date-time

    ISO 8601 formatted date indicating when the message request was received.

    sent_at date-time

    ISO 8601 formatted date indicating when the message was sent.

    completed_at date-time

    ISO 8601 formatted date indicating when the message was finalized.

    valid_until date-timenullable

    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

    errors

    Error[]

    These errors may point at addressees when referring to unsuccessful/unconfirmed delivery statuses.

  • Array [

  • code integerrequired
    title stringrequired
    detail string

    source

    object

    pointer json-pointer

    JSON pointer (RFC6901) to the offending entity.

    parameter string

    Indicates which query parameter caused the error.

    meta object
  • ]

default: Unexpected error

Schema

    errors

    Error[]

  • Array [

  • code integerrequired
    title stringrequired
    detail string

    source

    object

    pointer json-pointer

    JSON pointer (RFC6901) to the offending entity.

    parameter string

    Indicates which query parameter caused the error.

    meta object
  • ]

Callbacks

Loading...