APIs & Integrations

Not applicable

How to opt a contact out of email via API by using C#

SOLVE

How to unsubscribe a contact by using HubSpot API in C#?

Thanks,
Stephen

0 Upvotes
1 Accepted solution
Derek_Gervais
Solution
HubSpot Alumni
HubSpot Alumni

How to opt a contact out of email via API by using C#

SOLVE

Hey all,

You can unsubscribe contacts using the ‘Update email subscription status’ endpoint below. Keep in mind that this cannot be reversed.

Update email subscription status for an email address | Email API

PUT /email/public/v1/subscriptions/:email_address

View solution in original post

0 Upvotes
5 Replies 5
IsaacTakushi
HubSpot Employee
HubSpot Employee

How to opt a contact out of email via API by using C#

SOLVE

Hi @carrng,

This can be done by sending "unsubscribeFromAll": true in the body, as outlined in the example.

Isaac Takushi

Associate Certification Manager
0 Upvotes
jmichaelTest
Member

How to opt a contact out of email via API by using C#

SOLVE

Hi Derek,
Does not seem like the unsubscribe API works as expected. I tried to unsubscribe a user using the below API. However, if I check the preferences, I see that the user is still subscribed. It worked yesterday for me.
Given below is the request:
http://api.hubapi.com/email/public/v1/subscriptions/micjohny@gmail.com?hapikey=d6b4fd6a-7b96-4c19-8e...

PUT http://api.hubapi.com/email/public/v1/subscriptions/micjohny@gmail.com?hapikey=<hapikey>
User-Agent: Fiddler
Host: api.hubapi.com
Content-Length: 114
{
    "subscriptionStatuses": [
        {
        "id": 1245662, "subscribed": false
    }
    ]
}

0 Upvotes
carrng
Member

How to opt a contact out of email via API by using C#

SOLVE

The endpoint mentioned above is for specific subscription types. Sending a subscribed = false without a subscription ID returns an error. How does one do a general unsubscribe through the API?

0 Upvotes
Derek_Gervais
Solution
HubSpot Alumni
HubSpot Alumni

How to opt a contact out of email via API by using C#

SOLVE

Hey all,

You can unsubscribe contacts using the ‘Update email subscription status’ endpoint below. Keep in mind that this cannot be reversed.

Update email subscription status for an email address | Email API

PUT /email/public/v1/subscriptions/:email_address

0 Upvotes
jmichaelTest
Member

How to opt a contact out of email via API by using C#

SOLVE

I too am interested in this information.

Thanks,
Johnson

0 Upvotes