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

# Webhook Configuration

> How to configure webhooks for event notifications.

## Webhook Configuration

**Endpoint**: `POST /api/v1/webhooks`

**Purpose**: Register a webhook URL to receive event notifications from Enigma AI.

**Request Body** (JSON):

```json theme={null}
{
  "url": "https://example.com/webhook",
  "events": ["resource.created", "resource.updated", "message.sent"]
}
```

**Headers**:

* `Authorization: Bearer <API_KEY>`
* `Content-Type: application/json`

**Response**:

* `201 Created` – Webhook successfully registered.
* Body:

```json theme={null}
{
  "id": "uuid",
  "url": "https://example.com/webhook",
  "events": ["resource.created", "resource.updated", "message.sent"],
  "secret": "random-generated-secret"
}
```

**Verification**: Enigma AI will send a `GET` request with a challenge parameter to verify ownership of the URL.

**Security**: Each webhook request includes an `X-Signature` header containing an HMAC SHA256 signature of the request body using the secret provided during registration.

**Error Cases**:

* `400 Bad Request` – Invalid payload.
* `401 Unauthorized` – Missing or invalid API key.
* `409 Conflict` – Webhook URL already registered.

**Authentication**: API key in `Authorization` header.

**Permissions**: Requires `webhook:create` scope.
