Delete subscriber
A single subscriber can be deleted from all lists or single, specific list, using HTTP DELETE method. It is possible to remove subscriber from all channels or a single channel.
Request data format
By email address
Request URL parameters:
Parameter | Type | Notes |
---|---|---|
apiKey | string | Your API key, required for authentication. Required. |
string | Email. Required as URL parameter. Should be URL-encoded. | |
listId | int | List identifier. Optional. If specified, subscribers will be removed from single list. If not specified, subscribers will be removed from all lists. |
channel | string | Specifies a channel that subscriber should be deleted from. Possible values: All SmsMms Optional. Default value – Email |
addToBlacklist | boolean | If set to true, in addition to deleting subscriber from list(s), he will also be put on local blacklist.* |
* If set to true:
- listId parameter is ignored (subscriber will always be deleted from all lists)
- If subscriber was deleted from Email lists, his email will be added to local email blacklist
- If subscriber was deleted from Sms lists, his phone will be added to local phone blacklist
- Blacklisting source will be set to „Api”
Example URLs to delete subscriber using email address:
https://api.esv2.com/v2/Api/Subscribers?apiKey=YOUR_API_KEY_HERE&email=johndoe@domain.com
https://api.esv2.com/v2/Api/Subscribers?apiKey=YOUR_API_KEY_HERE&email=johndoe@domain.com&listId=1
https://api.esv2.com/v2/Api/Subscribers?apiKey=YOUR_API_KEY_HERE&email=johndoe@domain.com&channel=SmsMms
Please note that subscriber’s email is a parameter, NOT a part of the path.
By subscriber ID
Request URL parameters:
Parameter | Type | Notes |
---|---|---|
apiKey | string | Your API key, required for authentication. Required. |
ID | int | Subscriber ID. Required as a part of address (not parameter). See example below. |
listId | int | List identifier. Optional. If specified, subscribers will be removed from single list. If not specified, subscribers will be removed from all lists. |
channel | string | Specifies a channel that subscriber should be deleted from. Possible values: All SmsMms Optional. Default value – All |
addToBlacklist | boolean | If set to true, in addition to deleting subscriber from list(s), he will also be put on local blacklist.* |
* If set to true:
- listId parameter is ignored (subscriber will always be deleted from all lists)
- If subscriber was deleted from Email lists, his email will be added to local email blacklist
- If subscriber was deleted from Sms lists, his phone will be added to local phone blacklist
- Blacklisting source will be set to „Api”
Example URLs to delete subscriber using Subscriber ID:
https://api.esv2.com/v2/Api/Subscribers/123?apiKey=YOUR_API_KEY_HERE
https://api.esv2.com/v2/Api/Subscribers/123?apiKey=YOUR_API_KEY_HERE&listId=1
https://api.esv2.com/v2/Api/Subscribers/123?apiKey=YOUR_API_KEY_HERE&listId=1&channel=Email
Please note that subscriber’s ID is a part of URL path, NOT a parameter!
By phone number
Request URL parameters:
Parameter | Type | Notes |
---|---|---|
apiKey | string | Your API key, required for authentication. Required. |
phone | string | Subscriber’s phone number. Required as URL parameter. Should be URL-encoded. |
listId | int | List identifier. Optional. If specified, subscribers will be removed from single list. If not specified, subscribers will be removed from all lists. |
channel | string | Specifies a channel that subscriber should be deleted from. Possible values: All SmsMms Optional. Default value – SmsMms |
addToBlacklist | boolean | If set to true, in addition to deleting subscriber from list(s), he will also be put on local blacklist.* |
* If set to true:
- listId parameter is ignored (subscriber will always be deleted from all lists)
- If subscriber was deleted from Email lists, his email will be added to local email blacklist
- If subscriber was deleted from Sms lists, his phone will be added to local phone blacklist
- Blacklisting source will be set to „Api”
Example URLs to delete subscriber using phone numbers:
https://api.esv2.com/v2/Api/Subscribers?apiKey=YOUR_API_KEY_HERE&phone=48501223344
https://api.esv2.com/v2/Api/Subscribers?apiKey=YOUR_API_KEY_HERE&phone=48501223344&listId=1
https://api.esv2.com/v2/Api/Subscribers?apiKey=YOUR_API_KEY_HERE&phone=48501223344&channel=All
Please note that subscriber’s phone is a parameter, NOT a part of the path.
By custom subscriber ID
Request URL parameters:
Parameter | Type | Notes |
---|---|---|
apiKey | string | Your API key, required for authentication. Required. |
customSubscriberId | string | Subscriber’s custom ID. Required as URL parameter. Should be URL-encoded. |
listId | int | List identifier. Optional. If specified, subscribers will be removed from single list. If not specified, subscribers will be removed from all lists. |
channel | string | Specifies a channel that subscriber should be deleted from. Possible values: All SmsMms Custom Optional. Default value – All |
addToBlacklist | boolean | If set to true, in addition to deleting subscriber from list(s), he will also be put on local blacklist.* |
* If set to true:
- listId parameter is ignored (subscriber will always be deleted from all lists)
- If subscriber was deleted from Email lists, his email will be added to local email blacklist
- If subscriber was deleted from Sms lists, his phone will be added to local phone blacklist
- Blacklisting source will be set to „Api”
Example URLs to delete subscriber using custom subscriber ID:
https://api.esv2.com/v2/Api/Subscribers?apiKey=YOUR_API_KEY_HERE&customSubscriberId=sub_123
https://api.esv2.com/v2/Api/Subscribers?apiKey=YOUR_API_KEY_HERE&customSubscriberId=sub_123&listId=1
https://api.esv2.com/v2/Api/Subscribers?apiKey=YOUR_API_KEY_HERE&customSubscriberId=sub_123&channel=Email
Please note that subscriber’s custom ID is a parameter, NOT a part of the path.
Examples
Request:
DELETE https://api.esv2.com/v2/Api/Subscribers?apiKey=test_api_key1&email=john%40yahoo.com HTTP/1.1
Accept-Encoding: gzip,deflate
User-Agent: Jakarta Commons-HttpClient/3.1
Host: api.esv2.com
OK response:
HTTP/1.1 204 No Content
Cache-Control: private
Server: Microsoft-IIS/7.5
Set-Cookie: ASP.NET_SessionId=2ahrqf45zbbxc3njap11i155; path=/; HttpOnly
X-AspNetMvc-Version: 1.0
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Wed, 07 Jul 2017 15:56:14 GMT
Error response:
HTTP/1.1 404 Not Found
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
Set-Cookie: ASP.NET_SessionId=uq4wknygxzgtyojyaxkl4myn; path=/; HttpOnly
X-AspNetMvc-Version: 1.0
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Wed, 07 Jul 2017 16:11:18 GMT
Content-Length: 264
<ApiResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ErrorMessage>
<Code>404</Code>
<Message>Subscriber with email - john@yahoo.com - not found.</Message>
</ErrorMessage>
</ApiResponse>
Request:
DELETE http://api.servicestaging.expertsender?apiKey=myapikey&id=11111&addToBlacklist=true
OK response:
Subscriber 11111 is deleted from all lists of all types, his email and phone are blacklisted
Request:
DELETE http://api.servicestaging.expertsender?apiKey=myapikey&email=foo@bar.com&addToBlacklist=true
OK response:
Subscriber foo@bar.com is deleted from all Email lists, his email is blacklisted
Request:
DELETE http://api.servicestaging.expertsender?apiKey=myapikey&email=foo@bar.com&channel=SmsMms&addToBlacklist=true
OK response:
Subscriber foo@bar.com is deleted from all Sms lists, his phone is blacklisted (because channel=SmsMms)