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

# Clear campaign

> End every contact list of a campaign without deleting the campaign

# Clear campaign

Ends every active contact list of the campaign and, optionally, removes its calls — the same as **Clear campaign** in the dashboard. The campaign itself, its settings and its call history stay.

## Endpoint

```
POST /api/v1/campaigns/{campaign_id}/clear
```

## Path parameters

**campaign\_id** `string` *required*

Campaign UUID.

## Request headers

**Authorization** `string` *required*

Bearer token. Format: `Bearer talq_your_environment_token_here`

## Request body

**export\_to\_sftp** `boolean` (default: true)

When the campaign has SFTP export configured, export the results before removing the calls.

**delete\_calls** `boolean` (default: false)

Remove the calls whose status is in `delete_statuses`. Without it, unfinished calls are only stopped.

**delete\_statuses** `string[]` (default: \[])

Statuses to remove when `delete_calls` is `true`: `pending`, `queued`, `processing`, `awaiting_report`, `completed`, `failed`, `canceled`, `paused`, `terminated`.

> [!WARNING]
>
> **An empty `delete_statuses` removes nothing.** To remove the calls of every status, send every status in the list.

## What clearing does

* Every unfinished call (pending, paused, processing) is stopped, so nothing in the old lists is dialed again. Finished calls are kept.
* With `delete_calls`, calls in the chosen statuses leave the campaign. They are hidden, not destroyed: recordings, transcripts and billing stay.
* Removed numbers can be imported again right away. **This also drops their cooldown**: a number that completed a call can be called again by the next list.
* The response comes back when the lists are ended. Only the SFTP export, when configured, runs afterwards.

## Examples

```bash theme={null}
curl -X POST "https://app.talkover.ai/api/v1/campaigns/campaign-uuid/clear" \
  -H "Authorization: Bearer talq_your_environment_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "delete_calls": true,
    "delete_statuses": ["pending", "queued", "processing", "awaiting_report", "completed", "failed", "canceled", "paused", "terminated"]
  }'
```

## Response

```json theme={null}
{
  "success": true,
  "data": {
    "files_cleared": 1,
    "files_failed": 0,
    "completed_calls": 15204,
    "terminated_calls": 3138,
    "leftover_calls_deleted": 0,
    "sftp_export_queued": false
  },
  "message": "Campaign cleared. 1 files cleared, 15204 completed, 3138 terminated."
}
```

## Error responses

### 500 — Partially cleared

At least one list could not be ended (`files_failed` > 0) and is still active. **Do not upload the next list yet**: send the clear again — it only touches the lists that are still active.

```json theme={null}
{
  "success": false,
  "data": { "files_cleared": 2, "files_failed": 1, "completed_calls": 9120, "terminated_calls": 410, "leftover_calls_deleted": 0, "sftp_export_queued": false },
  "message": "Campaign partially cleared: 1 list(s) failed. Retry the clear before uploading."
}
```

### 404 — Campaign not found

The campaign does not exist or belongs to another environment.

## Daily cycle

To replace a campaign's mailing every day by script:

1. **Clear**: `POST /campaigns/{campaign_id}/clear`. On `500`, retry until it returns `200`.
2. **Upload**: `POST /campaigns/{campaign_id}/files` with the new CSV. On `422`, fix the file — nothing was imported.
3. **Follow**: `GET /campaigns/{campaign_id}/files/{file_data_id}/progress` every few seconds until `completed` or `failed`.

For mailings delivered as files, [SFTP import](https://docs.talkover.ai/api-reference/endpoints/trigger-campaign-sftp-import) does the same without an HTTP upload.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.