How To Create Unsubscribe Link In Sendgrid

One option for maintaining communication with customers is using SendGrid, a cloud-based SMTP provider. It eliminates the need for managing personal email servers, making it a great tool. However, it’s essential to give customers the choice to opt-out of receiving messages. To create an unsubscribe link in SendGrid, follow these steps.

Step 1: Create an Unsubscribe Group

The first step is to create an unsubscribe group. These groups allow your users to remove themselves from specific types of emails rather than all of your communications. To do this, navigate to ‘Settings > Unsubscribe Groups’ and click on ‘Create Group’. Fill in the ‘Group Name’ and ‘Group Description’, then click ‘Create Group’.

Step 2: Add the Unsubscribe Link to Your Email Template

Once you’ve created an unsubscribe group, the next step is to add the unsubscribe link to your email template. You can do this by including the following replacement tag in the body of your email:


You may wish to include this within a sentence such as, “If you wish to stop receiving these emails, click here.”

Step 3: Set the Unsubscribe Group in Your API Call

The final step is to set the unsubscribe group in your API call. You can do this by including the ‘asm’ parameter in your call:

  "asm": {
    "group_id": 1

Note that the ‘group_id’ should be replaced with the ID of the unsubscribe group you created earlier. This will associate the email with the correct group, so that when the recipient clicks the unsubscribe link, they will be removed from the correct list.


And that’s it! By following these steps, you can ensure that your users have the ability to opt-out of your communications, helping you maintain trust and comply with email best practice. Remember that it’s not just about sending emails, but also about respecting your recipients’ choices and their inbox.