> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kakiyo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Campaign

> Permanently delete a campaign and all associated data

## Overview

Permanently delete a campaign and all associated data. This operation cascades to remove all related prospects, conversations, tasks, and analytics data. **This action cannot be undone.**

## Path Parameters

<ParamField path="id" type="string" required>
  The unique identifier of the campaign to delete
</ParamField>

## Use Cases

* **Campaign Cleanup**: Remove completed or obsolete campaigns
* **Data Management**: Clean up test campaigns and outdated data
* **Compliance**: Remove campaigns for data retention compliance
* **Resource Management**: Free up resources by removing unused campaigns

## Important Considerations

<Warning>
  **Permanent Deletion**: This operation permanently deletes the campaign and ALL associated data including:

  * All prospects in the campaign
  * All conversation history and messages
  * All tasks and scheduled activities
  * All analytics and performance data
  * All webhook events related to the campaign

  This action cannot be undone. Consider exporting important data before deletion.
</Warning>

## Response Structure

The response provides a detailed summary of what was deleted:

```json theme={null}
{
  "message": "Campaign deleted successfully",
  "deletionSummary": {
    "campaignId": "campaign_123",
    "campaignName": "Q4 Enterprise Outreach",
    "deletedItems": {
      "prospects": 150,
      "chats": 150,
      "messages": 420,
      "tasks": 75,
      "webhookEvents": 12
    },
    "deletedAt": "2024-01-20T15:30:00Z"
  }
}
```

## Testing Example

```bash theme={null}
curl -X DELETE "https://api.kakiyo.com/v1/campaigns/campaign_123" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"
```

```javascript theme={null}
// JavaScript/Node.js
const campaignId = 'campaign_123';
const response = await fetch(`https://api.kakiyo.com/v1/campaigns/${campaignId}`, {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
});

const result = await response.json();
console.log('Deletion Result:', result);
```

```python theme={null}
# Python
import requests

campaign_id = 'campaign_123'
response = requests.delete(
    f'https://api.kakiyo.com/v1/campaigns/{campaign_id}',
    headers={
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
    }
)

result = response.json()
print('Deletion Result:', result)
```

## Error Responses

### Campaign Not Found

```json theme={null}
{
  "error": "not_found",
  "message": "Campaign not found"
}
```

### Access Denied

```json theme={null}
{
  "error": "forbidden",
  "message": "You do not have access to this campaign"
}
```

### Campaign In Use

```json theme={null}
{
  "error": "campaign_active",
  "message": "Cannot delete active campaign. Please pause the campaign first."
}
```

## Pre-Deletion Checklist

Before deleting a campaign, consider:

1. **Export Data**: Download important analytics and prospect data
2. **Pause Campaign**: Stop all active outreach activities
3. **Notify Team**: Inform team members about the deletion
4. **Backup Conversations**: Save important conversation history
5. **Update Integrations**: Remove campaign references from external systems

## Cascade Deletion Details

When a campaign is deleted, the following related data is automatically removed:

### Prospects

* All prospect records associated with the campaign
* Prospect profile information and additional fields
* LinkedIn profile data and enrichment information

### Conversations

* All chat records and conversation history
* Message threads and AI-generated content
* Response tracking and engagement metrics

### Tasks

* Scheduled outreach tasks
* Follow-up reminders and activities
* Automation workflows and triggers

### Analytics

* Campaign performance metrics
* Historical analytics data
* Activity logs and engagement tracking

### Webhooks

* Campaign-related webhook events
* Event history and delivery logs

## Best Practices

1. **Data Export**: Always export critical data before deletion
2. **Team Communication**: Notify relevant team members
3. **Gradual Cleanup**: Delete campaigns in batches for large cleanups
4. **Audit Trail**: Keep records of deleted campaigns for compliance
5. **Test Environment**: Practice deletion process in test environment first

## Recovery Options

<Info>
  **No Recovery Available**: Once a campaign is deleted, it cannot be recovered. The only way to restore functionality is to:

  * Create a new campaign with similar settings
  * Re-import prospect lists
  * Reconfigure automation workflows
  * Rebuild analytics from scratch
</Info>

## Alternative Actions

Instead of deletion, consider these alternatives:

* **Pause Campaign**: Temporarily stop activities while preserving data
* **Archive Campaign**: Mark as inactive but keep data accessible
* **Export & Recreate**: Export data, delete, then recreate with improvements


## OpenAPI

````yaml DELETE /campaigns/{id}
openapi: 3.1.0
info:
  title: Kakiyo API
  description: API for automating LinkedIn outreach campaigns with AI-powered conversations
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.kakiyo.com/v1
security:
  - bearerAuth: []
paths:
  /campaigns/{id}:
    delete:
      summary: Delete Campaign
      description: Permanently delete a campaign and all associated data
      operationId: deleteCampaign
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          example: campaign_12345abcde
      responses:
        '200':
          description: Campaign deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Campaign deleted successfully
                  deletionSummary:
                    type: object
                    properties:
                      campaignId:
                        type: string
                        example: campaign_123
                      deletedItems:
                        type: object
                        properties:
                          prospects:
                            type: integer
                            example: 150
                          chats:
                            type: integer
                            example: 150
        '401':
          description: Authentication failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Campaign not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
          example: validation_error
        message:
          type: string
          example: The request parameters failed validation
        details:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
                example: name
              message:
                type: string
                example: The name field is required
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````