- 27 Nov 2023
- 2 Minutes to read
Unsubscribe Email Users from Database / v2
- Updated on 27 Nov 2023
- 2 Minutes to read
Overview
The global unsubscribe API v2 enables you to ingest email addresses under global unsubscribe or ingest email addresses under the unsubscribe group that you create in the service.
The global unsubscribe API v2 differs from the global unsubscribe API v1 because it makes a user unsubscribe from a group and its limit to send unsubscribe users is 500 in a single request.
Endpoint and Headers
Headers
Header | Sample Value | Description |
---|---|---|
X-PARTNER-NAME | mybrand | This is your partner name. Navigate to Inone > Inone Settings > Account Preferences to copy your partner name. The partner name should be lowercase. |
X-REQUEST-TOKEN | 1a2b3c4e5d6f | This key is required to authorize your request. Refer to API Authentication Tokens to generate your Global Unsubscribe token. |
Content-Type | application/json | This header specifies the media type of the resource. |
Body Parameters
For Email Global Unsubscribe
Parameter | Description | Data Type | Required |
---|---|---|---|
emails | User's email addresses | String Array | Yes |
uploader_email | Your uploader email address | String | Yes |
For Email Group Unsubscribe
Parameter | Description | Data Type | Required |
---|---|---|---|
emails | User's email addresses | Yes | |
uploader_email | Your uploader email address | String | Yes |
group_name | The Unsubscribe Group’s name | String | Yes |
is_unsubscribe_group | Whether the unsubscribe group is enabled for the request | Boolean (True/False) | Yes |
- The purpose of uploader_email is to inform the API user through email. You can track the progress under the Global Unsubscriber list or Group Unsubscribe list.
We highly recommend you to put there a valid email to correctly display the post-upload informative mail. If you place a dummy email, then you get an error saying Please enter a valid uploader email.
- Concerning the group_name parameter, there is no restriction on the names, you can add a name in lowercase, uppercase, spaces, etc. For example, if you want to add users to the my_private_group, then you should write it in lowercase; otherwise, a new group will be created.
If the group does not exist in Insider's database, it will be created.
Sample Example
Sample Request
For Email Global Unsubscribe Requests
Every request made to the request endpoint requires a request body formatted in JSON.
curl --location --request POST 'http://contact.useinsider.com/email/v2/unsubscribe' \
--header 'Content-Type: application/json' \
--header 'X-PARTNER-NAME: mybrand' \
--header 'X-REQUEST-TOKEN: a1b2c3d4e5f6' \
--data-raw '{
"emails": [
"sample1@useinsider.com",
"sample2@useinsider.com"
],
"uploader_email": "sample@useinsider.com"
}'
For Email Group Unsubscribe Requests
curl --location --request POST 'http://contact.useinsider.com/email/v2/unsubscribe' \
--header 'Content-Type: application/json' \
--header 'X-PARTNER-NAME: mybrand' \
--header 'X-REQUEST-TOKEN: a1b2c3d4e5f6' \
--data-raw '{
"emails": [
"example1@useinsider.com",
"example2@useinsider.com"
],
"is_unsubscribe_group": true,
"group_name": "unsubscribe_group_name",
"uploader_email": "example@useinsider.com"
}'
Sample Responses
200 OK
{
"statusMessage": "OK"
}
400 Bad Request
{
"statusMessage": "Bad request"
}
401 Unauthorized
{
"statusMessage": "Unauthorized"
}
Limitations
- All functions must be executed with a simple HTTPS POST request.
- Only email addresses can be sent via this API. No data can be retrieved.
- A maximum of 500 emails can be consumed in one request.
- The API Key should be provided as the authorization key on the request header. If the key is incorrect, the operation will not be executed and an authorization error will return in the response.
- The value of X-PARTNER-NAME header should be lowercase.