Campaigner API Integration Document

Written By hbhairagani (Administrator)

Updated at May 8th, 2025

Introduction

The Campaigner API is HTTP-based, making it easy to interact with using standard web technologies. You can use it to retrieve, create, update, and delete data related to your Campaigner account.

HTTP Methods

Each action requires the correct HTTP method:

Action

Method

Retrieve data

GET

Create data

POST

Update data

PUT

Delete data

DELETE

Note: Using the wrong HTTP method will result in an error.

HTTP Code

Meaning

200 - OK

The call was successful

201 - Created

A new resource was created

400 - Bad Request

Invalid request. Check the response body for an ErrorCode and message

401 - Unauthorized

API Key is missing or incorrect

404 - Not found

Resource could not be found

500 - Server Error

An error occurred on Campaigner’s end

The API is a RESTful resource

The Campaigner API is designed as a RESTful resource, following standard REST principles to make it easy and consistent to use. It supports different data formats, and you can choose the format by setting the Accept and Content-Type headers in your request.

The default format is JSON, so if you don’t include an Accept header, the response will automatically be returned in JSON.

When sending data in JSON format, use the header Content-Type: application/json or Content-Type: text/json.

When you want to receive data in JSON format, use the header Accept: application/json or Accept: text/json.

All dates returned by the API use the ISO 8601 format, which looks like this: 2008-04-12T12:53:00Z.

Authentication

A valid API Key is required for every request. There are three different ways to pass the API Key, use whichever method best fits your environment. While the rest of the documentation uses option 1, all methods work the same.

Option 1: Pass the API Key in the HTTP Header

Sample Request:

GET https://edapi.campaigner.com/v1/Subscribers/jason@example.net HTTP/1.1
ApiKey: 67c27802-f234-4196-b44c-460245d4978e

Option 2: Pass the API Key in the Query String

Sample Request:

GET https://edapi.campaigner.com/v1/Subscribers/jason@example.net?ApiKey=67c27802-f234-4196-b44c-460245d4978e HTTP/1.1

Option 3: Use Basic Authentication

In this method, the username can be any placeholder value, and the password must be your API Key. For example, with the username hope and the API Key 67c27802-f234-4196-b44c-460245d4978e, you would Base64-encode the string:

hope:67c27802-f234-4196-b44c-460245d4978e

The Base64-encoded result would be:

aG9wZTo2N2MyNzgwMi1mMjM0LTQxOTYtYjQ0Yy00NjAyNDVkNDk3OGU=

Basic Authentication Sample Request:

GET https://edapi.campaigner.com/v1/Subscribers/jason@example.net HTTP/1.1
Authorization: Basic aG9wZTo2N2MyNzgwMi1mMjM0LTQxOTYtYjQ0Yy00NjAyNDVkNDk3OGU=

Steps to View a User's API Keys

In the user utilities, click the Profile icon.

Click Manage Users.

In the Users tab, click the username of the SMTP or API user.

Click the API Keys tab. (This tab is visible only if at least one API key has been created for the user.)

Campaigner API Integration with Annex Cloud

API Documentation Link: https://media.campaigner.com/apidocs/edapi/#overview

Library Path: api/campaigner/campaigner.php

1. Add or Update Multiple Subscribers

To add or update multiple subscribers in Campaigner, follow the steps below:

Include the Required Class File

Make sure to include the campaigner.php class file in your project.

require_once 'api/campaigner/campaigner.php';

Create an Object of the Class

Create an object of the class file for the function call as shown below:

$obj = new CampaignerClass();

Set the required parameters:

$obj->apiKey = "4440919b-251a-457c-911d-b43cb81adc1d";    
$obj->apiUrl = "https://edapi.campaigner.com/v1/";
$obj->listId = "4558932";

Function to Use

Method: POST
Function Name: AddOrUpdateMultipleSubscribers
Function Call:

$response = $obj->AddOrUpdateMultipleSubscribers($data);

Sample Request Payload

{
  "data": [
    {
      "EmailAddress": "contact11@example.net",
      "FirstName": "test",
      "LastName": "one",
      "available_point": "20",
      "Age": "30"
    },
    {
      "EmailAddress": "contact12@example.net",
      "FirstName": "test",
      "LastName": "two",
      "available_point": "55",
      "Age": "32"
    },
    {
      "EmailAddress": "contact13@example.net",
      "FirstName": "test",
      "LastName": "three",
      "available_point": "200",
      "Age": "34"
    },
    {
      "EmailAddress": "contact14@example.net",
      "FirstName": "test",
      "LastName": "four",
      "available_point": "300",
      "Age": "20"
    },
    {
      "EmailAddress": "contact15@example.net",
      "FirstName": "test",
      "LastName": "five",
      "available_point": "30",
      "Age": "27"
    }
  ]
}

Sample Response

{
  "success": true,
  "status": 200,
  "message": "Created new subscribers successfully",
  "data": {
    "ContactsSubmitted": 5,
    "Successes": 5,
    "Failures": [],
    "listDetails": {
      "ContactsSubmitted": 5,
      "Successes": 5,
      "Failures": [],
      "listName": "SampleTest"
    }
  }
}

