Unable to make post request for webhook

https://api.atlassian.com/ex/jira/{cloudid}/rest/api/3/webhook

This is successfully making the get request for list of webhooks with Bearer Authorization.

{
    "maxResults": 100,
    "startAt": 0,
    "total": 0,
    "isLast": true,
    "values": []
}

but unable to make post request with given URL. Giving this error

{
“message”: “Request failed with status code 401”
}