> ## 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.

# Restore Webhook

> Bring back a webhook that Flabs deleted automatically. It starts receiving new events straight away. Fix your endpoint first: if it still returns no `2xx` for 24 hours, it is deleted again.

Only auto-deleted webhooks can be restored; a webhook you deleted yourself cannot. Events created while the webhook was deleted are not sent.

**Party-scoped accounts:** returns `409` if an active webhook for the same party already covers one of its events (for example, a replacement you registered meanwhile).

**Party-scoped accounts:** you MUST pass the same party (`corporateUser` or `organization`) the webhook is bound to.

## Overview

Bring back a webhook that Flabs deleted automatically because it returned no `2xx` response for 24 hours. The webhook starts receiving new events straight away, with the same events, endpoint and party it had before.

Fix your endpoint before restoring it. If it still returns no `2xx` for 24 hours, it is deleted again.

## Endpoint

```
PATCH https://v2.flabs.in/client/events/reactivateEvent/<_id>?labID=<labID>
```

```bash theme={null}
curl --request PATCH \
  --url 'https://v2.flabs.in/client/events/reactivateEvent/6ac5e1f2a3b4c5d6e7f80912?labID=64a1b2c3d4e5f60718293a4b' \
  --header 'Authorization: Bearer <authToken>'
```

No request body is needed.

## Authentication

This endpoint requires a valid Bearer token obtained from the [authentication API](/auth/endpoint/get_auth_token).

## Request Parameters

The webhook identifier is sent in the path; the rest are query parameters:

| Parameter | Type | Required | Description |
| - | - | - | - |
| `id` | string | Yes | Path parameter. The `_id` from [Get Auto-deleted Webhooks](/webhooks/endpoint/get_deactivated_webhooks) |
| `labID` | string | Yes | Flabs lab (branch) identifier the webhook belongs to. Fetch via `GET /client/labs` |
| `corporateUser` | string | Cond. | Party-scoped accounts only — the corporate the webhook is bound to |
| `organization` | string | Cond. | Party-scoped accounts only — the doctor/hospital the webhook is bound to |

<Note>
  **Catch-all accounts (default):** do not send a party. **Party-scoped accounts:** you must send the same `corporateUser` **or** `organization` the webhook is bound to; you can only restore your own party's webhooks. See [integration modes](/crm/introduction).
</Note>

## What can be restored

* Only webhooks that Flabs **deleted automatically** can be restored.
* A webhook you deleted yourself with [Delete Webhook](/webhooks/endpoint/delete_webhook) cannot be restored. [Register](/webhooks/endpoint/register_webhook) it again instead.
* **Party-scoped accounts:** a party can have only one active webhook per event. If you registered a replacement for the same party and an overlapping event while this webhook was deleted, restoring returns `409`. Delete one of them first, otherwise every event would be delivered twice.
* If the webhook is not found among your auto-deleted webhooks (already active, deleted by you, another lab's or another party's), the API returns `404` with `error.details` set to `"Deactivated event not found"`.

### Responses

```json 200 Restored theme={null}
{
  "success": true,
  "message": "Event reactivated successfully",
  "data": {
    "_id": "6ac5e1f2a3b4c5d6e7f80912",
    "events": ["bill.completed", "report.completed"],
    "endpoint": "https://your-domain.com/flabs/webhooks",
    "protocol": "https",
    "createdAt": "2026-10-06T07:16:25.217Z",
    "updatedAt": "2026-10-12T11:02:10.000Z"
  }
}
```

```json 404 Not an auto-deleted webhook theme={null}
{
  "success": false,
  "status": 404,
  "message": "Not Found - The requested resource could not be found.",
  "error": {
    "details": "Deactivated event not found"
  }
}
```

```json 409 Replacement already active (party-scoped accounts) theme={null}
{
  "success": false,
  "status": 409,
  "message": "Conflict - The request could not be completed due to a conflict.",
  "error": {
    "details": "A webhook for this party already exists for one or more of these events"
  }
}
```

After a restore, the webhook appears again in [Get All Webhooks](/webhooks/endpoint/get_all_webhooks).

<Note>
  Events created while the webhook was deleted are not sent after you restore
  it. If you need them, contact Flabs support.
