Delete Webhooks

Delete Webhooks

To remove a webhook from a file or folder, you will need to use the remove webhook endpoint with the ID of the webhook. This value can be obtained using the list all webhooks endpoint.

cURL
curl -i -X DELETE "https://api.box.com/2.0/webhooks/3321123" \
     -H "Authorization: Bearer <ACCESS_TOKEN>"
Python
client.webhook(webhook_id='12345').delete()
print('The webhook was successfully deleted!')
iOS
client.webhooks.delete(webhookId: "22222") { result: Result<Void, BoxSDKError>} in
    guard case .success = result else {
        print("Error deleting webhook")
        return
    }

    print("Webhook successfully deleted")
}

Additional reasons for deletion

Using this endpoint is not the only way a webhook can be deleted.

The following reasons can cause webhooks to be deleted.

  1. Deleting a Box application automatically deletes all webhooks associated with the application.
  2. Deleting all active Access Tokens associated with a webhook will automatically delete the webhook. This includes Developer Tokens and password resets.
  3. If the last successful delivery was 30 days ago and the period between the last successful delivery date and the last trigger date was more than 14 days, the webhook will be automatically deleted.

In all of these cases Box would send a webhook payload with the WEBHOOK.DELETED event name to the notification URL. The body of the payload will include the following additional information.

"additional_info": {
  "reason": "auto_cleanup"
}