# Webhooks

Endpoints that receive signed events from activQC.

Paths start at `$ACTIVQC_BASE_URL`, and every call sends `Authorization: Bearer $ACTIVQC_KEY`. Errors use the [error envelope](https://activqc.wavbee.com/docs/errors.md). [All endpoints](https://activqc.wavbee.com/docs/api-reference.md).

## GET /v1/webhook_endpoints

List webhook endpoints.

**Auth:** a secret key, `Authorization: Bearer $ACTIVQC_KEY`.

#### Example request

```bash
curl -s "$ACTIVQC_BASE_URL/v1/webhook_endpoints" \
  -H "Authorization: Bearer $ACTIVQC_KEY"
```

#### Responses

| Status | Meaning |
|---|---|
| `200` | Endpoints (never including the signing secret) |

## POST /v1/webhook_endpoints

Register a webhook endpoint.

**Auth:** a secret key, `Authorization: Bearer $ACTIVQC_KEY`.

Send an `Idempotency-Key` header (a new UUID per operation; a retry reuses it).

#### Parameters

| Name | In | Type | Description |
|---|---|---|---|
| `Idempotency-Key` | header | string | **Required.** A unique string per operation, for example a UUID. A retry with the same key returns the first answer. Missing: 422. |

#### Request body

`application/json`.

| Field | Type | Description |
|---|---|---|
| `url` | string | Example `https://app.tenant.example/hooks/wavbee-qc`. |
| `enabled_events` | array of string |  |
| `mode` | string | `live` or `test`: the kind of the key that makes it, which is also what it is when left out. |

#### Example request

```bash
curl -s -X POST "$ACTIVQC_BASE_URL/v1/webhook_endpoints" \
  -H "Authorization: Bearer $ACTIVQC_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://app.tenant.example/hooks/wavbee-qc"
}'
```

#### Responses

| Status | Meaning |
|---|---|
| `201` | Endpoint registered; the signing secret is returned exactly once. |
| `422` | Url is not https, or does not resolve publicly. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |

#### Response `201`

| Field | Type | Description |
|---|---|---|
| `id` | integer | **Required.** Example `12`. |
| `url` | string | **Required.** Example `https://app.tenant.example/hooks/wavbee-qc`. |
| `status` | string | **Required.** One of `enabled`, `disabled`. |
| `enabled_events` | array of string | **Required.** Empty means every event type. |
| `secret_last4` | string or null |  |
| `signing_secret` | string or null | Shown exactly once, at creation and rotation. |
| `livemode` | boolean |  |
| `mode` | string | Which events it hears. `both` is an endpoint made before endpoints chose; choose one for it in the console. One of `live`, `test`, `both`. |
| `last_success_at` | string (date-time) or null |  |
| `consecutive_failures` | integer |  |

```json
{
  "id": 12,
  "url": "https://app.tenant.example/hooks/wavbee-qc",
  "status": "enabled",
  "enabled_events": [
    "string"
  ],
  "secret_last4": "string",
  "signing_secret": "string",
  "livemode": false,
  "mode": "live",
  "last_success_at": "2026-11-24T10:00:00Z",
  "consecutive_failures": 1
}
```

## GET /v1/webhook_endpoints/{id}

Fetch a webhook endpoint.

**Auth:** a secret key, `Authorization: Bearer $ACTIVQC_KEY`.

#### Parameters

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | integer | **Required.** |

#### Example request

```bash
curl -s "$ACTIVQC_BASE_URL/v1/webhook_endpoints/{id}" \
  -H "Authorization: Bearer $ACTIVQC_KEY"
```

#### Responses

| Status | Meaning |
|---|---|
| `200` | Endpoint. |
| `404` | Belongs to another tenant. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |

#### Response `200`

| Field | Type | Description |
|---|---|---|
| `id` | integer | **Required.** Example `12`. |
| `url` | string | **Required.** Example `https://app.tenant.example/hooks/wavbee-qc`. |
| `status` | string | **Required.** One of `enabled`, `disabled`. |
| `enabled_events` | array of string | **Required.** Empty means every event type. |
| `secret_last4` | string or null |  |
| `signing_secret` | string or null | Shown exactly once, at creation and rotation. |
| `livemode` | boolean |  |
| `mode` | string | Which events it hears. `both` is an endpoint made before endpoints chose; choose one for it in the console. One of `live`, `test`, `both`. |
| `last_success_at` | string (date-time) or null |  |
| `consecutive_failures` | integer |  |

```json
{
  "id": 12,
  "url": "https://app.tenant.example/hooks/wavbee-qc",
  "status": "enabled",
  "enabled_events": [
    "string"
  ],
  "secret_last4": "string",
  "signing_secret": "string",
  "livemode": false,
  "mode": "live",
  "last_success_at": "2026-11-24T10:00:00Z",
  "consecutive_failures": 1
}
```

## DELETE /v1/webhook_endpoints/{id}

Delete or disable a webhook endpoint.

**Auth:** a secret key, `Authorization: Bearer $ACTIVQC_KEY`.

#### Parameters

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | integer | **Required.** |

#### Example request

```bash
curl -s -X DELETE "$ACTIVQC_BASE_URL/v1/webhook_endpoints/{id}" \
  -H "Authorization: Bearer $ACTIVQC_KEY"
```

#### Responses

| Status | Meaning |
|---|---|
| `200` | Deleted when it has no delivery history, disabled when it does. |

## POST /v1/webhook_endpoints/{id}/rotate_secret

Rotate the signing secret.

**Auth:** a secret key, `Authorization: Bearer $ACTIVQC_KEY`.

#### Parameters

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | integer | **Required.** |

#### Example request

```bash
curl -s -X POST "$ACTIVQC_BASE_URL/v1/webhook_endpoints/{id}/rotate_secret" \
  -H "Authorization: Bearer $ACTIVQC_KEY"
```

#### Responses

| Status | Meaning |
|---|---|
| `200` | New secret returned once; the previous one keeps signing until the window closes. |

#### Response `200`

| Field | Type | Description |
|---|---|---|
| `id` | integer | **Required.** Example `12`. |
| `url` | string | **Required.** Example `https://app.tenant.example/hooks/wavbee-qc`. |
| `status` | string | **Required.** One of `enabled`, `disabled`. |
| `enabled_events` | array of string | **Required.** Empty means every event type. |
| `secret_last4` | string or null |  |
| `signing_secret` | string or null | Shown exactly once, at creation and rotation. |
| `livemode` | boolean |  |
| `mode` | string | Which events it hears. `both` is an endpoint made before endpoints chose; choose one for it in the console. One of `live`, `test`, `both`. |
| `last_success_at` | string (date-time) or null |  |
| `consecutive_failures` | integer |  |

```json
{
  "id": 12,
  "url": "https://app.tenant.example/hooks/wavbee-qc",
  "status": "enabled",
  "enabled_events": [
    "string"
  ],
  "secret_last4": "string",
  "signing_secret": "string",
  "livemode": false,
  "mode": "live",
  "last_success_at": "2026-11-24T10:00:00Z",
  "consecutive_failures": 1
}
```

## POST /v1/webhook_endpoints/{id}/test

Send a synthetic ping through the real signing path.

**Auth:** a secret key, `Authorization: Bearer $ACTIVQC_KEY`.

#### Parameters

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | integer | **Required.** |

#### Example request

```bash
curl -s -X POST "$ACTIVQC_BASE_URL/v1/webhook_endpoints/{id}/test" \
  -H "Authorization: Bearer $ACTIVQC_KEY"
```

#### Responses

| Status | Meaning |
|---|---|
| `202` | Ping emitted. |

