> ## Documentation Index
> Fetch the complete documentation index at: https://apidoc.mailercloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Campaign (v2)

> **The newer version of Create Campaign with additional options — prefer this endpoint for new integrations.**

**Required:** `name`, `subject`, and `sender` (with `sender_name` + `sender_email`). **Content:** provide `html` or `plain_text`. **Audience:** provide at least one of `list_ids`, `segments`, or `tag_ids`.



## OpenAPI

````yaml /openapi-v1.json post /campaign/save
openapi: 3.1.0
info:
  title: Mailercloud Marketing API
  version: 1.0.0
  description: >-
    Campaigns, contacts, lists, segments, automations, and webhooks for the
    Mailercloud Marketing Platform.
servers:
  - url: https://cloudapi.mailercloud.com/v1
security:
  - apiKey: []
tags:
  - name: Campaigns
  - name: Contacts
  - name: Lists
  - name: Tags
  - name: Segments
  - name: Custom Properties
  - name: Senders
  - name: Templates
  - name: Automations
  - name: Webhooks
  - name: Webforms
  - name: Inbox Tracker
  - name: Account
paths:
  /campaign/save:
    post:
      tags:
        - Campaigns
      summary: Create Campaign (v2)
      description: >-
        **The newer version of Create Campaign with additional options — prefer
        this endpoint for new integrations.**


        **Required:** `name`, `subject`, and `sender` (with `sender_name` +
        `sender_email`). **Content:** provide `html` or `plain_text`.
        **Audience:** provide at least one of `list_ids`, `segments`, or
        `tag_ids`.
      operationId: create-campaign-v2
      parameters:
        - name: Content-Type
          in: header
          required: true
          description: Request body type
          schema:
            type: string
            default: application/json
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email_preheader:
                  type: string
                exclude_list_ids:
                  type: array
                  items:
                    type: string
                exclude_segments:
                  type: array
                  items:
                    type: string
                exclude_tag_ids:
                  type: array
                  items:
                    type: string
                frequency_cap:
                  type: string
                html:
                  type: string
                is_publish:
                  type: string
                  enum:
                    - '0'
                    - '1'
                  description: >-
                    `"1"` publishes/schedules the campaign; `"0"` saves it as a
                    draft.
                list_ids:
                  type: array
                  items:
                    type: string
                mailing_preference:
                  type: boolean
                name:
                  type: string
                  maxLength: 150
                  minLength: 1
                pause_rules:
                  type: object
                  properties:
                    pause_condition:
                      type: string
                      enum:
                        - greater than
                        - less than
                    pause_criteria:
                      type: string
                      enum:
                        - open
                        - click
                    pause_limit:
                      type: integer
                      minimum: 1
                      maximum: 50
                    pause_target:
                      type: integer
                      minimum: 1
                      maximum: 100
                    wait_time:
                      type: integer
                      minimum: 1
                      maximum: 43200
                      description: >-
                        Minutes to wait before evaluating pause rules (max 30
                        days).
                permission_reminder:
                  type: string
                plain_text:
                  type: string
                reply_email:
                  type: string
                reply_id:
                  type: string
                report_spam:
                  type: boolean
                rules:
                  type: object
                  properties:
                    contacts_order:
                      type: string
                      enum:
                        - first
                        - last
                    limit:
                      type: integer
                scheduled_at:
                  type: string
                  description: >-
                    Schedule time in `YYYY-MM-DD HH:MM:SS` format. Omit to send
                    according to `is_publish`.
                segments:
                  type: array
                  items:
                    type: string
                sender:
                  type: object
                  properties:
                    sender_email:
                      type: string
                      format: email
                    sender_name:
                      type: string
                      maxLength: 100
                  required:
                    - sender_name
                    - sender_email
                sender_id:
                  type: array
                  items:
                    type: string
                subject:
                  type: string
                  maxLength: 65000
                  minLength: 1
                tag_id:
                  type: string
                tag_ids:
                  type: array
                  items:
                    type: string
                tag_name:
                  type: string
                track_opens:
                  type: string
                  enum:
                    - '0'
                    - '1'
                  description: >-
                    Per-campaign open tracking. `1` enables, `0` disables.
                    `true` / `false` are also accepted.


                    **Omit this field to leave tracking enabled** - absent means
                    enabled, so existing integrations are unaffected. A value
                    other than `0`/`1`/`true`/`false` (including an empty
                    string) is ignored and tracking stays enabled.


                    When disabled, the open is still counted in the campaign
                    totals but is not attributed to any contact - it does not
                    appear in per-recipient reports, segments or automations.
                track_clicks:
                  type: string
                  enum:
                    - '0'
                    - '1'
                  description: >-
                    Per-campaign click tracking. `1` enables, `0` disables.
                    `true` / `false` are also accepted.


                    **Omit this field to leave tracking enabled** - absent means
                    enabled, so existing integrations are unaffected. A value
                    other than `0`/`1`/`true`/`false` (including an empty
                    string) is ignored and tracking stays enabled.


                    When disabled, links are still rewritten and the click is
                    still counted in the campaign totals, but it is not
                    attributed to any contact.
              x-examples:
                Example 1:
                  email_preheader: string
                  exclude_list_ids:
                    - string
                  exclude_segments:
                    - string
                  exclude_tag_ids:
                    - string
                  frequency_cap: string
                  html: string
                  is_publish: string
                  list_ids:
                    - string
                  mailing_preference: true
                  name: string
                  pause_rules:
                    pause_condition: string
                    pause_criteria: string
                    pause_limit: 0
                    pause_target: 0
                    wait_time: 0
                  permission_reminder: string
                  plain_text: string
                  reply_email: string
                  reply_id: string
                  report_spam: true
                  rules:
                    contacts_order: string
                    limit: 0
                  scheduled_at: string
                  segments:
                    - string
                  sender:
                    sender_email: string
                    sender_name: string
                  sender_id:
                    - string
                  subject: string
                  tag_id: string
                  tag_ids:
                    - string
                  tag_name: string
              required:
                - name
                - subject
                - sender
            examples:
              example-1:
                value:
                  email_preheader: 'Prime member: You have an unused Prime benefit'
                  exclude_list_ids:
                    - '123'
                    - '456'
                  exclude_segments:
                    - segment1
                    - segment2
                  exclude_tag_ids:
                    - tag1
                    - tag2
                  frequency_cap: daily
                  html: <html><body>Sample HTML</body></html>
                  is_publish: '1'
                  list_ids:
                    - sCVJ
                    - ghy
                  mailing_preference: true
                  name: Campaign name
                  pause_rules:
                    pause_condition: greater than
                    pause_criteria: open
                    pause_limit: 1
                    pause_target: 1
                    wait_time: 10
                  permission_reminder: >-
                    If you wish to opt out of all types of emails, click
                    Unsubscribe.
                  plain_text: Plain text content
                  reply_email: sender@yourdomain.com
                  reply_id: reply-id-1
                  report_spam: false
                  rules:
                    contacts_order: last
                    limit: 5
                  scheduled_at: '2021-04-17 15:48:00'
                  segments:
                    - hju
                  sender:
                    sender_email: sender@yourdomain.com
                    sender_name: Sender Name
                  sender_id:
                    - sender-123
                  subject: Prime member notification.
                  tag_id: prime-tag
                  tag_ids:
                    - tag-123
                    - tag-456
                  tag_name: Prime Campaign Tag
              example-2:
                value:
                  email_preheader: Your weekly newsletter is here!
                  exclude_list_ids:
                    - exclude-list-1
                  exclude_segments:
                    - exclude-segment-1
                  exclude_tag_ids:
                    - exclude-tag-1
                  frequency_cap: weekly
                  html: <html><body>Weekly newsletter content</body></html>
                  is_publish: '0'
                  list_ids:
                    - list1
                    - list2
                  mailing_preference: false
                  name: Weekly Newsletter
                  pause_rules:
                    pause_condition: less than
                    pause_criteria: click
                    pause_limit: 3
                    pause_target: 2
                    wait_time: 20
                  permission_reminder: >-
                    You are receiving this email because you subscribed to our
                    newsletter.
                  plain_text: Plain text newsletter content
                  reply_email: newsletter@yourdomain.com
                  reply_id: reply-id-2
                  report_spam: true
                  rules:
                    contacts_order: first
                    limit: 10
                  scheduled_at: '2022-01-10 10:00:00'
                  segments:
                    - segment1
                    - segment2
                  sender:
                    sender_email: newsletter@yourdomain.com
                    sender_name: MailerCloud Team
                  sender_id:
                    - sender-456
                  subject: Weekly Newsletter
                  tag_id: newsletter-tag
                  tag_ids:
                    - tag-789
                    - tag-101
                  tag_name: Newsletter Tag
      responses:
        '201':
          description: |-
            {
              "id": "a"
            }
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: ID of the created campaign.
              examples:
                created:
                  value:
                    id: aBc12
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                description: ''
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      field:
                        type: string
                        minLength: 1
                      message:
                        type: string
                        minLength: 1
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                        message:
                          type: string
              examples:
                example-1:
                  value:
                    errors:
                      - field: sender_email
                        message: sender_email  must be a valid email address
                      - field: reply_email
                        message: reply_email  must be a valid email address
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                description: ''
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      field:
                        type: string
                        minLength: 1
                      message:
                        type: string
                        minLength: 1
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                        message:
                          type: string
              examples:
                example-1:
                  value:
                    errors:
                      - field: ''
                        message: Authorization failed
      servers:
        - url: https://cloudapi.mailercloud.com/v2
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Your Mailercloud API key (plain text, no Bearer prefix). Create keys in
        Settings → API.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.