`https://lumail.io/api/v1/campaigns/{campaignId}`

Permanently delete a campaign from your organization. Only campaigns with DRAFT status can be deleted.

## Response

- **Success (200 OK)** - Returns confirmation of deletion.
- **Error (400 Bad Request)** - Campaign is not in DRAFT status.
- **Error (404 Not Found)** - Campaign not found or doesn't belong to your organization.
- **Error (401 Unauthorized)** - Invalid or missing API token.

## Path Parameters

| Parameter    | Type   | Description                          |
| ------------ | ------ | ------------------------------------ |
| `campaignId` | string | **Required.** The unique campaign ID |

## Response Fields

| Field        | Type    | Description                               |
| ------------ | ------- | ----------------------------------------- |
| `success`    | boolean | Indicates if the operation was successful |
| `deleted`    | boolean | Confirms the campaign was deleted         |
| `campaignId` | string  | The ID of the deleted campaign            |

## Important Notes

- **Only DRAFT campaigns can be deleted.** Scheduled, sending, sent, or archived campaigns cannot be deleted via the API.
- **This action is permanent.** Deleted campaigns cannot be recovered.
- For campaigns you want to keep but hide, consider using the archive feature in the Lumail UI instead.
- Deleting a campaign does not affect any emails that have already been sent from that campaign.

## Usage Example

Use this API endpoint to:

- Clean up unused draft campaigns
- Remove test campaigns
- Build campaign management interfaces with delete functionality
- Automate cleanup of old draft campaigns

## Related Documentation

- [List Campaigns](/docs/api-reference/api-campaigns-get) - List all campaigns
- [Create Campaign](/docs/api-reference/api-campaigns-post) - Create a new campaign
- [Get Campaign](/docs/api-reference/api-campaign-get) - Get details for a specific campaign
- [Update Campaign](/docs/api-reference/api-campaign-patch) - Update a campaign


## API Reference
**Method:** DELETE
**Endpoint:** /api/v1/campaigns/{campaignId}

### SDK
```ts
import { Lumail } from "lumail";
const lumail = new Lumail({ apiKey: "YOUR_API_TOKEN" });

await lumail.campaigns.delete("cmp_abc123xyz");
```

### cURL
```bash
curl -X DELETE https://lumail.io/api/v1/campaigns/cmp_abc123xyz \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"
```

### JavaScript
```javascript
const campaignId = 'cmp_abc123xyz';
const response = await fetch(`https://lumail.io/api/v1/campaigns/${campaignId}`, {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json',
  },
});

const data = await response.json();
console.log(data);
```

### Python
```python
import requests

campaign_id = "cmp_abc123xyz"
url = f"https://lumail.io/api/v1/campaigns/{campaign_id}"
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}

response = requests.delete(url, headers=headers)
data = response.json()
print(data)
```

### Success Response
```json
{
  "success": true,
  "deleted": true,
  "campaignId": "cmp_abc123xyz"
}
```

### Error Response
```json
{
  "message": "Only DRAFT campaigns can be deleted. Archive the campaign instead if you want to keep it."
}
```
