---
title: "Create Webhook"
url: "https://docs.yoagent.dev/reference/rest-api/operations/createwebhook"
---

# Create Webhook

POST

/v0/webhooks

```sh
curl -s -X POST "https://api.yoagent.dev/v0/webhooks" \
  -H "Authorization: Bearer $YOAGENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"project_id":"prj_01je56wqswfmn9pgbc1wq8tjgq","url":"https://ci.example.com/hooks/yoagent","event_types":["domain.verified"],"scope":"project","inbox_ids":[],"client_id":"ci-run-1842"}'
```

```js
const response = await fetch("https://api.yoagent.dev/v0/webhooks", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.YOAGENT_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "project_id": "prj_01je56wqswfmn9pgbc1wq8tjgq",
    "url": "https://ci.example.com/hooks/yoagent",
    "event_types": [
      "domain.verified"
    ],
    "scope": "project",
    "inbox_ids": [],
    "client_id": "ci-run-1842"
  }),
});
if (!response.ok) throw new Error(await response.text());
const data = await response.json();
```

```python
import os

import requests

response = requests.post(
    "https://api.yoagent.dev/v0/webhooks",
    headers={"Authorization": f"Bearer {os.environ['YOAGENT_KEY']}"},
    json={
        "project_id": "prj_01je56wqswfmn9pgbc1wq8tjgq",
        "url": "https://ci.example.com/hooks/yoagent",
        "event_types": [
            "domain.verified",
        ],
        "scope": "project",
        "inbox_ids": [],
        "client_id": "ci-run-1842",
    },
    timeout=60,
)
response.raise_for_status()
data = response.json()
```

- api.yoagent.dev/v0/webhooks

Subscribe a public https URL to events (`message.received`) of a project, of chosen inboxes, or only of mail that came through the catch-all.

## Authorizations

- **[ApiKey](https://docs.yoagent.dev/reference/rest-api#apikey)**

## Request Body required

application/json

_WebhookCreate_

Subscribe a URL to events of a project: of every inbox (`scope` `project`, the default), of chosen ones (`inboxes` with `inbox_ids`), or only mail that came through the catch-all (`catch_all`, a paid feature).

object

**project_id**

_Project Id_

The project; omitted: the first project, in the dashboard’s order, where the caller may create it.

Any of:

**string**

string

/^prj\_\[0-7]\[0-9a-hjkmnp-tv-z]{25}$/

**null**

null

**url**

required

_Url_

Where it POSTs the events: an `https` URL.

string format: uri

\>= 1 characters <= 2000 characters

**event_types**

_Event Types_

Which events it receives (only those its scope reaches: an event of the whole project, such as `domain.verified`, only with scope `project`); omitted: every type its scope reaches now.

Array\<string>

\>= 1 items

Allowed values: domain.verified message.bounced message.complained message.delivered message.received message.rejected message.sent message.unsubscribed

**scope**

_WebhookScope_

Whose mail it gets: every inbox’s (`project`), chosen ones’ (`inboxes`) or the catch-all’s (`catch_all`).

string

default: project

Allowed values: project inboxes catch_all

**inbox_ids**

_Inbox Ids_

The inboxes of scope `inboxes` (1 to 100); not given with another scope.

Array\<string>

default: <= 100 items

**client_id**

_Client Id_

Your idempotency key, one per organization: creating again with the same `client_id` returns the same webhook.

Any of:

**string**

string

\>= 1 characters <= 100 characters

**null**

null

## Responses

### 201

Successful Response

application/json

_WebhookOut_

A webhook; `secret` verifies the `webhook-signature` header (Standard Webhooks).

object

**version**

required

_Version_

Goes up by one on every change: of two copies, the one with the higher version is the newer.

integer

**webhook_id**

required

_Webhook Id_

string

/^whk\_\[0-7]\[0-9a-hjkmnp-tv-z]{25}$/

**project_id**

required

_Project Id_

string

/^prj\_\[0-7]\[0-9a-hjkmnp-tv-z]{25}$/

**url**

required

_Url_

Where it POSTs; whole (with its user and password, sent as Basic auth, its path and query) only to a caller who may create the project’s webhooks (`webhook_create`), like `secret`; to others its scheme, host and port.

string

**event_types**

required

_Event Types_

Array\<string>

Allowed values: domain.verified message.bounced message.complained message.delivered message.received message.rejected message.sent message.unsubscribed

**scope**

required

_WebhookScope_

What mail of its project a webhook receives.

string

Allowed values: project inboxes catch_all

**inboxes**

required

_Inboxes_

The inboxes of scope `inboxes` (empty once they are all deleted: it then receives nothing).

Array\<object>

_WebhookInboxOut_

An inbox a webhook is limited to.

object

**inbox_id**

required

_Inbox Id_

string

/^inb\_\[0-7]\[0-9a-hjkmnp-tv-z]{25}$/

**address**

required

_Address_

Null when the caller does not see the inbox; its local part may come from a sender (auto-create).

Any of:

**string**

string

**null**

null

**enabled**

required

_Enabled_

boolean

**disabled_reason**

required

`failing`: we paused it after its URL failed deliveries in a row (how many: the webhooks’ event docs); null when on or paused by a person.

Any of:

**DisabledReason**

_DisabledReason_

Why a webhook is paused by us rather than by a person.

string

Allowed values: failing

**null**

null

**client_id**

required

_Client Id_

Any of:

**string**

string

**null**

null

**secret**

required

_Secret_

Shown to a caller who may create the project’s webhooks (`webhook_create`); null for one who may only read them.

Any of:

**string**

string

**null**

null

**editable**

required

_Editable_

Whether the caller may pause it, turn it on and change it (`webhook_update` in its project).

boolean

**deletable**

required

_Deletable_

Whether the caller may delete it (`webhook_delete` in its project).

boolean

**created_at**

required

_Created At_

string format: date-time

#### Example

```json
{
  "version": 1,
  "webhook_id": "whk_01je56wqswfmn9pgbc1wq8tjgq",
  "project_id": "prj_01je56wqswfmn9pgbc1wq8tjgq",
  "url": "https://ci.example.com/hooks/yoagent",
  "event_types": [
    "domain.verified"
  ],
  "scope": "project",
  "inboxes": [],
  "enabled": true,
  "disabled_reason": null,
  "client_id": "ci-run-1842",
  "secret": "whsec_…",
  "editable": true,
  "deletable": true,
  "created_at": "2026-12-01T12:00:00Z"
}
```

### default

An error (400, 401, 403, 404, 405, 409, 413, 429, 500, 503), in the one shape every call answers: [Errors](https://docs.yoagent.dev/reference/conventions#errors).
