« Back to Documentation Overview

get_contacts_unsubscription_stats

Section: Contacts
Version: 1.5.0


Get contacts unsubscription stats aggregated by time period, campaign and reason.
Conditions:

  • campaigns / get_campaigns (optional) – Get statistics only for given campaigns. Uses OR logic. If those params are not given statistics are returned from all campaigns on the account. Check IDs in conditions for detailed explanation.
  • created_on (optional) – Use time operators to narrow down search results to specific contact creation date. Multiple operators are allowed and logic AND is used so date range can also be expressed.
  • grouping (optional) – Determines period of time by which stats are aggregated. Allowed values are: hourly (result keys in "YYYY-MM-DD HH" format), daily (result keys in "YYYY-MM-DD" format), monthly (result keys in "YYYY-MM" format) and yearly (result keys in "YYYY" format). Default is daily.

Warning: Graduation may not be continuous. Given time period is present in result only if it has at least one positive value in it.
Hint: Possible reasons are: unsubscribe, user, support, automation, complaint, blacklisted, api, bounce, other.


Parameters
stringAPI_KEY
object
arraycampaigns
stringCAMPAIGN_ID
stringCAMPAIGN_ID
objectget_campaigns
objectname
stringCONTAINSmy_campaign_%
objectcreated_on
stringOPERATORvalue
stringgroupingmonthly
Return Value
object2010-01-01
objectCAMPAIGN_ID
integeruser128
object2010-01-02
objectCAMPAIGN_ID
integerautomation4
integerunsubscribe2

Example Request JSON

[
    "API_KEY",
    {
        "campaigns": [
            "CAMPAIGN_ID",
            "CAMPAIGN_ID"
        ],
        "get_campaigns": {
            "name": {
                "CONTAINS": "my_campaign_%"
            }
        },
        "created_on": {
            "OPERATOR": "value"
        },
        "grouping": "monthly"
    }
]

Example Response JSON

{
    "2010-01-01": {
        "CAMPAIGN_ID": {
            "user": 128
        }
    },
    "2010-01-02": {
        "CAMPAIGN_ID": {
            "automation": 4,
            "unsubscribe": 2
        }
    }
}
API-wide Errors
API key verification failed API key verification failed
API client IP not allowed API client IP not allowed
Invalid params Attribute params must be reference to hash