> 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"
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api.senderwiz.com/customer/campaigns/update-a-campaign.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
