Unsubscribe Email Users from Database / v2
  • 27 Nov 2023
  • 2 Minutes to read

    Unsubscribe Email Users from Database / v2


      Article Summary

      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

      POST https://contact.useinsider.com/email/v2/unsubscribe

      Headers

      HeaderSample ValueDescription
      X-PARTNER-NAMEmybrandThis is your partner name. Navigate to Inone > Inone Settings > Account Preferences to copy your partner name. The partner name should be lowercase.
      X-REQUEST-TOKEN1a2b3c4e5d6fThis key is required to authorize your request. Refer to API Authentication Tokens to generate your Global Unsubscribe token.
      Content-Typeapplication/jsonThis header specifies the media type of the resource.

      Body Parameters

      For Email Global Unsubscribe

      ParameterDescriptionData TypeRequired
      emailsUser's email addressesString ArrayYes
      uploader_emailYour uploader email addressStringYes

      For Email Group Unsubscribe

      ParameterDescriptionData TypeRequired
      emailsUser's email addresses
      Yes
      uploader_emailYour uploader email addressStringYes
      group_nameThe Unsubscribe Group’s nameStringYes
      is_unsubscribe_groupWhether the unsubscribe group is enabled for the requestBoolean (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

      Your title goes here
      is_unsubscribe_group should be true. Otherwise the API will ingest the upload request to be consumed for the global unsubscribe list.
      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.

      Was this article helpful?

      ESC

      Eddy, a super-smart generative AI, opening up ways to have tailored queries and responses