Skip to content
WeZend

Campaigns & content

API-triggered campaigns: send a saved campaign

POST /v1/campaigns/:id/trigger sends a saved campaign to people you name, with data of their own, or to lists and segments.

POST /v1/campaigns/{id}/trigger sends a saved campaign from your own system: an order is placed, a form is filled, an automation fires. Inside the message the data is {{ trigger.order_id }} (Liquid). It needs an API key with the send scope, or a dashboard user who may launch.

{
  "recipients": [
    { "email": "ann@example.com", "data": { "order_id": "1001", "total": "99 EUR" } },
    { "contact_id": "…", "data": { "order_id": "1002" } }
  ],
  "data": { "shop": "Acme" },
  "idempotency_key": "order-1001"
}

The answer is 202 { campaign_id, accepted, unmatched, opted_out }. You can send 1 to 1,000 recipients per call; data is at most 50 keys and 8,000 characters per recipient. Shared data applies to everyone, and a recipient's own data wins.

Aim at an audience instead

Instead of recipients, name list_ids and/or segment_ids (up to 20 ids; the account's own, otherwise list_not_found or segment_not_found). The audience is read when it sends, and the answer is 202 { campaign_id, audience }.

Rules

  • The saved campaign is the template. Each trigger copies it into a campaign of its own named "<name> (API trigger)"; the saved one is never touched. Only a draft, sent or active campaign can be triggered (409 campaign_not_triggerable).
  • Recipients must already be contacts. Unknown people come back in unmatched and are never created. People who opted out are left out and counted in opted_out.
  • Everything a campaign send enforces still runs: double opt-in, suppression, frequency caps and quiet hours, quota, balance, holdout, A/B, discount pools. Values are HTML-escaped in e-mail.
  • idempotency_key: the same key on the same saved campaign answers 200 { duplicate: true, campaign_id } and sends nothing again, even for parallel calls. Set one if your caller retries.
  • A new account's first e-mail campaign waits for a person to review it, so a trigger answers 409 first_campaign_needs_review before anything is copied. Send the campaign once from the dashboard first.
  • A bad body, another account's campaign (404), a read-only key (403) and no key (401) are refused before anything is sent.

To create the contact first, call POST /v1/contacts/upsert.

One platform. Every customer interaction.

Replace your patchwork of messaging APIs, CDP and automation tools with a single engagement platform built for scale.

No credit card required · EU data residency · 99.99% uptime SLA