# cancel_scheduled_mailing

Return a scheduled mailing to draft

`POST /v1/mailings/{mailing_id}/cancel`

| | |
| --- | --- |
| Risk | write |
| Authentication | API key or OAuth access token |
| Scopes | `mailings:write` |
| Idempotency | natural: repeating the call gives the same result |
| Dry run | yes: add dry_run=true to the query |
| Success status | 200 |
| Response type | application/json |

## What it does

- Use when: A mailing is scheduled for later and you need to change or stop it, more than 2 minutes before it sends.
- Do not use when: the mailing is already sending or sent (it cannot be recalled) or it is only a draft.
- Side effects: Removes the planned send; the mailing becomes an editable draft again.
- Reversible: Yes, call preview_send then request_send.
- Required scope: mailings:write.
- Idempotency: safe to repeat (same result).
- Typical next step: call update_mailing_draft, then preview_send.

## Scopes

- `mailings:write`: Create, edit and delete draft mailings, and ask for a send to be approved.

## Side effects

- Removes the planned send; the mailing becomes an editable draft again

## Request

### Path parameters

| Field | Type | Description |
| --- | --- | --- |
| `mailing_id` | string |  |

### Query parameters

None.

Every mutation also accepts `dry_run=true`: it runs every check and returns `{"dry_run": true, "would": {...}}` without writing anything.

## Response

The response has one of 2 shapes.

### Result

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes |  |
| `status` | one of "draft", "scheduled" | yes |  |
| `revision` | integer, min -9007199254740991, max 9007199254740991 | yes |  |

### When dry_run=true

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `dry_run` | exactly true | yes |  |
| `would` | object | yes | What the real call would do. |

## Examples

### back to draft

Request:

```bash
curl -X POST 'https://api.seemly.com/v1/mailings/cmp_4d8x2p0q7r4d8x2p0q7r4d8x/cancel' \
  -H "Authorization: Bearer $SEEMLY_API_KEY"
```

Response: `200`:

```json
{
  "id": "cmp_4d8x2p0q7r4d8x2p0q7r4d8x",
  "status": "draft",
  "revision": 4
}
```

## Errors

| Status | Codes |
| --- | --- |
| 400 | [`validation_failed`](/developers/md/errors/validation_failed) |
| 401 | [`unauthenticated`](/developers/md/errors/unauthenticated), [`credential_revoked`](/developers/md/errors/credential_revoked), [`credential_expired`](/developers/md/errors/credential_expired) |
| 403 | [`insufficient_scope`](/developers/md/errors/insufficient_scope), [`plan_does_not_include`](/developers/md/errors/plan_does_not_include), [`workspace_paused`](/developers/md/errors/workspace_paused), [`api_suspended`](/developers/md/errors/api_suspended), [`consent_required`](/developers/md/errors/consent_required) |
| 404 | [`not_found`](/developers/md/errors/not_found) |
| 409 | [`conflict`](/developers/md/errors/conflict) |
| 429 | [`rate_limited`](/developers/md/errors/rate_limited), [`quota_exceeded`](/developers/md/errors/quota_exceeded) |
| 503 | [`service_unavailable`](/developers/md/errors/service_unavailable) |

Every error is an `application/problem+json` body with a `code`, a `fix` sentence and `next_actions`. See [reading a problem response](/developers/md/guides/agents#reading-a-problem-response).

## Typical next steps

- [`update_mailing_draft`](/developers/md/operations/update_mailing_draft)
- [`preview_send`](/developers/md/operations/preview_send)

## Related

- [OpenAPI document](https://api.seemly.com/v1/openapi.json)
- [Agent guide](/developers/md/guides/agents)
