# Manage Webhooks

Webhooks notify users or other systems when actions happen in Immuta. Every action that generates a notification is available as a webhook.

This page lists the REST endpoints for managing webhooks and provides examples of requests.

## Webhook overview

Application Admins can configure webhooks that are triggered by events that happen in the system (such as when data sources or projects are created), but any user can configure webhooks that are triggered by access requests and activity notifications.

All user-configured webhook integrations must respond within 10 seconds of receiving the webhook request payload. If the webhook integration takes longer to respond, the [request will timeout](#timed-out-request).

## Webhook workflow

1. [Create a webhook](#create-a-webhook)
2. [Retrieve webhook information](#retrieve-webhook-information)
3. [Retry webhook](#retry-webhook-by-id).
4. [Delete a webhook](#delete-a-webhook)

## Create a webhook

<mark style="color:green;">`POST`</mark> `/webhooks`

Create a new webhook. Users can create multiple webhooks in a single request.

#### Payload parameters

<table><thead><tr><th>Attribute</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td><strong>webhooks</strong></td><td><code>array[object]</code> The details for each webhook you would like to create. Its child attributes are described below.</td><td><strong>Yes</strong></td></tr><tr><td>webhooks.<strong>url</strong></td><td><code>string</code> URL for outbound webhook request.</td><td><strong>Yes</strong></td></tr><tr><td>webhooks.<strong>name</strong></td><td><code>string</code> The webhook's name.</td><td><strong>Yes</strong></td></tr><tr><td>webhooks.<strong>global</strong></td><td><code>boolean</code> If <code>true</code>, you will receive all notifications even if they do not pertain to you.</td><td><strong>Yes</strong></td></tr><tr><td>webhooks.<strong>notificationType</strong></td><td><code>array</code> A list of the webhook notifications you would like to receive. <a href="#webhook-notifications">See the webhook notifications table for a list of possible values.</a></td><td><strong>Yes</strong></td></tr><tr><td>webhooks.<strong>actionType</strong></td><td><code>string</code> Specifies when to start the webhook. The options are <code>triggered</code> or <code>received</code>. When this attribute is set to <code>triggered</code>, the webhook will execute when the user who registered the webhook triggered the event. If this attribute is set to <code>received</code>, the webhook will execute if the user who registered the webhook receives an event triggered by another user.</td><td><strong>Yes</strong></td></tr><tr><td>webhooks.<strong>secret</strong></td><td><p><code>string</code> Shared secret for computing the webhook signature using HMAC authentication.<br><br>Once this field is configured, webhooks sent by Immuta will include a <code>x-immuta-webhook-signature</code> header that contains an HMAC digest created using <a href="https://nodejs.org/api/crypto.html#cryptocreatehmacalgorithm-key-options">this Node.js method</a>:</p><pre class="language-javascript" data-overflow="wrap"><code class="lang-javascript">createHmac('sha1', decryptedSecret).update(JSON.stringify(data)).digest('hex')
</code></pre><p>Use SHA-1 and the shared secret you configured to verify the webhook signature.</p></td><td>No</td></tr></tbody></table>

#### Webhook notifications

The following event types can be used to configure a webhook.

| Type                                       | Triggers                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ALL_NOTIFICATIONS`                        | Configures the webhook to be triggered by any event type.                                                                                                                                                                                                                                                                                                                                                                                      |
| `acknowledgedAccess`                       | A project member acknowledges the purposes on a project.                                                                                                                                                                                                                                                                                                                                                                                       |
| `addedToProject`                           | A data source is added to a project.                                                                                                                                                                                                                                                                                                                                                                                                           |
| `apiKeyRevoked`                            | A user's API key is revoked.                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `attributeAdded`                           | An attribute is added to a group or user.                                                                                                                                                                                                                                                                                                                                                                                                      |
| `attributeRemoved`                         | An attribute is removed from a group or user.                                                                                                                                                                                                                                                                                                                                                                                                  |
| `attributeUpdated`                         | Attributes for a group or user are updated.                                                                                                                                                                                                                                                                                                                                                                                                    |
| `bulkJobStatus`                            | A bulk action is completed (whether success/failure).                                                                                                                                                                                                                                                                                                                                                                                          |
| `certificationRequired`                    | A Global Policy that requires certification by the data source owner is applied to a data source.                                                                                                                                                                                                                                                                                                                                              |
| `collectionCreated`                        | A domain is created.                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `collectionDataSourceAdded`                | A data source is added to a domain.                                                                                                                                                                                                                                                                                                                                                                                                            |
| `collectionDataSourceRemoved`              | A data source is removed from a domain.                                                                                                                                                                                                                                                                                                                                                                                                        |
| `collectionDeleted`                        | A domain is deleted.                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `collectionPermissionGranted`              | A domain permission has been assigned to a user.                                                                                                                                                                                                                                                                                                                                                                                               |
| `collectionPermissionRevoked`              | A domain permission has been removed from a user.                                                                                                                                                                                                                                                                                                                                                                                              |
| `collectionUpdated`                        | A domain was updated.                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `conflictingGlobalPolicies`                | Global Policies are applied to the same column on a data source.                                                                                                                                                                                                                                                                                                                                                                               |
| `dataSourceExpired`                        | A data source that was configured to expire has expired.                                                                                                                                                                                                                                                                                                                                                                                       |
| `dataSourceExpiring`                       | A data source that was configured to expire expires tomorrow.                                                                                                                                                                                                                                                                                                                                                                                  |
| `dataSourceUpdated`                        | A data source is updated.                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `deletedDatasourceRemovedFromProject`      | A data source has been deleted and then removed from a project.                                                                                                                                                                                                                                                                                                                                                                                |
| `expiredDatasourceRemovedFromProject`      | A data source that has expired and been deleted is removed from a project.                                                                                                                                                                                                                                                                                                                                                                     |
| `firstQuery`                               | A data source is queried for the first time through Immuta.                                                                                                                                                                                                                                                                                                                                                                                    |
| `frameworkCreated`                         | A classification framework was created.                                                                                                                                                                                                                                                                                                                                                                                                        |
| `frameworkDeleted`                         | A classification framework was deleted.                                                                                                                                                                                                                                                                                                                                                                                                        |
| `frameworkUpdated`                         | A classification framework was updated.                                                                                                                                                                                                                                                                                                                                                                                                        |
| `globalPolicyApprovalRescinded`            | [A governor has removed their approval of a global policy](#user-content-fn-1)[^1].                                                                                                                                                                                                                                                                                                                                                            |
| `globalPolicyApproved`                     | [A governor has approved a global policy.](#user-content-fn-1)[^1]                                                                                                                                                                                                                                                                                                                                                                             |
| `globalPolicyChangeRequested`              | [A governor has requested changes to a global policy.](#user-content-fn-1)[^1]                                                                                                                                                                                                                                                                                                                                                                 |
| `globalPolicyCreated`                      | A global policy is created.                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `globalPolicyDeleted`                      | A global policy is deleted.                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `globalPolicyDisabled`                     | A global policy is disabled.                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `globalPolicyUpdated`                      | A global policy is updated.                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `groupUserAdded`                           | A user is added to a group.                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `groupUserDeleted`                         | A user is removed from a group.                                                                                                                                                                                                                                                                                                                                                                                                                |
| `healthCheckFailed`                        | A health check runs and returns not healthy.                                                                                                                                                                                                                                                                                                                                                                                                   |
| `healthCheckResolved`                      | A health check runs and returns healthy.                                                                                                                                                                                                                                                                                                                                                                                                       |
| `modelAccessApproved`                      | A user's access request is approved for a data source or project.                                                                                                                                                                                                                                                                                                                                                                              |
| `modelAccessDenied`                        | A user's access request is denied for a data source or project.                                                                                                                                                                                                                                                                                                                                                                                |
| `modelAccessRequested`                     | A user requests access to a data source or project.                                                                                                                                                                                                                                                                                                                                                                                            |
| `modelAccessRevoked`                       | A user's access request is revoked for a data source or project.                                                                                                                                                                                                                                                                                                                                                                               |
| `modelAccessUpdated`                       | A user's access level is updated for a data source or project.                                                                                                                                                                                                                                                                                                                                                                                 |
| `modelCopied`                              | A data source or project is copied.                                                                                                                                                                                                                                                                                                                                                                                                            |
| `modelCreated`                             | A data source or project is created.                                                                                                                                                                                                                                                                                                                                                                                                           |
| `modelDeleted`                             | A data source or project is deleted.                                                                                                                                                                                                                                                                                                                                                                                                           |
| `modelTagAdded`                            | A tag is added to a data source or a data source column.                                                                                                                                                                                                                                                                                                                                                                                       |
| `modelTagRemoved`                          | A tag is removed from a data source or a data source column.                                                                                                                                                                                                                                                                                                                                                                                   |
| `modelUserAdded`                           | A user is added to a data source.                                                                                                                                                                                                                                                                                                                                                                                                              |
| `modelUserDeleted`                         | A user is removed from a data source.                                                                                                                                                                                                                                                                                                                                                                                                          |
| `modelUserJoined`                          | A user joins a data source that they are already allowed to join.                                                                                                                                                                                                                                                                                                                                                                              |
| `nativeIntegrationValidationFailed`        | A validation test for an enabled integration has failed.                                                                                                                                                                                                                                                                                                                                                                                       |
| `permissionsUpdated`                       | A user's permissions are updated.                                                                                                                                                                                                                                                                                                                                                                                                              |
| `policyCertificationExpired`               | A policy certification on a data source has expired.                                                                                                                                                                                                                                                                                                                                                                                           |
| `policyUpdated`                            | A data source's policies have been updated by a user or Global Policy. Policy updates are triggered for many reasons, including when a data source is created, a user updates them, a Global Policy changed, tags are added to a data source or column, the data dictionary changed, a fingerprint is recomputed (only available for Snowflake data sources), an external catalog modifies tags on a linked data source, or a policy disabled. |
| `projectDisabled`                          | A project is disabled.                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `projectEqualizationMemberNotInCompliance` | A member of an equalized project is out of compliance.                                                                                                                                                                                                                                                                                                                                                                                         |
| `projectEqualizationToggled`               | Project equalization is toggled on or off.                                                                                                                                                                                                                                                                                                                                                                                                     |
| `projectUpdated`                           | A project is updated.                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `purposeCreated`                           | A purpose is created.                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `purposeDeleted`                           | A purpose is deleted.                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `purposeUpdated`                           | A purpose is updated.                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `queryCanceled`                            | A running query is canceled due to a change on a data source.                                                                                                                                                                                                                                                                                                                                                                                  |
| `removedFromProject`                       | A data source is removed from a project.                                                                                                                                                                                                                                                                                                                                                                                                       |
| `switchedCurrentProject`                   | A user switches their current project.                                                                                                                                                                                                                                                                                                                                                                                                         |
| `tagCreated`                               | A tag is created.                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `tagDeleted`                               | A tag is deleted.                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `tagUpdated`                               | A tag is updated.                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `taskDeleted`                              | An outstanding data source task is deleted without validation.                                                                                                                                                                                                                                                                                                                                                                                 |
| `taskValidated`                            | An outstanding data source task is validated.                                                                                                                                                                                                                                                                                                                                                                                                  |
| `userCloned`                               | A user is cloned.                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `userCreated`                              | A user or group is created.                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `userDeleted`                              | A user or group is deleted.                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `userDisabled`                             | A user is disabled.                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `userEnabled`                              | A user is enabled.                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `userMigrated`                             | A user is migrated from an old IAM to a new IAM.                                                                                                                                                                                                                                                                                                                                                                                               |
| `usernameUpdated`                          | A user's name is updated.                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `userUpdated`                              | A group is updated.                                                                                                                                                                                                                                                                                                                                                                                                                            |

#### Response schema

| Attribute           | Description                                                                                                                                             |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **createdWebhooks** | `array[object]` Details on each webhook that was created including values for `id`, `url`, `name`, `global`, `actionType`, and the date it was created. |

### Request example

The following request with the payload below creates a new webhook.

```shell
curl \
    --request POST \
    --header "Authorization: Bearer dea464c07bd07300095caa8" \
    --data @example-payload.json \
    https://demo.immuta.com/webhooks
```

#### Payload example

```json
{
  "webhooks": [
    {
      "url": "https://demo.service.com/processWebhook",
      "name": "ViewMonitorHook",
      "global": false,
      "notificationType": [
        "ALL_NOTIFICATIONS"
      ],
      "actionType": "triggered"
    }
  ]
}
```

### Response example

```json
{
  "createdWebhooks": [
    {
      "id": 3,
      "url": "https://demo.service.com/processWebhook",
      "name": "ViewMonitorHook",
      "global": false,
      "actionType": "triggered",
      "createdBy": 2,
      "createdAt": "2021-10-15T15:22:10.079Z",
      "updatedAt": "2021-10-15T15:22:10.079Z"
    }
  ],
  "errors": []
}
```

### Example payload received when a webhook is triggered

```json
  {
    "id": 15,
    "name": "Policy updated",
    "url": "organization.immuta.com",
    "notificationType": [
      "policyUpdated"
    ],
    "global": false,
    "createdBy": 2,
    "actionType": "triggered"
  }
```

## Retrieve webhook information

| Endpoint                                                                                 | Purpose                                                                                                           |
| ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| [<mark style="color:blue;">`/webhooks`</mark>](#search-for-webhooks)                     | Return a list of webhooks the user can see. (Admins can see all webhooks; users can only see their own webhooks.) |
| [<mark style="color:blue;">`/webhooks/actions`</mark>](#search-for-notification-actions) | Return a list of valid notification actions that a webhook can be triggered by.                                   |
| [<mark style="color:blue;">`/webhooks/history`</mark>](#search-for-webhook-records)      | Return historical records for webhook requests, including requests and responses.                                 |
| [<mark style="color:blue;">`/webhooks/{id}`</mark>](#search-for-webhook-by-id)           | Return specified webhook by ID.                                                                                   |

### Search for webhooks

<mark style="color:green;">`GET`</mark> `/webhooks`

Return a list of webhooks the user can see. (Admins can see all webhooks; users can only see their own webhooks.)

#### Response schema

| Attribute            | Description                                                                                                                                    |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| **id**               | `integer` The ID of the webhook.                                                                                                               |
| **url**              | `string` URL for outbound webhook request.                                                                                                     |
| **name**             | `string` The webhook's name.                                                                                                                   |
| **global**           | `boolean` If `true`, you will receive all notifications even if they do not pertain to you.                                                    |
| **notificationType** | `array` A list of the notification types included in the webhook. [See the table above for a list of possible values](#webhook-notifications). |
| **createdBy**        | `integer` The ID of the user who created the webhook.                                                                                          |

#### Request example

The following request returns a list of webhooks the user can see.

```shell
curl \
    --request GET \
    --header "Authorization: Bearer dea464c07bd07300095caa8" \
    https://demo.immuta.com/webhooks
```

#### Response example

```json
{
  "id": 1,
  "name": "internal-automatic-subscription-webhook",
  "url": "/internal-webhook/automatic-subscription",
  "notificationType": [
    "groupUserAdded",
    "groupUserDeleted",
    "attributeAdded",
    "attributeRemoved",
    "attributeUpdated",
    "userDeleted",
    "userMigrated",
    "userCreated",
    "policyUpdated",
    "dataSourceUpdated",
    "modelCreated"
  ],
  "global": true,
  "createdBy": 1
}
```

### Search for notification actions

<mark style="color:green;">`GET`</mark> `/webhooks/actions`

Return a list of valid notification actions that a webhook can be triggered by.

#### Response schema

Returns the list of notifications that can trigger a webhook. See the [webhook notification table](#webhook-notifications) for descriptions.

#### Request example

The following request returns a list of valid notifications that can trigger a webhook.

```shell
curl \
    --request GET \
    --header "Authorization: Bearer dea464c07bd07300095caa8" \
    https://demo.immuta.com/webhooks/actions
```

#### Response example

See the [webhook notifications](#webhook-notifications) table for descriptions of these notifications.

```json
[
  "ALL_NOTIFICATIONS",
  "modelCreated",
  "modelDeleted",
  "modelCopied",
  "dataSourceUpdated",
  "dataSourceExpired",
  "dataSourceExpiring",
  "healthCheckFailed",
  "healthCheckResolved",
  "modelUserAdded",
  "modelUserDeleted",
  "modelUserJoined",
  "modelAccessRequested",
  "modelAccessApproved",
  "modelAccessRevoked",
  "modelAccessUpdated",
  "modelAccessDenied",
  "modelTagAdded",
  "modelTagRemoved",
  "projectUpdated",
  "projectEqualizationToggled",
  "projectEqualizationMemberNotInCompliance",
  "projectDisabled",
  "addedToProject",
  "removedFromProject",
  "deletedDatasourceRemovedFromProject",
  "expiredDatasourceRemovedFromProject",
  "nativeIntegrationValidationFailed",
  "policyUpdated",
  "queryCanceled",
  "firstQuery",
  "userCreated",
  "userDeleted",
  "userEnabled",
  "userCloned",
  "userDisabled",
  "userMigrated",
  "groupUserAdded",
  "groupUserDeleted",
  "userUpdated",
  "attributeUpdated",
  "attributeAdded",
  "attributeRemoved",
  "permissionsUpdated",
  "switchedCurrentProject",
  "usernameUpdated",
  "acknowledgedAccess",
  "purposeCreated",
  "purposeUpdated",
  "purposeDeleted",
  "tagCreated",
  "tagUpdated",
  "tagDeleted",
  "apiKeyRevoked",
  "conflictingGlobalPolicies",
  "globalPolicyCreated",
  "globalPolicyUpdated",
  "globalPolicyDeleted",
  "globalPolicyDisabled",
  "bulkJobStatus",
  "taskValidated",
  "taskDeleted",
  "certificationRequired",
  "policyCertificationExpired"
]
```

### Search for webhook records

<mark style="color:green;">`GET`</mark> `/webhooks/history`

Return historical records for webhook requests, including requests and responses.

#### Query parameters

| Attribute            | Description                                                                                            | Required |
| -------------------- | ------------------------------------------------------------------------------------------------------ | -------- |
| **offset**           | `integer` The number of records to skip for this query.                                                | No       |
| **pageSize**         | `integer` The number of records to return in this query. **The default is `20`**.                      | No       |
| **sortField**        | `string` The field to use for sorting. **The default is `createdAt`.**                                 | No       |
| **sortOrder**        | `string` The sort order to use. **The default is `desc`**.                                             | No       |
| **notificationType** | `string` If set will only return activities of this type.                                              | No       |
| **includeGlobal**    | `boolean` If `true`, global records will be included.                                                  | No       |
| **includeUser**      | `boolean` If `true`, personal webhooks will be returned for the given user. **The default is `true`**. | No       |
| **successOrFailure** | `string` If set will only retrieve records that were successful or failed.                             | No       |

#### Response schema

| Attribute   | Description                                      |
| ----------- | ------------------------------------------------ |
| **count**   | `integer` The number of results for the request. |
| **records** | `metadata` Details on each webhook result.       |

#### Request example

The following request returns historical records for webhook requests, including requests and responses.

```shell
curl \
    --request GET \
    --header "Authorization: Bearer dea464c07bd07300095caa8" \
    https://demo.immuta.com/webhooks/history?pageSize=20&includeUser=true
```

#### Response example

```json
{
  "count": "0",
  "records": []
}
```

### Search for webhook by ID

<mark style="color:green;">`GET`</mark> `/webhooks/{id}`

Return specified webhook by ID.

#### Query parameters

| Attribute | Description              | Required |
| --------- | ------------------------ | -------- |
| **id**    | `string` The webhook ID. | **Yes**  |

#### Response schema

| Attribute            | Description                                                                                                                                    |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| **id**               | `integer` The ID of the webhook.                                                                                                               |
| **url**              | `string` URL for outbound webhook request.                                                                                                     |
| **name**             | `string` The webhook's name.                                                                                                                   |
| **global**           | `boolean` If `true`, you will receive all notifications even if they do not pertain to you.                                                    |
| **notificationType** | `array` A list of the notification types included in the webhook. [See the table above for a list of possible values](#webhook-notifications). |
| **createdBy**        | `integer` The ID of the user who created the webhook.                                                                                          |

#### Request example

The following request returns details on the webhook with the ID `1`.

```shell
curl \
    --request GET \
    --header "Authorization: Bearer dea464c07bd07300095caa8" \
    https://demo.immuta.com/webhooks/1
```

#### Response example

```json
{
  "id": 1,
  "name": "internal-automatic-subscription-webhook",
  "url": "/internal-webhook/automatic-subscription",
  "notificationType": [
    "groupUserAdded",
    "groupUserDeleted",
    "attributeAdded",
    "attributeRemoved",
    "attributeUpdated",
    "userDeleted",
    "userMigrated",
    "userCreated",
    "policyUpdated",
    "dataSourceUpdated",
    "modelCreated"
  ],
  "global": true,
  "createdBy": 1
}
```

## Retry webhook by ID

<mark style="color:green;">`POST`</mark> `/webhooks/history/retry/{id}`

Retry webhook requests by history ID. This can be done against any history record, regardless of failure or success.

#### Query parameters

| Attribute | Description                                  | Required |
| --------- | -------------------------------------------- | -------- |
| **id**    | `integer` ID of the history record to retry. | **Yes**  |

#### Response schema

| Attribute              | Description                                                                                              |
| ---------------------- | -------------------------------------------------------------------------------------------------------- |
| **id**                 | `integer` The ID of the history record.                                                                  |
| **request**            | `array` Details on the request, including values for `test`, `metadata`, `webhookId`, and `webhookName`. |
| **response**           | `array` Details on the response.                                                                         |
| **statusCode**         | `integer` The status code for the webhook. *A value of `200` is successful.*                             |
| **notificationType**   | `string` The type of notification.                                                                       |
| **webhooksActivityId** | `integer` The ID for the activity.                                                                       |
| **createdAt**          | `timestamp` The date the webhook was created.                                                            |
| **updatedAt**          | `timestamp` The date the webhook was last updated.                                                       |

### Request example

The following request retries the webhook with the ID `1`.

```shell
curl \
    --request POST \
    --header "Authorization: Bearer dea464c07bd07300095caa8" \
    https://demo.immuta.com/webhooks/history/retry/1
```

### Response example

```json
{
  "id": 228,
  "request": {
    "text": "Katie has created the Public (https://demo.example.com/#/project/1) project. Please click here (https://demo.example.com/#/project/1) for additional information.",
    "metadata": {
      "modelId": 1,
      "actionBy": 2,
      "modelType": "project",
      "targetUser": 2,
      "projectName": "Public",
      "targetGroup": null,
      "actionByName": "Katie",
      "targetUserName": "Katie",
      "notifyInitiator": true,
      "notificationType": "modelCreated"
    },
    "webhookId": 1,
    "webhookName": "internal-automatic-subscription-webhook"
  },
  "response": {},
  "statusCode": 200,
  "notificationType": "modelCreated",
  "webhooksActivityId": 11,
  "createdAt": "2021-10-15T16:44:06.872Z",
  "updatedAt": "2021-10-15T16:44:06.872Z"
}
```

## Delete a webhook

<mark style="color:green;">`DELETE`</mark> `/webhooks/{id}`

Delete a webhook by ID.

#### Query parameters

| Attribute | Description               | Required |
| --------- | ------------------------- | -------- |
| **id**    | `integer` The webhook ID. | **Yes**  |

#### Response schema

| Attribute            | Description                                                                                                                                    |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| **id**               | `integer` The ID of the webhook.                                                                                                               |
| **url**              | `string` URL for outbound webhook request.                                                                                                     |
| **name**             | `string` The webhook's name.                                                                                                                   |
| **global**           | `boolean` If `true`, you will receive all notifications even if they do not pertain to you.                                                    |
| **notificationType** | `array` A list of the notification types included in the webhook. [See the table above for a list of possible values](#webhook-notifications). |
| **createdBy**        | `integer` The ID of the user who created the webhook.                                                                                          |
| **createdAt**        | `timestamp` The date and time the webhook was created.                                                                                         |
| **updatedAt**        | `timestamp` The date and time the webhook was last updated.                                                                                    |

### Request example

The following request deletes the webhook with the ID `1`.

```shell
curl \
    --request DELETE \
    --header "Authorization: Bearer dea464c07bd07300095caa8" \
    https://demo.immuta.com/webhooks/1
```

### Response example

```json
{
  "id": 1,
  "url": "/internal-webhook/automatic-subscription",
  "name": "internal-automatic-subscription-webhook",
  "global": true,
  "actionType": null,
  "createdBy": 1,
  "createdAt": "2021-06-24T15:08:58.906Z",
  "updatedAt": "2021-06-24T15:08:58.906Z"
}
```

## Troubleshooting

| statusCode | code                                                                     | Issue                  |
| ---------- | ------------------------------------------------------------------------ | ---------------------- |
| `500`      | [<mark style="color:blue;">`ESOCKETTIMEDOUT`</mark>](#timed-out-request) | The request timed out. |

### Timed out request

The webhook request took longer than Immuta allows for a response. The default is 10 seconds, but this can be configured from the [Apps Settings page](https://documentation.immuta.com/2024.3/application-settings/how-to-guides/config-builder-guide#advanced-configuration).

#### Request example

```shell
curl \
    --request GET \
    --header "Authorization: Bearer <TOKEN>" \
    https://demo.immuta.com/webhooks/history?pageSize=20&includeUser=true
```

#### Response example

```json
{
  "count": "1",
  "records": [
    {
      "id": 1,
      "request": {
        "text": "You have created the sheep man project. Please click here (http://immuta.demo.com/#/project/11) for additional information.",
        "metadata": {
          "modelId": 11,
          "actionBy": 1,
          "modelType": "project",
          "targetUser": 1,
          "projectName": "sheep man",
          "targetGroup": null,
          "actionByName": "Jane Doe",
          "targetUserName": "Jane Doe",
          "notificationType": "modelCreated"
        },
        "webhookId": 2,
        "webhookName": "webhook"
      },
      "response": {
        "body": {
          "code": "ESOCKETTIMEDOUT",
          "connect": false
        }
      },
      "statusCode": 500,
      "notificationType": "modelCreated",
      "webhooksActivityId": 15,
      "createdAt": "2022-06-01T17:05:34.001Z",
      "updatedAt": "2022-06-01T17:05:34.001Z",
      "webhooksId": 2,
      "url": "http://localhost:8080/webhook",
      "name": "webhook",
      "actionType": null,
      "createdBy": 1
    }
  ]
}
```

[^1]: This event can only occur in the approve to promote global policy workflow, which has been deprecated.