</Note>


## OpenAPI

````yaml PATCH /client/events/reactivateEvent/{id}
openapi: 3.0.3
info:
  title: Webhooks API
  version: 1.0.0
  description: >-
    APIs for managing webhook to receive real-time notifications about bill and
    report events.
servers:
  - url: https://v2.flabs.in
    description: Production Server
security: []
paths:
  /client/events/reactivateEvent/{id}:
    patch:
      summary: Restore webhook
      description: >-
        Bring back a webhook that Flabs deleted automatically. It starts
        receiving new events straight away. Fix your endpoint first: if it still
        returns no `2xx` for 24 hours, it is deleted again.


        Only auto-deleted webhooks can be restored; a webhook you deleted
        yourself cannot. Events created while the webhook was deleted are not
        sent.


        **Party-scoped accounts:** returns `409` if an active webhook for the
        same party already covers one of its events (for example, a replacement
        you registered meanwhile).


        **Party-scoped accounts:** you MUST pass the same party (`corporateUser`
        or `organization`) the webhook is bound to.
      parameters:
        - name: id
          in: path
          required: true
          description: Unique identifier of the auto-deleted webhook
          schema:
            type: string
          example: 68a51f702b9a428dce0da5e2
        - name: labID
          in: query
          required: true
          schema:
            type: string
          description: >-
            Flabs lab (branch) identifier. Fetch the list of labs via GET
            /client/labs.
        - name: corporateUser
          in: query
          required: false
          schema:
            type: string
          description: >-
            Party-scoped accounts only. The corporate the webhook is bound to.
            Pass either `corporateUser` or `organization`, not both.
        - name: organization
          in: query
          required: false
          schema:
            type: string
          description: >-
            Party-scoped accounts only. The doctor/hospital the webhook is bound
            to. Pass either `corporateUser` or `organization`, not both.
      responses:
        '200':
          description: Successfully restored webhook
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Event reactivated successfully
                  data:
                    type: object
                    properties:
                      _id:
                        type: string
                        description: Unique identifier for the webhook
                      events:
                        type: array
                        items:
                          type: string
                          enum:
                            - bill.created
                            - bill.deleted
                            - bill.completed
                            - report.completed
                            - lead.created
                            - booking.created
                            - booking.phlebotomist_assigned
                            - booking.phlebotomist_arrived
                            - booking.phlebotomist_sample_collected
                            - booking.phlebotomist_sample_submitted
                            - booking.rescheduled
                            - booking.cancelled
                            - report.send
                            - bill.send
                            - booking.send
                            - phlebotomist.send
                            - quotation.send
                        description: List of subscribed event types
                      endpoint:
                        type: string
                        description: URL the webhook delivers to
                      protocol:
                        type: string
                        enum:
                          - https
                        description: Protocol used for webhook delivery
                      corporateUser:
                        type: string
                        description: >-
                          Party-scoped accounts: the corporate this webhook is
                          bound to (if any).
                      organization:
                        type: string
                        description: >-
                          Party-scoped accounts: the doctor/hospital this
                          webhook is bound to (if any).
                      createdAt:
                        type: string
                        format: date-time
                        description: ISO 8601 timestamp when was created
                      updatedAt:
                        type: string
                        format: date-time
                        description: ISO 8601 timestamp when was last updated
              example:
                success: true
                message: Event reactivated successfully
                data:
                  _id: <unique id>
                  events:
                    - bill.completed
                  endpoint: https://example.com/webhooks/flabs
                  protocol: https
                  createdAt: '2025-08-21T08:57:49.700Z'
                  updatedAt: '2026-10-12T11:02:10.000Z'
        4XX:
          description: Error response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  status:
                    type: integer
                  message:
                    type: string
                  error:
                    type: object
                    properties:
                      details:
                        type: string
              example:
                success: false
                status: 401
                message: Unauthorized
                error:
                  details: Invalid client credentials
        5XX:
          description: Error response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  status:
                    type: integer
                  message:
                    type: string
                  error:
                    type: object
                    properties:
                      details:
                        type: string
              example:
                success: false
                status: 500
                message: Internal Server Error
                error:
                  details: An unexpected error occurred
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT token obtained from the authentication endpoint

````

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