### Create a webhook endpoint

`POST /api/v1/admin/webhooks/endpoints`

Registers a URL and the events it should receive. Set all_events to subscribe to everything, present and future, instead of naming keys.

- Authentication: manager session (JWT) or API token
- Permission: `prm_notifications_manage` (Manage notification channels & templates)
- Risk: write
- Rate limit bucket: `t_mutate`

#### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `name` | body | string | yes | A label for the endpoint. |
| `url` | body | string | yes | Where deliveries are POSTed. Validated on save. |
| `events` | body | array | no | Event keys from the catalogue. Ignored when all_events is true. |
| `all_events` | body | boolean | no | Subscribe to every event, including ones added in later releases. |
| `enabled` | body | boolean | no | Defaults to true on create. |

#### Request

```json
{
  "name": "billing-sync",
  "url": "https://hooks.acme.example/xradius",
  "events": ["user.created", "user.disconnected"],
  "all_events": false,
  "enabled": true
}
```

#### Errors

| Code | Status | When |
| --- | --- | --- |
| `ERR_VALIDATION` | 400 | an unknown event key, or a URL that does not validate |
| `ERR_CONFLICT` | 409 | the licensed endpoint ceiling is reached |

#### Note

Answers 200, not 201, despite creating a record. Do not gate your client on the status code here.

