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

# Cancel a contact's scheduled messages

DELETE https://api.youratlas.com/v1/api/campaign-chat/{campaignId}/contacts/{contactIdentifier}/scheduled-messages

Cancels every queued (not yet sent) message for one contact in a campaign, across all of that contact's conversations. Other contacts on the same sender number are not affected, and the campaign keeps sending. Cancelled messages are removed and never sent. Messages that are already sending are left alone and not counted. Safe to repeat: when nothing is queued the response is `{"cancelled": 0}`. Returns `400` if the campaign does not exist on your account.

Reference: https://docs.youratlas.com/api-reference/atlas-api/campaign-chat/cancel-contact-scheduled-messages

## Authentication

- `api-key` header (required) — Your Atlas API key. Get it from the Atlas Portal under Settings > API Keys.

## Request

### Path parameters

- `campaignId` (string, required)
- `contactIdentifier` (string, required) — Contact phone number (E.164) or Apple ID email, URL-encoded (`+` becomes `%2B`).

## Response

### 200

Messages cancelled

- `cancelled` (integer, optional) — Number of queued messages that were cancelled.

## Errors

### 400 Bad Request Error

Bad request

- `error` (ErrorError, optional)

### 500 Internal Server Error

Internal server error

- `error` (ErrorError, optional)

## Types

### ErrorError

- `message` (string, optional)
- `code` (string, optional)
- `requestId` (string, optional)

## Examples

**Response**

```json
{
  "cancelled": 3
}
```

**SDK Code**

```python Campaign Chat_cancelContactScheduledMessages_example
import requests

url = "https://api.youratlas.com/v1/api/campaign-chat/campaignId/contacts/contactIdentifier/scheduled-messages"

headers = {"api-key": "<apiKey>"}

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

print(response.json())
```

```javascript Campaign Chat_cancelContactScheduledMessages_example
const url = 'https://api.youratlas.com/v1/api/campaign-chat/campaignId/contacts/contactIdentifier/scheduled-messages';
const options = {method: 'DELETE', headers: {'api-key': '<apiKey>'}};

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

```go Campaign Chat_cancelContactScheduledMessages_example
package main

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

func main() {

	url := "https://api.youratlas.com/v1/api/campaign-chat/campaignId/contacts/contactIdentifier/scheduled-messages"

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

	req.Header.Add("api-key", "<apiKey>")

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

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

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

}
```

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

url = URI("https://api.youratlas.com/v1/api/campaign-chat/campaignId/contacts/contactIdentifier/scheduled-messages")

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

request = Net::HTTP::Delete.new(url)
request["api-key"] = '<apiKey>'

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

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

HttpResponse<String> response = Unirest.delete("https://api.youratlas.com/v1/api/campaign-chat/campaignId/contacts/contactIdentifier/scheduled-messages")
  .header("api-key", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://api.youratlas.com/v1/api/campaign-chat/campaignId/contacts/contactIdentifier/scheduled-messages', [
  'headers' => [
    'api-key' => '<apiKey>',
  ],
]);

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

```csharp Campaign Chat_cancelContactScheduledMessages_example
using RestSharp;

var client = new RestClient("https://api.youratlas.com/v1/api/campaign-chat/campaignId/contacts/contactIdentifier/scheduled-messages");
var request = new RestRequest(Method.DELETE);
request.AddHeader("api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Campaign Chat_cancelContactScheduledMessages_example
import Foundation

let headers = ["api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.youratlas.com/v1/api/campaign-chat/campaignId/contacts/contactIdentifier/scheduled-messages")! 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()
```