# Campaign follow-ups (after sending)

> Create, read, change and stop follow-ups on a campaign that has started sending.

These endpoints add a follow-up to a campaign that is already sending or sent. A follow-up goes to each recipient who meets its `condition`, `delay_days` and `delay_hours` after they met it, as a reply in the same thread. A campaign can have up to **5** active follow-ups. Follow-ups written inline when the campaign is created (the `followups` field of [POST /campaigns](https://www.senddart.com/docs/api/campaigns-followups)) are a different kind: they appear on [GET /campaigns/:id](https://www.senddart.com/docs/api/campaigns-get) but these endpoints answer `404` for them.

## Create a follow-up

`POST /campaigns/:id/followups`

**Body parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `condition` | string | Yes | `delivered`, `opened`, `clicked` or `replied`. `opened` is refused (422) when the sending domain does not track opens. |
| `delay_days` | integer | Yes | 0 to 7. |
| `delay_hours` | integer | Yes | 0 to 23. Added to `delay_days`. |
| `html` | string | Yes | The follow-up body. Supports the campaign’s merge tags. |
| `subject` | string | No | Up to 998 characters. Leave it out to use `Re: ` and the campaign’s subject. |
| `auto_followup` | boolean | No | `false` (default): the follow-up goes to the recipients who meet the condition now, and then it is done. `true`: it also keeps going to recipients who meet the condition later. |

**Request**

```bash
curl -X POST 'https://www.senddart.com/api/campaigns/CAMPAIGN_ID/followups' \
  -H 'Authorization: Bearer mb_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{ "condition": "clicked", "delay_days": 1, "delay_hours": 0, "html": "<p>Thanks for taking a look…</p>" }'
```

**Response**

```json
{
  "object": "campaign_followup",
  "id": "cfu_3b1f0c2e9a7d4e5f8a6b2c1d0e9f",
  "recipients": 42
}
```

Answers `201`. `recipients` is how many recipients meet the condition already. It honours `Idempotency-Key`. Needs a full-access key that can send. Errors: `validation_error` (422) for a bad field, a campaign that has not started sending, a sixth active follow-up, or `opened` without open tracking; `not_found` for a campaign that is not yours.

## Retrieve a follow-up

`GET /campaigns/:id/followups/:followup_id`

Returns the follow-up with its settings (`condition`, `delay_days`, `delay_hours`, `subject`, `html`, `auto_followup`), its `status` (`scheduled`, `active` for an automatic one, `sent`, `canceled` or `failed`), `failure_reason` and `delivery_counts` (`pending`, `sending`, `sent`, `failed`, `canceled`). Needs an API key with read access. A sending-only key gets `401 restricted_api_key`.

## Change a follow-up

`PATCH /campaigns/:id/followups/:followup_id`

Takes the same body as create, and every field is required again (it replaces the follow-up). Deliveries still waiting are canceled and worked out again under the new settings. Recipients who already got it are not sent it again unless you add `"resend_previously_sent": true`. Answers `{ object, id, recipients }` with `recipients` = deliveries now waiting. Needs a full-access key that can send.

## Stop a follow-up

`DELETE /campaigns/:id/followups/:followup_id`

Stops the follow-up and cancels every delivery still waiting. Answers `{ "object": "campaign_followup", "id": "…", "canceled": true }`. Needs a full-access API key. A sending-only key gets `401 restricted_api_key`.

## Retry a failed follow-up

A `failed` follow-up of either kind can be sent again to the recipients it has not reached with [POST /campaigns/:id/followups/:followup_id/retry](https://www.senddart.com/docs/api/campaigns-followups-retry). Nobody is emailed twice.
