Create a free account

API Documentation

Campaign Monitor

Campaign.Create

Creates a campaign for an existing client. This campaign will be imported and ready to send to the subscribers in the specified lists and segments.

The campaign must have both HTML and plain text content, imported from the internet. Styling for the HTML content will be automatically brought inline.

Samples

While we don't have any samples for this particular method, we do have a number of samples in .NET, PHP, Classic ASP, Flash, Perl and Cold Fusion that can be easily adapted to use this method.

Parameters and required information

Here's a list of all the parameters you'll need to pass to the Campaign.Create method. All of the parameters are required unless otherwise noted.

ApiKey
Your API application key. See here for more details.
ClientID
The ID of the client the campaign should be created for. See Here for more details.
Campaign Name
The name of the new campaign. This must be unique across all draft campaign for the client
Campaign Subject
The subject of the new campaign
From Name
The name to appear in the From field in the recipients email client when they receive the new campaign
From Email Address
The email address that the new campaign will come from
Reply To Email Address
The email address that any replies to the new campaign will be sent to
HTML Content URL
The URL of the HTML content for the new campaign. If no unsubscribe link is found then one will be added automatically. Styling in the campaign will be automatically brought inline
Text Content URL
The URL of the Text content for the new campaign. If no unsubscribe link is found then one will be added automatically.
Subscriber Lists
An array of lists to send the campaign to. See here for more details.
Subscriber List Segments
An array of Segment Names and their appropriate List ID's to send the campaign to.

Return Codes

Success

Upon a successful call, this method will return a Result object with the newly create Campaign's ID as the Code.

Error

100: Invalid API Key
The API key passed was not valid or has expired.
102: Invalid ClientID
The ClientID value passed in was not valid.
303: Duplicate Campaign Name
The campaign name passed in already exists for this client.
304: Campaign Subject Required
A campaign subject must be provided.
305: From Name Required
The From name field is required and must be provided.
306: Invalid From Name
The From Name must not contain an '&'.
307: Invalid From Email Address
The From Email Address must be a valid email address.
308: Reply to Address Required
The Reply-To Address is a required field and must be provided.
309: Invalid Reply-To Address
The Reply-To Address must be a valid email address.
310: HTML Content URL Required
You must provide a URL of the HTML content for your campaign.
311: Invalid HTML Content
Your content contains JavaScript or Flash which cannot be sent to email clients.
312: Text Content URL Required
You must provide a URL of the Text content for your campaign.
313: Invalid ListID's
The List ID's you supplied are invalid.
314: Invalid Segments
The Segments you supplied are invalid.
315: Lists or Segments Required
You must provide either List ID's or Segments to send to.

SOAP 1.1

The following is a sample SOAP request and response. The placeholders shown need to be replaced with actual values.

POST /api/api.asmx HTTP/1.1
Host: intern.devcampmon.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://app.campaignmonitor.com/api/Campaign.Create"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
 xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Campaign.Create xmlns="http://app.campaignmonitor.com/api/">
      <ApiKey>string</ApiKey>
      <ClientID>int</ClientID>
      <CampaignName>string</CampaignName>
      <CampaignSubject>string</CampaignSubject>
      <FromName>string</FromName>
      <FromEmail>string</FromEmail>
      <ReplyTo>string</ReplyTo>
      <HtmlUrl>string</HtmlUrl>
      <TextUrl>string</TextUrl>
      <SubscriberListIDs>
        <int>int</int>
        <int>int</int>
      </SubscriberListIDs>
      <ListSegments>
        <List>
          <ListID>int</ListID>
          <Name>string</Name>
        </List>
        <List>
          <ListID>int</ListID>
          <Name>string</Name>
        </List>
      </ListSegments>
    </Campaign.Create>
  </soap:Body>
</soap:Envelope>

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
 xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Campaign.CreateResponse xmlns="http://app.campaignmonitor.com/api/">
      <Campaign.CreateResult>
        <Code>int</Code>
        <Message>string</Message>
      </Campaign.CreateResult>
    </Campaign.CreateResponse>
  </soap:Body>
</soap:Envelope>