Back

Campaign Monitor API Essential Guide

Aug 13, 20246 minute read

What type of API does Campaign Monitor provide?

Campaign Monitor uses a REST API.

Key points:

  1. The Campaign Monitor API documentation refers to REST-style concepts like HTTP verbs (GET, POST, PUT, DELETE) and resource-based URLs.

  2. The authentication methods described (OAuth and API key) are typical for REST APIs.

  3. The API endpoints are structured in a RESTful manner, with resources like clients, campaigns, lists, etc.

  4. The documentation describes JSON as the primary data format for requests and responses, which is common for REST APIs.

Best practices:

  1. Use the provided API wrappers when available to simplify authentication and request handling.

  2. Authenticate using OAuth when possible, as it's preferred over API key authentication.

  3. Be aware of rate limiting to avoid exceeding usage limits.

  4. Utilize the API documentation to understand the available endpoints and their functionality.

Does the Campaign Monitor API have webhooks?

Yes, the official Campaign Monitor API does have webhooks. Here are the key points about Campaign Monitor's webhook support:

Webhook Availability

  • Campaign Monitor supports webhooks for events related to subscriber lists.

Supported Events

You can subscribe to the following types of events via webhooks:

  1. List Subscribe - Triggered when someone subscribes to one of your lists.

  2. List Unsubscribe - Triggered when someone unsubscribes from your list.

  3. Email Address Update - Triggered when a subscriber's email address is updated.

  4. Deactivate - Triggered when a subscriber is deactivated.

  5. Reactivate - Triggered when a subscriber is reactivated.

Webhook Management

  • You can manage subscriber list webhooks using the Campaign Monitor Lists API.
  • The API allows you to:
    • Create webhooks
    • Test webhooks
    • Activate webhooks
    • Deactivate webhooks
    • Delete webhooks
    • Get all webhooks created for a list

Webhook Data Format

  • The payload format for webhooks can be specified as either JSON or XML when creating the webhook.

Event Batching

  • Campaign Monitor batches events together when possible to minimize the number of HTTP POST requests made to your webhook URLs.

Best Practices

  1. Use tools like ngrok or RequestBin for testing and debugging webhooks locally.

  2. Implement proper error handling and retry logic for webhook processing.

  3. Verify the authenticity of incoming webhook requests to ensure they are from Campaign Monitor.

  4. Consider using the events.list.ids parameter to specify which lists you want to monitor for events when setting up webhooks.

In summary, Campaign Monitor's API offers robust webhook support for various subscriber-related events, allowing you to keep your systems in sync with changes to your subscriber lists in real-time.

Rate Limits and other limitations

Based on the search results provided, here are the key points regarding the API Rate Limits of the Campaign Monitor API:

Rate Limiting

Campaign Monitor implements rate limiting for their API. Here are the important details:

  1. All /transactional endpoints are subject to API rate limiting [1].

  2. The rate limit status is included in the HTTP headers of every response [1].

  3. The following headers are used to communicate rate limit information [1]:

    • X-RateLimit-Limit: The maximum number of requests you can make before the rate limit is reset.
    • X-RateLimit-Remaining: The number of requests remaining in the current rate limit window.
    • X-RateLimit-Reset: The number of seconds before the rate limit is reset.
  4. When the rate limit is exceeded, you will receive a 429 Forbidden response [1]. For example:

HTTP/1.1 429 Forbidden
Date: Tue, 20 Jan 2014 14:50:41 GMT
Status: 429 Forbidden
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 348
{
    "Code": 429,
    "Message": "Rate limit exceeded"
}

Additional Considerations

While not directly related to rate limits, there are some other restrictions to be aware of:

  1. For campaign previews, you can only send to fifteen (15) addresses at once [3].

  2. There's a limit of sending to 240 addresses every 1440 minutes (24 hours) for client test campaigns [3].

  3. Each customer can send a limited number of test campaigns (of less than 6 recipients) and campaign previews [3].

Best Practices

  1. Monitor the rate limit headers in your API responses to ensure you're not exceeding the limits.

  2. Implement appropriate backoff and retry mechanisms in your code to handle rate limit errors gracefully.

  3. If you're building an application that will be used by multiple third parties, consider using OAuth authentication instead of API keys [1].

  4. Be aware of the specific limits for different types of operations (e.g., preview recipients, test campaigns) to avoid hitting these restrictions unexpectedly.

It's important to note that the exact rate limits (e.g., number of requests per time period) are not explicitly stated in the provided search results. If you need more specific information about the rate limits, you may need to contact Campaign Monitor support or check their most up-to-date documentation.

Latest API Version

The most recent version of the Campaign Monitor API is version 3.3 [1].