2. Add or Update a Single Subscriber

To add or update a single subscriber in Campaigner, follow the steps below:

Create an Object of the Class

Create an object of the class file for the function call as shown below:

$obj = new CampaignerClass();
$obj->apiKey = "4440919b-251a-457c-911d-b43cb81adc1d";    
$obj->apiUrl = "https://edapi.campaigner.com/v1/";
$obj->listId = "4558932";

Function to Use

Function Name: addOrUpdateContacts

HTTP Method: POST

Function Call:

$response = $obj->addOrUpdateContacts($data);

Sample Request Payload

{
  "EmailAddress": "testQa003@annexcloud.com",
  "CustomFields": [
    {
      "FieldName": "FirstName",
      "Value": "annex"
    },
    {
      "FieldName": "LastName",
      "Value": "test"
    },
    {
      "FieldName": "PhoneNo",
      "Value": "9890351758"
    },
    {
      "FieldName": "available_point",
      "Value": "500"
    },
    {
      "FieldName": "used_points",
      "Value": "100"
    }
  ]
}

Sample Response

{
  "success": true,
  "status": 200,
  "message": "Created new subscriber successfully",
  "data": {
    "CustomFields": null,
    "EmailID": 255441714,
    "EmailAddress": "testQa003@annexcloud.com",
    "Created": "2025-01-29T14:55:33.503",
    "Status": "Active",
    "Links": [],
    "listDetails": {
      "ContactsSubmitted": 1,
      "Successes": 0,
      "Failures": [],
      "listName": "SampleTest"
    }
  }
}

3. Add Subscribers to a List

To add subscribers to a specific list in Campaigner, follow the steps below:

Create an Object of the Class

Create an object of the class file for the function call as shown below:

$obj = new CampaignerClass();
$obj->apiKey = "4440919b-251a-457c-911d-b43cb81adc1d";    
$obj->apiUrl = "https://edapi.campaigner.com/v1/";
$obj->listId = "4558932";

Function to Use

Function Name: addSubscribersToList

HTTP Method: POST

Function Call:

$response = $obj->addSubscribersToList($data);

Sample Request Payload

{
  "EmailAddresses": [
    "annextest@annexcloud.com",
    "vpotdar@annexcloud.com"
  ]
}

Sample Response

{
  "success": true,
  "status": 200,
  "message": "Added subscribers to the list successfully",
  "data": {
    "ContactsSubmitted": 2,
    "Successes": 0,
    "Failures": [],
    "listName": "SampleTest"
  }
}

 

4. Get All Lists

To retrieve all contact lists in Campaigner, follow the steps below:

Create an Object of the Class

Create an object of the class file for the function call as shown below:

$obj = new CampaignerClass();
$obj->apiKey = "4440919b-251a-457c-911d-b43cb81adc1d";    
$obj->apiUrl = "https://edapi.campaigner.com/v1/";

Function to Use

Function Name: getAllList

HTTP Method: GET

Function Call:

$response = $obj->getAllList();

Request Body: Not required

Sample Response

{
  "success": true,
  "status": 200,
  "message": "Retrieved lists successfully",
  "data": [
    {
      "ListID": 4507137,
      "Name": "AnnexTestList",
      "Description": "Created list for testing.",
      "ActiveMembers": 0,
      "IsActive": true,
      "Links": []
    },
    {
      "ListID": 4558932,
      "Name": "SampleTest",
      "Description": "Created sample list for testing.",
      "ActiveMembers": 0,
      "IsActive": true,
      "Links": []
    }
  ]
}

5. Get All Fields

To retrieve all standard and custom fields (columns) available in your Campaigner account, follow the steps below:

Create an Object of the Class

Create an object of the class file for the function call as shown below:

$obj = new CampaignerClass();

$obj->apiKey = "4440919b-251a-457c-911d-b43cb81adc1d";    
$obj->apiUrl = "https://edapi.campaigner.com/v1/";

Function to Use

Function Name: getAllFields

HTTP Method: GET

Function Call:

$response = $obj->getAllFields();

Request Body: Not required

Sample Response

