Update an email campaign

Log in to see full request history
timestatususer agent
Retrieving recent requests…
LoadingLoading…

Code Examples

You can use as reference the code below to implement this call in your preferred language.
Check all our official API clients here

const SibApiV3Sdk = require('sib-api-v3-sdk'); let defaultClient = SibApiV3Sdk.ApiClient.instance; let apiKey = defaultClient.authentications['api-key']; apiKey.apiKey = 'YOUR API KEY'; let apiInstance = new SibApiV3Sdk.EmailCampaignsApi(); let campaignId = 1; let emailCampaign = new SibApiV3Sdk.UpdateEmailCampaign(); emailCampaign = { tag: 'myTag', sender: {name: 'senderName', email: 'sender@domain.com'}, name: 'My First Campaign', templateId: 10, scheduledAt: new Date("2021-01-01T00:00:00+00:00"), subject: ' My {{params.subject}}', replyTo: 'replyto@domain.com', toField: '{{contact.FIRSTNAME}} {{contact.LASTNAME}}', recipients: {listIds: [1, 3], exclusionListIds: [2]}, attachmentUrl: 'https://attachment.domain.com/myAttachmentFromUrl.jpg', inlineImageActivation: false, mirrorActive: false, recurring: false, type: 'classic', header: 'If you are not able to see this mail, click {here}', footer: 'If you wish to unsubscribe from our newsletter, click {here}', utmCampaign: 'My utm campaign value', params: {'PARAMETER': 'My param value' , 'ADDRESS': 'Seattle, WA', 'SUBJECT': 'New Subject'} }; apiInstance.updateEmailCampaign(campaignId, emailCampaign).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); });
<?php require_once(__DIR__ . '/vendor/autoload.php'); $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR API KEY'); $apiInstance = new SendinBlue\Client\Api\EmailCampaignsApi( new GuzzleHttp\Client(), $config ); $campaignId = 1; $emailCampaign = new \SendinBlue\Client\Model\UpdateEmailCampaign(); $emailCampaign['tag'] = 'myTag'; $emailCampaign['sender'] = array('name' => 'senderName', 'email' => 'sender@domain.com'); $emailCampaign['name'] = 'My First Campaign'; $emailCampaign['templateId'] = 1; $emailCampaign['scheduledAt'] = new \DateTime('2021-01-01T00:00:00+00:00'); $emailCampaign['subject'] = 'My {{params.subject}}'; $emailCampaign['replyTo'] = 'replyto@domain.com'; $emailCampaign['toField'] = '{{contact.FIRSTNAME}} {{contact.LASTNAME}}'; $emailCampaign['recipients'] = array( 'listIds' => array(1, 3), 'exclusionListIds' => array(2) ); $emailCampaign['attachmentUrl'] = 'https://attachment.domain.com/myAttachmentFromUrl.jpg'; $emailCampaign['inlineImageActivation'] = false; $emailCampaign['mirrorActive'] = false; $emailCampaign['recurring'] = false; $emailCampaign['type'] = 'classic'; $emailCampaign['header'] = 'If you are not able to see this mail, click {here}'; $emailCampaign['footer'] = 'If you wish to unsubscribe from our newsletter, click {here}'; $emailCampaign['utmCampaign'] = 'My utm campaign value'; $emailCampaign['params'] = array('PARAMETER' => 'My param value', 'ADDRESS' => 'Seattle, WA', 'SUBJECT' => 'New Subject'); try { $apiInstance->updateEmailCampaign($campaignId, $emailCampaign); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->updateEmailCampaign: ', $e->getMessage(), PHP_EOL; } ?>
from __future__ import print_function import time import datetime import sib_api_v3_sdk from sib_api_v3_sdk.rest import ApiException from pprint import pprint configuration = sib_api_v3_sdk.Configuration() configuration.api_key['api-key'] = 'YOUR API KEY' api_instance = sib_api_v3_sdk.EmailCampaignsApi(sib_api_v3_sdk.ApiClient(configuration)) campaign_id = 1 tag = 'myTag' sender = {"name": 'senderName', "email": 'sender@domain.com'} name = 'My First Campaign' scheduled_at = "2021-03-25T15:10:00+05:30" subject = ' My Subject' reply_to = 'replyto@domain.com' to_field = 'John Doe' recipients = {"listIds": [1, 3], "exclusionListIds": [2]} attachment_url = 'https://attachment.domain.com/myAttachmentFromUrl.jpg' inline_image_activation = False mirror_active = False header = 'If you are not able to see this mail, click {here}' footer = 'If you wish to unsubscribe from our newsletter, click {here}' utm_campaign = 'My utm campaign value' email_campaign = sib_api_v3_sdk.UpdateEmailCampaign(tag=tag, sender=sender, name=name, scheduled_at=scheduled_at, subject=subject, reply_to=reply_to, to_field=to_field, recipients=recipients, attachment_url=attachment_url, inline_image_activation=inline_image_activation,mirror_active=mirror_active, header=header, footer=footer, utm_campaign=utm_campaign) # UpdateEmailCampaign | Values to update a campaign try: api_instance.update_email_campaign(campaign_id, email_campaign) except ApiException as e: print("Exception when calling EmailCampaignsApi->update_email_campaign: %s\n" % e)
const SibApiV3Sdk = require('sib-api-v3-typescript'); let apiInstance = new SibApiV3Sdk.EmailCampaignsApi(); let apiKey = apiInstance.authentications['apiKey']; apiKey.apiKey = 'YOUR API KEY'; let campaignId = 1; let emailCampaign = new SibApiV3Sdk.UpdateEmailCampaign(); emailCampaign = { tag: 'myTag', sender: {name: 'senderName', email: 'sender@domain.com'}, name: 'My First Campaign', templateId: 10, scheduledAt: new Date("2021-01-01T00:00:00+00:00"), subject: ' My {{params.subject}}', replyTo: 'replyto@domain.com', toField: '{{contact.FIRSTNAME}} {{contact.LASTNAME}}', recipients: {listIds: [1, 3], exclusionListIds: [2]}, attachmentUrl: 'https://attachment.domain.com/myAttachmentFromUrl.jpg', inlineImageActivation: false, mirrorActive: false, recurring: false, type: 'classic', header: 'If you are not able to see this mail, click {here}', footer: 'If you wish to unsubscribe from our newsletter, click {here}', utmCampaign: 'My utm campaign value', params: {'PARAMETER': 'My param value' , 'ADDRESS': 'Seattle, WA', 'SUBJECT': 'New Subject'} }; apiInstance.updateEmailCampaign(campaignId, emailCampaign).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); });
package sibApi; import sendinblue.ApiClient; import sendinblue.Configuration; import sendinblue.auth.ApiKeyAuth; import sibModel.*; import org.threeten.bp.OffsetDateTime; import java.util.*; import java.util.List; public class Program { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); // Configure API key authorization: api-key ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("api-key"); apiKey.setApiKey("YOUR API KEY"); try { EmailCampaignsApi api = new EmailCampaignsApi(); Long campaignId = 1l; UpdateEmailCampaignSender sender = new UpdateEmailCampaignSender(); sender.setEmail("example@example.com"); sender.setName("John Doe"); String scheduledAt = "2021-08-22T09:43:51.970+05:30"; List<Long> listIds = new ArrayList<Long>(); listIds.add(4l); List<Long> exclusionListIds = new ArrayList<Long>(); exclusionListIds.add(2l); UpdateEmailCampaignRecipients recipients = new UpdateEmailCampaignRecipients(); recipients.setListIds(listIds); recipients.setExclusionListIds(exclusionListIds); UpdateEmailCampaign emailCampaign = new UpdateEmailCampaign(); emailCampaign.setTag("myTag"); emailCampaign.setSender(sender); emailCampaign.setName("My First Campaign"); emailCampaign.setScheduledAt(scheduledAt); emailCampaign.setSubject("My {{params.subject}}"); emailCampaign.setReplyTo("replyto@domain.com"); emailCampaign.setToField("{{contact.FIRSTNAME}} {{contact.LASTNAME}}"); emailCampaign.setRecipients(recipients); emailCampaign.setAttachmentUrl("https://attachment.domain.com/myAttachmentFromUrl.jpg"); emailCampaign.setInlineImageActivation(false); emailCampaign.setMirrorActive(false); emailCampaign.setHeader("If you are not able to see this mail, click {here}"); emailCampaign.setFooter("If you wish to unsubscribe from our newsletter, click {here}"); emailCampaign.setUtmCampaign("My utm campaign value"); Properties params = new Properties(); params.setProperty("PARAMETER","My param value"); params.setProperty("ADDRESS","Seattle, WA"); params.setProperty("SUBJECT","New Subject"); emailCampaign.setParams(params); api.updateEmailCampaign(campaignId, emailCampaign); } catch (Exception e) { System.out.println("Exception occurred:- " + e.getMessage()); } } }
using sib_api_v3_sdk.Api; using sib_api_v3_sdk.Client; using sib_api_v3_sdk.Model; using System; using System.Diagnostics; using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace Sendinblue { class Program { static void Main(string[] args) { Configuration.Default.ApiKey.Add("api-key", "YOUR API KEY"); var apiInstance = new EmailCampaignsApi(); long? campaignId = 1; string tag = "myTag"; string sender_Name = "John Doe"; string sender_Email = "example@example.com"; UpdateEmailCampaignSender sender = new UpdateEmailCampaignSender(sender_Name, sender_Email); string name = "My First Campaign"; string htmlContent = null; string htmlUrl = null; string scheduledAt = "2021-12-24T16:03:51.000+05:30); string subject = "My {{params.subject}}"; string replyTo = "replyto@domain.com"; string toField = "{{contact.FIRSTNAME}} {{contact.LASTNAME}}"; List<long?> exclusionListIds = new List<long?>(); exclusionListIds.Add(2); List<long?> listIds = new List<long?>(); listIds.Add(4); UpdateEmailCampaignRecipients recipients = new UpdateEmailCampaignRecipients(exclusionListIds, listIds); string attachmentUrl = "https://attachment.domain.com/myAttachmentFromUrl.jpg"; bool? inlineImageActivation = false; bool? mirrorActive = false; bool? recurring = false; string footer = "If you wish to unsubscribe from our newsletter, click {here}"; string header = "If you are not able to see this mail, click {here}"; string utmCampaign = "My utm campaign value"; JObject _params = new JObject(); _params.Add("PARAMETER", "My param value"); _params.Add("ADDRESS", "Seattle, WA"); _params.Add("SUBJECT", "New Subject"); try { var emailCampaign = new UpdateEmailCampaign(tag, sender, name, htmlContent, htmlUrl, scheduledAt, subject, replyTo, toField, recipients, attachmentUrl, inlineImageActivation, mirrorActive, recurring, footer, header, utmCampaign, _params); apiInstance.UpdateEmailCampaign(campaignId, emailCampaign); Console.ReadLine(); } catch (Exception e) { Debug.WriteLine(e.Message); Console.WriteLine(e.Message); Console.ReadLine(); } } } }
package main import ( "fmt" "context" sib_api_v3_sdk "./lib" ) func main() { var ctx context.Context var cli = sib_api_v3_sdk.APIClient{ cfg: sib_api_v3_sdk.NewConfiguration(), } //Configure API key authorization: api-key cli.cfg.AddDefaultHeader("api-key", "YOUR_API_KEY") sib := sib_api_v3_sdk.NewAPIClient(cli.cfg) campaignId := int64(1) params := UpdateEmailCampaign{ Tag: "myTag", Sender: &UpdateEmailCampaignSender{ Name: "senderName", Email: "sender@domain.com", }, Name: "My First Campaign", ScheduledAt: "2021-03-25T15:10:00+05:30", Subject: "My Subject", ReplyTo: "replyto@domain.com", ToField: "John Doe", AttachmentUrl: "https://attachment.domain.com/myAttachmentFromUrl.jpg", InlineImageActivation: false, MirrorActive: false, UtmCampaign: "My utm campaign value", } resp, err := sib.EmailCampaignsApi.UpdateEmailCampaign(ctx, params, campaignId) if err!=nil{ fmt.Println("Error in EmailCampaignsApi->UpdateEmailCampaign ",err.Error()) return } fmt.Println( "UpdateEmailCampaign, response:",resp) return }
# load the gem require 'sib-api-v3-sdk' # setup authorization SibApiV3Sdk.configure do |config| # Configure API key authorization: api-key config.api_key['api-key'] = 'YOUR API KEY' end api_instance = SibApiV3Sdk::EmailCampaignsApi.new campaign_id = 789 # Integer | Id of the campaign email_campaign = SibApiV3Sdk::UpdateEmailCampaign.new # UpdateEmailCampaign | Values to update a campaign email_campaigns = { 'name'=> 'my new campaign', 'subject'=> 'My {{params.subject}}', 'sender'=> { 'name'=> 'senderName', 'email'=> 'sender@domain.com' }, 'templateId'=> 10, 'scheduledAt'=> DateTime.iso8601('2021-02-03T04:05:06+07:00'), 'replyTo'=> 'replyto@domain.com', 'toField'=> '{{contact.FIRSTNAME}} {{contact.LASTNAME}}', 'recipients'=> { 'listIds'=> [1,3], 'exclusionListIds'=> [2] }, 'attachmentUrl'=> 'https://attachment.domain.com/myAttachmentFromUrl.jpg', 'inlineImageActivation'=> false, 'mirrorActive'=> false, 'recurring'=> false, 'type'=> 'classic', 'tag'=> 'myTag', 'header'=> 'If you are not able to see this mail, click {here}', 'footer'=> 'If you wish to unsubscribe from our newsletter, click {here}', 'utmCampaign'=> 'My utm campaign value', 'params'=> { 'PARAMETER'=> 'My param value', 'ADDRESS'=> 'Seattle, WA', 'SUBJECT'=> 'New Subject' } }; begin #Update an email campaign api_instance.update_email_campaign(campaign_id, email_campaign) rescue SibApiV3Sdk::ApiError => e puts "Exception when calling EmailCampaignsApi->update_email_campaign: #{e}" end
Path Params
int64
required

Id of the campaign

Body Params

Values to update a campaign

string

Tag of the campaign

object

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"}
{"name":"xyz", "id":123}

string

Name of the campaign

string

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

url

Url which contents the body of the email message. REQUIRED if htmlContent is empty

string

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).

string

Subject of the campaign

string

Preview text or preheader of the email campaign

string

Email on which campaign recipients will be able to reply to

string

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

object

Segment ids and List ids to include/exclude from campaign

url

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'

boolean
Defaults to 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.

boolean

Status of mirror links in campaign. mirrorActive = false means mirror links are deactivated, & mirrorActive = true means mirror links are activated, in the campaign

boolean
Defaults to 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

string
string

Header of the email campaign

string

Customize the utm_campaign value. If this field is empty, the campaign name will be used. Only alphanumeric characters and spaces are allowed

object

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

boolean

Set this to true if you want to send your campaign at best time.
Note:- if true, warmup ip will be disabled.

boolean
Defaults to 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

string

Subject A of the campaign. Mandatory if abTesting = true.
subjectA & subjectB should have unique value

string

Subject B of the campaign. Mandatory if abTesting = true.
subjectA & subjectB should have unique value

int64
1 to 50

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

string

Choose the metrics that will determinate the winning version. Mandatory if splitRule >= 1 and < 50. If splitRule = 50, winnerCriteria is ignored if passed

int64
1 to 168

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

boolean
Defaults to false

Available for dedicated ip clients. Set this to true if you wish to warm up your ip.

int64

Set an initial quota greater than 1 for warming up your ip. We recommend you set a value of 3000.

int64
0 to 100

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%.

string

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.

string

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.

object

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.

Responses
204

Email campaign updated

Language
Credentials
Click Try It! to start a request and see the response here! Or choose an example:
application/json