REST API: GET unsubscribes (Publisher mailing)

Each emailing is tracked, which allows Copernica to provide you with emailing statistics. Unsubscribes are one of these statistics. You can retrieve the unsubscribes for an emailing by sending an HTTP GET call to the following URL:$id/unsubscribes?access_token=xxxx

Where the $id should be replaced with the ID of the emailing. This method also support the use of the fields parameter for the timestamp field.

Returned fields

The method returns a JSON object with several unsubscribes in the 'data' field. For each unsubscribe the following information is available:

  • ID: The ID of the unsubscribe.
  • timestamp: The timestamp of the unsubscribe.
  • source: The source of the unsubscribe: Either from a link or an email.
  • success: Whether the unsubscribe was successful or not.
  • emailing: The ID of the emailing.
  • destination: The ID of the destination.
  • profile: The ID of the profile.
  • subprofile: The ID of the subprofile (if applicable).

JSON example

A single unsubscribe might look something like this:

   "timestamp":"2011-11-09 12:42:35",

PHP example

This script demonstrates how to use this API method:

// dependencies

// change this into your access token
$api = new CopernicaRestAPI("your-access-token", 3);

// set the period
$parameters = array(
    'fields'    =>  array('timestamp>2019-01-01', 'timestamp<2019-02-01')

// execute the call
print_r($api->get("publisher/emailing/{$emailingID}/unsubscribes/", $parameters));

This example requires the REST API class.

More information