Our v3 API is now available! Learn more by visiting the v3 developer portal.

Email Campaign Collections

Use this end point to retrieve (GET) the collection of existing email campaigns, or to create (POST) a new email campaign.

Methods:

Click a method to view its documentation

GET POST

DescriptionTOP

Privileges required: campaign:create

When creating a new email campaign, template_type is automatically set to CUSTOM; There are several campaign properties that are optional by default, but become REQUIRED once another property is used. See Structure table below for specific properties.

POST: https://api.constantcontact.com/v2/emailmarketing/campaigns

Test API

name

type

default

description

api_key

query

REQUIRED; The API key for the application

Example JSON Request BodyTOP

{
    "name": "Test Campaign 1351175725",
    "subject": "Subject Test",
    "from_name": "My Organization",
    "from_email": "from-email@example.com",
    "reply_to_email": "replyto-email@example.com",
    "is_permission_reminder_enabled": true,
    "permission_reminder_text": "As a reminder, you're receiving this email because you have expressed an interest in MyCompany. Don't forget to add from_email@example.com to your address book so we'll be sure to land in your inbox! You may unsubscribe if you no longer wish to receive our emails.",
    "is_view_as_webpage_enabled": true,
    "view_as_web_page_text": "View this message as a web page",
    "view_as_web_page_link_text": "Click here",
    "greeting_salutations": "Hello",
    "greeting_name": "FIRST_NAME",
    "greeting_string": "Dear ",
    "email_content": "<html><body><p>This is text of the email message.</p></body></html>",
    "text_content": "This is the text-only content of the email message for mail clients that do not support HTML.",
    "email_content_format": "HTML",
    "style_sheet": "",
    "message_footer": {
        "organization_name": "My Organization",
        "address_line_1": "123 Maple Street",
        "address_line_2": "Suite 1",
        "address_line_3": "",
        "city": "Anytown",
        "state": "MA",
        "international_state": "",
        "postal_code": "01444",
        "country": "US",
        "include_forward_email": true,
        "forward_email_link_text": "Click here to forward this message",
        "include_subscribe_link": true,
        "subscribe_link_text": "Subscribe to Our Newsletter!"
    }
   }

Response CodesTOP

code

description

201

Email campaign was successfully created

400

Bad Request:Either JSON was malformed or there was a data validation error

401

Authentication failure

406

Unsupported accept header value, must be application/json

409

Email Campaign name already in use

415

Unsupported content-type in the header, use application/json

500

Internal server error occurred

StructureTOP

property

type(max length)

description

+ click_through_details

array

Tracking summary data for this email campaign. (Read Only)

created_date

string

Date the email campaign was last sent to contacts, in ISO-8601 format (Read Only)

email_content

string (930000)

REQUIRED. The full HTML or XHTML content of the email campaign. This field is not available (and read-only) when accessed using the API if the template_type = STOCK and TEMPLATE_V2

email_content_format

string

Specifies the email campaign message format, valid values: HTML, XHTML; if not specified, defaults to HTML. If XHTML, the text_content text needs to be wrapped with <text></text>

from_email

string (80)

REQUIRED. The email address the email campaign originated from, this must be a verified email address associated with the account.

from_name

string (100)

REQUIRED. Name displayed in the From field to indicate whom the email is from

greeting_name

string

This is the personalized content for each contact that will be used in the greeting, valid values are:

  • FIRST_NAME - contacts first name on record
  • LAST_NAME - contacts last name of record
  • FIRST_AND_LAST_NAME - use both the contacts first and last name
  • NONE; if NONE then the email message will use the greeting_string parameter.

greeting_salutations

string (50)

The salutation used in the email message(e.g. Dear)

greeting_string

string (1500)

Specifies the greeting text used if not using greeting_name and greeting_salutations, which have precedence over greeting_string)

id

string

Unique identifier for the email campaign (Read Only)

is_permission_reminder_enabled

boolean

If true, displays permission_reminder_text at top of email message reminding the recipient they are receiving the email because they have subscribed to an email list.

is_view_as_webpage_enabled

boolean

If true, displays the text and link specified in permission_reminder_text to view web page version of email message

last_run_date

string

Date the email campaign was last run, in ISO-8601 format. A scheduled campaign is run when it is in the process of being sent (Read Only)

+ message_footer

object

REQUIRED if the organization address is not set in the user's account. Defines the content of the email campaign message footer

modified_date

string

