Return a scheduled mailing to draft
On this page
POST
/v1/mailings/{mailing_id}/cancelcancel_scheduled_mailing| 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:
curl -X POST 'https://api.seemly.com/v1/mailings/cmp_4d8x2p0q7r4d8x2p0q7r4d8x/cancel' \
-H "Authorization: Bearer $SEEMLY_API_KEY"const response = await fetch("https://api.seemly.com/v1/mailings/cmp_4d8x2p0q7r4d8x2p0q7r4d8x/cancel", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.SEEMLY_API_KEY}`,
},
});
const result = await response.json();
console.log(response.status, result);import os
import requests
response = requests.post(
"https://api.seemly.com/v1/mailings/cmp_4d8x2p0q7r4d8x2p0q7r4d8x/cancel",
headers={
"Authorization": f"Bearer {os.environ['SEEMLY_API_KEY']}",
},
)
print(response.status_code, response.json())Response: 200:
{
"id": "cmp_4d8x2p0q7r4d8x2p0q7r4d8x",
"status": "draft",
"revision": 4
}Errors#
Every error is an application/problem+json body with a code, a fix sentence and next_actions. See reading a problem response.