V3 REFERENCE Campaigns

/campaign

Historical view of sent emails, both transactional and marketing. Each e-mail going through Mailjet is attached to a Campaign. This object is automatically generated by Mailjet.

List campaign resources available for this apikey, use a GET request. Alternatively, you may want to add one or more filters.

# list campaign resources

curl -s -X GET \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/campaign
Unique Key

In addition to the resource $ID, you can also use the unique key $CustomValue to identify this resource. Please refer to the field(s) description below for more information.

Properties
Name Description
CampaignType Type of campaign (transactional, campaign).
  • Read Only
  • [ Type LongInt ]
ClickTracked Number of messages for which click tracking is requested.
  • Read Only
  • [ Type Int64 ]
CreatedAt Timestamp when object was created in database.
  • Read Only
  • [ Type TRFC3339DateTime ]
CustomValue Custom tag for this campaign, must be unique.
  • Unique
  • Read Only
  • [ Type AnsiString ]
FirstMessageID Unique numerical ID for this object.
  • Read Only
  • [ Type Int64 ]
FromID
OR
FromALT
FromID
ID reference to Sender
FromALT
Value of the Email field of the related Sender resource
  • Read Only
  • [ Type TSender ]
FromEmail Sender email address for the campaign.
  • Mandatory
  • Read Only
  • [ Type TEmail ]
FromName Sender name for the campaign.
  • Read Only
  • [ Type AnsiString ]
HasHtmlCount Number of messages containing HTML in this campaign.
  • Read Only
  • [ Type Int64 ]
HasTxtCount Number of messages containing TXT in this campaign.
  • Read Only
  • [ Type Int64 ]
ID Unique numerical ID for this object.
  • Read Only
  • [ Type Int64 ]
IsDeleted Has the campaign been deleted by the user.
  • [ Type Boolean ]
IsStarred Is this campaign marked as starred?.
  • [ Type Boolean ]
ListID
OR
ListALT
ListID
ID reference to ContactsList
ListALT
Value of the Address field of the related ContactsList resource
  • Read Only
  • [ Type TContactsList ]
NewsLetterID Newletter ID for which the campaign was created.
  • Read Only
  • [ Type Int64 ]
OpenTracked Number of messages for which open tracking is requested.
  • Read Only
  • [ Type Int64 ]
SegmentationID
OR
SegmentationALT
SegmentationID
ID reference to ContactFilter
SegmentationALT
Value of the Name field of the related ContactFilter resource
  • Read Only
  • [ Type TContactFilter ]
SendEndAt Timestamp indicating when last message in this campaign was sent.
  • Read Only
  • [ Type TRFC3339DateTime ]
SendStartAt Timestamp indicating when first message in this campaign was sent.
  • Read Only
  • [ Type TRFC3339DateTime ]
SpamassScore Spam Assassin score for this campaign.
  • Read Only
  • [ Type Currency ]
Status Status of this campaign.
  • Read Only
  • [ Type SmallInt ]
Subject Campaign subject.
  • Read Only
  • [ Type AnsiString ]
UnsubscribeTrackedCount Number of messages for which unsubscribe tracking is requested.
  • Read Only
  • [ Type Int64 ]
Workflow
  • Read Only
  • [ Type TWorkflow ]
Filters
Name Description
CampaignID Unique numerical ID for this object.
  • [ Type Int64 ]
CampaignStatus Only retrieve campaign resources for which Status equals the specified value.
  • [ Type SmallInt ]
ContactsList Only retrieve campaigns for this contact list.
  • [ Type Int64 ]
CustomCampaign Only retrieve campaigns with this custom campaign value.
  • [ Type AnsiString ]
From Only retrieve campaign resources for which From equals the specified value.
  • [ Type AnsiString ]
FromDomain Only retrieve campaigns with this from domain.
  • [ Type AnsiString ]
FromID Only retrieve campaigns with this sender ID.
  • [ Type Int64 ]
FromTS Only retrieve campaigns with SendStartAt after this timestamp.
  • [ Type TRFC3339DateTime ]
FromType Only retrieve campaigns with FromType equal to specified value.
  • [ Type LongInt ]
IsDeleted Only retrieve campaign resources for which IsDeleted equals the specified value.
  • [ Type TBooleanFilter ]
IsNewsletterTool Only retrieve campaigns which were started by the newsletter tool.
  • [ Type TBooleanFilter ]
IsStarred Only retrieve campaigns which were marked as starred.
  • [ Type TBooleanFilter ]
Period Set FromTS and ToTS timestamps to beginning of indicated period and current timestamp, respectively.
  • [ Type AnsiString ]
ToTS Only retrieve campaigns with SendStartAt timestamp less than the specified value.
  • [ Type TRFC3339DateTime ]
WorkflowID
  • [ Type Int64 ]

Access a given campaign resource, use a GET request, providing the campaign's ID value.

# access the campaign resource identified by $ID

curl -s -X GET \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/campaign/$ID

    
# access the resource through the CustomValue's value
# note: all keys marked as 'unique' may be used as an alternate ID

curl -s -X GET \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/campaign/$CustomValue
    
    
Unique Key

In addition to the resource $ID, you can also use the unique key $CustomValue to identify this resource. Please refer to the field(s) description below for more information.

Properties
Name Description
CampaignType Type of campaign (transactional, campaign).
  • Read Only
  • [ Type LongInt ]
ClickTracked Number of messages for which click tracking is requested.
  • Read Only
  • [ Type Int64 ]
CreatedAt Timestamp when object was created in database.
  • Read Only
  • [ Type TRFC3339DateTime ]
CustomValue Custom tag for this campaign, must be unique.
  • Unique
  • Read Only
  • [ Type AnsiString ]
