Code preference:
Curl
Ruby
Php
Python
Node.js
C#
Java

Campaign

Developers can access their campaign information as well as manage their campaigns using this API. Following are the various operations supported by this API.

This API call will let you access your created campaigns information.

a. To retrieve details of any particular campaign : get_campaign_v2()

Input Parameter Description
id Unique Id of the campaign [Mandatory].

Example :

Sample Output :

b. To retrieve details of all campaigns : get_campaigns_v2()

Input Parameter Description
type Type of campaign. Possible values – classic, trigger, sms, template ( case sensitive ) [Optional].
status Status of campaign. Possible values – draft , sent, archive, queued, suspended, in_process, temp_active, temp_inactive ( case sensitive ) [Optional].
page Maximum number of records per request is 500, if there are more than 500 campaigns then you can use this parameter to get next 500 results [Optional].
page_limit This should be a valid number between 1-1000. If page limit is kept empty or >1000, default is 500 [Optional].

Example :

Sample Output :

This API call will let you create and schedule your campaigns. It returns the ID of the created campaign.

Input Parameter Description
category Tag name of the campaign [Optional].
from_name Sender name from which the campaign emails are sent, default value = ‘[DEFAULT_FROM_NAME]’ [Optional].
name Name of the campaign [Mandatory].
bat Email address for test mail [Optional].
html_content Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty].
html_url Url which content is the body of content [Mandatory: if html_content is empty].
listid These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty].
scheduled_date The day on which the campaign is supposed to run[Optional].
subject Subject of the campaign [Mandatory].
from_email Sender email from which the campaign emails are sent [Mandatory: Please make sure that the sender details are defined here, and is a verified sender, you can add them also via API].
reply_to The reply to email in the campaign emails [Optional].
to_field This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional].
exclude_list These are the lists which must be excluded from the campaign [Optional].
attachment_url Provide the absolute url of the attachment. Url not allowed from local machine. File must be hosted somewhere.
Possilbe extension values: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, msg, pub & mobi [Optional].
inline_image Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional].
You cannot send a campaign of more than 5MB with images embedded in the email. Campaigns with the images embedded in the email must be sent to less than 5000 contacts.
mirror_active Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional].
send_now Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional].
utm_campaign Customize the utm_campaign value by completing this field. If you leave this field empty, the campaign name will be used. Only alphanumeric characters and spaces are allowed [Optional].

Here are some caveats for successful campaign creation & scheduling.

  • If the client’s account is not verified, and any campaign is to be sent to more than 10 users, in this case, account will need to be validated manually on our end before its sent.
  • You must have [UNSUBSCRIBE] tag within your html or a variable {} in your footer to create a valid campaign. Its important that the user is able to unsubscribe from your list.
  • For more information about unsubscribe link, please see this page

Example :

Sample Output :

This API call will let you delete your campaigns. You cannot delete an already scheduled campaign, only drafts can be deleted.

Input Parameter Description
id Id of campaign to be deleted [Mandatory].

Example :

Sample Output :

This API call will let you update and schedule your campaigns. You can only update a campaign before the scheduled date.

Input Parameter Description
id Id of campaign to be modified [Mandatory].
category Tag name of the campaign [Optional].
from_name Sender name from which the campaign emails are sent, default value = ‘[DEFAULT_FROM_NAME]’ [Optional].
name Name of the campaign [Optional].
bat Email address for test mail [Optional].
html_content Body of the content. The HTML content field must have more than 10 characters [Optional].
html_url Url which content is the body of content [Optional].
listid These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty].
scheduled_date The day on which the campaign is supposed to run[Optional].
subject Subject of the campaign [Optional].
from_email Sender email from which the campaign emails are sent [Mandatory: Please make sure that the sender details are defined here, and is a verified sender, you can add them also via API].
reply_to The reply to email in the campaign emails [Optional].
to_field This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional].
exclude_list These are the lists which must be excluded from the campaign [Optional].
attachment_url Provide the absolute url of the attachment. Url not allowed from local machine. File must be hosted somewhere.
Possilbe extension values: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, msg, pub & mobi [Optional].
inline_image Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional].
You cannot send a campaign of more than 5MB with images embedded in the email. Campaigns with the images embedded in the email must be sent to less than 5000 contacts.
mirror_active Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional].
send_now Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional].
utm_campaign Customize the utm_campaign value by completing this field. If you leave this field empty, the campaign name will be used. Only alphanumeric characters and spaces are allowed [Optional].

Example :

Sample Output :

This API call will let you send report of Sent and Archived campaign, to the specified email addresses, with respective data and a pdf attachment in detail.

Input Parameter Description
id Id of campaign to send its report [Mandatory].
lang Language of email content. Possible values – fr (default), en, es, it & pt [Optional].
email_subject Message subject [Mandatory].
email_to Email address of the recipient(s). Example: “test@example.net”. You can use commas to separate multiple recipients [Mandatory].
email_content_type Body of the message in text/HTML version. Possible values – text & html [Mandatory].
email_bcc Same as email_to but for Bcc [Optional].
email_cc Same as email_to but for Cc [Optional].
email_body Body of the message [Mandatory].

