Drafts

To send a marketing campaign, you first need to create a draft object. In that object you specify the senders, recipients, contents, etc. Use the resources below to manage your drafts, as well as test, schedule and send them. Once a draft is sent, it automatically creates a campaign object.

post

Create a new campaign draft

post

Manage the content of your campaign draft email

post

Create a new newsletter

post

Manage the content of your newsletter email

post

/campaigndraft

Create a new campaign draft. `Newsletter` and `CampaignDraft` objects are differentiated by the EditMode values - we recommend using `CampaignDraft`, as `Newsletter` objects are ones created using the legacy Mailjet template builder.

Full API path

https://api.mailjet.com/v3/REST/campaigndraft

Body parameters

AXFraction

number

Fraction of an AB Testing campaign as a percentage of the total emails. Zero indicates the remainder.

AXFractionName

string

Name of the AB Testing fraction.

AXTesting

object

An ID reference to the respective AXTesting object.

Current

integer

Data ID of the current content.

EditMode

string

Edit mode for the campaign draft.

Possible values:

  • tool2 - Passport drag-and-drop template editor
  • html2 - HTML editor in Passport
  • mjml - MJML editor in Passport

IsStarred

boolean

Indicates whether the campaign draft is marked as Starred or not.

IsTextPartIncluded

boolean

Indicates whether the draft email contains a text version or not.

ReplyEmail

string

Reply-to email address for the campaign. Returned only if a reply-to email was specified.

SenderName

string

Name of the sender, which will be visible to recipients.

TemplateID

integer

Unique numeric ID of the template the CampaignDraft was generated from, or as which it was last saved. Changing the template ID will not update the content of the CampaignDraft.

Title

string

Internal title for this campaign draft.

ContactsListID

integer

Unique numeric ID for the contact list linked to this draft. Required for successful sending of the campaign. Interchangeable with ContactsListAlt.

ContactsListAlt

string

A unique contact list email address generated by Mailjet, which is linked to this campaign draft. Required for successful sending of the campaign. Interchangeable with ContactsListID.

Locale

string, required

Locale, in which the information is saved.

SegmentationID

integer

ID of the segment configuration (contactfilter) used for this campaign draft. Interchangeable with SegmentationAlt.

SegmentationAlt

string

The user-selected name of the segment configuration (contactfilter) used for this campaign draft. Interchangeable with SegmentationID.

Sender

string

ID of the sender email address. Required for successful sending of the campaign.

SenderEmail

string

The email address of the sender. Required for successful sending of the campaign.

Subject

string, required

Subject line for the campaign emails.

Responses

Note: You can find all the errors related to API in the error page

Count

integer

Data

array

AXFraction

number

Fraction of an AB Testing campaign as a percentage of the total emails. Zero indicates the remainder.

AXFractionName

string

Name of the AB Testing fraction.

AXTesting

object

An ID reference to the respective AXTesting object.

Current

integer

Data ID of the current content.

EditMode

string

Edit mode for the campaign draft.

Possible values:

  • tool2 - Passport drag-and-drop template editor
  • html2 - HTML editor in Passport
  • mjml - MJML editor in Passport

IsStarred

boolean

Indicates whether the campaign draft is marked as Starred or not.

IsTextPartIncluded

boolean

Indicates whether the draft email contains a text version or not.

ReplyEmail

string

Reply-to email address for the campaign. Returned only if a reply-to email was specified.

SenderName

string

Name of the sender, which will be visible to recipients.

TemplateID

integer

Unique numeric ID of the template the CampaignDraft was generated from, or as which it was last saved. Changing the template ID will not update the content of the CampaignDraft.

Title

string

Internal title for this campaign draft.

CampaignID

integer

Unique numeric ID of the campaign linked to this campaign draft. Will only be returned if the draft is already sent.

ContactsListID

integer

Unique numeric ID for the contact list linked to this draft. Required for successful sending of the campaign.

CreatedAt

string

Timestamp indicating when the campaigndraft was created.

DeliveredAt

string

Timestamp indicating when the campaigndraft was delivered.

ID

integer

Unique numeric ID for this campaign draft.

Locale

string

Locale, in which the information is saved.

ModifiedAt

string

Timestamp indicating when the campaign draft was last modified.

Preset

string

String, representing a JSON array of styles for this campaign draft. The API does not interpret the styles.

SegmentationID

integer

ID of the segment configuration (contactfilter) used for this campaign draft.

Sender

string

Unique numeric ID of the sender email address.

SenderEmail

string

Email address of the sender.

Status

integer

Status of the campaign draft. Only campaign drafts in status Draft or Programmed can be scheduled and sent out via /campaigndraft/{draft_id}/schedule or /campaigndraft/{draft_id}/send.

Possible values:

  • -3 - AXCanceled
  • -2 - Deleted
  • -1 - Archived
  • 0 - Draft
  • 1 - Programmed (scheduled)
  • 2 - Sent
  • 3 - AXTested (AB Testing versions sent, but winning version not selected yet)
  • 4 - AXSelected (AB Testing winning version selected and sent)

