# Create a webhook (native event names)

> Creates a webhook with native event names (email.queued, email.deferred, email.unsubscribed, email.canceled, domain.status_changed, account.status_changed, …). An empty events list subscribes to…

Source: https://docs.pidgely.com/api-reference/v1/webhooks/create/

`POST https://api.pidgely.com/v1/webhooks`

Creates a webhook with **native** event names (`email.queued`, `email.deferred`, `email.unsubscribed`, `email.canceled`, `domain.status_changed`, `account.status_changed`, …). An empty `events` list subscribes to every event. See [Webhooks](https://docs.pidgely.com/guides/webhooks/#native-events).

**Authorization:** `Bearer pdg_…`. An API key with the `full` scope.

## Body parameters

JSON object.

| Name | Type | Required | Description |
|---|---|---|---|
| `url` | string | Yes | Public `https` URL that receives the events. |
| `events` | string[] | No | Event types to subscribe to, for example `email.delivered`. See [Webhooks](https://docs.pidgely.com/guides/webhooks/#events). |

## Request

```bash tab="cURL"
curl -X POST 'https://api.pidgely.com/v1/webhooks' \
  -H "Authorization: Bearer $PIDGELY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "url": "https://acme.com/webhooks/pidgely",
  "events": [
    "email.delivered",
    "email.bounced"
  ]
}'
```

## Response

`201 Created` with a JSON object.

## Errors

Native routes return `{"error": {"code", "message", "field", "request_id"}}`. See [Errors](https://docs.pidgely.com/errors/#native-api-errors).

| Status | Code | When |
|---|---|---|
| 401 | `missing_api_key` | No `Authorization: Bearer` header. |
| 403 | `invalid_api_key`, `insufficient_scope` | The key is invalid or lacks the scope. |
| 404 | `not_found` | The resource does not exist in this account. |
| 422 | `validation_error` | A field is missing or invalid; `field` names it. |
| 429 | `rate_limited`, `daily_quota_exceeded` | Too many requests, or the quota is used up. |
