> This page is for Developers.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.emnify.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.emnify.com/_mcp/server.

> Send, receive, list, and cancel SMS messages for IoT devices using the endpoint API operations.

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

* List sent and received SMS
  ### Request

GET [https://cdn.emnify.net/api/v1/endpoint/\{endpoint\_id}/sms](https://cdn.emnify.net/api/v1/endpoint/\{endpoint_id}/sms)

**`SMS List`**

```curl SMS List
curl https://cdn.emnify.net/api/v1/endpoint/1/sms \
     -H "Authorization: Bearer <token>"
```

**`SMS List`**

```python SMS List
import requests

url = "https://cdn.emnify.net/api/v1/endpoint/1/sms"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

**`SMS List`**

```javascript SMS List
const url = 'https://cdn.emnify.net/api/v1/endpoint/1/sms';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**`SMS List`**

```go SMS List
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://cdn.emnify.net/api/v1/endpoint/1/sms"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

**`SMS List`**

```ruby SMS List
require 'uri'
require 'net/http'

url = URI("https://cdn.emnify.net/api/v1/endpoint/1/sms")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

**`SMS List`**

```java SMS List
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://cdn.emnify.net/api/v1/endpoint/1/sms")
  .header("Authorization", "Bearer <token>")
  .asString();
```

**`SMS List`**

```php SMS List
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://cdn.emnify.net/api/v1/endpoint/1/sms', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

**`SMS List`**

```csharp SMS List
using RestSharp;

var client = new RestClient("https://cdn.emnify.net/api/v1/endpoint/1/sms");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

**`SMS List`**

```swift SMS List
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://cdn.emnify.net/api/v1/endpoint/1/sms")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

* Send SMS to a device
  ### Request

POST [https://cdn.emnify.net/api/v1/endpoint/\{endpoint\_id}/sms](https://cdn.emnify.net/api/v1/endpoint/\{endpoint_id}/sms)

**`Standard SMS`**

```curl Standard SMS
curl -X POST https://cdn.emnify.net/api/v1/endpoint/12345/sms \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json" \
     -d '{
  "payload": "This is the message text",
  "source_address": "12345689"
}'
```

**`Standard SMS`**

```python Standard SMS
import requests

url = "https://cdn.emnify.net/api/v1/endpoint/12345/sms"

payload = {
    "payload": "This is the message text",
    "source_address": "12345689"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

**`Standard SMS`**

```javascript Standard SMS
const url = 'https://cdn.emnify.net/api/v1/endpoint/12345/sms';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"payload":"This is the message text","source_address":"12345689"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**`Standard SMS`**

```go Standard SMS
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://cdn.emnify.net/api/v1/endpoint/12345/sms"

	payload := strings.NewReader("{\n  \"payload\": \"This is the message text\",\n  \"source_address\": \"12345689\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

**`Standard SMS`**

```ruby Standard SMS
require 'uri'
require 'net/http'

url = URI("https://cdn.emnify.net/api/v1/endpoint/12345/sms")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"payload\": \"This is the message text\",\n  \"source_address\": \"12345689\"\n}"

response = http.request(request)
puts response.read_body
```

**`Standard SMS`**

```java Standard SMS
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://cdn.emnify.net/api/v1/endpoint/12345/sms")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"payload\": \"This is the message text\",\n  \"source_address\": \"12345689\"\n}")
  .asString();
```

**`Standard SMS`**

```php Standard SMS
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://cdn.emnify.net/api/v1/endpoint/12345/sms', [
  'body' => '{
  "payload": "This is the message text",
  "source_address": "12345689"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

**`Standard SMS`**

```csharp Standard SMS
using RestSharp;

var client = new RestClient("https://cdn.emnify.net/api/v1/endpoint/12345/sms");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"payload\": \"This is the message text\",\n  \"source_address\": \"12345689\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

**`Standard SMS`**

```swift Standard SMS
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "payload": "This is the message text",
  "source_address": "12345689"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://cdn.emnify.net/api/v1/endpoint/12345/sms")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

* Get details about a device SMS
  ### Request

GET [https://cdn.emnify.net/api/v1/endpoint/\{endpoint\_id}/sms/\{sms\_id}](https://cdn.emnify.net/api/v1/endpoint/\{endpoint_id}/sms/\{sms_id})

**`SMS Details`**

```curl SMS Details
curl https://cdn.emnify.net/api/v1/endpoint/1/sms/1.1 \
     -H "Authorization: Bearer <token>"
```

**`SMS Details`**

```python SMS Details
import requests

url = "https://cdn.emnify.net/api/v1/endpoint/1/sms/1.1"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

**`SMS Details`**

```javascript SMS Details
const url = 'https://cdn.emnify.net/api/v1/endpoint/1/sms/1.1';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**`SMS Details`**

```go SMS Details
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://cdn.emnify.net/api/v1/endpoint/1/sms/1.1"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

**`SMS Details`**

```ruby SMS Details
require 'uri'
require 'net/http'

url = URI("https://cdn.emnify.net/api/v1/endpoint/1/sms/1.1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

**`SMS Details`**

```java SMS Details
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://cdn.emnify.net/api/v1/endpoint/1/sms/1.1")
  .header("Authorization", "Bearer <token>")
  .asString();
```

**`SMS Details`**

```php SMS Details
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://cdn.emnify.net/api/v1/endpoint/1/sms/1.1', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

**`SMS Details`**

```csharp SMS Details
using RestSharp;

var client = new RestClient("https://cdn.emnify.net/api/v1/endpoint/1/sms/1.1");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

**`SMS Details`**

```swift SMS Details
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://cdn.emnify.net/api/v1/endpoint/1/sms/1.1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

* Cancel a buffered SMS
  ### Request

DELETE [https://cdn.emnify.net/api/v1/endpoint/\{endpoint\_id}/sms/\{sms\_id}](https://cdn.emnify.net/api/v1/endpoint/\{endpoint_id}/sms/\{sms_id})

```curl
curl -X DELETE https://cdn.emnify.net/api/v1/endpoint/1/sms/1.1 \
     -H "Authorization: Bearer <token>"
```

```python
import requests

url = "https://cdn.emnify.net/api/v1/endpoint/1/sms/1.1"

headers = {"Authorization": "Bearer <token>"}

response = requests.delete(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://cdn.emnify.net/api/v1/endpoint/1/sms/1.1';
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://cdn.emnify.net/api/v1/endpoint/1/sms/1.1"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://cdn.emnify.net/api/v1/endpoint/1/sms/1.1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://cdn.emnify.net/api/v1/endpoint/1/sms/1.1")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://cdn.emnify.net/api/v1/endpoint/1/sms/1.1', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://cdn.emnify.net/api/v1/endpoint/1/sms/1.1");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://cdn.emnify.net/api/v1/endpoint/1/sms/1.1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

## 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`](/developers/auth/application-tokens) and make sure there's a non-breaking space between `Bearer` and the token value.

Request body for Mobile terminated (MT) SMS:

```json
{
  "source_address": 12345,
  "payload": "This is the message text"
}
```

Successful response:

```json
201
```

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

> **Tip**
>
> 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](/developers/callbacks/sms).