# Delete campaign

> DELETE /campaigns/:id — permanently delete a campaign.

`DELETE /campaigns/:id`

Permanently deletes a campaign. This cannot be undone. You can only delete campaigns in the `draft`, `scheduled`, or `recurring` status; deleting a scheduled or recurring campaign also cancels its pending job so it will not fire.

**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.remove('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90');
console.log({ data, error });
```

**Ruby**

```ruby
require "sendping"

SendPing.api_key = "mb_xxxxxxxxx"

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

**PHP**

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

use SendPing\SendPing;

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

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

**Python**

```python
import sendping

sendping.api_key = "mb_xxxxxxxxx"

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

**Go**

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

client := sendping.NewClient("mb_xxxxxxxxx")

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

**Rust**

```rust
use sendping::SendPing;

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

let _removed = mb.campaigns.remove("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().remove("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90");
```

**.NET**

```csharp
using SendPing;

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

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

**cURL**

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

**CLI**

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

### Response

```json
{
  "object": "campaign",
  "id": "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90",
  "deleted": true
}
```

> **Note:** Errors: `not_found` if the campaign does not exist or is not yours; `validation_error` (422) for a campaign in any other status — a campaign that is already `queued`, `sent`, `failed` or `canceled` cannot be deleted.
