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

# Delete Leads from Campaigns

> Remove up to 2000 leads from up to 100 campaigns in one call, with a dry run to preview the counts

Removes the given leads from the given campaigns in one transaction. Send `"dry_run": true` first: it returns the same counts and writes nothing.

> [!WARNING]
>
> When a lead is left in **none** of your campaigns after the removal, the lead itself is deleted too, with its list and tag links (main account key). With a client API key, only that client's access to the lead is removed; the lead record is never deleted. Check `summary.lead_rows_deleted` in a dry run before you run it for real.

## Query Parameters

**api\_key** `string` *required*

Your SmartLead API key

## Request Body

**lead\_ids** `array` *required*

Lead ids (positive integers), 1 to 2000. These are lead ids, not campaign-lead mapping ids.

**campaign\_ids** `array` *required*

Campaign ids (positive integers) to remove the leads from, 1 to 100.

**dry\_run** `boolean` (default: false)

`true` returns the counts that a real run would produce and changes nothing.

```bash cURL theme={null}
curl -X POST "https://server.smartlead.ai/api/v1/leads/delete-from-campaigns?api_key=YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"lead_ids": [5001, 5002], "campaign_ids": [123], "dry_run": true}'
```

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

body = {"lead_ids": [5001, 5002], "campaign_ids": [123]}
url = "https://server.smartlead.ai/api/v1/leads/delete-from-campaigns"
params = {"api_key": "YOUR_API_KEY"}

preview = requests.post(url, params=params, json={**body, "dry_run": True}).json()
print(preview["summary"])
if preview["summary"]["lead_rows_deleted"] == 0:
    print(requests.post(url, params=params, json=body).json())
```

```json 200 theme={null}
{
  "ok": true,
  "dry_run": true,
  "scope": "specific_campaigns",
  "summary": {
    "lead_ids_processed": [5001, 5002],
    "lead_ids_not_found": [],
    "campaign_mappings_deleted": 2,
    "campaign_stats_stopped": 1,
    "list_mappings_deleted": 0,
    "tag_mappings_deleted": 0,
    "client_mappings_deleted": 0,
    "lead_rows_deleted": 0
  },
  "request_id": "6f1c2a7e-3b0d-4d5e-9a51-2c8f4b7d9e10"
}
```

```json 500 theme={null}
{
  "ok": false,
  "message": "Failed to delete leads. Please retry. If this persists, contact support with request_id.",
  "request_id": "6f1c2a7e-3b0d-4d5e-9a51-2c8f4b7d9e10"
}
```

## Response Fields

**summary.lead\_ids\_processed** `array`

Lead ids found in the given campaigns

**summary.lead\_ids\_not\_found** `array`

Lead ids that are not in any of the given campaigns (nothing is done to them)

**summary.campaign\_mappings\_deleted** `number`

Lead-in-campaign rows removed

**summary.campaign\_stats\_stopped** `number`

Scheduled (not yet sent) emails that were stopped

**summary.lead\_rows\_deleted** `number`

Leads deleted entirely because they are no longer in any of your campaigns

**request\_id** `string`

Request id. Sent back from your `X-Request-Id` header when you set one. Quote it to support.

## Related Endpoints

* [Delete Lead from Campaign](https://api.smartlead.ai/api-reference/leads/delete.md) - one lead, one campaign
* [Delete Leads](https://api.smartlead.ai/api-reference/leads/bulk-delete.md) - delete leads from your whole account


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