---
title: "Create a webhook"
slug: "create-a-webhook"
abstract: "Create and enable a webhook to start immediately forwarding audit logs from SitecoreCommon Audit Log to the webhook target URL."
---
# Create a webhook

`POST /api/v1/eventConfigurations`

Creates a webhook.

In the request body, you can enable the webhook by setting the value for `enabled` to `true`. When you enable the webhook, Sitecore Common Audit Log will immediately start forwarding all audit logs to the webhook target URL.

You must provide the following required attributes in the request body:

| Attribute | Type | Description | Example(s) |
| --- | --- | --- | --- |
| `space` | string | For logged activities in Sitecore CDP, Sitecore Connect, and Sitecore Personalize, set this value to `"Production"`.<br><br>For [logged activities in the Sitecore Cloud Portal](https://doc.sitecore.com/portal/en/developers/sitecore-cloud-portal/sitecore-common-audit-log/webhook-rest-api/logged-activities-in-the-sitecore-cloud-portal.html), set this value to `"prod"`.<br><br>> [!note]<br>> To send events from CDP, Connect, Personalize, and the Cloud Portal to a single endpoint, create two webhooks with the same webhook target URL. | <ul><li>`"Production"`</li><li>`"prod"`</li></ul> |
| `sourceSystem.$type` | string | The Sitecore digital experience platform (DXP) app to forward logs from.<br><br>You must set this value to `"AnySource"`, which means that logs from all apps will be forwarded. | `"AnySource"` |
| `destinationSystem.$type` | string | The type of the system that logs will be forwarded to.<br><br>You must set this value to `"Webhook"`. | `"Webhook"` |
| `destinationSystem.secret` | string | A secret you define, automatically passed in the `X-Secret` request header. To authenticate incoming webhook calls, your target application must verify this secret. | `"mys3cr3tstr1ingforauth1!x"` |
| `destinationSystem.targetUrl` | string | The webhook target URL. This is the URL that logs will be forwarded to. | `"https://www.exampletarget.url/example-endpoint"` |
| `eventName` | string | The internal event name of when a webhook is created.<br><br>You must set this value to `"sitecore.backbone.messages.audit.created"`. | `"sitecore.backbone.messages.audit.created"` |
| `enabled` | boolean | Determines whether the webhook is enabled or disabled at creation time.<br><br>When enabled, logs will immediately start being forwarded to the webhook target URL.<br><br>To change this after creating the webhook, see [Disable a webhook](https://doc.sitecore.com/portal/en/developers/sitecore-cloud-portal/sitecore-common-audit-log/webhook-rest-api/disable-a-webhook.html) and [Enable a webhook](https://doc.sitecore.com/portal/en/developers/sitecore-cloud-portal/sitecore-common-audit-log/webhook-rest-api/enable-a-webhook.html). | `true` or `false` |

In the response, in the object in the `events` array, the `id` key contains the webhook ID. You use the webhook ID to, for example, [retrieve](https://doc.sitecore.com/portal/en/developers/sitecore-cloud-portal/sitecore-common-audit-log/webhook-rest-api/retrieve-a-webhook.html "Retrieve a webhook") or [update](https://doc.sitecore.com/portal/en/developers/sitecore-cloud-portal/sitecore-common-audit-log/webhook-rest-api/update-a-webhook.html "Update a webhook") the webhook.

```curl
curl -X POST '<baseURL>/api/v1/eventConfigurations' \
-H 'Authorization: Bearer <bearerToken>' \
-H 'Accept: application/json' \
--data-raw '
{
  "space": "Development",
  "sourceSystem": {
    "$type": "AnySource"
  },
  "destinationSystem": {
    "$type": "Webhook",
    "secret": "<secret>",
    "targetUrl": "https://www.exampletartget.url/example-endpoint"
  },
  "eventName": "sitecore.backbone.messages.audit.created",
  "enabled": true
}'

```

```json
{
  "events": [
    {
      "id": "7050346545d5447da57b64be6416ac78",
      "enabled": true,
      "name": "sitecore.backbone.messages.audit.created",
      "description": null
    }
  ]
}

```