# Webhooks

These routes allow you to CRUD webhooks within Cal.com.

## Find all webhooks

## Finds all webhooks

<mark style="color:blue;">`GET`</mark> `http://localhost:3002/v1/hooks`

{% tabs %}
{% tab title="200: OK OK" %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized Authorization information is missing or invalid." %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="404: Not Found No webhooks were found" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## Create a new webhook

## Creates a new webhook

<mark style="color:green;">`POST`</mark> `http://localhost:3002/v1/hooks`

#### Request Body

| Name                                            | Type    | Description                                                          |
| ----------------------------------------------- | ------- | -------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark>            | String  | UUID v4, identifies the webhook                                      |
| eventTriggers<mark style="color:red;">\*</mark> | ENUM    | \["BOOKING\_CREATED", "BOOKING\_RESCHEDULED", "BOOKING\_CANCELLED"'] |
| subscriberUrl<mark style="color:red;">\*</mark> | String  | A valid webhook subscriber URL                                       |
| active<mark style="color:red;">\*</mark>        | Boolean | The state of the webhook being created                               |
| eventTypeId                                     | Number  | Event type ID to associate the webhook with                          |
| appId                                           | Number  | App ID to associate the webhook with                                 |
| payloadTemplate                                 | String  | A template to customize the webhook payload                          |

{% tabs %}
{% tab title="201: Created OK, webhook created" %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="400: Bad Request Bad request. Webhook body is invalid." %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized Authorization information is missing or invalid." %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## Find a webhook

## Find a webhook from id

<mark style="color:blue;">`GET`</mark> `http://localhost:3002/v1/hooks/{id}`

#### Path Parameters

| Name                                 | Type   | Description               |
| ------------------------------------ | ------ | ------------------------- |
| id<mark style="color:red;">\*</mark> | String | ID of the webhook to find |

{% tabs %}
{% tab title="200: OK Ok" %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized Authorization information is missing or invalid." %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="404: Not Found Webhook was not found" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## Edit an existing webhook

## Edit an existing webhook identified by id

<mark style="color:purple;">`PATCH`</mark> `http://localhost:3002/v1/hooks/{id}`

#### Path Parameters

| Name                                 | Type   | Description               |
| ------------------------------------ | ------ | ------------------------- |
| id<mark style="color:red;">\*</mark> | String | ID of the webhook to edit |

#### Request Body

| Name            | Type   | Description                                                          |
| --------------- | ------ | -------------------------------------------------------------------- |
| eventTrigger    | ENUM   | \["BOOKING\_CREATED", "BOOKING\_RESCHEDULED", "BOOKING\_CANCELLED"'] |
| payloadTemplate | String | A template to customize the webhook payload                          |
| subscriberUrl   | String | A valid webhook subscriber URL                                       |

{% tabs %}
{% tab title="201: Created OK, webhook edited successfuly" %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="400: Bad Request Bad request. Webhook body is invalid." %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized Authorization information is missing or invalid." %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## Delete a webhook

## Deletes a webhook identified by id

<mark style="color:red;">`DELETE`</mark> `http://localhost:3002/v1/hooks/{id}`

#### Path Parameters

| Name                                 | Type   | Description                 |
| ------------------------------------ | ------ | --------------------------- |
| id<mark style="color:red;">\*</mark> | String | Id of the webhook to delete |

{% tabs %}
{% tab title="201: Created OK, webhook removed successfuly" %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="400: Bad Request Bad request. Webhook id is invalid." %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized Authorization information is missing or invalid." %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}
