Cancel a scheduled email campaign
Cancels a scheduled campaign, removing the pending send job and returning the campaign to the draft state. The campaign must be in the scheduled state — cancelling from any other state returns 422 ("Campaign is not scheduled").
Pass the API token in the Api-Token header
Unique identifier of the email campaign
4567A single email campaign.
Authentication failed — missing or invalid API token.
The API token does not have permission to access this resource.
The requested email campaign was not found.
The lifecycle action was rejected — the campaign was in a state that does not allow the
action, the datetime was invalid, or sending validation failed.
Too many requests. The public API is rate limited to 150 requests per 10 seconds per
API token. Retry after the window resets (see the x-ratelimit-reset header).
curl -X POST "https://mailtrap.io/api/email_campaigns/4567/cancel" \
-H 'Api-Token: YOUR_API_KEY'
{
"data": {
"id": 4567,
"domain_id": 4321,
"domain_name": "acme.com",
"name": "Spring Sale",
"from_local_part": "news",
"from_display_name": "Acme Marketing",
"reply_to": {
"display_name": "Acme Support",
"local_part": "support",
"domain": "acme.com"
},
"current_state": "draft",
"current_state_metadata": {
"reason": "text",
"error": "text",
"errors": [
{
"message": "Invalid recipient address",
"rcpt_index": 0
}
],
"scheduled_at": "2026-06-01T09:00:00.000Z"
},
"created_at": "2026-05-01T10:15:00.000Z",
"updated_at": "2026-05-02T09:00:00.000Z",
"last_started_at": "2026-05-03T12:00:00.000Z",
"last_started_at_date": "2026-05-03",
"recipient_total_count": 1500,
"contact_list_ids": [
55,
56
],
"contact_segment_ids": [
12
],
"delivery_mode": "rapid",
"delivery_options": {
"emails_per_hour": 1000
},
"template": {
"id": 789,
"subject": "Spring is here — 30% off",
"merge_tags": [
"first_name"
],
"body_html": "<html><body><h1>Hi {{first_name}}!</h1><p><a href=\"__unsubscribe_url__\">Unsubscribe</a></p></body></html>",
"body_text": null
}
}
}Last updated
Was this helpful?

