---
title: "Update a campaign"
method: PUT
path: "/{teamPid}/campaigns/{campaign}"
tags: ["Campaigns"]
---

# Update a campaign

`PUT /{teamPid}/campaigns/{campaign}`

## Request

- Base URL: `https://api.rightmessage.com/v1`
- URL: `https://api.rightmessage.com/v1/{teamPid}/campaigns/{campaign}`
- Auth: HTTP bearer

Changes the draft only. Publish the draft to make it live.

Requires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.

## Path parameters

- `teamPid` string, required
- `campaign` string, required

## Request body

- UpdateCampaignRequest
  - `name` string
  - `is_active` boolean
  - `base_url` string, nullable
  - `testing` object
    - `is_enabled` boolean
    - `withhold` integer
  - `goal_ids` string[]
  - `outcome` 'any_goal' | 'primary_goal'
  - `audience_tests` object[]
    - `variant_id` string, required
    - `test` string[], required
  - `changes` object[]
    - `id` string, nullable
    - `variant_id` string, nullable
    - `version_id` 'A' | 'B' | 'C' | 'D'
    - `kind` 'override'
    - `action_id` string
    - `skip` boolean
    - `fields` string[]
    - `targeting` string[], nullable
    - `selector` string, nullable
    - `segment_ids` string, nullable
    - `page` string, nullable
    - `content` string, nullable
    - `visibility` 'show' | 'hide' | 'null', nullable
    - `style` string[], nullable
    - `attr` string[], nullable
    - `add_classes` string, nullable
    - `remove_classes` string, nullable

## Response `200`

`CampaignResource`

- object
  - `data` CampaignResource, required
    - `id` string, nullable, required
    - `name` string, nullable, required
    - `is_active` union, required
      - string
      - boolean
    - `base_url` string, nullable, required
    - `testing` string, nullable, required
    - `goal_ids` union, required
      - string
      - string[]
    - `outcome` string
    - `changes` unknown[], required
      - unknown
    - `audience_tests` string, required
    - `original_deployment` string, required

## Other responses

- `401`: Missing, invalid or revoked API token.
- `403`: Authorization error
- `404`: Not found
- `422`: Validation error
- `429`: Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.

---

[API](https://skmtc.dev/rightmessage/apis/rightmessage-api.md) - [All operations](https://skmtc.dev/rightmessage/apis/rightmessage-api/llms.txt) - [OpenAPI document](https://skmtc.dev/rightmessage/apis/rightmessage-api/revisions/adec35e9720c?raw)
