EmailOctopus logo

API > Campaigns > Get Campaign Report: Unsubscribed

GET https://emailoctopus.com/api/1.6/campaigns/:campaignId/reports/unsubscribed

Get information on the contacts who unsubscribed using a link in the campaign.

Parameters
data (array of structs)

Details of each unsubscribe:

contact (struct)

Details of the contact:

id (string) The identifier of the contact.
email_address (string) The email address of the contact.
fields (object) An object containing key/value pairs of field values, using the field's tag as the key.
tags (array) An array of tags associated with the contact.
status (string) The status of the contact: SUBSCRIBED, UNSUBSCRIBED or PENDING.
deleted (boolean) If the contact has since been deleted.
If `true`, all other fields apart from `id` will be NULL.
created_at (string) When the contact was created, in ISO 8601 format.
last_updated_at (string) When the contact was last updated, in ISO 8601 format.
occurred_at (string) When the unsubscribe occurred, in ISO 8601 format.
paging (struct/array)

If there is more data available, an object is returned in the following format:

next (string) A link for the immediate next page of results.

If there is no more data to page, an empty array is returned.

200 (success) returns
data (array of structs)

Details of the contacts that unsubscribed:

id (string) The identifier of the contact.
email_address (string) The email address of the contact.
fields (object) An object containing key/value pairs of field values, using the field's tag as the key.
tags (array) An array of tags associated with the contact.
status (string) The status of the contact: SUBSCRIBED, UNSUBSCRIBED or PENDING.
deleted (boolean) If the contact has since been deleted.
If `true`, all other fields apart from `id` will be NULL.
created_at (string) When the contact was created, in ISO 8601 format.
last_updated_at (string) When the contact was last updated, in ISO 8601 format.
paging (struct/array)

URLs to navigate the results:

If there is more data available, an object is returned in the following format:

next (string) A link for the immediate next page of results.

If there is no more data to page, an empty array is returned.

Non-200 (error) returns

Details of the error:

code (string) The error code.
message (string) A description of the error.
Method-specific error codes
CAMPAIGN_NOT_FOUND The campaign could not be found.
CAMPAIGN_NOT_SENT The campaign does not have a status of 'SENT'.
API-wide error codes
INVALID_PARAMETERS Parameters are missing or invalid.
API_KEY_INVALID Your API key is invalid.
UNAUTHORISED You're not authorised to perform that action.
NOT_FOUND The requested endpoint does not exist.
UNKNOWN An unknown error has occurred.
Example request
/api/1.6/campaigns/00000000-0000-0000-0000-000000000000/reports/unsubscribed?api_key=00000000-0000-0000-0000-000000000000
Example response
                        
                            {
                                "data": [
                                    {
                                        "contact": {
    "id": "00000000-0000-0000-0000-000000000000",
    
    "email_address": "john.doe@example.com",
    
    "fields": {
        "FirstName": "John",
        "LastName": "Doe",
        "Birthday": "2000-12-20"
    },
    "tags": ["vip"],
    "status": "UNSUBSCRIBED",
    "created_at": "2024-12-10T00:00:00+00:00",
    "last_updated_at": "2024-12-11T19:36:58+00:00"
}
,
                                        "occurred_at": "2024-12-10T19:36:58+00:00"
                                    },
                                    {
                                        "contact": 
{
    "id": "00000000-0000-0000-0000-000000000001",
    
    "email_address": "jane.doe@example.com",
    
    "fields": {
        "FirstName": "Jane",
        "LastName": "Doe",
        "Birthday": "2000-12-20"
    },
    "tags": ["vip"],
    "status": "UNSUBSCRIBED",
    "created_at": "2024-12-10T00:00:00+00:00"
}
,
                                        "occurred_at": "2024-12-10T19:36:58+00:00"
                                    }
                                ],
                                "paging": []
                            }
                        
                    
Code sample
copy