SMS operations

You can perform the following SMS-related operations using the endpoint API:

  • List sent and received SMS
    GET
    /api/v1/endpoint/:endpoint_id/sms
    1curl https://cdn.emnify.net/api/v1/endpoint/endpoint_id/sms \
    2 -H "Authorization: Bearer <token>"
  • Send SMS to a device
    POST
    /api/v1/endpoint/:endpoint_id/sms
    1curl -X POST https://cdn.emnify.net/api/v1/endpoint/endpoint_id/sms \
    2 -H "Authorization: Bearer <token>" \
    3 -H "Content-Type: application/json" \
    4 -d '{
    5 "payload": "This is the message text",
    6 "source_address": "Sender Name",
    7 "source_address_type": {
    8 "id": 208
    9 }
    10}'
  • Get details about a device SMS
    GET
    /api/v1/endpoint/:endpoint_id/sms/:sms_id
    1curl https://cdn.emnify.net/api/v1/endpoint/endpoint_id/sms/sms_id \
    2 -H "Authorization: Bearer <token>"
  • Cancel a buffered SMS
    DELETE
    /api/v1/endpoint/:endpoint_id/sms/:sms_id
    1curl -X DELETE https://cdn.emnify.net/api/v1/endpoint/endpoint_id/sms/sms_id \
    2 -H "Authorization: Bearer <token>"

Example

To send SMS directly from your application to a device, make the following API call: POST https://cdn.emnify.net/api/v1/endpoint/{endpoint_id}/sms

The required headers are Content-Type and Authorization with the respective values application/json and Bearer TOKEN. Replace TOKEN with your auth_token and make sure there’s a non-breaking space between Bearer and the token value.

Request body for Mobile terminated (MT) SMS:

1{
2 "source_address": 12345,
3 "payload": "This is the message text"
4}

Successful response:

1201

The source address is the sender number that appears on the receiving device. The payload is the actual text sent as an SMS.

To receive SMS on your application from the device, you need to first set up a callback URL in the service profile assigned to the device. For more information, see Receive MO SMS via API Callback.