Subject

string

Subject line for the campaign emails.

Url

string

The URL, where an online version of the template can be found. A URL is automatically generated by Mailjet for marketing templates, after the campaign draft is sent.

Used

boolean

Indicates whether the campaign draft (or a test email of it) has been sent or not.

Total

integer

post

/campaigndraft/{draft_ID}/detailcontent

Create, update or delete the content of your campaign draft email. You can select a Text part, HTML part, MJML content, as well as additional headers. Each `POST` request overwrites any content previously added - e.g. if you have submitted HTML content on the initial `POST`, and on the next you only submit Text content, the previously saved value of `Html-part` will be deleted.

Full API path

https://api.mailjet.com/v3/REST/campaigndraft/{draft_ID}/detailcontent

Path parameters

draft_ID

integer, required

Unique numeric ID for the campaign draft you want to manage the content for.

Body parameters

Headers

object

A JSON object, where you can list all main headers. The header values override properties such as Subject if specified.

Html-part

string

The HTML-formatted part of the message.

MJMLContent

string

The content of the message in MJML.

Note: Any update of the MJMLContent property of the /campaigndraft/{draft_ID}/detailcontent resource will not automatically generate the Html-part version of the content. In this case, you should regenerate the Html-part with the MJML tools.

Text-part

string

The plain text part of the message.

Responses

Note: You can find all the errors related to API in the error page

Count

integer

Data

array

Headers

object

A JSON object, where you can list all main headers. The header values override properties such as Subject if specified.

Html-part

string

The HTML-formatted part of the message.

MJMLContent

string

The content of the message in MJML.

Note: Any update of the MJMLContent property of the /campaigndraft/{draft_ID}/detailcontent resource will not automatically generate the Html-part version of the content. In this case, you should regenerate the Html-part with the MJML tools.

Text-part

string

The plain text part of the message.

Total

integer

post

/newsletter

Create a new newsletter. `CampaignDraft` and `Newsletter` objects are differentiated by the `EditMode` values - we recommend using `CampaignDraft`, as `Newsletter` objects are ones created using the legacy Mailjet template builder.

Full API path

https://api.mailjet.com/v3/REST/newsletter

Body parameters

AXFraction

number

Fraction of an AB Testing newsletter as a percentage of the total emails. Zero indicates the remainder.

AXFractionName

string

Name of the AB Testing fraction.

AXTesting

object

An ID reference to the respective AXTesting object.

Callback

string

The callback URL used for this newsletter.

EditMode

string

Edit mode for newsletter.

  • tool - Legacy drag-and-drop template editor
  • html - Legacy HTML editor

Default value: tool

EditType

string

Edit type.

Default value: full

Footer

string

Specifies the footer type that will be generated - either the default one, or none.

Default value: default

FooterAddress

string

The address that will be used in the footer.

FooterWYSIWYGType

integer

Specifies what type of footer is used, based on selections available in the legacy drag-and-drop template builder.

HeaderFilename

string

Indicates the URL link to where the file used in the header is located, if you have added one.

HeaderLink

string

Indicates the URL link used in the header.

HeaderText

string

The text content in the header.

HeaderUrl

string

URL used in header.

Ip

string

The IP address used to create the newsletter.

IsStarred

boolean

Indicates whether the newsletter is marked as Starred or not.

IsTextPartIncluded

boolean

Indicates whether the newsletter email contains a plain text version or not.

Permalink

string

Type of permalink that should be added to the newsletter. The default permalink allows recipients to view an online version of the newsletter template online.

Default value: default

PermalinkHost

string

Host for the permalink.

PermalinkWYSIWYGType

integer

Deprecated property.

PolitenessMode

integer

Deprecated property.

ReplyEmail

string

Reply-to email address for the campaign.

SenderName

string

Name of the sender, which will be visible to recipients.

Status

integer

Status of the newsletter. Only newsletters in status newsletter or Programmed can be scheduled and sent out via /newsletter/{newsletter_id}/schedule or /newsletter/{newsletter_id}/send.

  • -3 - AXCancelled
  • -2- Deleted
  • -1 - Archived
  • 0 - Draft
  • 1 - Programmed (scheduled)
  • 2 - Sent
  • 3 - AXTested (AB Testing versions sent, but winning version not selected yet)
  • 4 - AXSelected (AB Testing winning version selected and sent)

TemplateID

integer

ID reference to the template the newsletter was generated from, or as which it was last saved. Changing the template ID will not update the content of the newsletter.

TestAddress

string

Email address used as a sender for test emails of this newsletter.

Title

string

Internal title for this newsletter.

Url

string

URL where an online version of the newsletter can be found.

ContactsListID

integer

Unique numeric ID for the contact list linked to this newsletter. Required for successful sending of the campaign. Interchangeable with ContactsListAlt.

