# 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 { SendDart } from 'senddart';

const mb = new SendDart('mb_xxxxxxxxx');

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

**Ruby**

```ruby
require "senddart"

SendDart.api_key = "mb_xxxxxxxxx"

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

**PHP**

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

use SendDart\SendDart;

$senddart = SendDart::client('mb_xxxxxxxxx');

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

**Python**

```python
import senddart

senddart.api_key = "mb_xxxxxxxxx"

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

**Go**

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

client := senddart.NewClient("mb_xxxxxxxxx")

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

**Rust**

```rust
use senddart::SendDart;

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

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

**Java**

```java
import com.senddart.SendDart;
import com.senddart.SendDartResponse;

SendDart senddart = new SendDart("mb_xxxxxxxxx");

SendDartResponse response = senddart.campaigns().remove("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90");
```

**.NET**

```csharp
using SendDart;

ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx");

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

**cURL**

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

**CLI**

```bash
senddart 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.
