« Back to Documentation Overview

get_contacts_deleted

Section: Contacts
Version: 1.5.0


Get deleted contacts.

Conditions:

  • campaigns / get_campaigns (optional) – Search only in given campaigns. Uses OR logic. If those params are not given search is performed in all campaigns on the account. Check IDs in conditions for detailed explanation.
  • messages / get_messages (optional) – Search only contacts removed from given messages, this info is known for example if contact clicked unsubscribe link. Uses OR logic. CCheck IDs in conditions for detailed explanation.
  • email (optional) – Use text operators to narrow down search results to specific contact emails.
  • reason (optional) – Narrow down search results only to contacts removed due to specific reason, allowed values are: unsubscribe, user, support, automation (or more specific automation::remove-on-remove, automation::remove-on-sale, automation::remove-on-subscribe), complaint, blacklisted, api, bounce (or more specific bounce::mailbox_full, bounce::other_hard, bounce::other_soft, bounce::user_unknown, bounce::user_recycled), other.
  • 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.
  • deleted_on (optional) – Use time operators to narrow down search results to specific contact deletion date. Multiple operators are allowed and logic AND is used so date range can also be expressed.
Warning: If a contact was added and removed multiple times from the same campaign it is presented only once in results with newest deleted_on date.

Warning: Reasons in result are always general even if you requested specific one.

Warning: Unsubscribe link allows contact to unsubscribe from multiple campaigns, even if message was not sent from those campaigns or to contact in those campaigns.

Warning: Value of CONTACT_ID does not change after contact is deleted but you can no longer use it in other API calls, Missing contact error will be returned.

Hint: If you want to keep unsubscribes synchronized with external database, then setting unsubscribe callback is much more efficient than querying this method periodically.


Parameters
stringAPI_KEY
object
arraycampaigns
stringCAMPAIGN_ID
stringCAMPAIGN_ID
objectget_campaigns
objectname
stringCONTAINSmy_campaign_%
arraymessages
stringMESSAGE_ID
stringMESSAGE_ID
objectget_messages
objectname
stringCONTAINSmy_message_%
objectemail
stringOPERATORvalue
stringreasonvalue
objectcreated_on
stringOPERATORvalue
objectdeleted_on
stringOPERATORvalue
Return Value
objectCONTACT_ID
stringcampaignCAMPAIGN_ID
stringmessageMESSAGE_ID
stringnameMy Contact Name
stringemailmy_contact_2@emailaddress.com
stringoriginapi
stringip1.1.1.1
stringcycle_dayget_contacts_deleted_cycle_day__string
stringreasonother
stringcreated_on2010-01-01 00:00:00
stringdeleted_on2010-01-01 00:00:00

Example Request JSON

[
    "API_KEY",
    {
        "campaigns": [
            "CAMPAIGN_ID",
            "CAMPAIGN_ID"
        ],
        "get_campaigns": {
            "name": {
                "CONTAINS": "my_campaign_%"
            }
        },
        "messages": [
            "MESSAGE_ID",
            "MESSAGE_ID"
        ],
        "get_messages": {
            "name": {
                "CONTAINS": "my_message_%"
            }
        },
        "email": {
            "OPERATOR": "value"
        },
        "reason": "value",
        "created_on": {
            "OPERATOR": "value"
        },
        "deleted_on": {
            "OPERATOR": "value"
        }
    }
]

Example Response JSON

{
    "CONTACT_ID": {
        "campaign": "CAMPAIGN_ID",
        "message": "MESSAGE_ID",
        "name": "My Contact Name",
        "email": "my_contact_2@emailaddress.com",
        "origin": "api",
        "ip": "1.1.1.1",
        "cycle_day": null,
        "reason": "other",
        "created_on": "2010-01-01 00:00:00",
        "deleted_on": "2010-01-01 00:00:00"
    }
}
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