Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages

unsubscribe method

The method unsubscribes the contact email or phone number from one or several lists. In contrast to the exclude method, it does not exclude a contact from the lists, but marks the contact as «unsubscribed». It is impossible to restore the «active» status through API – it is only the contact who can do this by clicking on the activation link in the letter.

We recommend using the unsubscribe method in case the contact refuses to subscribe, and the exclude method in case subscription/unsubscription is managed on the initiative of the sender.

Principle of use

Syntax and URL to call the method
unsubscribe (string contact_type, string contact, string list_ids)
https://api.unisender.com/en/api/unsubscribe?format=json&api_key=KEY&contact=test@example.org&contact_type=
TYPE&list_ids=134,135
Arguments
api_key * API access key.
contact_type * The type of the contact to be unsubscribed is either «email» or «phone».Examples:

contact_type=email
contact_type=phone
contact * Email or phone number that needs be unsubscribed from campaigns.Examples:

contact=test@example.org
contact=89091234567
list_ids List codes separated by comma from which contacts are being unsubscribed. If it is not specified, contacts will be unsubscribed from all lists. Codes of the lists can be obtained by calling the getLists method. They match the codes used in the subscription form.Examples:

list_ids=662572
list_ids=112233,887789,6665576
Return value
There will be an empty object in case of success. If any errors or warnings occur, they will be returned in the standard way.
In case of an attempt to unsubscribe an address from the list in which such address is absent, the following error will be returned:

{
  "error":"Contact \"no_such@address.com\" not found",
  "code":"unspecified",
  "result":""
}