> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.brevo.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.brevo.com/_mcp/server.

# Update an email campaign

PUT https://api.brevo.com/v3/emailCampaigns/{campaignId}
Content-Type: application/json

Update an existing email campaign''s properties such as name, subject, content, sender, recipients, schedule, and A/B testing configuration. The campaign must exist and the request body must contain at least one valid field to update. Only draft or scheduled campaigns can be modified; if sendAtBestTime is enabled, IP warmup will be automatically disabled.

Reference: https://developers.brevo.com/reference/update-email-campaign

## Authentication

- `api-key` header (required) — The API key should be passed in the request headers as `api-key` for authentication.

## Request

### Path parameters

- `campaignId` (long, required) — Id of the campaign

### Body (application/json)

This endpoint expects an object.

- `abTesting` (boolean, optional, default: false) — Status of A/B Test. abTesting = false means it is disabled & abTesting = true means it is enabled. **subjectA, subjectB, splitRule, winnerCriteria & winnerDelay** will be considered when abTesting is set to true. subjectA & subjectB are mandatory together & subject if passed is ignored. **Can be set to true only if sendAtBestTime is false**. You will be able to set up two subject lines for your campaign and send them to a random sample of your total recipients. Half of the test group will receive version A, and the other half will receive version B
- `attachmentUrl` (string, optional) — Absolute url of the attachment (no local file). Extension allowed: #### xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps'
- `emailExpirationDate` (object, optional) — To reduce your carbon footprint, set an expiration date for your email. If supported, it will be automatically deleted from the recipient’s inbox, saving storage space and energy.
  - `duration` (long, optional) — Duration of the email expiry. maximum duration can be 3600 days or 480 weeks or 120 months.
  - `unit` (enum, optional) — unit of the duration
    - Allowed values: `days`, `weeks`, `months`
- `footer` (string, optional) — Footer of the email campaign
- `header` (string, optional) — Header of the email campaign
- `htmlContent` (string, optional) — Body of the message (HTML version). If the campaign is designed using Drag & Drop editor via HTML content, then the design page will not have Drag & Drop editor access for that campaign. **REQUIRED if htmlUrl is empty**
- `htmlUrl` (string, optional) — Url which contents the body of the email message. **REQUIRED if htmlContent is empty**
- `increaseRate` (long, optional) — Set a percentage increase rate for warming up your ip. We recommend you set the increase rate to 30% per day. If you want to send the same number of emails every day, set the daily increase value to 0%.
- `initialQuota` (long, optional) — Set an initial quota greater than 1 for warming up your ip. We recommend you set a value of 3000.
- `inlineImageActivation` (boolean, optional, default: false) — Status of inline image. inlineImageActivation = false means image can’t be embedded, & inlineImageActivation = true means image can be embedded, in the email. You cannot send a campaign of more than **4MB** with images embedded in the email. Campaigns with the images embedded in the email _must be sent to less than 5000 contacts_.
- `ipWarmupEnable` (boolean, optional, default: false) — **Available for dedicated ip clients**. Set this to true if you wish to warm up your ip.
- `mirrorActive` (boolean, optional) — Status of mirror links in campaign. mirrorActive = false means mirror links are deactivated, & mirrorActive = true means mirror links are activated, in the campaign
- `name` (string, optional) — Name of the campaign
- `params` (map from string to any, optional) — Pass the set of attributes to customize the type classic campaign. For example: **\{"FNAME":"Joe", "LNAME":"Doe"}**. Only available if **type** is **classic**. It's considered only if campaign is in *New Template Language format*. The New Template Language is dependent on the values of **subject, htmlContent/htmlUrl, sender.name & toField**
- `previewText` (string, optional) — Preview text or preheader of the email campaign
- `recipients` (object, optional) — Segment ids and List ids to include/exclude from campaign
  - `exclusionListIds` (list of long, optional) — List ids which have to be excluded from a campaign
  - `exclusionSegmentIds` (list of long, optional) — Segment ids which have to be excluded from a campaign.
  - `listIds` (list of long, optional) — Lists Ids to send the campaign to. **Campaign should only be updated with listIds if listIds were used to create it. REQUIRED if already not present in campaign and scheduledAt is not empty**
  - `segmentIds` (list of long, optional) — **Mandatory if listIds are not used. Campaign should only be updated with segmentIds if segmentIds were used to create it.** Segment ids to send the campaign to.
- `recurring` (boolean, optional, default: false) — **FOR TRIGGER ONLY !** Type of trigger campaign.recurring = false means contact can receive the same Trigger campaign only once, & recurring = true means contact can receive the same Trigger campaign several times
- `replyTo` (string, optional) — Email on which campaign recipients will be able to reply to
- `scheduledAt` (string, optional) — UTC date-time on which the campaign has to run (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** If sendAtBestTime is set to true, your campaign will be sent according to the date passed (ignoring the time part).
- `sendAtBestTime` (boolean, optional) — Set this to true if you want to send your campaign at best time. Note:- **if true, warmup ip will be disabled.**
- `sender` (object, optional) — Sender details including id or email and name (optional). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example: **\{"name":"xyz", "email":"[example@abc.com](mailto:example@abc.com)"}** **\{"name":"xyz", "id":123}**
  - `email` (string, optional) — Sender email from which the campaign emails are sent
  - `id` (long, optional) — Select the sender for the campaign on the basis of sender id. **In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email)**.
  - `name` (string, optional) — Sender Name from which the campaign emails are sent
