Skip to content
Last updated

Create a campaign draft

Prerequisites

  1. Have a validated sender linked to your API Key
  2. Have a contact list containing all the recipients you want to send to your campaign.

Optionally, have a sengment you would like to apply to your list to target a specific demographic.

To create a campaign draft, perform a POST on the /campaigndraft resource. You need to select a Locale, Sender, SenderEmail, Subject and ContactsListID.

If you want to send your campaign to a segment of your contact list, please also enter a SegmentationID (more info on segmentation can be found here).

Example

# Create : CampaignDraft data
curl -s \
	-X POST \
	--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
	https://api.mailjet.com/v3/REST/campaigndraft \
	-H 'Content-Type: application/json' \
	-d '{
		"Locale":"en_US",
		"Sender":"MisterMailjet",
		"SenderEmail":"Mister@mailjet.com",
		"Subject":"Greetings from Mailjet",
		"ContactsListID":"$ID_CONTACTSLIST",
		"Title":"Friday newsletter"
	}'

API Response

{
  "Count": 1,
  "Data": [
    {
      "AXFractionName": "",
      "AXTesting": "",
      "CampaignID": "",
      "ContactsListID": "$ID_CONTACTSLIST",
      "CreatedAt": "",
      "Current": "",
      "DeliveredAt": "",
      "EditMode": "",
      "ID": "",
      "IsStarred": "false",
      "IsTextPartIncluded": "false",
      "Locale": "en_US",
      "ModifiedAt": "",
      "Preset": "",
      "ReplyEmail": "",
      "SegmentationID": "",
      "Sender": "MisterMailjet",
      "SenderEmail": "Mister@mailjet.com",
      "SenderName": "",
      "Status": "",
      "Subject": "Greetings from Mailjet",
      "Template": "",
      "Title": "Friday newsletter",
      "Url": "",
      "Used": "false"
    }
  ],
  "Total": 1
}