> For the complete documentation index, see [llms.txt](https://api.senderwiz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.senderwiz.com/customer/campaigns/update-a-campaign.md).

# Update a Campaign

### ✏️ Update a Campaign

Modify an existing campaign by providing updated fields. Only the fields included in the request will be changed.

***

#### 🔹 HTTP Request

```http
PUT API-URL/campaigns/CAMPAIGN-UNIQUE-ID
```

***

#### 🔸 URL Segments

| Segment              | Required | Description                   |
| -------------------- | -------- | ----------------------------- |
| `CAMPAIGN-UNIQUE-ID` | Yes      | Campaign unique ID to update. |

***

#### 🔐 Authorization Header

```
X-API-KEY: your-api-key-here
```

***

#### 📥 PUT Parameters

Same as the parameters used in **Create a Campaign**, but all fields are optional during update.

***

#### 💻 PHP Example

```php
// UPDATE CAMPAIGN
$response = $endpoint->update('CAMPAIGN-XYZ123456', [
    'name'          => 'April Promo Campaign - Updated', // optional at update
    'from_name'     => 'Ethan Clark', // optional at update
    'from_email'    => 'ethan.clark@demo.org', // optional at update
    'subject'       => 'Updated Campaign: Explore What’s New!', // optional at update
    'reply_to'      => 'ethan.clark@demo.org', // optional at update
    'send_at'       => date('Y-m-d H:i:s', strtotime('+1 hour')), //optional at update, this will use the timezone which customer selected
    'list_uid'      => 'LIST-UID-456XYZ', // optional at update
    'segment_uid'   => 'SEGMENT-UID-123ABC', // optional, only to narrow down

    // optional block, defaults are shown
    'options' => [
        'url_tracking'      => 'no', // yes | no
        'json_feed'         => 'no', // yes | no
        'xml_feed'          => 'no', // yes | no
        'plain_text_email'  => 'yes', // yes | no
        'email_stats'       => null, // a valid email address where we should send the stats after campaign done
    ],

    // optional block at update, archive or template_uid or content => required.
    'template' => [
        //'archive'         => file_get_contents(__DIR__ . '/template-example.zip'),
        //'template_uid'    => 'TEMPLATE-UNIQUE-ID',
        'content'           => file_get_contents(__DIR__ . '/template-example.html'),
        'inline_css'        => 'no', // yes | no
        'plain_text'        => null, // leave empty to auto generate
        'auto_plain_text'   => 'yes', // yes | no
    ],
]);

// DISPLAY RESPONSE
echo '<hr /><pre>';
print_r($response->body);
echo '</pre>';
```

***

#### 📦 Sample JSON Response

```json
{
  "status": "success"
}
```
