> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a webhook handler

> **Required scope:** write

**Required scope:** `write`

### Request body

`CreateWebhookRequest`

<ParamField body="description" type="string" />

<ParamField body="events" type="string[]" required>
  Event slugs to subscribe to. Use `['*']` for all events.
</ParamField>

<ParamField body="url" type="string" required />

### Response

`CreateWebhookResponse`

<ResponseField name="created_at" type="string" required />

<ResponseField name="description" type="string" />

<ResponseField name="events" type="string[]" required />

<ResponseField name="id" type="string" required />

<ResponseField name="is_active" type="boolean" required />

<ResponseField name="secret_shown_once" type="boolean" required>
  Redaction warning — this full secret is shown ONLY at creation.
</ResponseField>

<ResponseField name="signing_secret" type="string" required />

<ResponseField name="url" type="string" required />

### Status codes

| Code  | Meaning                                            |
| ----- | -------------------------------------------------- |
| `201` | Endpoint registered; signing secret returned ONCE  |
| `400` | Invalid URL or events                              |
| `401` | Unauthorized                                       |
| `403` | Forbidden — the key/token lacks the required scope |
| `429` | Rate limited — see Retry-After / X-RateLimit-Reset |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.nsr.stateset.com/api/v1/webhooks' \
    --header "X-API-Key: $STATESET_NSR_API_KEY" \
    --header 'Content-Type: application/json' \
    --data '{
    "description": "Two-person tent, green — replacement for damaged pole set.",
    "events": [
      "string"
    ],
    "url": "https://example.com/webhooks/stateset"
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "created_at": "2026-08-31T14:22:05Z",
    "description": "Two-person tent, green — replacement for damaged pole set.",
    "events": [
      "string"
    ],
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "is_active": true,
    "secret_shown_once": true,
    "signing_secret": "YOUR_API_KEY",
    "url": "https://example.com/webhooks/stateset"
  }
  ```
</ResponseExample>
