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

# Update Campaign

> Update a draft or scheduled campaign's name, subject, or content

<Warning>
  Campaigns with status `sending` or `sent` cannot be updated. Attempting to do so returns a `400` error.
</Warning>

## Headers

<ParamField header="Authorization" type="string" required>
  `Bearer YOUR_API_KEY`
</ParamField>

<ParamField header="X-Project-ID" type="string">
  Your project UUID. Not required if the API key already encodes the project.
</ParamField>

## Path Parameters

<ParamField path="campaignId" type="string" required>
  Campaign UUID
</ParamField>

## Request Body

All three body fields are **required**.

<ParamField body="name" type="string" required>
  Updated campaign display name
</ParamField>

<ParamField body="subject" type="string" required>
  Updated email subject line
</ParamField>

<ParamField body="content" type="string" required>
  Updated HTML body content
</ParamField>

<ParamField body="html_content" type="string">
  Pre-processed HTML — defaults to `content` if omitted
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  `true` on success
</ResponseField>

<ResponseField name="message" type="string">
  Human-readable confirmation
</ResponseField>

<ResponseField name="campaign" type="object">
  The full updated campaign object
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X PUT "https://api.usegately.com/api/v1/campaigns/CAMPAIGN_ID" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "X-Project-ID: YOUR_PROJECT_ID" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "June Newsletter (revised)",
      "subject": "What we shipped this month — updated",
      "content": "<h1>June Update</h1><p>Updated content here.</p>"
    }'
  ```

  ```typescript SDK theme={null}
  import { GatelyCampaigns } from '@gately/sdk'

  const campaigns = new GatelyCampaigns({ projectId: 'YOUR_PROJECT_ID' })

  const updated = await campaigns.update('CAMPAIGN_ID', {
    name: 'June Newsletter (revised)',
    subject: 'What we shipped this month — updated',
    content: '<h1>June Update</h1><p>Updated content here.</p>',
  })
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "success": true,
    "message": "Campaign updated successfully",
    "campaign": {
      "id": "a1b2c3d4-e5f6-4789-abcd-ef1234567890",
      "name": "June Newsletter (revised)",
      "subject": "What we shipped this month — updated",
      "status": "scheduled",
      "updated_at": "2025-06-15T11:30:00.000Z"
    }
  }
  ```

  ```json Cannot update sent campaign theme={null}
  {
    "error": "Cannot update campaign that is sending or already sent"
  }
  ```

  ```json Missing fields theme={null}
  {
    "error": "Missing required fields: name, subject, content"
  }
  ```
</ResponseExample>
