> ## Documentation Index
> Fetch the complete documentation index at: https://developer.box.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete webhooks (v2)

export const MultiRelatedLinks = ({sections = []}) => {
  if (!sections || sections.length === 0) {
    return null;
  }
  return <div className="space-y-8">
      {sections.map((section, index) => <RelatedLinks key={index} title={section.title} items={section.items} />)}
    </div>;
};

export const RelatedLinks = ({title, items = []}) => {
  const getBadgeClass = badge => {
    if (!badge) return "badge-default";
    const badgeType = badge.toLowerCase().replace(/\s+/g, "-");
    return `badge-${badge === "ガイド" ? "guide" : badgeType}`;
  };
  if (!items || items.length === 0) {
    return null;
  }
  return <div className="my-8">
      {}
      <h3 className="text-sm font-bold uppercase tracking-wider mb-4">{title}</h3>

      {}
      <div className="flex flex-col gap-3">
        {items.map((item, index) => <a key={index} href={item.href} className="py-2 px-3 rounded related_link hover:bg-[#f2f2f2] dark:hover:bg-[#111827] flex items-center gap-3 group no-underline hover:no-underline border-b-0">
            {}
            <span className={`px-2 py-1 rounded-full text-xs font-semibold uppercase tracking-wide flex-shrink-0 ${getBadgeClass(item.badge)}`}>
              {item.badge}
            </span>

            {}
            <span className="text-base">{item.label}</span>
          </a>)}
      </div>
    </div>;
};

export const Link = ({href, children, className, ...props}) => {
  const localizedHref = localizeLink(href);
  return <a href={localizedHref} className={className} {...props}>
      {children}
    </a>;
};

<RelatedLinks
  title="REQUIRED GUIDES"
  items={[
{ label: translate("Create Webhooks"), href: "/guides/webhooks/v2/create-v2", badge: "GUIDE" },
{ label: translate("List Webhooks for a User"), href: "/guides/webhooks/v2/list-v2", badge: "GUIDE" }
]}
/>

You can delete a webhook using the [Developer Console][console] or API.

## Developer Console

To delete a webhook follow the steps below.

1. Navigate to the **Webhooks** tab in the [Developer Console][console].
2. Select the webhook you want to delete by clicking on its ID.
3. Click the **Delete** button.
4. Confirm the action by clicking **Delete** under the warning message.

## API

To remove a webhook from a file or folder, you need to use the
<Link href="/reference/delete-webhooks-id">remove webhook endpoint</Link> with the ID of the webhook. You can
get this value using the <Link href="/reference/get-webhooks">list all webhooks endpoint</Link>.

<CodeGroup>
  ```sh cURL theme={null}
  curl -i -X DELETE "https://api.box.com/2.0/webhooks/3321123" \
       -H "authorization: Bearer <ACCESS_TOKEN>"
  ```

  ```typescript Node/TypeScript v10 theme={null}
  await client.webhooks.deleteWebhookById(webhook.id!);
  ```

  ```python Python v10 theme={null}
  client.webhooks.delete_webhook_by_id(webhook.id)
  ```

  ```csharp .NET v10 theme={null}
  await client.Webhooks.DeleteWebhookByIdAsync(webhookId: NullableUtils.Unwrap(webhook.Id));
  ```

  ```swift Swift v10 theme={null}
  try await client.webhooks.deleteWebhookById(webhookId: webhook.id!)
  ```

  ```java Java v10 theme={null}
  client.getWebhooks().deleteWebhookById(webhook.getId())
  ```

  ```py Python v4 theme={null}
  client.webhook(webhook_id='12345').delete()
  print('The webhook was successfully deleted!')
  ```

  ```csharp .NET v6 theme={null}
  await client.WebhooksManager.DeleteWebhookAsync("11111");
  ```

  ```js Node v4 theme={null}
  client.webhooks.delete('1234')
   .then(() => {
    // deletion succeeded — no value returned
   });
  ```
</CodeGroup>

## Automatic webhook deletion

Using <Link href="/reference/delete-webhooks-id">this</Link> endpoint is not the only way a webhook can be deleted.

The following reasons can cause webhooks to be deleted.

* Deleting a Box application automatically deletes all webhooks associated with it.
* Deleting all active Access Tokens associated with a webhook automatically deletes the webhook. This includes Developer Tokens and password.
* The last successful notification was delivered 30 days ago to the set URL and the period between the last successful notification delivery and the last user trigger event date exceeds 14 days.

  Let's go through a scenario
  in which the user downloads a file. This action
  triggers the webhook to use the set URL to
  delete a shared link.
  The diagram illustrates this scenario, showing
  when the webhook will be deleted.

  <Frame>
    <img src="https://mintcdn.com/box/QQwa5kSyD2QPHaV1/images/guides/webhooks/delete_webhooks.png?fit=max&auto=format&n=QQwa5kSyD2QPHaV1&q=85&s=dc8a187f8a4bdb99f18cabf9e334defc" alt="Delete webhooks" width="1312" height="254" data-path="images/guides/webhooks/delete_webhooks.png" />
  </Frame>

  * **User event trigger**: when the user initiated the event, for example downloaded a file.
  * **Notification trigger**: when the notification was sent to the webhook, saying that the file was downloaded.
  * **Last notification delivery**: when the webhook sent a message to a specific URL, for example to delete a shared link.

In all of these cases Box sends a webhook payload with the
`WEBHOOK.DELETED` event name to the notification URL. The body of
the payload
includes the following additional information.

```json theme={null}
"additional_info": {
  "reason": "auto_cleanup"
}
```

[console]: https://app.box.com/developers/console

<RelatedLinks
  title="RELATED APIS"
  items={[
{ label: translate("Remove webhook"), href: "/reference/delete-webhooks-id", badge: "DELETE" }
]}
/>

<RelatedLinks
  title="RELATED GUIDES"
  items={[
{ label: translate("Create Webhooks"), href: "/guides/webhooks/v2/create-v2", badge: "GUIDE" },
{ label: translate("List Webhooks for a User"), href: "/guides/webhooks/v2/list-v2", badge: "GUIDE" }
]}
/>