{
  "success": true,
  "status": 200,
  "message": "Retrieved all fields successfully",
  "data": {
    "DatabaseColumns": [
      {
        "ColumnName": "Email",
        "ColumnType": "Text",
        "ColumnSize": 100,
        "IsCustom": false,
        "Variable": "[Contact.Email]",
        "Links": []
      },
      {
        "ColumnName": "DateStamp",
        "ColumnType": "Date",
        "ColumnSize": 0,
        "IsCustom": false,
        "Variable": null,
        "Links": []
      },
      {
        "ColumnName": "EmailID",
        "ColumnType": "Int",
        "ColumnSize": 0,
        "IsCustom": false,
        "Variable": "[Contact.Id]",
        "Links": []
      },
      {
        "ColumnName": "CreateDate",
        "ColumnType": "Date",
        "ColumnSize": 0,
        "IsCustom": false,
        "Variable": null,
        "Links": []
      },
      {
        "ColumnName": "IPAddress",
        "ColumnType": "Text",
        "ColumnSize": 32,
        "IsCustom": false,
        "Variable": null,
        "Links": []
      },
      {
        "ColumnName": "available_point",
        "ColumnType": "Int",
        "ColumnSize": 0,
        "IsCustom": true,
        "Variable": "[Contact.available_point]",
        "Links": []
      },
      {
        "ColumnName": "current_tier",
        "ColumnType": "Text",
        "ColumnSize": 500,
        "IsCustom": true,
        "Variable": "[Contact.current_tier]",
        "Links": []
      },
      {
        "ColumnName": "earned_points",
        "ColumnType": "Text",
        "ColumnSize": 500,
        "IsCustom": true,
        "Variable": "[Contact.earned_points]",
        "Links": []
      },
      {
        "ColumnName": "Fax",
        "ColumnType": "Text",
        "ColumnSize": 100,
        "IsCustom": false,
        "Variable": "[Contact.Fax]",
        "Links": []
      },
      {
        "ColumnName": "FirstName",
        "ColumnType": "Text",
        "ColumnSize": 100,
        "IsCustom": true,
        "Variable": "[Contact.First Name]",
        "Links": []
      },
      {
        "ColumnName": "first_loyalty_activity_date",
        "ColumnType": "Date",
        "ColumnSize": 0,
        "IsCustom": true,
        "Variable": "[Contact.first_loyalty_activity_date]",
        "Links": []
      },
      {
        "ColumnName": "first_purchase_date",
        "ColumnType": "Date",
        "ColumnSize": 0,
        "IsCustom": true,
        "Variable": "[Contact.first_purchase_date]",
        "Links": []
      },
      {
        "ColumnName": "hold_points",
        "ColumnType": "Text",
        "ColumnSize": 500,
        "IsCustom": true,
        "Variable": "[Contact.hold_points]",
        "Links": []
      },
      {
        "ColumnName": "LastName",
        "ColumnType": "Text",
        "ColumnSize": 100,
        "IsCustom": true,
        "Variable": "[Contact.Last Name]",
        "Links": []
      },
      {
        "ColumnName": "last_loyalty_activity_date",
        "ColumnType": "Date",
        "ColumnSize": 0,
        "IsCustom": true,
        "Variable": "[Contact.last_loyalty_activity_date]",
        "Links": []
      },
      {
        "ColumnName": "last_purchase_date",
        "ColumnType": "Date",
        "ColumnSize": 0,
        "IsCustom": true,
        "Variable": "[Contact.last_purchase_date]",
        "Links": []
      },
      {
        "ColumnName": "next_expiring_points",
        "ColumnType": "Text",
        "ColumnSize": 500,
        "IsCustom": true,
        "Variable": "[Contact.next_expiring_points]",
        "Links": []
      },
      {
        "ColumnName": "opt_in_date",
        "ColumnType": "Date",
        "ColumnSize": 0,
        "IsCustom": true,
        "Variable": "[Contact.opt_in_date]",
        "Links": []
      },
      {
        "ColumnName": "opt_in_status",
        "ColumnType": "Text",
        "ColumnSize": 500,
        "IsCustom": true,
        "Variable": "[Contact.opt_in_status]",
        "Links": []
      },
      {
        "ColumnName": "Owner Email",
        "ColumnType": "Text",
        "ColumnSize": 500,
        "IsCustom": true,
        "Variable": "[Contact.Owner Email]",
        "Links": []
      },
      {
        "ColumnName": "Owner First Name",
        "ColumnType": "Text",
        "ColumnSize": 500,
        "IsCustom": true,
        "Variable": "[Contact.Owner First Name]",
        "Links": []
      },
      {
        "ColumnName": "Owner Last Name",
        "ColumnType": "Text",
        "ColumnSize": 500,
        "IsCustom": true,
        "Variable": "[Contact.Owner Last Name]",
        "Links": []
      },
      {
        "ColumnName": "Phone",
        "ColumnType": "Text",
        "ColumnSize": 100,
        "IsCustom": false,
        "Variable": "[Contact.Phone]",
        "Links": []
      },
      {
        "ColumnName": "PhoneNo",
        "ColumnType": "Int",
        "ColumnSize": 0,
        "IsCustom": true,
        "Variable": "[Contact.PhoneNo]",
        "Links": []
      },
      {
        "ColumnName": "used_points",
        "ColumnType": "Text",
        "ColumnSize": 500,
        "IsCustom": true,
        "Variable": "[Contact.used_points]",
        "Links": []
      }
    ]
  }
}

Error Codes

  • 200 OK: The call was successful.
  • 201 Created: The resource was successfully created.
  • 400 Bad Request: The request was invalid. Check the message body for details, including an ErrorCode and Message.
  • 401 Unauthorized: The API key was missing or invalid.
  • 404 Not Found: The resource you are trying to GET, UPDATE, or DELETE was not found. Check the message body for details.
  • 500 Internal Server Error: An unhandled exception occurred on the server.