> ## 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.

# Register a webhook endpoint

> Webhook registered. Keys are camelCase, matching the controller's WebhookConfig; the secret is stripped.

### Request body

`CreateWebhookRequest`

<ParamField body="url" type="string (uri)" required />

<ParamField body="events" type="string[]" required />

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

### Response

`object`

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

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

<ResponseField name="events" type="string" required>
  Either the literal '\*' or an array of subscribed event names
</ResponseField>

<ResponseField name="hasSecret" type="boolean" />

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

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

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

<ResponseField name="headers" type="object" />

<ResponseField name="retryCount" type="integer" required />

<ResponseField name="retryDelayMs" type="integer" required />

<ResponseField name="timeoutMs" type="integer" required />

<ResponseField name="createdAt" type="string (date-time)" required />

### Status codes

| Code  | Meaning                                                                                                  |
| ----- | -------------------------------------------------------------------------------------------------------- |
| `201` | Webhook registered. Keys are camelCase, matching the controller's WebhookConfig; the secret is stripped. |
| `400` | Invalid request                                                                                          |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.sandbox.stateset.app/api/v1/webhooks' \
    --header "Authorization: Bearer $STATESET_SANDBOX_API_KEY" \
    --header 'Content-Type: application/json' \
    --data '{
    "url": "https://example.com/webhooks/stateset",
    "events": [
      "string"
    ],
    "secret": "YOUR_API_KEY"
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "url": "https://example.com/webhooks/stateset",
    "events": "*",
    "hasSecret": true,
    "enabled": true,
    "orgId": "string",
    "sandboxId": "string",
    "headers": {},
    "retryCount": 1,
    "retryDelayMs": 1,
    "timeoutMs": 250,
    "createdAt": "2026-08-31T14:22:05Z"
  }
  ```
</ResponseExample>