Example :

Sample Output:

This API call will let you export the recipients of a specified campaign. It returns the background process ID which on completion calls the notify URL that you have set in the input.

Input Parameter Description
id Id of campaign to export its recipients [Mandatory].
notify_url URL that will be called once the export process is finished [Mandatory].
type Type of recipients. Possible values – all, non_clicker, non_opener, clicker, opener, soft_bounces, hard_bounces & unsubscribes [Mandatory].

Example :

Sample Output :

Note: Once the export process is finished, the output of ‘notify_url’ contains below information –
proc_success=123&url=http://domain.com/path-to-file/filename.csv&
where, ‘proc_success’ is the process id returned in the api response, & ‘url’ is the path to download export file in csv format.

This API call will let you send a test campaign.

Input Parameter Description
campid Id of the campaign [Mandatory].
email_to Email address of recipient(s) existing in the one of the lists & should not be blacklisted. Example: “test@example.net”. You can use commas to separate multiple recipients [Mandatory].

Example :

Sample Output :
On successfully sending the test email, you will get the following response.

This API call will let you create and schedule your Trigger campaigns. It returns the ID of the created Trigger campaign.

Input Parameter Description
category Tag name of the campaign [Optional].
from_name Sender name from which the campaign emails are sent, default value = ‘[DEFAULT_FROM_NAME]’ [Optional].
trigger_name Name of the trigger campaign [Mandatory].
bat Email address for test mail [Optional].
html_content Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty].
html_url Url which content is the body of content [Mandatory: if html_content is empty].
listid These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty].
scheduled_date The day on which the campaign is supposed to run[Optional].
subject Subject of the campaign [Mandatory].
from_email Sender email from which the campaign emails are sent [Mandatory: Please make sure that the sender details are defined here, and is a verified sender, you can add them also via API].
reply_to The reply to email in the campaign emails [Optional].
to_field This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional].
exclude_list These are the lists which must be excluded from the campaign [Optional].
recurring Type of trigger campaign. Possible values = 0 (default) & 1. recurring = 0 means contact can receive the same Trigger campaign only once, & recurring = 1 means contact can receive the same Trigger campaign several times [Optional].
attachment_url Provide the absolute url of the attachment. Url not allowed from local machine. File must be hosted somewhere.
Possilbe extension values: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, msg, pub & mobi [Optional].
inline_image Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional].
You cannot send a campaign of more than 5MB with images embedded in the email. Campaigns with the images embedded in the email must be sent to less than 5000 contacts.
mirror_active Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional].
send_now Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional].

Example :

Sample Output:

This API call will let you update and schedule your Trigger campaigns. You can only update a campaign before the scheduled date.

Input Parameter Description
id Id of Trigger campaign to be modified [Mandatory].
category Tag name of the campaign [Optional].
from_name Sender name from which the campaign emails are sent, default value = ‘[DEFAULT_FROM_NAME]’ [Optional].
trigger_name Name of the trigger campaign [Optional].
bat Email address for test mail [Optional].
html_content Body of the content. The HTML content field must have more than 10 characters [Optional: if html_url is empty].
html_url Url which content is the body of content [Optional: if html_content is empty].
listid These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty].
scheduled_date The day on which the campaign is supposed to run[Optional].
subject Subject of the campaign [Optional].
from_email Sender email from which the campaign emails are sent [Mandatory: Please make sure that the sender details are defined here, and is a verified sender, you can add them also via API].
reply_to The reply to email in the campaign emails [Optional].
to_field This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional].
exclude_list These are the lists which must be excluded from the campaign [Optional].
recurring Type of trigger campaign. Possible values = 0 (default) & 1. recurring = 0 means contact can receive the same Trigger campaign only once, & recurring = 1 means contact can receive the same Trigger campaign several times [Optional].
attachment_url Provide the absolute url of the attachment. Url not allowed from local machine. File must be hosted somewhere.
Possilbe extension values: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, msg, pub & mobi [Optional].
inline_image Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional].
You cannot send a campaign of more than 5MB with images embedded in the email. Campaigns with the images embedded in the email must be sent to less than 5000 contacts.
mirror_active Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional].
send_now Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional].

Example :

Sample Output:

This API call will return the Campaign name, subject and share link of the classic type campaigns only which are sent, for those which are not sent and the rest of campaign types like trigger, template & sms, will return an error message of share link not available.

Input Parameter Description
campaign_ids Id of campaign to get share link. You can use commas to separate multiple ids [Mandatory].

Example :

Sample Output:

This API call will let let you update the campaign status.

Input Parameter Description
id Id of campaign to update its status [Mandatory].
status Types of status. Possible values – suspended, archive, darchive, sent, queued, replicate and replicate_template ( case sensitive ) [Mandatory].

Example :