Generated from Postwind commit a19b2e4 OpenAPI 0.1.0 synced

Campaigns HTTP API

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 scope write (its own project; the argument is ignored), list_ids naming 1 to 16 distinct live lists of the project (list_lists) and template_id naming a message template of it (list_templates); a list or template that is not the project’s, a deleted list or a partial is validation_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 as POST /api/v1/projects/{project_id}/campaigns. There is no Idempotency-Key: if a call gets no answer, check list_campaigns before calling again, or a second campaign is made.

Arguments

  • object
  • list_idsarray of stringrequired

    The 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

  • namestringrequired

    What people call the campaign: 1 to 128 characters. Two campaigns may share a name.

    example Spring sale

  • template_idstring · uuidrequired

    The template it sends: the id of a message template of the project (list_templates).

  • from_emailstring · email | null

    The sender address; null: the project’s settings.from_email.

  • from_namestring | null

    The sender name, 1 to 128 characters; null: the project’s settings.from_name.

    example Acme News

  • project_idstring · uuid | null

    The 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 | null

    Reply-To; null: the project’s settings.reply_to.

  • subject_overridestring | null

    The subject source in place of the template’s; null: the template’s.

  • throttle_per_hourinteger · int64 | null

    Most messages an hour, 1 to 4294967295; null: the project’s default_throttle_per_hour, or no limit.

    1–4294967295

  • tracking_overrideTrackingOverrideArguments | null

    What to track, both flags, in place of the project’s settings.tracking; null: the project’s.

    2 fields
  • transport_overridestring | null

    direct or relay:<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 | null

    null: the project’s settings.from_email.

  • from_namestring | null

    null: the project’s settings.from_name.

  • idstring · uuid
  • last_errorstring | null

    Why the launch failed; null unless failed.

  • launched_atstring · date-time | null
  • list_idsarray of string

    The lists it goes to, in the order given.

  • namestring
  • partial_versionsmap of string → integer · uint32

    The versions of the partials fixed at launch, by name; {} before.

  • project_idstring · uuid
  • reply_tostring | null

    null: the project’s settings.reply_to.

  • scheduled_atstring · date-time | null

    When a scheduled campaign launches; null unless scheduled.

  • shard_countinteger · uint32 | null

    Fixed at launch; null before.

    ≥ 0

  • statusstring

    draft, scheduled, launching, sending, paused, completed, cancelled or failed.

  • subject_overridestring | null

    null: the template’s subject.

  • template_idstring · uuid
  • template_versioninteger · uint32 | null

    The template’s version fixed at launch; null before.

    ≥ 0

  • throttle_per_hourinteger · uint32 | null

    null: the project’s default_throttle_per_hour, or no limit.

    ≥ 0

  • total_recipientsinteger · uint64 | null

    Recipients of the launch’s snapshot; null before.

    ≥ 0

  • tracking_overrideTrackingOverride | null

    null: the project’s settings.tracking.

    2 fields
  • transport_overridestring | null

    null: the project’s transport, then the node’s default.

  • updated_atstring · date-time

    The 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
  • clicksboolean

    Click redirects.

  • opensboolean

    The 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