Date the email campaign was last modified, in ISO-8601 format (Read Only)

name

string (80)

REQUIRED. Name of the email campaign; each email campaign name must be unique within a user's account

next_run_date

string

Date the email campaign is next scheduled to run and be sent to contacts, in ISO-8601 format (Read Only)

permalink_url

string

System generated, non-expiring link to use for sharing a sent email campaign using social channels. Only available for email campaigns with status of SENT. If the user removes the email campaign from their campaign list, the link is taken down. Any shared links will return a 404. (Read Only)

permission_reminder_text

string (1500)

REQUIRED if is_permission_reminder_enabled = true; enter text to display in the permission reminder message; otherwise not required

reply_to_email

string (80)

REQUIRED. The reply-to email address for the email campaign, this must be a verified email address associated with the account.

+ sent_to_contact_lists

array

Unique IDs of the contact lists the email campaign message is sent to

status

string

Current status of the email campaign, valid values:

  • DRAFT: This is the default status for an email that is still being worked on. Draft emails have been saved and can be edited at any time.
  • RUNNING: The email messagSente is in the process of being sent and cannot be edited.
  • SENT: An email that has been sent has already been mailed to it's contact list. It cannot be edited.
  • SCHEDULED: A scheduled email has been set to mail on a specific date and cannot be edited unless it's returned to Draft status.
(Read Only)

style_sheet

string

Valid only if email_content_format = XHTML; see the Advanced Editor Users Guide for specific formatting constraints. Lists the stylesheet elements used to format the email campaign message

subject

string (200)

REQUIRED. The Subject Line for the email campaign

template_type

string

The template used to create the email campaign; valid values are STOCK, CUSTOM, and TEMPLATE_V2. For campaigns using the STOCK and TEMPLATE_V2 templates, the text_content and email_content fields are not available (and read-only) when the email campaign message is accessed using the API. Learn more here. (Read Only)

text_content

string (930000)

REQUIRED. The content for the text-only version of the email campaign which is viewed by recipients whose email client does not accept HTML email. If email_content_format=XHTML, the text_content needs to be wrapped with <text></text>. This field is not available (and read-only) when accessed using the API if the template_type = STOCK and TEMPLATE_V2

+ tracking_summary

object

Campaign Tracking summary data for this email campaign. (Read Only)

view_as_web_page_link_text

string (50)

REQUIRED if is_view_as_webpage_enabled = true; enter desired link text to display in the View As Web page link; otherwise not required

view_as_web_page_text

string (50)

REQUIRED if is_view_as_webpage_enabled = true; enter text to display with link at the top of email message, such as "View this message as a web page"; otherwise not required

Example ResponseTOP

{
    "id": "1113591978764",
    "name": "Test Campaign 1351175725",
    "subject": "Subject Test",
    "status": "DRAFT",
    "from_name": "My Organization",
    "from_email": "email@example.com",
    "reply_to_email": "email@example.com",
    "template_type": "CUSTOM",
    "is_permission_reminder_enabled": true,
    "permission_reminder_text": "As a reminder, you're receiving this email because you have expressed an interest in MyCompany. Don't forget to add from_email@example.com to your address book so we'll be sure to land in your inbox! You may unsubscribe if you no longer wish to receive our emails.",
    "is_view_as_webpage_enabled": true,
    "view_as_web_page_text": "View this message as a web page",
    "view_as_web_page_link_text": "Click here",
    "greeting_salutations": "Hello",
    "greeting_name": "FIRST_NAME",
    "greeting_string": "Dear",
    "email_content": "<html><body><p>This is text of the email message.</p></body></html>",
    "text_content": "This is the text-only content of the email message for mail clients that do not support HTML.",
    "email_content_format": "HTML",
    "style_sheet": "",
    "message_footer": {
        "city": "Anytown",
        "state": "MA",
        "country": "US",
        "organization_name": "My Organization",
        "address_line_1": "123 Maple Street",
        "address_line_2": "Suite 1",
        "address_line_3": "",
        "international_state": "",
        "postal_code": "01444",
        "include_forward_email": true,
        "forward_email_link_text": "Click here to forward this message",
        "include_subscribe_link": true,
        "subscribe_link_text": "Subscribe to Our Newsletter!"
    },
    "tracking_summary": {
        "sends": 0,
        "opens": 0,
        "clicks": 0,
        "forwards": 0,
        "unsubscribes": 0,
        "bounces": 0
    }
}