# Create a webhook

`POST /v1/webhooks`

The signing secret is returned exactly once, in this response. It is stored encrypted and cannot be retrieved again. To replace it, create a new webhook and delete this one.

**Price:** Free.

**Rate limit:** Counts as 1 request against your per-minute rate limit.

**MCP tool:** `create_webhook`, only on [MCP](/mcp) connections granted monitor or webhook access.

Requires an API key, sent as `Authorization: Bearer <key>`.

## Request

```bash
curl --request POST \
  --url https://api.weirapp.io/v1/webhooks \
  --header "Authorization: Bearer $WEIR_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{"name":"…","url":"https://example.com"}'
```

### Body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `name` | string | yes | 1–80 chars |
| `url` | string (uri) | yes | max 2048 chars |
| `events` | array of string | no | default `["monitor.result.created"]` |

## Response

The created webhook and its one-time signing secret.

### `201`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `data` | object | yes |  |
| `data.id` | string (uuid) | yes |  |
| `data.name` | string | yes |  |
| `data.url` | string | yes |  |
| `data.status` | string | yes | `active`, `disabled` |
| `data.events` | array of string | yes |  |
| `data.failureCount` | integer | yes | min 0 |
| `data.disabledAt` | string or null | yes |  |
| `data.createdAt` | string (date-time) | yes |  |
| `data.updatedAt` | string (date-time) | yes |  |
| `data.secret` | string | yes | Shown once. Store it now; it cannot be recovered. |
| `meta` | object | yes |  |
| `meta.requestId` | string | yes |  |

## Errors

| Status | Meaning | What to do |
| --- | --- | --- |
| `400` | The request failed validation, or the URL is not a permitted destination. | The request was malformed. The `details` object names the field. |
| `401` | The API key is missing, malformed, expired, or revoked. | The key is missing, malformed, revoked, or expired. |
| `402` | The account is out of credit. Not retryable: this cannot clear until the billing period resets or the plan changes. | Out of credits. **Never retry.** Only a person can clear it, by adding credits at https://weirapp.io/dashboard/billing. Retrying never will. |
| `403` | The API key does not carry the scope this route requires. | The key is valid but lacks the scope this operation needs. |
| `409` | The tier's webhook limit was reached. `details.limit` is the ceiling. | The request conflicts with the current state of the resource. |
| `429` | The per-minute rate limit is exhausted. Retryable: wait for Retry-After and try again. | Rate limited. Retryable: wait for `Retry-After`, then try again. |
| `500` | An unexpected error occurred. | Something failed on our side. Retryable with backoff. |
