# Event types

Every webhook delivery carries an `event` field on the JSON body, and its value is one of the event types listed below. Subscribe to the events you care about when you configure your endpoint.

## Envelope

Every event shares the same outer shape:

```json
{
  "id": "5dba8a3c-9b71-4f9b-9b9a-3b8b2a1c4d2e",
  "createdAt": "2026-05-28T12:00:00.000Z",
  "event": "risk.created",
  "data": {
    // event-specific payload — see below
  }
}
```

- `id` - UUID for this event. Stable across retries; same as the `Webhook-Id` header. Use this to dedupe.
- `createdAt` - when the event was created (the moment the change was saved, not when it was delivered).
- `event` - the event type, one of the strings in the table below.
- `data` - event-specific payload.

Those four keys are the whole envelope. There is no organisation id in the body: an endpoint belongs to one organisation, so the endpoint that received the delivery tells you which. The order of the keys is not fixed; verify the signature over the raw bytes and read the keys by name.

DTOs in `data` follow the public-API shape (`RiskDtoV1`, `ControlDtoV1`, etc.). Same projection that `/api/v1/*` GET responses use. See [`docs/api/openapi.yaml`](https://riskregister.com/docs/api/openapi.yaml) for the full DTO schemas.

## Event catalogue

| Type | Trigger | Payload |
| --- | --- | --- |
| `register.created` | A new register was created (UI, API, clone, framework instantiation, AI generation). | `{ register: RegisterDtoV1 }` |
| `register.archived` | A register moved into `archived` status, from any surface that can archive one: the archive endpoint (`POST /api/v1/registers/{id}/archive`), the session-authenticated `DELETE /api/registers/{id}`, or a `PATCH` that sets `status: archived` (the app's Edit page, through `PATCH /api/registers/{id}`, or `PATCH /api/v1/registers/{id}`). Transition-only: re-archiving an already archived register sends nothing, and un-archiving (moving it back to active) sends no event. | `{ register: RegisterDtoV1, previous: RegisterDtoV1 }` |
| `risk.created` | A new risk was added to a register. Fires on single creates AND on every risk in a bulk create (AI generation, framework instantiation, import). | `{ risk: RiskDtoV1 }` |
| `risk.updated` | A risk's fields or custom field values changed via PATCH or a bulk edit. Fires only when something changed: a request that resends a risk's current values, or a bulk edit over risks that already have the value, fires nothing for those risks. Doesn't fire for verb endpoints (those have their own events). | `{ risk: RiskDtoV1, previous: RiskDtoV1 }` |
| `risk.deleted` | A risk was deleted. Payload captures the final state before deletion. The risk's treatment actions, reviews and acceptances (and their evidence links), its control links, comments and custom field values are removed with it; this event is the only one sent for them (no `treatment_action.deleted`, `review.*` or other per-item event fires for what goes with a deleted risk). | `{ risk: RiskDtoV1 }` |
| `risk.escalated` | Sub-event of `risk.updated` and `risk.assessed`. Fires when the residual band crosses upward (e.g. low → medium). Useful for paging on degraded posture. | `{ risk: RiskDtoV1, previous: RiskDtoV1, previousLevel: ScoreBand, currentLevel: ScoreBand }` |
| `risk.de_escalated` | Mirror of `risk.escalated` for downward band transitions. Useful for "good news" workflows. | `{ risk: RiskDtoV1, previous: RiskDtoV1, previousLevel: ScoreBand, currentLevel: ScoreBand }` |
| `risk.appetite_breached` | Sub-event of `risk.updated` and `risk.assessed`. Fires on the transition (non-breach → breach) when a re-score pushes a risk's residual above its register's configured appetite threshold. Transition-only: a risk already in breach that is re-scored and stays in breach does NOT re-fire. Not emitted on create, nor when someone moves the threshold under a risk that hasn't changed. | `{ risk: RiskDtoV1, previous: RiskDtoV1, appetiteThreshold: number \| null, residualScore: number \| null }` |
| `risk.assessed` | Fires on `POST /api/v1/risks/{id}/assess`. Captures the full assessment with the assessor's rationale as a first-class field. `scoresBefore` and `scoresAfter` each hold four numbers: `inherentLikelihood`, `inherentImpact`, `residualLikelihood` and `residualImpact`. | `{ risk: RiskDtoV1, previous: RiskDtoV1, scoresBefore: {...}, scoresAfter: {...}, rationale: string }` |
| `risk.treated` | Fires on `POST /api/v1/risks/{id}/treat`. Captures treatment + status transitions with rationale. | `{ risk: RiskDtoV1, previous: RiskDtoV1, treatmentBefore: string, treatmentAfter: string, statusBefore: string, statusAfter: string, rationale: string }` |
| `control.status_changed` | A control was updated through `PATCH` (the app's edit form, or `PATCH /api/v1/controls/{id}`). Despite its name, it is sent for any such update, and the payload carries no status field: compare `control` with `previous` to see what changed. | `{ control: ControlDtoV1, previous: ControlDtoV1 }` |
| `control.deleted` | A control was deleted. | `{ control: ControlDtoV1 }` |
| `review.requested` | A review was requested on a risk. | `{ review: RiskReviewDtoV1, risk: RiskDtoV1 }` |
| `review.completed` | A review was completed: a pending one, or one recorded in one step with no request first (then `previous` is null). The reviewer's findings are `review.notes`, and the links to its evidence are `review.evidence`. | `{ review: RiskReviewDtoV1, previous: RiskReviewDtoV1 \| null, risk: RiskDtoV1 }` |
| `review.cancelled` | A pending review was cancelled, with the reason the person gave. | `{ review: RiskReviewDtoV1, previous: RiskReviewDtoV1, risk: RiskDtoV1, reason: string }` |
| `treatment_action.created` | An item was added to a risk's treatment plan. | `{ risk: RiskDtoV1, action: TreatmentActionDtoV1 }` |
| `treatment_action.updated` | A plan item's fields changed (title, description, owner, due date, notes), or an evidence link was added to it or removed (`action.evidence` and `previous.evidence` show which) — **not** its status. | `{ risk: RiskDtoV1, action: TreatmentActionDtoV1, previous: TreatmentActionDtoV1 }` |
| `treatment_action.status_changed` | A plan item moved between `open` / `in_progress` / `done` / `cancelled`, including a reopen. `reason` is present on a cancel, null otherwise. A same-status move fires nothing. | `{ risk: RiskDtoV1, action: TreatmentActionDtoV1, previous: TreatmentActionDtoV1, reason: string \| null }` |
| `treatment_action.deleted` | A plan item was hard-deleted on its own (an item that should never have existed, as distinct from cancelling abandoned work). Not sent for the items removed when their risk is deleted: `risk.deleted` covers those. | `{ risk: RiskDtoV1, action: TreatmentActionDtoV1 }` |
| `review.overdue` | Cron-fired by the daily reminder run: seven days before a risk's review date, on the day, and once it has passed without a completed review. `reminderType` says which. Fired at most once per risk, reminder type and review date; a new review date starts again. Only for risks in an active register: an archived or closed register's risks send neither this nor the reminder email *(v0.49.819.0+)*. | `{ risk: RiskDtoV1, reminderType: 'review_reminder_7d' \| 'review_reminder_due' \| 'review_reminder_overdue' }` |
| `invitation.created` | An org admin invited someone by email. Carries no credential material: the token itself is never sent. | `{ invitation: InvitationDtoV1 }` |
| `invitation.accepted` | The person invited accepted and joined the organisation (`acceptedAt` and `acceptedByUserId` set). Subscribe to this for "someone joined". A revoked invitation sends nothing. | `{ invitation: InvitationDtoV1 }` |
| `organisation.updated` | An org admin changed the organisation's name, sector, size band or region in Settings. Billing and plan changes are not part of it. | `{ organisation: OrganisationDtoV1, previous: OrganisationDtoV1 }` |
| `user.updated` | A person changed their own profile (their display name). An admin changing someone's role sends no webhook. | `{ user: UserProfileDtoV1, previous: UserProfileDtoV1 }` |

`ScoreBand` is `'low' | 'medium' | 'high' | 'critical'`.


## On `previous`

Stateful transitions (`updated`, `archived`, `assessed`, `treated`, `escalated`, `de_escalated`, `appetite_breached`, `status_changed`, `completed`, `cancelled`) carry a `previous` object alongside the current state (`null` on a `review.completed` recorded in one step). Subscribers can compute the delta inline without a follow-up `/api/v1/*` GET.

Creation events (`created`, `requested`) don't carry `previous` (nothing was there before).

Deletion events (`deleted`) carry the final state as the main payload (the record is gone by the time the event reaches you).

## Sub-event semantics — escalation

When a risk's residual band transitions upward, two events fire: `risk.escalated`, and the event for the change itself, which is `risk.updated` for a `PATCH` or `risk.assessed` for the assess endpoint. Subscribers wanting just the upward transitions subscribe to `risk.escalated` alone. Subscribers wanting every re-score subscribe to both `risk.updated` and `risk.assessed` and may compare the scores in `previous` themselves.

The same applies to `risk.de_escalated` for downward transitions.

This is deliberate. The sub-event pattern lets pager-worthy subscribers (Slack alerts, on-call paging) opt into the narrow surface without parsing every update.

## Rationale on verb events

`risk.assessed` and `risk.treated` carry the free-text rationale the person gave, and `review.cancelled` its reason, as a first-class field on `data`, so you don't have to dig it out of the audit log. A completed review's findings are its `notes`. The assess and treat endpoints require a rationale, and cancelling a review a reason (1–5,000 characters, server-validated). The audit log, the webhook and the activity feed all read it from the same source.

## Bulk creation events

Bulk paths (AI generation, framework template instantiation, register clone, CSV/Excel/JSON import) emit one `risk.created` event per risk created, atomic with the audit row. A register an assistant saves or generates as a draft through the API (`POST /api/v1/registers/from-document` and `/from-template`; `/from-context` with a `propose` token or app) sends nothing until a person adopts it, and adoption sends `register.created` and one `risk.created` per risk. A 1,000-row import produces 1,000 events. They leave the outbox at up to 300 per organisation a minute (see [Rate limits](https://riskregister.com/docs/rate-limits.md#per-org-per-minute-caps)), so that import takes at least four minutes to send, and longer when your endpoint is slow or other organisations have a backlog. Each endpoint is also sent at most 100 delivery attempts a minute; an attempt over that is recorded as failed without calling the endpoint and retried on the [usual schedule](https://riskregister.com/docs/webhooks.md#retry-policy). Subscribers see events arrive in batches.

## Order of delivery

**There is no order guarantee.** Events are sent roughly oldest first, but two events can arrive in either order, even two from the same request (a `risk.updated` and its `risk.escalated`, say): an organisation's events are delivered two at a time, and a failed delivery is retried minutes or hours later while newer events go ahead of it.

If you care about order, dedupe on the event's `id` and compare `createdAt` with what you have already stored, ignoring an event older than your current state. Arrival time can't restore the order, and events from one request can share a `createdAt` to the millisecond, so where the exact order matters, read the current state from the API.


## Treatment plans — why there is no "plan complete" event

The four `treatment_action.*` events are enough to mirror a plan into a task
tracker: create files a ticket, `updated` keeps it in sync, `status_changed`
moves it, `deleted` closes it. Every one carries its parent `risk`, so a
subscriber never needs a follow-up fetch to know what to file against.

There is deliberately **no** `treatment_action.plan_completed`, even though it
would be the single most useful signal for an integration. It is a *derived
claim*, and the question we ask of any derived claim is what it reads on a plan
with one item, created five seconds ago and immediately ticked. The answer is
"complete" — which says nothing about whether the risk was actually treated.

Subscribers who want that signal can compute it from these four events plus
`GET /api/v1/risks/{riskId}/treatment-actions`, and computing it themselves
means they decide what "complete" means for their organisation. We are not
better placed to decide that than they are.

## See also

- [Verifying signatures](https://riskregister.com/docs/webhook-signatures.md) — verify before parsing.
- [Webhook integration overview](https://riskregister.com/docs/webhooks.md) — architecture, retries, secrets.
