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

# Archive a campaign

Archives a campaign. This is a soft delete: the campaign and its history are retained for reporting, but the campaign disappears from `GET /campaigns`, stops being returned by `GET /campaigns/{id}`, and can never be edited, resumed or re-launched.

Archiving is **also a stop**. In one operation it:

1. Sets the campaign's status to `archived` and marks it deleted.
2. Retires every contact that was still live (`pending`, `scheduled`, `dialing`, `awaiting_disposition`) to `excluded`.
3. Cancels every call this campaign had waiting to be dialed.

Step 3 is best-effort by design: a call the dispatcher has already picked up belongs to the dispatcher and will complete normally, then settle. So archiving stops the campaign *offering* new calls immediately, while at most `max_in_flight` calls already on their way may still connect. If you need a clean stop with the campaign left readable, use `POST /campaigns/{id}/stop` instead.

Required scope: `campaigns:manage`.

## Path parameters

| Parameter | Type | Notes                                                |
| --------- | ---- | ---------------------------------------------------- |
| `id`      | uuid | Campaign ID. Must belong to the API key's workspace. |

There is no request body and no query parameter. Archiving works from any status, including `draft` and already-terminal campaigns.

## Archive or stop?

|                                         | `POST /campaigns/{id}/stop` | `DELETE /campaigns/{id}` |
| --------------------------------------- | --------------------------- | ------------------------ |
| Status afterwards                       | `stopped`                   | `archived`               |
| Still listed by `GET /campaigns`        | yes                         | no                       |
| Still readable by `GET /campaigns/{id}` | yes                         | no (404)                 |
| Live contacts retired                   | `pending` and `scheduled`   | every live state         |
| Queued calls cancelled                  | no                          | yes                      |
| Name freed for reuse                    | no                          | yes                      |

Archiving frees the campaign's `name`: uniqueness is enforced only across non-archived campaigns, so you can create a fresh campaign with the same name afterwards.

## Example request

```bash theme={null}
curl -X DELETE "https://api.goyappr.com/campaigns/CAMPAIGN_ID" \
  -H "Authorization: Bearer $YAPPR_API_KEY"
```

## Example response

A short acknowledgement rather than the full campaign object, because the campaign is no longer readable:

```json theme={null}
{
  "id": "b3f1c0d2-5a44-4f0e-9c11-7a2e8d3f0001",
  "status": "archived",
  "company_id": "fe493f11-0000-0000-0000-000000000001"
}
```

Calling it again returns 404 — the operation is not idempotent in its response, only in its effect.

## Errors

| HTTP | Code                 | When                                                                   |
| ---- | -------------------- | ---------------------------------------------------------------------- |
| 401  | `INSUFFICIENT_SCOPE` | API key lacks `campaigns:manage`.                                      |
| 404  | —                    | No campaign with that ID in this workspace, or it is already archived. |
| 500  | —                    | The archive write failed. The campaign is unchanged; safe to retry.    |
