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

# Lead status campaign

## POST /api/v1/public/campaigns/:id/lead-status/

Stop or resume outreach for leads of a campaign — the **Stop outreach** / **Resume outreach** actions of the campaign's leads table.

* `action: "stop"` sets each lead's status to `STOPPED`. **This stops all outreach to the person in every campaign**, not only in this one: pending steps are cancelled and running sequences move to `STOPPED`.
* `action: "resume"` sets each lead's status back to `ACTIVE` (when it was a stopping status or empty) and restarts every sequence of the person that a stop ended, in every campaign. Cancelled steps are planned again without their delay; steps that already ran are never repeated. In a paused campaign the steps are planned when the campaign is resumed.

Pick the leads with `prospect_ids`, or with `amount` + `filters` + `search` to act on all leads matching what you see in the table. At most **1000** leads per call.

Auth: `X-API-Key`

### Path Parameters

* `id` (integer, required): Campaign ID

### Request Body

Selected leads:

```json theme={null}
{
  "action": "stop",
  "prospect_ids": [2001, 2002, 2003]
}
```

All leads that match a filter and a search:

```json theme={null}
{
  "action": "resume",
  "amount": 0,
  "filters": [{ "column": "status", "operation": "contains", "value": "REPLIED" }],
  "search": "acme"
}
```

### Request Body Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `action` | string | Yes | `stop` or `resume`. |
| `prospect_ids` | array of integers | No | Campaign lead (prospect) IDs. IDs that aren't in this campaign are ignored. |
| `amount` | integer | No | Defaults to the number of `prospect_ids`. When it is larger than the number of `prospect_ids` (or there are none), the leads are selected by `filters` + `search` instead: the first `amount` matches, or **all** matches when `amount` is `0`. |
| `filters` | array \| object | No | Lead filters, in the same format as [campaign export](https://docs.seleqt.ai/api-reference/public/campaigns-export.md) and [add to campaign](https://docs.seleqt.ai/api-reference/public/lead-lists-add-to-campaign.md). Used only when selecting by `amount`. |
| `search` | string | No | Free-text search on first name, last name, email and company name. Used only when selecting by `amount`. |
| `sort_field` | string | No | Order used with `amount`. Defaults to `id`. |
| `sort_direction` | string | No | `asc` or `desc`. Defaults to `asc`. |

### Response

```json theme={null}
{
  "success": true,
  "leads": 3,
  "stopped": 4,
  "resumed": 0
}
```

| Field | Type | Description |
| - | - | - |
| `success` | boolean | Always `true` on a successful response. |
| `leads` | integer | How many people were stopped or resumed. A person is counted once, however many of their rows were selected. |
| `stopped` | integer | `stop`: how many campaign sequences were stopped (across all campaigns of these people). |
| `resumed` | integer | `resume`: how many stopped sequences were restarted. |

Each changed status is recorded in the lead's [status history](https://docs.seleqt.ai/api-reference/public/lead-status-events.md) with source `API` and sends the [`lead.status_changed`](https://docs.seleqt.ai/webhooks/webhook-events) webhook event.

### Error Responses

| Status | `error` | When |
| - | - | - |
| `400` | `action must be stop or resume.` | `action` is missing or invalid. |
| `400` | `Pick at most 1000 leads at a time.` | The selection holds more than 1000 leads. Nothing is changed. |
| `403` | `Viewers can't stop or resume leads.` | The API key belongs to a Viewer. |
| `404` | `Campaign not found.` | No campaign with this ID in your current workspace. |

### Example

```bash theme={null}
curl -X POST -H "X-API-Key: <key>" \
  -H "Content-Type: application/json" \
  -d '{"action": "stop", "prospect_ids": [2001, 2002, 2003]}' \
  "https://api.seleqt.ai/api/v1/public/campaigns/456/lead-status/"
```

### Notes

* To change one lead's status to something other than `STOPPED` / `ACTIVE`, use [PATCH /public/prospects/:id/lead-status/](https://docs.seleqt.ai/api-reference/public/lead-status-set.md).
* Stopping a lead that is already `STOPPED` makes sure nothing of theirs is still running.


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