> For the complete documentation index, see [llms.txt](https://help.clickatell.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.clickatell.com/developers-api-reference/developers-archive/sms-rest-api-overview/stop-message.md).

# Stop message

Archive

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]
```

{% hint style="info" %}
The REST API may respond with various HTTP status codes. See the full list [here](broken://pages/g4LnbcQA4XA3TRKvmBGV).
{% endhint %}

### **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**

{% code lineNumbers="true" %}

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

{% endcode %}

#### **Response**

{% code lineNumbers="true" %}

```
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>
```

{% endcode %}

### **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**

{% code lineNumbers="true" %}

```
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
    }
)
```

{% endcode %}

#### **PHP**

{% code overflow="wrap" lineNumbers="true" %}

```
<?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);
 
?>
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.clickatell.com/developers-api-reference/developers-archive/sms-rest-api-overview/stop-message.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
