Cancel a scheduled message
Cancel a scheduled message while it is still queued.
Cancels a message that was scheduled with send_at before it is dispatched. Only messages that are still queued with a future send_at can be cancelled — anything already handed to delivery returns 400.
DELETE /v3/messages/{id}
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Required | The message id returned when the scheduled send was accepted — always starts with msg_. |
Responses
| Status | Description |
|---|---|
200 | Cancelled. { id, status: "cancelled", message: "Scheduled message has been cancelled" }. The stored message is marked rejected and a rejected webhook fires with reason: "scheduled_message_cancelled". |
400 | The message is no longer queued, or it has no future send_at (immediate sends can't be cancelled). |
401 | Missing or invalid API key. |
404 | Declared for unknown ids, but in practice an id still in the ingest pipeline is cancelled optimistically with 200 — the cancellation marker stops the delivery worker. |
Code examples
cURL
curl -X DELETE https://api.wemail.io/v3/messages/{id} \
-H "Authorization: Bearer afn_live_…"Node.js
const res = await fetch("https://api.wemail.io/v3/messages/{id}", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.WEMAIL_API_KEY}`,
},
});
const data = await res.json();Python
import os, requests
r = requests.delete(
"https://api.wemail.io/v3/messages/{id}",
headers={"Authorization": f"Bearer {os.environ['WEMAIL_API_KEY']}"},
)
data = r.json()