FirstMessageID Unique numerical ID for this object.
  • Read Only
  • [ Type Int64 ]
FromID
OR
FromALT
FromID
ID reference to Sender
FromALT
Value of the Email field of the related Sender resource
  • Read Only
  • [ Type TSender ]
FromEmail Sender email address for the campaign.
  • Mandatory
  • Read Only
  • [ Type TEmail ]
FromName Sender name for the campaign.
  • Read Only
  • [ Type AnsiString ]
HasHtmlCount Number of messages containing HTML in this campaign.
  • Read Only
  • [ Type Int64 ]
HasTxtCount Number of messages containing TXT in this campaign.
  • Read Only
  • [ Type Int64 ]
ID Unique numerical ID for this object.
  • Read Only
  • [ Type Int64 ]
IsDeleted Has the campaign been deleted by the user.
  • [ Type Boolean ]
IsStarred Is this campaign marked as starred?.
  • [ Type Boolean ]
ListID
OR
ListALT
ListID
ID reference to ContactsList
ListALT
Value of the Address field of the related ContactsList resource
  • Read Only
  • [ Type TContactsList ]
NewsLetterID Newletter ID for which the campaign was created.
  • Read Only
  • [ Type Int64 ]
OpenTracked Number of messages for which open tracking is requested.
  • Read Only
  • [ Type Int64 ]
SegmentationID
OR
SegmentationALT
SegmentationID
ID reference to ContactFilter
SegmentationALT
Value of the Name field of the related ContactFilter resource
  • Read Only
  • [ Type TContactFilter ]
SendEndAt Timestamp indicating when last message in this campaign was sent.
  • Read Only
  • [ Type TRFC3339DateTime ]
SendStartAt Timestamp indicating when first message in this campaign was sent.
  • Read Only
  • [ Type TRFC3339DateTime ]
SpamassScore Spam Assassin score for this campaign.
  • Read Only
  • [ Type Currency ]
Status Status of this campaign.
  • Read Only
  • [ Type SmallInt ]
Subject Campaign subject.
  • Read Only
  • [ Type AnsiString ]
UnsubscribeTrackedCount Number of messages for which unsubscribe tracking is requested.
  • Read Only
  • [ Type Int64 ]
Workflow
  • Read Only
  • [ Type TWorkflow ]

Update one specific campaign resource with a PUT request, providing the campaign's ID value. Be sure to include all the mandatory properties.

# update content of resource campaign identified by ID $ID

curl -s -X PUT \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/campaign/$ID \
-H 'Content-Type: application/json' \
-d '{"IsDeleted": ...}'

    
# update the content, using the value of the CustomValue property
# note: all keys marked as 'unique' may be used as an alternate ID

curl -s -X PUT \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/campaign/:CustomValue \
-H 'Content-Type: application/json' \
-d '{"CampaignType": ...}'
    
Unique Key

In addition to the resource $ID, you can also use the unique key $CustomValue to identify this resource. Please refer to the field(s) description below for more information.

Properties
Name Description
CampaignType Type of campaign (transactional, campaign).
  • Read Only
  • [ Type LongInt ]
ClickTracked Number of messages for which click tracking is requested.
  • Read Only
  • [ Type Int64 ]
CreatedAt Timestamp when object was created in database.
  • Read Only
  • [ Type TRFC3339DateTime ]
CustomValue Custom tag for this campaign, must be unique.
  • Unique
  • Read Only
  • [ Type AnsiString ]
FirstMessageID Unique numerical ID for this object.
  • Read Only
  • [ Type Int64 ]
FromID
OR
FromALT
FromID
ID reference to Sender
FromALT
Value of the Email field of the related Sender resource
  • Read Only
  • [ Type TSender ]
FromEmail Sender email address for the campaign.
  • Mandatory
  • Read Only
  • [ Type TEmail ]
FromName Sender name for the campaign.
  • Read Only
  • [ Type AnsiString ]
HasHtmlCount Number of messages containing HTML in this campaign.
  • Read Only
  • [ Type Int64 ]
HasTxtCount Number of messages containing TXT in this campaign.
  • Read Only
  • [ Type Int64 ]
ID Unique numerical ID for this object.
  • Read Only
  • [ Type Int64 ]
IsDeleted Has the campaign been deleted by the user.
  • [ Type Boolean ]
IsStarred Is this campaign marked as starred?.
  • [ Type Boolean ]
ListID
OR
ListALT
ListID
ID reference to ContactsList
ListALT
Value of the Address field of the related ContactsList resource
  • Read Only
  • [ Type TContactsList ]
NewsLetterID Newletter ID for which the campaign was created.
  • Read Only
  • [ Type Int64 ]
OpenTracked Number of messages for which open tracking is requested.
  • Read Only
  • [ Type Int64 ]
SegmentationID
OR
SegmentationALT
SegmentationID
ID reference to ContactFilter
SegmentationALT
Value of the Name field of the related ContactFilter resource
  • Read Only
  • [ Type TContactFilter ]
SendEndAt Timestamp indicating when last message in this campaign was sent.
  • Read Only
  • [ Type TRFC3339DateTime ]
SendStartAt Timestamp indicating when first message in this campaign was sent.
  • Read Only
  • [ Type TRFC3339DateTime ]
SpamassScore Spam Assassin score for this campaign.
  • Read Only
  • [ Type Currency ]
Status Status of this campaign.
  • Read Only
  • [ Type SmallInt ]
Subject Campaign subject.
  • Read Only
  • [ Type AnsiString ]
UnsubscribeTrackedCount Number of messages for which unsubscribe tracking is requested.
  • Read Only
  • [ Type Int64 ]
Workflow
  • Read Only
  • [ Type TWorkflow ]