- `splitRule` (long, optional) — Add the size of your test groups. **Mandatory if abTesting = true & 'recipients' is passed**. We'll send version A and B to a random sample of recipients, and then the winning version to everyone else
- `subject` (string, optional) — Subject of the campaign
- `subjectA` (string, optional) — Subject A of the campaign. **Mandatory if abTesting = true**. subjectA & subjectB should have unique value
- `subjectB` (string, optional) — Subject B of the campaign. **Mandatory if abTesting = true**. subjectA & subjectB should have unique value
- `tag` (string, optional) — Tag of the campaign
- `toField` (string, optional) — To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **\{FNAME} \{LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **\{\{contact.FNAME}} \{\{contact.LNAME}}** for personalization
- `unsubscriptionPageId` (string, optional) — Enter an unsubscription page id. The page id is a 24 digit alphanumeric id that can be found in the URL when editing the page.
- `updateFormId` (string, optional) — **Mandatory if templateId is used containing the \{\{ update\_profile }} tag**. Enter an update profile form id. The form id is a 24 digit alphanumeric id that can be found in the URL when editing the form.
- `utmCampaign` (string, optional) — Customize the utm_campaign value. If this field is empty, the campaign name will be used. Only alphanumeric characters and spaces are allowed
- `utmContent` (string, optional) — Customize the utm_content value. Appears on outgoing tracking links alongside utm_campaign. Only alphanumeric characters and spaces are allowed
- `utmTerm` (string, optional) — Customize the utm_term value. Appears on outgoing tracking links alongside utm_campaign. Only alphanumeric characters and spaces are allowed
- `winnerCriteria` (enum, optional) — Choose the metrics that will determinate the winning version. **Mandatory if *splitRule* >= 1 and \< 50**. If splitRule = 50, `winnerCriteria` is ignored if passed
  - Allowed values: `open`, `click`
- `winnerDelay` (long, optional) — Choose the duration of the test in hours. Maximum is 7 days, pass 24\*7 = 168 hours. The winning version will be sent at the end of the test. **Mandatory if *splitRule* >= 1 and \< 50**. If splitRule = 50, `winnerDelay` is ignored if passed

## Response

### 204

Email campaign updated

## Errors

### 400 Bad Request Error

bad request

- `code` (enum, required) — Error code displayed in case of a failure
  - Allowed values: `invalid_parameter`, `missing_parameter`, `out_of_range`, `campaign_processing`, `campaign_sent`, `document_not_found`, `not_enough_credits`, `permission_denied`, `duplicate_parameter`, `duplicate_request`, `method_not_allowed`, `unauthorized`, `account_under_validation`, `not_acceptable`, `bad_request`, `unprocessable_entity`, `Domain does not exist`, `Contact email not found`, `Attribute not found`, `Category id not found`, `Invalid parameters passed`, `Record(s) for identifier not found`, `Returned when query params are invalid`, `Returned when invalid data posted`, `Feed not found`, `Campaign ID not found`, `api-key not found`, `DMARC policy requires domain authentication`, `DNS records not properly configured`, `Invalid OTP code provided`, `OTP code has expired`, `Domain already exists in your account`, `The sum of all IP weights must equal 100`, `Authentication failed`, `Insufficient credits`, `Request already processed`
- `message` (string, required) — Readable message associated to the failure

### 404 Not Found Error

bad request

- `code` (enum, required) — Error code displayed in case of a failure
  - Allowed values: `invalid_parameter`, `missing_parameter`, `out_of_range`, `campaign_processing`, `campaign_sent`, `document_not_found`, `not_enough_credits`, `permission_denied`, `duplicate_parameter`, `duplicate_request`, `method_not_allowed`, `unauthorized`, `account_under_validation`, `not_acceptable`, `bad_request`, `unprocessable_entity`, `Domain does not exist`, `Contact email not found`, `Attribute not found`, `Category id not found`, `Invalid parameters passed`, `Record(s) for identifier not found`, `Returned when query params are invalid`, `Returned when invalid data posted`, `Feed not found`, `Campaign ID not found`, `api-key not found`, `DMARC policy requires domain authentication`, `DNS records not properly configured`, `Invalid OTP code provided`, `OTP code has expired`, `Domain already exists in your account`, `The sum of all IP weights must equal 100`, `Authentication failed`, `Insufficient credits`, `Request already processed`
- `message` (string, required) — Readable message associated to the failure

### 405 Method Not Allowed Error

Method not allowed. Returned when using sendAtBestTime or abTesting features without the required premium plan.

- `message` (string, required) — Readable message associated to the failure
- `code` (string, optional) — Error code displayed in case of a failure

## Examples

**Request**

```json
{}
```

**SDK Code**

```typescript
import { BrevoClient } from "@getbrevo/brevo";

async function main() {
    const client = new BrevoClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.emailCampaigns.updateEmailCampaign({
        campaignId: 1,
    });
}
main();

```

```python
from brevo import Brevo

client = Brevo(
    api_key="YOUR_API_KEY_HERE",
)

client.email_campaigns.update_email_campaign(
    campaign_id=1,
)

```

```php
<?php

namespace Example;

use Brevo\Brevo;
use Brevo\EmailCampaigns\Requests\UpdateEmailCampaignRequest;

$client = new Brevo(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->emailCampaigns->updateEmailCampaign(
    1,
    new UpdateEmailCampaignRequest([]),
);

```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.brevo.com/v3/emailCampaigns/1"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.brevo.com/v3/emailCampaigns/1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.brevo.com/v3/emailCampaigns/1")
  .header("api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.brevo.com/v3/emailCampaigns/1");
var request = new RestRequest(Method.PUT);
request.AddHeader("api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.brevo.com/v3/emailCampaigns/1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```