# Delete Campaign

`DELETE https://api.inboxjot.com/v1/campaigns/{campaign_id}`

Deletes a draft or canceled campaign. Needs a Full key. A key limited to one domain answers 403. Send an optional `Idempotency-Key` header to retry safely. See Idempotency.

## Path Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `campaign_id` | string | Yes | The campaign id. |

## Response

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `status` | string | No | Always `ok`. |

## Request

cURL:

```bash
curl -X DELETE https://api.inboxjot.com/v1/campaigns/cpg_06d2mfk8r7hm4ps9wb2kd \
  -H "Authorization: Bearer $INBOXJOT_API_KEY"
```

## Responses

| Status | Description |
| --- | --- |
| 200 | Deleted the campaign. |
| 400 | A parameter is missing or invalid, or the Idempotency-Key header is not valid. |
| 401 | The API key is missing, revoked or expired. |
| 403 | The key is a Sending key or is limited to one domain, or the request comes from outside its IP allowlist. |
| 404 | The campaign does not exist in this workspace. |
| 409 | The campaign is not a draft or canceled, or a request with the same Idempotency-Key is still running. |
| 422 | The Idempotency-Key was already used with a different request. |
| 429 | Too many requests for this key. Wait for the seconds in the Retry-After header. |
| 500 | Something failed on our side. Retry later. |

200:

```json
{
  "status": "ok"
}
```

400:

```json
{
  "name": "invalid_idempotency_key",
  "status": 400,
  "message": "Idempotency-Key must be 1 to 256 printable ASCII characters",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

401:

```json
{
  "name": "unauthorized",
  "status": 401,
  "message": "Unauthorized",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

403:

```json
{
  "name": "forbidden",
  "status": 403,
  "message": "This key cannot be used from 203.0.113.7",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

404:

```json
{
  "name": "not_found",
  "status": 404,
  "message": "Campaign not found",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

409:

```json
{
  "name": "conflict",
  "status": 409,
  "message": "Only a draft or canceled campaign can be deleted",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

422:

```json
{
  "name": "invalid_idempotent_request",
  "status": 422,
  "message": "This idempotency key was already used with a different request",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

429:

```json
{
  "name": "rate_limit_exceeded",
  "status": 429,
  "message": "Too many attempts. Try again later.",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

500:

```json
{
  "name": "unknown_error",
  "status": 500,
  "message": "Something went wrong. Please try again later.",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```
