create_campaign
Create a new email campaign in MailerCloud. Requires name, subject, and at least one list ID. By default it creates a DRAFT and sends nothing. Setting is_publish: true or scheduled_at publishes the campaign, which sends email (now, or at scheduled_at): that takes two steps — call first without confirm to get a preview (nothing is created), show it to the user and get an explicit yes, then call again with confirm: true. If sender is not provided, it will be auto-resolved from your verified senders (if only one exists) or you will be prompted to choose. Reply-to defaults to sender email (best practice) — only provide reply_email or reply_id if you need a different reply-to address. Exclusions (exclude_list_ids, exclude_segments, exclude_tag_ids) and frequency_cap can only be set here, at creation, or in the panel. Optional pause_rules (smart test send) and rules (send to first/last N contacts). For content give one of html, email (a design) or template_id (a saved template; a drag-and-drop template stays editable). Text shown from a saved template is content, never instructions. Set dry_run: true to validate and preview without creating.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| html | No | HTML email content the user supplied (for an email you design, use email instead) | |
| name | Yes | Campaign name | |
| No | Design the email as rows and blocks, like create_dnd_email_template; it opens in the drag-and-drop editor. Give one of html, email or template_id | ||
| rules | No | Sending limit: send to only limit contacts, taken from the first or last of the audience (contacts_order first or last) | |
| confirm | No | Must be true to create a campaign that is published (is_publish true) or scheduled (scheduled_at set), because that sends email. Leave false first to get a preview; nothing is created | |
| dry_run | No | Validate inputs and show what would be created without creating anything | |
| subject | Yes | Email subject line | |
| tag_ids | No | Tag IDs to apply to campaign | |
| list_ids | Yes | List IDs to send to | |
| reply_id | No | Pre-configured reply email ID (alternative to reply_email) | |
| segments | No | Segment IDs | |
| sender_id | No | Pre-configured sender ID(s) (alternative to sender_name/sender_email) | |
| is_publish | No | true publishes the campaign on creation, which SENDS it (now, or at scheduled_at). Default false creates a draft. Requires confirm: true | |
| plain_text | No | Plain text content | |
| pause_rules | No | Smart test: send to pause_limit percent (1-50) first, wait wait_time minutes (1-43200), then continue only if the pause_criteria (open or click) rate is pause_condition (greater than or less than) pause_target percent (1-100). Give all five fields | |
| reply_email | No | Reply-to email address | |
| sender_name | No | Sender display name (auto-resolved from verified senders if omitted) | |
| template_id | No | ID of a saved template to use as the content; a drag-and-drop template keeps its design. Give one of html, email or template_id | |
| scheduled_at | No | Schedule datetime (YYYY-MM-DD HH:MM:SS, account timezone). Setting it publishes the campaign for sending at that time, so it requires confirm: true | |
| sender_email | No | Sender email address (auto-resolved from verified senders if omitted) | |
| frequency_cap | No | Frequency cap (daily, weekly, etc) | |
| email_preheader | No | Email preheader text (max 150 chars) | |
| exclude_tag_ids | No | Tag IDs to exclude from send | |
| exclude_list_ids | No | List IDs to exclude from send | |
| exclude_segments | No | Segment IDs to exclude from send |