Developer
Hub

Image for How+to+send+and+receive+SMS+via+the+API%3F

How to send and receive SMS via the API?

To submit SMS directly from your application to an endpoint using our API, the following API call needs to be made: POST https://cdn.emnify.net/api/v1/endpoint/{endpointId}/sms Required Headers: Content-Type: application/json Authorization: Bearer {auth_token} JSON Body: { "source_address": "12345", "payload": "This is the message text!" } To receive SMS on your application server from the device you will need to first set up a Callback URL in the Service profile assigned to that endpoint: Set the API URL on the "SMS" tab - select "RestAPI" on the drop-down menu for “Interface” Select the “configuration icon” next to “RestAPI”, input a purpose (name of your choosing) and the URL You can also set up a "Secret" (optional) The EMnify system will then send the MO SMS as a JSON payload if the destination address of the SMS is an invalid MSISDN (8 digits or less). A2P / P2P Routing Our system distinguishes A2P SMS (application-to-person) from P2P SMS (person-to-person) based on the length of the source (MO SMS) or the destination (MT SMS) address. If there are 8 digits or less (i.e. an invalid MSISDN), an SMS will be considered A2P. If there are 9 digits or more, an SMS will be processed as MSISDN and will be considered P2P. To dispatch SMS MO to your application (A2P) and at the same time have P2P SMS enabled, the destination number (dest_address) must be limited to 8 digits or less. A detailed description of the SMS API you can find in our API Documentation.

1 2 3 4