> 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 scheduled messages

DELETE https://api.youratlas.com/v1/api/campaign-chat/{campaignId}/scheduled-messages
Content-Type: application/json

Cancels messages that are waiting to be sent in a campaign. Send `{"all": true}` to cancel every waiting message in the campaign, or `{"messages": [...]}` with up to 500 `sessionId` and `messageId` pairs (from [List scheduled messages](/api-reference/atlas-api/campaign-chat/get-scheduled-messages)) to cancel specific ones. Cancelled messages are removed and never sent. Messages that were already sent are not counted. Returns `400` if the body is invalid or the campaign does not exist on your account.

Reference: https://docs.youratlas.com/api-reference/atlas-api/campaign-chat/cancel-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)

### Body (application/json)

This endpoint expects a Campaign Chat_cancelScheduledMessages_Request.

- `Campaign Chat_cancelScheduledMessages_Request`
  - CampaignChatCancelScheduledMessagesRequest0
  - CampaignChatCancelScheduledMessagesRequest1

## Response

### 200

Messages cancelled

- `cancelled` (integer, optional) — Number of 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

### CampaignChatCancelScheduledMessagesRequest0

- `all` (boolean, required) — Cancel every message waiting to be sent in the campaign.

### CampaignChatCancelScheduledMessagesRequest1

- `messages` (list of CampaignChatCampaignIdScheduledMessagesDeleteRequestBodyContentApplicationJsonSchemaOneOf1MessagesItems, required)

### ErrorError

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

### CampaignChatCampaignIdScheduledMessagesDeleteRequestBodyContentApplicationJsonSchemaOneOf1MessagesItems

- `sessionId` (string, required)
- `messageId` (string, required)

## Examples

### Campaign Chat_cancelScheduledMessages_example

**Response**

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

**SDK Code**

```python Campaign Chat_cancelScheduledMessages_example
import requests

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

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

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

print(response.json())
```

```javascript Campaign Chat_cancelScheduledMessages_example
const url = 'https://api.youratlas.com/v1/api/campaign-chat/campaignId/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_cancelScheduledMessages_example
package main

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

func main() {

	url := "https://api.youratlas.com/v1/api/campaign-chat/campaignId/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_cancelScheduledMessages_example
require 'uri'
require 'net/http'

url = URI("https://api.youratlas.com/v1/api/campaign-chat/campaignId/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_cancelScheduledMessages_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/scheduled-messages")
  .header("api-key", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

```csharp Campaign Chat_cancelScheduledMessages_example
using RestSharp;

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

```swift Campaign Chat_cancelScheduledMessages_example
import Foundation

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

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

### Cancel everything waiting to be sent

**Request**

```json
{
  "all": true
}
```

**Response**

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

**SDK Code**

```python Cancel everything waiting to be sent
import requests

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

payload = { "all": True }
headers = {
    "api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Cancel everything waiting to be sent
const url = 'https://api.youratlas.com/v1/api/campaign-chat/campaignId/scheduled-messages';
const options = {
  method: 'DELETE',
  headers: {'api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"all":true}'
};

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

```go Cancel everything waiting to be sent
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"all\": true\n}")

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

	req.Header.Add("api-key", "<apiKey>")
	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))

}
```

```ruby Cancel everything waiting to be sent
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Delete.new(url)
request["api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"all\": true\n}"

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

```java Cancel everything waiting to be sent
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/scheduled-messages")
  .header("api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"all\": true\n}")
  .asString();
```

```php Cancel everything waiting to be sent
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://api.youratlas.com/v1/api/campaign-chat/campaignId/scheduled-messages', [
  'body' => '{
  "all": true
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'api-key' => '<apiKey>',
  ],
]);

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

```csharp Cancel everything waiting to be sent
using RestSharp;

var client = new RestClient("https://api.youratlas.com/v1/api/campaign-chat/campaignId/scheduled-messages");
var request = new RestRequest(Method.DELETE);
request.AddHeader("api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"all\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Cancel everything waiting to be sent
import Foundation

let headers = [
  "api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["all": true] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.youratlas.com/v1/api/campaign-chat/campaignId/scheduled-messages")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
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()
```

### Cancel specific messages

**Request**

```json
{
  "messages": [
    {
      "messageId": "0000000000001",
      "sessionId": "a1b2c3d4"
    }
  ]
}
```

**Response**

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

**SDK Code**

```python Cancel specific messages
import requests

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

payload = { "messages": [
        {
            "messageId": "0000000000001",
            "sessionId": "a1b2c3d4"
        }
    ] }
headers = {
    "api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Cancel specific messages
const url = 'https://api.youratlas.com/v1/api/campaign-chat/campaignId/scheduled-messages';
const options = {
  method: 'DELETE',
  headers: {'api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"messages":[{"messageId":"0000000000001","sessionId":"a1b2c3d4"}]}'
};

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

```go Cancel specific messages
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"messages\": [\n    {\n      \"messageId\": \"0000000000001\",\n      \"sessionId\": \"a1b2c3d4\"\n    }\n  ]\n}")

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

	req.Header.Add("api-key", "<apiKey>")
	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))

}
```

```ruby Cancel specific messages
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Delete.new(url)
request["api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"messages\": [\n    {\n      \"messageId\": \"0000000000001\",\n      \"sessionId\": \"a1b2c3d4\"\n    }\n  ]\n}"

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

```java Cancel specific messages
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/scheduled-messages")
  .header("api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"messages\": [\n    {\n      \"messageId\": \"0000000000001\",\n      \"sessionId\": \"a1b2c3d4\"\n    }\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://api.youratlas.com/v1/api/campaign-chat/campaignId/scheduled-messages', [
  'body' => '{
  "messages": [
    {
      "messageId": "0000000000001",
      "sessionId": "a1b2c3d4"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'api-key' => '<apiKey>',
  ],
]);

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

```csharp Cancel specific messages
using RestSharp;

var client = new RestClient("https://api.youratlas.com/v1/api/campaign-chat/campaignId/scheduled-messages");
var request = new RestRequest(Method.DELETE);
request.AddHeader("api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"messages\": [\n    {\n      \"messageId\": \"0000000000001\",\n      \"sessionId\": \"a1b2c3d4\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Cancel specific messages
import Foundation

let headers = [
  "api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["messages": [
    [
      "messageId": "0000000000001",
      "sessionId": "a1b2c3d4"
    ]
  ]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.youratlas.com/v1/api/campaign-chat/campaignId/scheduled-messages")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
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()
```