# Create a webhook subscription

Source: https://docs.vlayers.ai/reference/webhooks/create-webhook-subscription

`POST /v1/webhooks/subscriptions` · scope `webhooks:manage`

Registers an HTTPS endpoint to receive events. The response includes the signing `secret` — the only time you see it. Store it and use it to verify each delivery's `x-voicelayer-signature` header.

Requires an API key with the `webhooks:manage` scope.

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `url` | body | string | yes | Your public HTTPS endpoint. |
| `eventTypes` | body | string[] | no | Exact event types or a prefix with `.*` (`message.*`). Leave it empty to receive every type. |
| `description` | body | string | no | A label for you, up to 500 characters. |

## Request

cURL:

```bash
curl -X POST https://api.vlayers.ai/v1/webhooks/subscriptions \
  -H "Authorization: Bearer $VOICELAYER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/voicelayer/webhooks",
    "eventTypes": [
      "message.*",
      "conversation.*"
    ]
  }'
```

TypeScript:

```ts
import { createVoiceLayerClient, createWebhookSubscription } from '@voicelayer/api';

const client = createVoiceLayerClient({ apiKey: process.env.VOICELAYER_API_KEY!, throwOnError: true });

const { data } = await createWebhookSubscription({
  client,
  body: {
    url: 'https://example.com/voicelayer/webhooks',
    eventTypes: ['message.*', 'conversation.*']
  }
});
console.log(data.subscription.secret);
```

Python:

```python
import os
import voicelayer

config = voicelayer.Configuration(access_token=os.environ["VOICELAYER_API_KEY"])
with voicelayer.ApiClient(config) as client:
    api = voicelayer.WebhooksApi(client)
    result = api.create_webhook_subscription(
        create_webhook_subscription_request=voicelayer.CreateWebhookSubscriptionRequest.from_dict({
            "url": "https://example.com/voicelayer/webhooks",
            "eventTypes": ["message.*", "conversation.*"],
        }),
    )
    print(result.subscription.secret)
```

## Response `201`

```json
{
  "subscription": {
    "id": "0192f5a7-3c4d-7e5f-8a6b-7c8d9e0f1a23",
    "projectId": "0192f5a1-5e6f-7a7b-8c8d-9e0f1a2b3c45",
    "url": "https://example.com/voicelayer/webhooks",
    "eventTypes": [
      "message.*",
      "conversation.*"
    ],
    "description": "Production receiver",
    "enabled": true,
    "createdByKeyId": "key_7f2a91",
    "restrictTags": [],
    "createdAt": "2026-10-20T15:04:05.000Z",
    "updatedAt": "2026-10-20T15:04:05.000Z",
    "secret": "<shown only in this response>"
  }
}
```
