Send Message
This request sends a message from a rented DID.
| post | /sms/messages |
Sample
A sample POST request to send an SMS:
curl -X POST \
'https://api.carrierx.com/core/v2/sms/messages' \
-H 'Content-Type: application/json' \
--data-binary '{"from":"15162065575", "to":"15162065574", "message":"This is a test message"}'
-H 'Authorization: Bearer 5ebc03d6-8b2b-44ad-bf65-72d4f1491dda'
Response
200 status code with a serialized copy of the SMS object:
{
"date_changed": "2023-12-06T15:18:30.084Z",
"date_created": "2023-12-06T15:18:29.189Z",
"date_status_changed": null,
"direction": "outbound",
"from": "15162065575",
"group_recipients": [],
"mcc": null,
"media_urls": [],
"message": "This is a test message",
"message_segments": 1,
"message_sid": "097b49df-c54e-4eaf-97d0-89cf7d5a655b",
"mnc": null,
"partner_sid": "e00430c3-a7d0-4666-ab5c-f7202448382f",
"price": null,
"status": "queued",
"to": "15162065574",
"type": "sms",
"user_data": "test_message"
}
note
Please note, that
- to send messages from a rented DID you need to enable SMS/MMS messaging on that DID first.
- an MMS message can have a text body of up to 1600 characters and up to 10 media items such as images with the total size limited to 3 MB. If you exceed these restrictions, the message will fail and will not be sent out.
Required Scopes
To create an SMS object, the partner must have one of the following scopes enabled:
sms.managesms.create
Body Arguments
JSON representation of the fields and values of the SMS object to be created.
Required fields to send an SMS message are:
from(some legacy users may still seefrom_did, i.e. the old naming)messageto(some legacy users may still seeto_did, i.e. the old naming)
Required fields to send an MMS message are:
group_recipients: if this field contains at least one phone number and the messagedirectionisoutbound, the messagetypemust be set tomms. If themedia_urlsattribute is already specified,group_recipientsis optional for themmsmessagefrom(some legacy users may still seefrom_did, i.e. the old naming)media_urls: if thegroup_recipientsattribute is already specified,media_urlsis optional for themmsmessagemessage: is required if themedia_urlsfield is emptyto(some legacy users may still seeto_did, i.e. the old naming)
note
Please note, that sending SMS from short code and MMS to phone numbers outside the US is disabled.
Refer to this table to view all fields that appear in the SMS object.