unsubscribeContact

Unsubscribes an email address.

unsubscribeContact

Unsubscribes an email address.

Top ↑

Syntax

int unsubscribeContact(
    string api_key,
    int list_id,
    string email_address 
);

Parameters

api_key (string)

A key for accessing the API. See Getting Started for more information.

list_id (int)

This List to unsubscribe the email address from. Valid values are:

  • a List ID - Unsubscribe all Contacts in the List who have the specified Email address. The Contacts will also be added to the Unsubscriber List.
  • 0 - Add the Email address to the Unsubscriber List (does not unsubscribe any Contacts).
email_address (string)

The email address to unsubscribe.

Return Value

Returns the List ID on success.

Examples

The example code unsubscribes all Contacts with the Email bob@example.com from the List 1234567.

$list_id = 1234567;     // can be obtained using searchLists()
$email_address = 'bob@example.com';

$api = new Api($url, 'YOURAPIKEY');
$api->invokeMethod('unsubscribeContact', $list_id, $email_address);
{
    "id": 1,
    "method": "unsubscribeContact",
    "params": [
        "YOURAPIKEY",
        1234567,
        "bob@example.com"
    ]
}
{
    "id": 1,
    "result": 1234567,
    "error": null
}

Remarks

By default, a Contact which has been added to the Unsubscriber List is not reuploaded.

The method will trigger associated Unsubscribe Campaign Events or Autoresponders for each contact successfully unsubscribed.

Use unsubscribeContactById to unsubscribe a specific Contact.

Error Codes

This method may return the following error code in addition to the standard error codes:

Code Error Description
303 Unable to Load List list_id is not a valid List

See Also