---
title: "Create a webhook endpoint"
canonical: "https://bird.com/docs/api/reference/create-webhook"
---

# Create a webhook endpoint

`POST /v1/webhooks`

Registers an `active` webhook endpoint that receives the event types in `events` as signed HTTPS `POST` requests. The call stores the endpoint, subscribes it to each event type, generates its signing secret and, for a connector destination, stores a connection holding the credentials supplied. Nothing is sent when the endpoint is created; deliveries start with the next matching event. See the [webhooks guide](/docs/guides/webhooks) for delivery, signing, and retry behavior.

The `201` response is the only response that includes the signing secret (`whsec_` prefix). Store it immediately; if it is lost, [rotate the signing secret](/docs/api/reference/rotate-webhook-secret).

A non-HTTPS or non-public `url`, an unknown event type, or exceeding the organization's endpoint limit returns `422`.

Creating a connector endpoint does not contact its platform. `next` suggests [testing the endpoint](/docs/api/reference/test-webhook), which checks its fields with the platform.

## Servers

- `https://{region}.platform.bird.com`: Regional API endpoint. Use the host for the region your organization is hosted in. Official Bird SDKs and the CLI select it automatically from your API key, so you rarely need to set it by hand.
  - `region`: `us1`, `eu1`. Default: `us1`. The region your organization's data is hosted in.

## Authentication

Use one authentication option:

- `BearerAuth`: HTTP bearer authentication. Pass the API key as a bearer token in the `Authorization` header. Workspace
keys use `bk_{region}_*`; organization master keys use `bm_{region}_*`.
The prefix identifies the region and selects the
API endpoint. Official Bird SDKs and the CLI derive the region from the key.

## Code samples

**TypeScript**

```ts
const created = await bird.webhooks.create({
  url: "https://acme.com/hooks/bird",
  events: ["email.delivered", "email.bounced"],
  description: "Delivery pipeline",
});
console.log(created.id, created.secret);
```

Examples: [TypeScript](/docs/api/reference/create-webhook.ts.md) · [Python](/docs/api/reference/create-webhook.py.md) · [Go](/docs/api/reference/create-webhook.go.md) · [PHP](/docs/api/reference/create-webhook.php.md) · [CLI](/docs/api/reference/create-webhook.cli.md) · [MCP](/docs/api/reference/create-webhook.mcp.md) · [cURL](/docs/api/reference/create-webhook.curl.md)

## Example response `201`

```json
{
  "id": "whk_01krdgeqcxet5s7t44vh8rt9mg",
  "url": "https://example.com/webhook",
  "description": "Production webhook endpoint",
  "filter": null,
  "events": [
    "email.delivered",
    "email.bounced"
  ],
  "status": "active",
  "destination": {
    "type": "webhook"
  },
  "next": [
    {
      "kind": "operation"
    }
  ],
  "created_at": "2026-05-20T09:14:52Z",
  "updated_at": "2026-05-25T16:42:01Z",
  "secret": "whsec_base64encodedvalue"
}
```

## Header parameters

- `Idempotency-Key` (string, optional)

  Client-supplied key. On operations supporting request deduplication, a retained
  response is replayed for duplicate requests with the same key within the
  idempotency window (3 hours by default). This protection requires a workspace,
  organization, or staff-account scope. User-only and unscoped unauthenticated operations,
  streams, and operations with a separate replay contract do not use this
  response replay.

  On a supported operation, if idempotency protection is unavailable before execution, the API returns
  `503 IdempotencyUnavailable` (E01033) without executing this attempt. Retry with
  backoff using the same key and request. An operation that takes effect before
  its response is retained can still execute again on retry.

  Two distinct 409 errors signal misuse:

  - `request_in_progress` (E01004): The same key is currently being
    processed by a concurrent request. Wait briefly and retry. The lock expires within 30 seconds.
  - `idempotency_key_reuse` (E01005): The same key has already completed
    against a different request body or method. Generate a new key.

  Recommended key format is `<event-type>/<entity-id>` (for example `welcome-user/usr_abc123`).
- `X-Workspace-Id` (string, optional): Workspace context for the request. Required for dashboard authentication and master keys. Workspace keys and access tokens already identify their workspace; send that workspace or omit the header. A different one is rejected.
- `X-Organization-Id` (string, optional): Organization context for the request. Required for dashboard authentication. An API key or access token carries its own organization, so send either that organization or no header at all; a different one is rejected.

## Request body

- `url` (string): HTTPS URL to deliver events to, at most 2048 characters. The host must be publicly reachable: URLs on private, loopback, or link-local addresses are rejected with a `422`. Required unless `destination` is a connector, whose URL comes from the connector and its `config`; a URL given with one must equal it.
- `filter` (object): Limit delivery to one mailbox and only email_mailbox events. Omit to include all resources.
- `filter.mailbox_id` (string, required): Mailbox to receive events for. Must belong to this workspace; a mailbox outside it returns `422`.
- `events` (array of string, required): Event types to subscribe to; the endpoint receives only matching events. Types outside the event catalog return a `422`, and an endpoint holds at most 100 entries.
- `description` (string): Human-readable label for this endpoint, up to 256 characters.
- `destination` (object): How each delivery is built. Omit to post the signed event to `url` unchanged, the same as `{"type": "webhook"}`.
  - Variant `webhook`: Posts the signed event to the endpoint's `url` unchanged.
    - `destination.type` (string, required): Value: `webhook`
  - Variant `connector`: Sends the request a connector action builds, with credentials stored for this endpoint.
    - `destination.type` (string, required): Value: `connector`
    - `destination.connector` (object, required): The connector to deliver through and the values it needs. Omit the endpoint's `url`: Bird builds it from the connector's URL and these `config` values, and a URL given anyway must equal that. The credentials belong to this endpoint alone, and deleting the endpoint erases them.
    - `destination.connector.connector_id` (string, required): The connector to deliver through; [Webhook connectors](/docs/ai/webhook-connectors) lists each one's fields, accepted events and platform setup.
    - `destination.connector.action` (string): Action of the connector that each delivery runs. Omit when the connector has one action. An action the connector does not have, or `events` the action does not accept, returns a `422`.
    - `destination.connector.credentials` (object, required): Values for the connector's secret fields, keyed by field `name`. Every required secret field must be present, after merging with the stored values on an update, and a key the connector does not declare as secret returns a `422`. No response includes these values.
    - `destination.connector.config` (object): Values for the connector's nonsecret fields, keyed by field `name`, such as the URL the endpoint's requests go to. A URL must be HTTPS, on one of the connector's `allowed_origins`, and under its `path_prefix` when it has one. It cannot include user info, a fragment, an IP address as its host, dot segments, or encoded slashes.

