Loader

Stop message


Overview

This command will attempt to stop the delivery of a particular message. This command can only stop messages that have been scheduled for delivery in the future or may be queued within our router. It cannot stop messages that have already been delivered to an SMSC.

DELETE https://api.clickatell.com/rest/message/[message ID]
 

Note: the REST API may respond with various HTTP status codes. See the full list here.


JSON

Request
DELETE /rest/message/360586640fe9846954897dffe6c13dfc HTTP/1.1
HOST: api.clickatell.com
X-Version: 1
Authorization: Bearer [Your Authorization Token]
Accept: application/json

Response
HTTP/1.1 200 OK
Content-Type: application/json
 
{
   "data" : {
       "messageStatus" "006",
       "description" "User cancelled message delivery",
        "apiMessageId" "360586640fe9846954897dffe6c13dfc"
    }
}

XML

Request

1
2
3
4
5

DELETE /rest/message/360586640fe9846954897dffe6c13dfc HTTP/1.1
HOST: api.clickatell.com
X-Version: 1
Authorization: Bearer [Your Authorization Token]
Accept: application/xml


Response

1
2
3
4
5
6
7
8
9
10
11

HTTP/1.1 200 OK
Content-Type: application/xml
 
<?xml version="1.0"?>
<response>
    <data>
    <messageStatus>006</messageStatus>
    <description>User cancelled message delivery</description>
    <apiMessageId>b09e1b1bdb5a070c978f03b6836b955c</apiMessageId>
    </data>
</response>


Sample code

cURL
msgId=""
 
authToken=""
 
curl -X DELETE \
-H "X-Version: 1" \
-H "Accept: application/json" \
-H "Authorization: Bearer $authToken" \
 
https://api.clickatell.com/rest/message/$msgId

Python

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

import httplib2, json
 
msgId = ""
 
authToken = ""
 
resp, content = httplib2.Http().request(
    "https://api.clickatell.com/rest/message/" + msgId,
    "DELETE",
    headers={
        "X-Version" "1",
        "Accept" "application/json",
        "Authorization" "Bearer " + authToken
    }
)


PHP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

<?php
 
$msgId "<api message ID>";
 
$authToken "<place auth token here>";
 
$ch = curl_init();
 
curl_setopt($ch, CURLOPT_URL,            "https://api.clickatell.com/rest/message/$msgId");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,  "DELETE");
curl_setopt($ch, CURLOPT_HTTPHEADER,     array(
    "X-Version: 1",
    "Accept: application/json",
    "Authorization: Bearer $authToken"
));
  
$result = curl_exec ($ch);
 
?>

Did you find this information informative?

Other Resources

Ask the Community

Visit Stack Overflow to join our community of developers and find the answer you need

Contact Support

Contact our support team and one of our agents will be in touch with you to answer any questions you have