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

# Auto-deleted Webhooks

> Flabs automatically deletes a webhook that has not accepted a delivery for 24 hours.

If your endpoint stops accepting deliveries, Flabs does not keep calling it forever. A webhook that returns **no `2xx` response for 24 hours** is deleted automatically, and Flabs stops sending events to it. You are emailed before and when this happens.

Unlike a webhook you [delete](/webhooks/endpoint/delete_webhook) yourself, an auto-deleted webhook can be [restored](/webhooks/endpoint/reactivate_webhook).

## How it works

```mermaid theme={null}
sequenceDiagram
    participant F as Flabs
    participant W as Your webhook
    participant A as Lab admin email
    F->>W: POST event
    W-->>F: 500 / timeout / no response
    Note over F: Failure streak starts
    F->>W: Retries and later events
    W-->>F: Still failing
    F->>A: Warning email (once, between 12 and 23 hours)
    Note over F: 24 hours with no 2xx
    F--xW: Webhook deleted, no more events
    F->>A: Deletion email
```

1. When a delivery to your endpoint fails, Flabs notes the time of that first failure.
2. Deliveries and [retries](/webhooks/introduction#retry-policy) continue as usual.
3. **Any single `2xx` response clears the record.** The webhook is healthy again, and the 24 hours start over from the next failure.
4. If your endpoint is still failing after 12 hours, the lab admin gets a **warning email**. It is sent once, on the first failed delivery after 12 hours, or at 23 hours if no delivery was attempted in between.
5. If your endpoint has returned no `2xx` for 24 hours, the next failed delivery deletes the webhook and the lab admin gets a **deletion email**.

A delivery counts as failed when your endpoint returns a status outside `200`–`299`, does not answer within 10 seconds, or cannot be reached.

<Note>
  Each webhook is checked on its own. If you have several webhooks, even on the
  same URL, only the one that kept failing is deleted. The others keep
  receiving their events.
</Note>

## Emails

Both emails go to the lab admin's email address, from `hello@flabs.in`. They show the endpoint, its events, when it started failing, the number of failed delivery attempts and the last error.

Each webhook gets its own emails. If several of your webhooks use the same URL, each email names the corporate or doctor/hospital the webhook is for, and says how many webhooks share that URL.

## Getting events again

1. Fix your endpoint so it returns a `2xx` status within 10 seconds.
2. List your auto-deleted webhooks with [Get Auto-deleted Webhooks](/webhooks/endpoint/get_deactivated_webhooks):
   `GET /client/events/getDeactivatedEvents?labID=<labID>`
3. Bring the webhook back with [Restore Webhook](/webhooks/endpoint/reactivate_webhook), using the `_id` from step 2:
   `PATCH /client/events/reactivateEvent/<_id>?labID=<labID>`
   It starts receiving new events straight away. You can also [register](/webhooks/endpoint/register_webhook) a new webhook instead.

Events created while the webhook was deleted are not sent. If you need them, contact Flabs support.

## Avoiding auto-deletion

* Return a `2xx` status as soon as you have received the event, then process it in the background.
* Keep the URL stable. If it changes, register the new URL and [delete](/webhooks/endpoint/delete_webhook) the old webhook.
* Delete test webhooks once you no longer need them.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.