# Cancel campaign

> POST /campaigns/:id/cancel — return a scheduled campaign to draft, or terminally stop one that is already sending.

`POST /campaigns/:id/cancel`

Cancels a campaign that still has pending work. A `scheduled`, `recurring` or reputation-`paused` campaign has its pending job dropped and returns to the `draft` status, so you can edit it and send or schedule it again. A campaign that is already sending (reported as `queued`) is **stopped** instead: all remaining work is cancelled and it becomes the terminal status `canceled`, which cannot be resumed or re-sent. Returns the updated campaign object.

**Path parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | The campaign ID. |

**Node.js**

```js
import { SendPing } from 'sendping';

const mb = new SendPing('mb_xxxxxxxxx');

const { data, error } = await mb.campaigns.cancel('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90');
console.log({ data, error });
```

**Ruby**

```ruby
require "sendping"

SendPing.api_key = "mb_xxxxxxxxx"

SendPing::Campaigns.cancel("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90")
```

**PHP**

```php
<?php
require 'vendor/autoload.php';

use SendPing\SendPing;

$sendping = SendPing::client('mb_xxxxxxxxx');

$sendping->campaigns->cancel('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90');
```

**Python**

```python
import sendping

sendping.api_key = "mb_xxxxxxxxx"

sendping.Campaigns.cancel("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90")
```

**Go**

```go
import "github.com/shekhu10/sendping-sdks/sendping-go"

client := sendping.NewClient("mb_xxxxxxxxx")

campaign, err := client.Campaigns.Cancel("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90")
```

**Rust**

```rust
use sendping::SendPing;

let mb = SendPing::new("mb_xxxxxxxxx");

let _campaign = mb.campaigns.cancel("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90").await?;
```

**Java**

```java
import co.sendping.SendPing;
import co.sendping.SendPingResponse;

SendPing sendping = new SendPing("mb_xxxxxxxxx");

SendPingResponse response = sendping.campaigns().cancel("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90");
```

**.NET**

```csharp
using SendPing;

ISendPing sendping = SendPingClient.Create("mb_xxxxxxxxx");

var resp = await sendping.CampaignCancelAsync("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90");
```

**cURL**

```bash
curl -X POST 'https://www.sendping.co/api/campaigns/8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90/cancel' \
  -H 'Authorization: Bearer mb_xxxxxxxxx'
```

**CLI**

```bash
sendping campaigns cancel 8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90
```

### Response

```json
{
  "object": "campaign",
  "id": "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90",
  "name": "June newsletter",
  "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
  "segment_id": null,
  "topic_id": null,
  "from": "Acme <news@yourdomain.com>",
  "subject": "What's new in June",
  "html": "<p>Hi {{FIRST_NAME}}!</p>",
  "text": "Hi {{FIRST_NAME}}!",
  "reply_to": null,
  "preview_text": null,
  "status": "draft",
  "scheduled_at": null,
  "sent_at": null,
  "created_at": "2026-06-23T10:00:00.000Z",
  "ab_test": { "enabled": false },
  "recurrence": null,
  "parent_campaign_id": null
}
```

> **Note:** Errors: `not_found` if the campaign does not exist or is not yours; `validation_error` if it is not in one of the four cancelable states (`scheduled`, `recurring`, `paused`, or `queued`).
