> ## 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.

# Update Campaign

> API for updating the campaign. Can't change or edit the list, segments, pause_rule, rules for the campaigns in sending status. Pause the campaign to edit the scheduled date.



## OpenAPI

````yaml /openapi-v1.json put /campaign/{id}
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/{id}:
    put:
      tags:
        - Campaigns
      summary: Update Campaign
      description: >-
        API for updating the campaign. Can't change or edit the list, segments,
        pause_rule, rules for the campaigns in sending status. Pause the
        campaign to edit the scheduled date.
      operationId: update-campaign
      parameters:
        - name: id
          in: path
          required: true
          description: Campaign Id
          schema:
            type: string
        - name: Content-Type
          in: header
          required: true
          description: application/json
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email_preheader:
                  type: string
                  minLength: 1
                  description: >-
                    Email preheader is the summary text that follows a subject
                    line when the email is viewed in an inbox. In many cases,
                    it’s used to provide a short summary of the email, and is
                    typically one sentence long.


                    Minimum: 1


                    Maximum: 150
                html:
                  type: string
                  minLength: 1
                  description: HTML template content for your email campaign.
                list_ids:
                  type: array
                  description: Recipients of your email campaign.
                  items:
                    type: string
                    description: >-
                      Contact list id. Before setting list id please check your
                      contact count in list.
                mailing_preference:
                  type: boolean
                  description: >-
                    true -  Mailing preference option will be displayed in
                    footer of email campaign template.


                    false - Mailing preference option will not be dispalyed.
                name:
                  type: string
                  minLength: 1
                  description: |-
                    Name of the campaign.

                    Minimum: 1

                    Maximum: 150
                pause_rules:
                  type: object
                  description: >-
                    Optional


                    If you want to set a rule for sending a campaign, use this
                    option. Based on the configured rule, the campaign will be
                    sent.
                  properties:
                    pause_condition:
                      type: string
                      minLength: 1
                      description: >-
                        Rule for setting open or click percentage greater than
                        or less than pause target.


                        Supported pause_condition - greater than, less than
                    pause_criteria:
                      type: string
                      minLength: 1
                      description: Supported pause_criteria - open, click
                    pause_limit:
                      type: number
                      description: >-
                        The percentage of list contacts to which we want to send
                        campaigns first. In the order we set in rules.


                        Minimum: 1


                        Maximum: 50
                    pause_target:
                      type: number
                      description: >-
                        After achieving pause condition how many percentage of
                        subscribers we have to send campaign.


                        Minimum: 1


                        Maximum: 100
                    wait_time:
                      type: number
                      description: >-
                        After getting click rate or open rate grater than or
                        less than pause limit , How many time we have to wait to
                        send campaign to other contacts in the list.


                        Wait time in minutes .


                        Minimum: 1


                        Maximum: 43200
                permission_reminder:
                  type: string
                  minLength: 1
                  description: >-
                    The permission reminder content in your email campaign. If
                    you want give unsubscribe link give %%unsubscribe%%


                    Minimum: 1


                    Maximum: 150
                plain_text:
                  type: string
                  minLength: 1
                  description: Plain text content of your email campaign.
                reply_email:
                  type: string
                  minLength: 1
                  description: >-
                    Email on which the campaign recipients will be able to reply
                    to. If replay_email empty then sender email will be the
                    reply email 
                report_spam:
                  type: boolean
                  description: 'Spam reporting enable or disable. '
                rules:
                  type: object
                  description: 'Supported contacts_order : first, last.'
                  properties:
                    contacts_order:
                      type: string
                      minLength: 1
                      description: >-
                        The order of contact list in which you want to send your
                        email campaign.


                        Supported: first,last
                    limit:
                      type: number
                      description: >-
                        count of subscribers in list to which campaign sends
                        based on the contacts_order. 
                scheduled_at:
                  type: string
                  minLength: 1
                  description: >-
                    Schedule time for your email campaign. Pass your timezone
                    date-time format for accurate results.


                    Format: 2021-04-23 15:04:05
                segments:
                  type: string
                  minLength: 1
                  description: Your recipient segment id.
                sender:
                  type: object
                  properties:
                    sender_email:
                      type: string
                      minLength: 1
                      description: From email for your email campaign.
                    sender_name:
                      type: string
                      minLength: 1
                      description: |-
                        From name for email campaign.

                        Maximum: 100
                subject:
                  type: string
                  minLength: 1
                  description: |-
                    Subject of the campaign.

                    Minimum: 1

                    Maximum: 150
                viewin_browser:
                  type: boolean
                  description: >-
                    true: Enable the "View this email in your browser"  in
                    Campaign preview page.


                    false: Disable the "View this email in your browser"  in
                    Campaign preview page.
            examples:
              example-1:
                value:
                  email_preheader: 'Prime member: You have an unused Prime benefit'
                  html: <html><body> Edited Sample HTML  </body></html>
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                description: ''
                type: object
                properties:
                  message:
                    type: string
                    minLength: 1
              examples:
                example-1:
                  value:
                    message: Campaign has been updated
        '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
              examples:
                example-1:
                  value:
                    error:
                      field: string
                      message: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                description: ''
                type: object
                properties:
                  errors:
                    type: array
                    uniqueItems: true
                    minItems: 1
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                        message:
                          type: string
                          minLength: 1
              examples:
                example-1:
                  value:
                    errors:
                      - field: ''
                        message: Authorization failed
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                description: ''
                type: object
                properties:
                  errors:
                    type: array
                    uniqueItems: true
                    minItems: 1
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                          minLength: 1
                        message:
                          type: string
                          minLength: 1
              examples:
                example-1:
                  value:
                    errors:
                      - field: id
                        message: Record not found with the given Id
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Your Mailercloud API key (plain text, no Bearer prefix). Create keys in
        Settings → API.

````