Key points to consider:

  • Campaign Monitor recently updated their API from version 3.2 to 3.3 [1].
  • The previous version (3.2) is no longer the most up-to-date API version [4].
  • Campaign Monitor has deprecated support for legacy TLS connections v1.0 & v1.1. TLS v1.2 is their current supported protocol [1].

Best practices:

  • When using the Campaign Monitor API, it's recommended to use the latest version (3.3) to ensure access to the most recent features and improvements.
  • Ensure that your application is using TLS v1.2 for secure connections when interacting with the API [1].
  • If you're still using version 3.2, consider updating your integration to use version 3.3 to stay current with the latest changes and improvements.

Additional information:

  • The Campaign Monitor API supports two methods of authentication: OAuth and API key [3].
  • OAuth is the preferred method for authentication over using an API key with Basic Authentication [3].
  • To use the API, you'll need to either register an OAuth application or obtain an API key from your Campaign Monitor account settings [3].

When working with the Campaign Monitor API, always refer to the most recent documentation to ensure you're using the latest features and following the most up-to-date best practices.

Citations: [1] https://www.campaignmonitor.com/api/#:~:text=Please%20note%3A%20We%20recently%20updated,version%20from%203.2%20to%203.3. [2] https://www.campaignmonitor.com/api/campaigns/ [3] https://www.campaignmonitor.com/api/getting-started/ [4] https://www.campaignmonitor.com/api/v3-2/

How to get a Campaign Monitor developer account and API Keys?

1. Sign up for a Campaign Monitor account

If you don't already have one, sign up for a Campaign Monitor account at campaignmonitor.com.

2. Get your API key

Once logged in to your Campaign Monitor account:

  1. Go to the Account Settings page
  2. Look for the API key section
  3. Copy your API key, which you'll use to authenticate API requests

3. Choose an authentication method

Campaign Monitor supports two authentication methods:

  1. OAuth 2.0 (recommended for multi-user applications)
  2. API key authentication (simpler for personal use or testing)

For OAuth:

  • Register an OAuth application in your Campaign Monitor account
  • You'll receive a Client ID and Client Secret to use in the OAuth flow

For API key:

  • Use your API key as the username in Basic Authentication
  • Leave the password blank or use a dummy value

4. Familiarize yourself with the API documentation

Review the Campaign Monitor API documentation at campaignmonitor.com/api to understand:

  • Available endpoints and methods
  • Request/response formats
  • Rate limits
  • Best practices

5. Choose a development approach

You can:

  1. Use one of Campaign Monitor's official API wrappers for various programming languages
  2. Make direct HTTP requests to the API endpoints
  3. Use the API to create custom integrations with your website or application

6. Test API calls

Start by making simple API calls, such as retrieving your client list:

curl -u "YOUR_API_KEY:x" https://api.createsend.com/api/v3.3/clients.json

What can you do with the Campaign Monitor API?

Based on the search results provided, here is a list of data models you can interact with using the Campaign Monitor API, along with what is possible for each:

Accounts

  • Get client details
  • Get billing details
  • Get valid countries and timezones
  • Add, update, and delete administrators
  • Set and get primary contact
  • Create embedded sessions

Campaigns

  • Create draft campaigns
  • Create campaigns from templates
  • Send draft campaigns and previews
  • Get email client usage statistics
  • Manage campaign lists and segments
  • Access recipient data (opens, clicks, bounces, unsubscribes, spam complaints)
  • Delete and unschedule campaigns
  • Get campaign summaries

Clients

  • Create and delete clients
  • Get client details
  • Manage subscriber lists and segments
  • Handle suppression lists
  • Manage templates
  • Set billing details
  • Transfer credits
  • Manage people (add, update, delete)
  • Get sent, scheduled, and draft campaigns
  • Manage sending domains

Journeys

  • Get journey details and summaries
  • Access journey email statistics (recipients, opens, clicks, bounces, unsubscribes)
  • Copy journeys
  • Get subscriber activity for journeys

Lists

  • Create and delete lists
  • Get list details and statistics
  • Manage custom fields
  • Handle list segments
  • Manage list webhooks
  • Access subscriber data (active, unconfirmed, unsubscribed, bounced, deleted)

Segments

  • Create, update, and delete segments
  • Manage segment rules
  • Get active subscribers for segments

Subscribers

  • Add and update subscribers
  • Import multiple subscribers
  • Get subscriber history and details
  • Unsubscribe and delete subscribers

Templates

  • Get, create, update, and delete templates
  • Copy templates

Transactional

  • Manage smart emails (listing, details, sending)
  • Send classic emails
  • Access statistics and message timelines
  • Resend messages

Webhooks

  • Set up and manage webhooks for various events

This list covers the main data models and operations available through the Campaign Monitor API. Each model offers a range of functionalities for managing and interacting with different aspects of email marketing campaigns and subscriber data.