Update email subscription status for an email address: error 405 (lack of documentation?)


#1

We are trying to update the email subscription status of users that sign up to our software (for GDPR purposes).

We are adding a subscription. But our request is failing with error 405. Would you guys know why?

Endpoint: https://api.hubapi.com/email/public/v1/subscriptions/test@test.com/?hapikey=XXX&portalId=XXX
Body: '{"subscriptionStatuses": [{"id":0,"subscribed":true,"optState":"OPT_IN","legalBasis":"LEGITIMATE_INTEREST_PQL","legalBasisExplanation":"XXX"}],"portalSubscriptionLegalBasis":"LEGITIMATE_INTEREST_PQL","portalSubscriptionLegalBasisExplanation":"XXX"}' },

In the documentation is not clear what is expected in the id, and what is portalSubscriptionLegalBasis (!?). The link is here: https://developers.hubspot.com/docs/methods/email/update_status

Would you be able to help with the error, and clarifying what are these fields?


#3

Hi @Raphael_Arias,

Happy to help. Can you confirm which method you are using? This endpoint requires PUT, so if you're receiving a 405 METHOD NOT ALLOWED error, I suspect you may be using POST.

The id parameter refers to the subscriptionId defined in this article. You can retrieve these IDs via this endpoint.

The portalSubscriptionLegalBasis parameter reflects your legal basis for communicating with the recipient under the GDPR. The five options reflect the broad categories of legal basis discussed here. I recommend working with your own legal counsel if you're not familiar with which options best apply in your situation.