POST/api/v1/projects/{project_id}/campaigns
create_campaign
Creates a campaign in a project, a draft: one message template sent to one or more of its lists.
- Call it
- to prepare a mailing; nothing is sent until it is launched, and it can be changed (
update_campaign) while it is a draft. - Needs
- an admin key with
project_id, or a project key with scopewrite(its own project; the argument is ignored),list_idsnaming 1 to 16 distinct live lists of the project (list_lists) andtemplate_idnaming a message template of it (list_templates); a list or template that is not the project’s, a deleted list or a partial isvalidation_failed. Sender, reply-to, subject, transport, tracking and throttle left out or null take the project’s values at launch. - Returns
- the campaign (
status:draft), the same asPOST /api/v1/projects/{project_id}/campaigns. There is noIdempotency-Key: if a call gets no answer, checklist_campaignsbefore calling again, or a second campaign is made.
Arguments
- object
-
list_idsarray of stringrequiredThe lists it goes to: 1 to 16 distinct ids of live lists of the project (
list_lists). A recipient on several is sent once, as a subscriber of the first.1–16 items
-
namestringrequiredWhat people call the campaign: 1 to 128 characters. Two campaigns may share a name.
example
Spring sale -
template_idstring · uuidrequiredThe template it sends: the id of a message template of the project (
list_templates). -
from_emailstring · email | nullThe sender address; null: the project’s
settings.from_email. -
from_namestring | nullThe sender name, 1 to 128 characters; null: the project’s
settings.from_name.example
Acme News -
project_idstring · uuid | nullThe project to create the campaign in. An admin key must pass it; a project key’s own project is used and this is ignored.
-
reply_tostring · email | nullReply-To; null: the project’ssettings.reply_to. -
subject_overridestring | nullThe subject source in place of the template’s; null: the template’s.
-
throttle_per_hourinteger · int64 | nullMost messages an hour, 1 to 4294967295; null: the project’s
default_throttle_per_hour, or no limit.1–4294967295
-
tracking_overrideTrackingOverrideArguments | nullWhat to track, both flags, in place of the project’s
settings.tracking; null: the project’s.2 fields
- TrackingOverrideArguments object · all fields required
-
clicksbooleanClick redirects.
-
opensbooleanThe open pixel.
-
transport_overridestring | nulldirectorrelay:<name>(a relay of the node); null: the project’s transport.
No other arguments are accepted.
Result
The result comes back as structuredContent, with the same JSON as a text block.
- 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.
Definitions
TrackingOverride
What a campaign tracks in place of the project’s.
- object · all fields required
-
clicksboolean -
opensboolean
TrackingOverrideArguments
What a campaign tracks.
- object · all fields required
-
clicksbooleanClick redirects.
-
opensbooleanThe open pixel.
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