Campaignsrequires confirm HTTP API
POST/api/v1/projects/{project_id}/campaigns/{campaign_id}/cancel
cancel_campaign
Cancels a scheduled, sending or paused campaign for good: its letters not sent yet are cancelled; letters already sent stay sent.
- Call it
- to stop a campaign that must not go on (a wrong audience, a campaign no longer wanted);
pause_campaignholds one that may resume. Irreversible: it takesconfirm: true; without it the call checks the same and changes nothing. - Needs
- an admin key with
project_id, or a project key with scopesend(its own project; the argument is ignored); a draft, launching, completed or failed campaign is aconflict. - Returns
outcome(would_cancel,cancelled,already_cancelled),effectin words and the campaign asget_campaignreturns it after the call: the same asPOST /api/v1/projects/{project_id}/campaigns/{campaign_id}/cancelanswers when confirmed.
Arguments
- object
-
campaign_idstring · uuidrequiredThe campaign’s id: a scheduled, sending or paused campaign.
-
confirmbooleantruecancels the campaign for good. Without it the call checks what the cancel checks, says what would happen and changes nothing.default
false -
project_idstring · uuid | nullThe campaign’s project. An admin key must pass it; a project key’s own project is used and this is ignored.
No other arguments are accepted.
Result
The result comes back as structuredContent, with the same JSON as a text block.
- object · all fields required
-
campaignCampaignThe campaign after the call, as
get_campaignreturns it: the cancel’s answer (POST /api/v1/projects/{project_id}/campaigns/{campaign_id}/cancel) when confirmed; unchanged by a dry run.23 fields
- Campaign object · all fields required
-
completed_atstring · date-time | null -
created_atstring · date-time -
from_emailstring | nullnull: the project’ssettings.from_email. -
from_namestring | nullnull: the project’ssettings.from_name. -
idstring · uuid -
last_errorstring | nullWhy the launch failed;
nullunlessfailed. -
launched_atstring · date-time | null -
list_idsarray of stringThe lists it goes to, in the order given.
-
namestring -
partial_versionsmap of string → integer · uint32The versions of the partials fixed at launch, by name;
{}before. -
project_idstring · uuid -
reply_tostring | nullnull: the project’ssettings.reply_to. -
scheduled_atstring · date-time | nullWhen a scheduled campaign launches;
nullunless scheduled. -
shard_countinteger · uint32 | nullFixed at launch;
nullbefore.≥ 0
-
statusstringdraft,scheduled,launching,sending,paused,completed,cancelledorfailed. -
subject_overridestring | nullnull: the template’s subject. -
template_idstring · uuid -
template_versioninteger · uint32 | nullThe template’s version fixed at launch;
nullbefore.≥ 0
-
throttle_per_hourinteger · uint32 | nullnull: the project’sdefault_throttle_per_hour, or no limit.≥ 0
-
total_recipientsinteger · uint64 | nullRecipients of the launch’s snapshot;
nullbefore.≥ 0
-
tracking_overrideTrackingOverride | nullnull: the project’ssettings.tracking.2 fields
- TrackingOverride object · all fields required
-
clicksboolean -
opensboolean
-
transport_overridestring | nullnull: the project’s transport, then the node’s default. -
updated_atstring · date-timeThe latest change: creation, fields, status.
-
effectstringThe outcome in words, for the agent and its user.
-
outcomeCancelOutcomeWhat a cancel did.
would_cancelA dry run: nothing changed; a call withconfirm: truecancels it.cancelledCancelled: no more of its letters go out.already_cancelledIt was cancelled already: nothing changed.
Definitions
Campaign
A campaign of a project (create_campaign, get_campaign,
update_campaign; GET /api/v1/projects/{project_id}/campaigns/{campaign_id}).
- object · all fields required
-
completed_atstring · date-time | null -
created_atstring · date-time -
from_emailstring | nullnull: the project’ssettings.from_email. -
from_namestring | nullnull: the project’ssettings.from_name. -
idstring · uuid -
last_errorstring | nullWhy the launch failed;
nullunlessfailed. -
launched_atstring · date-time | null -
list_idsarray of stringThe lists it goes to, in the order given.
-
namestring -
partial_versionsmap of string → integer · uint32The versions of the partials fixed at launch, by name;
{}before. -
project_idstring · uuid -
reply_tostring | nullnull: the project’ssettings.reply_to. -
scheduled_atstring · date-time | nullWhen a scheduled campaign launches;
nullunless scheduled. -
shard_countinteger · uint32 | nullFixed at launch;
nullbefore.≥ 0
-
statusstringdraft,scheduled,launching,sending,paused,completed,cancelledorfailed. -
subject_overridestring | nullnull: the template’s subject. -
template_idstring · uuid -
template_versioninteger · uint32 | nullThe template’s version fixed at launch;
nullbefore.≥ 0
-
throttle_per_hourinteger · uint32 | nullnull: the project’sdefault_throttle_per_hour, or no limit.≥ 0
-
total_recipientsinteger · uint64 | nullRecipients of the launch’s snapshot;
nullbefore.≥ 0
-
tracking_overrideTrackingOverride | nullnull: the project’ssettings.tracking.see TrackingOverride
-
transport_overridestring | nullnull: the project’s transport, then the node’s default. -
updated_atstring · date-timeThe latest change: creation, fields, status.
CancelOutcome
What a cancel did.
string · enum
would_cancel A dry run: nothing changed; a call with confirm: true cancels it.
cancelled Cancelled: no more of its letters go out.
already_cancelled It was cancelled already: nothing changed.
TrackingOverride
What a campaign tracks in place of the project’s.
- object · all fields required
-
clicksboolean -
opensboolean
Errors
A failed call answers isError: true with a code from the same table as the HTTP API, and detail. How tools report errors
HTTP API
The same operation over HTTP: POST /api/v1/projects/{project_id}/campaigns/{campaign_id}/cancel