POST/api/v1/projects/{project_id}/campaigns
Needs scope: writeIdempotency-KeyMCP tool: create_campaign
operationId create_campaign
Create a campaign
Creates a campaign in the project, a draft: nothing is sent until it
is launched. Needs scope write; an admin key may create one in any
live project. Writes campaign.created.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
project_idrequired |
path | string · uuid | The project’s id |
Idempotency-Key |
header | string
1–128 characters · pattern |
A key of the client’s choosing, one per request it means to send once (a UUID will do). A repeat with the same key and the same body within 24 h creates nothing again and gets the first answer, marked Idempotent-Replayed: true. The key belongs to the API key that sent it. Only a 2xx answer is kept: after any other answer the key is free again. |
Request body
application/json · required
- CreateCampaignRequest object
-
list_idsarray of stringrequiredThe lists it goes to: 1 to 16 distinct ids of live lists of the project. 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, trimmed. Two campaigns may share a name.
example
Spring sale -
template_idstring · uuidrequiredThe template it sends: the id of a message template of the project.
-
from_emailstring · email | nullexample
news@acme.example -
from_namestring | nullexample
Acme News -
reply_tostring · email | null -
subject_overridestring | nullThe subject source in place of the template’s.
-
throttle_per_hourinteger · int64 | nullMost messages an hour, 1 to 4294967295.
1–4294967295
-
tracking_overrideTrackingOverrideInput | nullWhat a campaign tracks in place of the project’s
settings.tracking.2 fields
- TrackingOverrideInput object · all fields required
-
clicksbooleanClick redirects.
-
opensbooleanThe open pixel.
-
transport_overridestring | nulldirectorrelay:<name>(a relay of the node).example
direct
Responses
201
The campaign, a draft
| Header | Type | Description |
|---|---|---|
Idempotent-Replayed | string · enum | true when the answer is a replay of an earlier request with the same Idempotency-Key; absent otherwise. |
Location | string | The campaign’s URL |
- Campaign object · all fields required
-
completed_atstring · date-time | null -
created_atstring · date-time -
from_emailstring · email | nullnull: the project’ssettings.from_email. -
from_namestring | nullnull: the project’ssettings.from_name. -
idstring · uuidexample
01900000-0000-7000-8000-000000000001 -
last_errorstring | nullWhy the launch failed;
nullunlessfailed. -
launched_atstring · date-time | null -
list_idsarray of stringIn the order given.
-
namestringexample
Spring sale -
partial_versionsmap of string → integer · int32The versions of the partials fixed at launch, by name;
{}before. -
project_idstring · uuid -
reply_tostring · email | nullnull: the project’ssettings.reply_to. -
scheduled_atstring · date-time | nullWhen a scheduled campaign launches;
nullunless scheduled. -
shard_countinteger · int32 | nullFixed at launch;
nullbefore.≥ 0
-
statusstringdraft,scheduled,launching,sending,paused,completed,cancelledorfailed.example
draft -
subject_overridestring | nullnull: the template’s subject. -
template_idstring · uuid -
template_versioninteger · int32 | nullThe template’s version fixed at launch;
nullbefore.≥ 0
-
throttle_per_hourinteger · int32 | nullnull: the project’sdefault_throttle_per_hour, or no limit.≥ 0
-
total_recipientsinteger · int64 | 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.
409
The project is deleted (conflict); or a request with the same Idempotency-Key has not answered yet (idempotency_key_in_progress)
422
Invalid fields, every one in errors (validation_failed): unknown_field, required, invalid_type, invalid (also a list or template that is not the project’s, a deleted list, a partial), out_of_range, unknown_relay; or the Idempotency-Key was used in the last 24 h for another request (idempotency_key_reused), or is not 1 to 128 visible ASCII characters (validation_failed, field Idempotency-Key)
429
The key is over its rate limit, api.rate_limit_per_minute requests a minute on this node (rate_limited)
| Header | Type | Description |
|---|---|---|
Retry-After | integer | Seconds until the key’s next request passes; rounded up. |
504
Postwind’s storage did not answer within its time limit (storage_timeout). A change the request makes may still take effect: check before repeating it. A repeat with the same Idempotency-Key never runs it twice: it is 409 idempotency_key_in_progress until the key’s 24 h end