ContactsListAlt

string

A unique contact list email address generated by Mailjet, which is linked to this newsletter. Required for successful sending of the campaign. Interchangeable with ContactsListID.

Locale

string, required

Locale, in which the information is saved.

SegmentationID

integer

ID of the segment configuration (contactfilter) used for this newsletter. Interchangeable with SegmentationAlt.

SegmentationAlt

string

The user-selected name of the segment configuration (contactfilter) used for this newsletter. Interchangeable with SegmentationID.

Sender

string

ID of the sender email address. Required for successful sending of the newsletter.

SenderEmail

string

The email address of the sender. Required for successful sending of the newsletter.

Subject

string, required

Subject line for the newsletter emails.

Responses

Note: You can find all the errors related to API in the error page

Count

integer

Data

array

AXFraction

number

Fraction of an AB Testing newsletter as a percentage of the total emails. Zero indicates the remainder.

AXFractionName

string

Name of the AB Testing fraction.

AXTesting

object

An ID reference to the respective AXTesting object.

Callback

string

The callback URL used for this newsletter.

EditMode

string

Edit mode for newsletter.

  • tool - Legacy drag-and-drop template editor
  • html - Legacy HTML editor

Default value: tool

EditType

string

Edit type.

Default value: full

Footer

string

Specifies the footer type that will be generated - either the default one, or none.

Default value: default

FooterAddress

string

The address that will be used in the footer.

FooterWYSIWYGType

integer

Specifies what type of footer is used, based on selections available in the legacy drag-and-drop template builder.

HeaderFilename

string

Indicates the URL link to where the file used in the header is located, if you have added one.

HeaderLink

string

Indicates the URL link used in the header.

HeaderText

string

The text content in the header.

HeaderUrl

string

URL used in header.

Ip

string

The IP address used to create the newsletter.

IsStarred

boolean

Indicates whether the newsletter is marked as Starred or not.

IsTextPartIncluded

boolean

Indicates whether the newsletter email contains a plain text version or not.

Permalink

string

Type of permalink that should be added to the newsletter. The default permalink allows recipients to view an online version of the newsletter template online.

Default value: default

PermalinkHost

string

Host for the permalink.

PermalinkWYSIWYGType

integer

Deprecated property.

PolitenessMode

integer

Deprecated property.

ReplyEmail

string

Reply-to email address for the campaign.

SenderName

string

Name of the sender, which will be visible to recipients.

Status

integer

Status of the newsletter. Only newsletters in status newsletter or Programmed can be scheduled and sent out via /newsletter/{newsletter_id}/schedule or /newsletter/{newsletter_id}/send.

  • -3 - AXCancelled
  • -2- Deleted
  • -1 - Archived
  • 0 - Draft
  • 1 - Programmed (scheduled)
  • 2 - Sent
  • 3 - AXTested (AB Testing versions sent, but winning version not selected yet)
  • 4 - AXSelected (AB Testing winning version selected and sent)

TemplateID

integer

ID reference to the template the newsletter was generated from, or as which it was last saved. Changing the template ID will not update the content of the newsletter.

TestAddress

string

Email address used as a sender for test emails of this newsletter.

Title

string

Internal title for this newsletter.

Url

string

URL where an online version of the newsletter can be found.

CampaignID

integer

Unique numeric ID for this newsletter.

ContactsListID

integer

Unique numeric ID for the contact list linked to this newsletter. Required for successful sending of the campaign.

CreatedAt

string

Timestamp of when the newsletter was created.

DeliveredAt

string

Timestamp of when the newsletter was delivered to the campaign's recipients.

ID

integer

Unique numeric ID for this newsletter.

IsHandled

boolean

Indicates whether the newsletter has been sent out, or a test email was sent out, or not.

Locale

string

Locale, in which the information is saved.

ModifiedAt

string

Timestamp of when the newsletter was last modified.

SegmentationID

integer

ID of the segment configuration (contactfilter) used for this newsletter.

Sender

string

Unique numeric ID of the sender email address.

SenderEmail

string

Email address of the sender.

Subject

string

Subject line for the newsletter emails.

Total

integer

post

/newsletter/{newsletter_ID}/detailcontent

Create, update or delete the content of your newsletter email. You can select a Text part and/or HTML part. Each POST request overwrites any content previously added - e.g. if you have submitted HTML content on the initial `POST`, and on the next you only submit Text content, the previously saved value of `Html-part` will be deleted.

Full API path

https://api.mailjet.com/v3/REST/newsletter/{newsletter_ID}/detailcontent

Path parameters

newsletter_ID

integer, required

Unique numeric ID for the newsletter you want to manage the content of.

Body parameters

Html-part

string

The HTML-formatted part of the message.

Text-part

string

The plain text part of the message.

Responses

Note: You can find all the errors related to API in the error page

Count

integer

Data

array

Html-part

string

The HTML-formatted part of the message.

Text-part

string

The plain text part of the message.

Total

integer