---
title: "Update"
method: POST
path: "/campaigns/update"
tags: ["Campaigns"]
---

# Update

`POST /campaigns/update`

Update an existing campaign

## Headers

- `X-Batch-Project` string, required

## Request body

- CampaignUpdate
  - `id` string, required — Campaign id received from the create API
  - `campaign` Campaign, required
    - `name` string, required — Display name of the campaign on the dashboard
    - `state` 'DRAFT' | 'RUNNING' | 'STOPPED', required — State of the campaign to create. Draft campaigns are not sent until they are started (updated to RUNNING). Stopped campaigns are paused and can be resumed by updating them to RUNNING.
    - `send_rate` integer — Determines the maximum number of messages to be sent per minute.
    - `when` When, required
      - `local_time` boolean — If true, Batch servers will send messages according to each time zone. The campaign will take 24 hours to complete
      - `start_time` string, required — Campaign start date in UTC in a RFC 3339 date-time format (for example 2023-10-24T10:22:00Z) or ***now*** to start the campaign as soon as the call is made
    - `targeting` Targeting
      - `languages` string[] — An array containing all device languages to be targeted. All language codes in this array must be contained in the messages object. [See here](https://doc.batch.com/api/campaigns/advanced#_language-and-country-codes) for matching rules and valid language codes. E.g.{"languages":["it","fr"]}
      - `regions` string[] — An array containing all the geographical regions codes to be targeted. [See here](https://doc.batch.com/api/campaigns/advanced#_language-and-country-codes) for all valid region codes. E.g.{"regions":["FR","US"]}
      - `query` object — A mongo inspired query object containing filters & operators, based on native attributes (app version, OS version, etc) and custom users data (attributes, tags & events defined by you in the SDK)
    - `labels` string[] — An array of labels to assign to the campaign for organizational and capping purposes. Limited at 5 labels per campaign.
    - `messages` union[], required — Messages to send, only one kind of message is allowed at a time.
      - union
        - Email — A representation of an email message
          - `channel_type` 'email', required
          - `subject` string, required — Your email subject. Can use personalization
          - `sender_identity_id` string, required
          - `reply_to` object
            - `email_address` string, required
          - `html` string, required — Your email content as html. Can use personalization
          - `languages` LanguageEmail[] — Array of translations. Default language content is located at the level above.
            - `language` string, required
            - `subject` string, required — Your email subject. Can use personalization
            - `sender_identity_id` string, required
            - `reply_to` object
              - …
            - `html` string, required — Your email content as html. Can use personalization
        - Push — A representation of a push message
          - `channel_type` 'push', required
          - `platform_type` string[], required
          - `title` string — Title of the notification. Can use personalization
          - `body` string, required — Body of the notification. Can use personalization
          - `media` object — Rich notification content
            - `picture` string — URL to an image that will be displayed as the main notification image. The file must be a RGB PNG or JPG image with a minimum height of 300px and width of 200px. Your server must support the HTTP OPTION verb. Can use personalization
          - `priority` 'normal' | 'high' — Defines the priority of your message on iOS (APNS) and Android (FCM). If you set `push_type` to `background`, this value MUST be `normal`
          - `push_type` 'alert' | 'background' — Defines whether notifications should show an alert or be silent to trigger a background action
          - `time_to_live` integer — Time to live (TTL) represents the time a notification can be held for delivery in seconds before expiring. If a user was offline and comes back online after this duration, the notification will not be delivered. It does not remove notifications already delivered to devices. Setting a value of `0` disables the TTL, which leaves expiration up to the platform push service
          - `filter_push_tokens` 'all' | 'collected' | 'imported' — `all` - the campaign will target imported and collected push tokens<br> `collected` - the campaign will target only collected push tokens, detected by Batch SDKs<br> `imported` - the campaign will target only imported push tokens, not yet detected by Batch SDKs
          - `ios` object — iOS specific attributes
            - `deeplink` string — Deeplink that the notification should point to once opened. Can use personalization
            - `custom_payload` string — String representation of a JSON object. Can be used to override standard keys, such as `aps`. Using the `com.batch` key is forbidden. Can use personalization
          - `android` object — Android specific attributes
            - `deeplink` string — Deeplink that the notification should point to once opened. Can use personalization
            - `custom_payload` string — String representation of a JSON object. Can be used to override standard keys, such as `aps`. Using the `com.batch` key is forbidden. Can use personalization
            - `media` object — Rich notification content
              - …
            - `collapse_key` object — Defines how notifications are managed when an offline device goes online (enabled by default). If enabled, the device will only show the most recent notification. If disabled, it will show all the notifications received when the device was offline. You should disable the collapse key if all your notifications matter (E.g. messages, etc) . You can use up to 3 different collapse keys if you want users to get only one notification of each kind when coming online (E.g. marketing messages, alert, etc)
              - …
          - `web` object — Web specific attributes
            - `deeplink` string — Deeplink that the notification should point to once opened. Can use personalization
            - `media` object — Rich notification content
              - …
          - `languages` LanguagePush[] — Array of translations. Default language content is located at the level above.
            - `language` string, required
            - `title` string — Title of the notification. Can use personalization
            - `body` string, required — Body of the notification. Can use personalization
            - `media` object — Rich notification content
              - …
            - `ios` object — iOS specific attributes
              - …
            - `android` object — Android specific attributes
              - …
            - `web` object — Web specific attributes
              - …

## Response `200`

Request successful, campaign udpated

- EmptyResponse

## Other responses

- `400` — The request is malformed
- `401` — The Rest API Key is not valid for this project
- `404` — Not found
- `429` — Too Many Requests
- `500` — Unexpected error
- `503` — Batch's services are under maintenance. Please try again later

---

[API](https://skmtc.net/batch/apis/batch-rest-api.md) · [All operations](https://skmtc.net/batch/apis/batch-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/batch/batch-rest-api/revisions/ec696334ff35/schema)
