Webook Creation Leading to 402 Error

I was attempting to create a webhook, first tried the workspace level but also tested with project level, and received the following error both times:
{“errors”:[{“message”:“The remote server responded with an incorrect status code: 402”,“help”:“For more information on API status codes and how to handle them, read the docs on errors: https://developers.asana.com/docs/errors”}]}

Here’s the curl request I was sending for workplace:
curl -X POST https://app.asana.com/api/1.0/webhooks -H ‘Content-Type: application/json’ -H ‘Accept: application/json’ -H 'Authorization: Bearer ’ -d ‘{“data”: {“filters”: [{“action”: “deleted”,“resource_type”: “task”}],“resource”: “”,“target”: “https://e7f5865ac437.ngrok.io/receive-webhook?workspace=”}}’

I can do other premium API activities such as search tasks so I am unsure why I get a 402 error here. I can query if webhooks exist via curl (none do) so I’m wondering if there is special permission/access I need to create a webhook?

Isn’t it your server that responds 402 to the handshake they send? :thinking: cc @Phil_Seeman

Hi @sana.moghul,

Actually that’s an odd one - 402 means “Payment required” which is the error return you’ll get when you try to perform something that’s not permitted at your subscription level (i.e. trying to add a start date on a task for a Free-level user, or trying to add a portfolio for a Premium-level user).

But I don’t understand what would cause a 402 error trying to create a webhook for a workspace or project, since to my knowledge, webhooks on those resources are available at every subscription level.

@Ross_Grambo, any thoughts on why one would get a 402 on a webhook creation request?

2 Likes

HI @Ross_Grambo,

Can you please provide any insight as to why one would get a 402 on a webhook creation request? This is slowing our development within our company and we are trying to meet our internal deadlines. Any insight would be really appreciated, thank you in advance.

It can appear if the user you’re requesting it on behalf of was premium at one point but no longer is. Additionally it can happen if you’re requesting webhooks on premium+ objects.

1 Like

Thanks for the response @Ross_Grambo however the project I’m trying to create a webhook on was created using my own account as was the Authentication Token. It doesn’t make sense why one would be premium and the other not.

Also I can do task searches with this authentication token which is a premium feature so it again doesn’t make sense why a webhook can’t be setup.

Have you setup a webhook that filters on the deleted action before? Do you get an error like 402?

I haven’t personally. I can ask an API eng to look into it. Can you check if other actions work for you? (Actions other than deleted)

I was able to build one for “changed” without an issue.

1 Like