## Response body

- `id` (string, required): Unique identifier for the endpoint (`whk_` prefix). Accepted as `webhook_id` by every `/v1/webhooks/{webhook_id}` operation.
- `url` (string, required): HTTPS URL where the API delivers events for this endpoint.
- `description` (string): Human-readable label for the endpoint.
- `filter` (nullable object, required): Mailbox scope configured through filter, or null.
- `filter.mailbox_id` (string, required): Mailbox to receive events for. Must belong to this workspace; a mailbox outside it returns `422`.
- `events` (array of string, required): Event types this endpoint is subscribed to; only matching events are delivered. Change the set with [Update a webhook endpoint](/docs/api/reference/update-webhook).
- `status` (string, required)

  Delivery state of the endpoint.

  - `active`: The initial state; events are being delivered normally.
  - `degraded`: Recent deliveries are failing. We keep delivering and retrying,
    and the endpoint returns to `active` automatically once deliveries succeed
    again.
  - `paused`: All delivery is stopped, either because an update set `status` to
    `paused` or automatically after sustained delivery failures. A paused endpoint
    never resumes on its own: re-enable it with
    [Update a webhook endpoint](/docs/api/reference/update-webhook), then
    [Replay failed deliveries](/docs/api/reference/create-webhook-replay) to
    recover the deliveries that failed before the pause. Events that arrived
    while it was paused were never attempted, so a replay does not reach them.

  Possible values: `active`, `degraded`, `paused`
- `destination` (object): How each delivery to the endpoint is built.
  - Variant `webhook`: Posts the signed event to the endpoint's `url` unchanged.
    - `destination.type` (string, required): Value: `webhook`
  - Variant `connector`: Sends the request a connector action builds, with the credentials stored for this endpoint. The endpoint's URL comes from its connector setup, so updating the endpoint with a `url` returns a `422`.
    - `destination.type` (string, required): Value: `connector`
    - `destination.connector` (object, required)
    - `destination.connector.connector_id` (string, required): Stable identifier of a connector, such as `claude_managed_agents`.
    - `destination.connector.action` (string, required): Action of the connector that each delivery runs.
    - `destination.connector.connection_name` (string, required): Label of the credentials the endpoint delivers with.
    - `destination.connector.config` (object): The connector's nonsecret fields as the endpoint delivers with them. Secret fields are never returned.
- `next` (array of object): What to do next with this endpoint. The responses that create or update a connector endpoint suggest testing it, which checks its fields with the connected platform. Other responses that return one endpoint return an empty list, and lists omit it.
- `next.kind` (string, required)

  What you do about this step.

  - `operation`: call the operation named in `operation`, then
    read again.
  - `external`: act somewhere this API does not reach, then read
    again.
  - `wait`: nothing is asked of you, so read again later.
  - `terminal`: nothing you do resolves this, so stop retrying.

  Tolerate a value you do not recognize: show the `description` and
  offer no action.

  Possible values (may grow over time): `operation`, `external`, `wait`, `terminal`
- `next.description` (string, required): A short, human-readable label for the step, suitable for display.
- `next.operation` (string): The operationId to call. Present only when `kind` is `operation`. The operation's own schema says how to call it; this says only which one, and what to address it with.
- `next.params` (object): The parameters that address the operation, by name: `{"sender_id": "…"}` for an operation on `/v1/sms/senders/{sender_id}/requirements`. A parameter the operation takes in its query string is given the same way, so an operation addressed as `?subject_id=` carries `{"subject_id": "…"}`. Every parameter the call needs is here, whether its value came from the thing you were acting on or is fixed for this step, so you can make the call from this object alone. Present only when `kind` is `operation` and the operation names a subject. A request body, when the operation takes one, is described by the operation's own schema and never appears here.
- `next.url` (string): A URL to open. Present only when `kind` is `external`, and only when the step has one. An external step whose `description` says to go and do something with no URL to open is normal.
- `created_at` (string, required)
- `updated_at` (string, required)
- `secret` (string, required): Signing secret for this endpoint (`whsec_` prefix), used to verify every delivery signature. Present in this response only: store it immediately, it cannot be retrieved again. If you lose it, mint a new one with [Rotate webhook signing secret](/docs/api/reference/rotate-webhook-secret).

## Related resources

- [Webhooks done right: reliable delivery events](/learn/basics/webhooks-done-right-reliable-delivery-events) (video)
- [How do I verify a webhook signature?](/explained/platform/how-do-i-verify-a-webhook-signature) (answer)
- [Operate messaging reliably](/learn/paths/reliability) (course)

[Get an implementation brief](/learn/workspace?topic=webhooks)
