# Create webhook

> Register a URL for events and get its signing secret, once.

Canonical: <https://www.tryadeli.com/docs/api/webhooks/create-webhook>

`POST https://app.tryadeli.com/api/v1/webhooks`

Authorization: `Bearer <API key>` — see [Authentication](https://www.tryadeli.com/docs/authentication)

Register a URL for a profile's events. The response holds the signing secret,
**the only time it is shown**: store it, and use it to
[verify every delivery](https://www.tryadeli.com/docs/api/webhooks#verifying-signatures).

**Body**

| Name        | Type       | Required | Description                                                                                                    |
| ----------- | ---------- | -------- | -------------------------------------------------------------------------------------------------------------- |
| `profileId` | `uuid`     | Yes      | The profile whose accounts' events to send.                                                                    |
| `url`       | `string`   | Yes      | An `https` URL, or `http://localhost` or `http://127.0.0.1` for local development. No credentials or fragment. |
| `events`    | `string[]` | Yes      | One or more of `comment.created` and `message.postback`.                                                       |

Returns `201` with `{ webhook, secret }`.

**Errors** — `401 unauthorized`, `400 invalid_request`, `404 profile_not_found`.

## Request examples

**cURL**

```bash
curl -X POST "https://app.tryadeli.com/api/v1/webhooks" \
  -H "Authorization: Bearer $ADELI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "profileId": "00000000-0000-4000-8000-000000000001",
  "url": "https://example.com/webhooks/adeli",
  "events": [
    "comment.created",
    "message.postback"
  ]
}'
```

**JavaScript**

```javascript
const response = await fetch("https://app.tryadeli.com/api/v1/webhooks", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ADELI_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    profileId: "00000000-0000-4000-8000-000000000001",
    url: "https://example.com/webhooks/adeli",
    events: [
      "comment.created",
      "message.postback",
    ],
  }),
});
console.log(await response.json());
```

**Python**

```python
import os

import requests

response = requests.post(
    "https://app.tryadeli.com/api/v1/webhooks",
    headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"},
    json={
        "profileId": "00000000-0000-4000-8000-000000000001",
        "url": "https://example.com/webhooks/adeli",
        "events": [
            "comment.created",
            "message.postback",
        ],
    },
)
print(response.json())
```

## Responses

### 201

```json
{
  "webhook": {
    "id": "00000000-0000-4000-8000-000000000009",
    "profileId": "00000000-0000-4000-8000-000000000001",
    "url": "https://example.com/webhooks/adeli",
    "events": ["comment.created", "message.postback"],
    "status": "active",
    "createdAt": "2026-10-27T21:30:00.000Z"
  },
  "secret": "whsec_4Jx0m2v8QyRZbq1hT6nUWc3kLp9sAdEf7GiHoNrVtYz"
}
```

### 400

```json
{
  "error": {
    "code": "invalid_request",
    "message": "Invalid webhook"
  }
}
```
