Delete the all Subscription but get the error


#1

Hello,

I have multiple subscription created.i want to delete that subscription using API
i am Using this API

var options = {
method: method,
url: 'https://api.hubapi.com/webhooks/v1/'+appId+'/subscriptions/'+subscriptionsId,
headers: { 'content-type': 'application/json'},
json: true
};

response get

Options-------------> { method: 'DELETE',
url: 'https://api.hubapi.com/webhooks/v1/182195/subscriptions/81739',
headers: { 'content-type': 'application/json' },
json: true }

Error:

 {"status":"error","message":"Any of the listed authentication credentials are missing","correlationId":"XXXXXXX-XXX-XXXX-XXXX-XXXXXX","engagement":{"shhkey-v1":"shhkey-v1 not engaged. Shhkey not found in the request header.","oauth-token":"oauth-token not engaged. OAuth access token not found in request header.","access_token":"access_token not engaged. Token not found in query params.","hapikey":"hapikey not engaged. hapikey is not present in query params.","internal-cookie":"internal-cookie not engaged. Cookie not found in the request.","app-cookie":"app-cookie not engaged. App cookie is not present on the request.","legacy-app-cookie":"legacy-app-cookie not engaged. Auth cookie is not present in the request."},"requestId":"6e50b2a62295a5aa76f8a78cacb6387b"}

please reply asap

Thanks


#2

hello,

I changes some in api and try once again but got the same error...

var options = {
    method: method,
    url: 'https://api.hubapi.com/webhooks/v1/'+appId+'/subscriptions/'+subscriptionsId,
    headers: { 'content-type': 'application/json','Authorization':'Bearer ' + authToken},
    json: true 
  };

I send the api

Thanks


#4

Hi @avinash,

Webhook subscriptions are set up for a HubSpot app, not individual accounts, so you cannot use an OAuth token to delete them. You must use your developer account's API key in the hapikey parameter.

For example:

https://api.hubapi.com/webhooks/v1/'+appId+'/subscriptions/'+subscriptionId'?hapikey='+your_developer_api_key'