Skip to main content
Developer docs menu

Developers

Webhooks

A webhook is an address of yours that Quick Policy calls when something happens, so you do not have to keep asking the API. Each call is an HTTPS POST with a JSON body, signed so you can check it came from us.

Setting up a webhook

  1. An organisation admin opens Settings, then Webhooks, in Quick Policy (on Professional and Custom).
  2. Add the address, a name, and the events you want. The address must be public: private and local addresses are refused.
  3. Copy the signing secret. Like an API key, it is shown only once. You need it to check signatures.
  4. Send a test event from the same page and watch it arrive in the delivery log.

Webhooks are managed in the app only; there is no API for creating them.

What a delivery looks like

The body is the event’s JSON object on its own, with no wrapper. Its kind field and the X-QP-Event header both name the event. These headers come with every delivery:

  • X-QP-Event

    The event name, for example policy.published.

  • X-QP-Delivery

    The delivery id. Retries of the same delivery reuse it, so use it to ignore duplicates.

  • X-QP-Timestamp

    When this attempt was signed, as an ISO 8601 time.

  • X-QP-Signature

    sha256= followed by the hex HMAC-SHA256 of the timestamp, a full stop, and the raw body, keyed with your signing secret.

Links in a payload (url, downloadUrl) are paths in the Quick Policy app. Add your app address in front to open them; they need a signed-in person, not an API key.

Checking the signature

Work out the HMAC-SHA256 of the X-QP-Timestamp value, a full stop, and the raw request body, using your signing secret as the key. Compare it, in constant time, with the hex after sha256= in X-QP-Signature. Then refuse anything signed more than 5 minutes away from now, so an old delivery cannot be replayed.

Node.js
import crypto from 'node:crypto'

// rawBody must be the exact bytes received, before any JSON parsing.
export function isGenuineQuickPolicyDelivery(rawBody, headers, secret) {
  const signature = headers['x-qp-signature'] || ''
  const timestamp = headers['x-qp-timestamp'] || ''
  if (!signature.startsWith('sha256=')) return false

  const expected = crypto
    .createHmac('sha256', secret)
    .update(`${timestamp}.${rawBody}`)
    .digest('hex')
  const given = signature.slice('sha256='.length)
  if (given.length !== expected.length) return false
  if (!crypto.timingSafeEqual(Buffer.from(given, 'hex'), Buffer.from(expected, 'hex'))) return false

  // Refuse anything signed more than five minutes ago (or ahead).
  const signedAt = new Date(timestamp).getTime()
  return Number.isFinite(signedAt) && Math.abs(Date.now() - signedAt) <= 5 * 60 * 1000
}

Answering, retries and duplicates

  • Answer with any 2xx status within 30 seconds. Anything else, including a redirect, counts as a failure. Do slow work after you have answered.
  • Deliveries go out from a queue that runs every 1 minute, so expect an event within a few minutes of it happening, not instantly.
  • A failed delivery is tried 6 times in all, waiting 1 minute, 5 minutes, 30 minutes, 2 hours, 12 hours between attempts. After the last failure it is given up, and shows as such in the delivery log, where you can replay it.
  • After 50 failures in a row we switch the webhook off. An admin can switch it back on in Settings.
  • The same event can arrive more than once (a retry after a slow answer, or a replay). Use X-QP-Delivery to ignore one you have already handled. Events can also arrive out of order.

Events

Every event and its payload. The same descriptions are in the webhooks section of the OpenAPI file.

incident.opened

A new incident is reported.

  • kindalways "incident.opened"
  • incidentIdstring
  • titlestring
  • severitystring, one of LOW, MEDIUM, HIGH, CRITICAL

    Upper case here, unlike the incident endpoints.

  • statusstring
  • reportedAtstring

    ISO 8601 date and time, UTC.

  • urlstring

    A path in the Quick Policy app, relative to the app address.

Example body
{
  "kind": "incident.opened",
  "incidentId": "cm3inc0001",
  "title": "Laptop left on a train",
  "severity": "HIGH",
  "status": "OPEN",
  "reportedAt": "2026-11-01T09:30:00.000Z",
  "url": "/dashboard/incidents/cm3inc0001"
}

incident.severity_escalated

Severity is raised on an existing incident.

  • kindalways "incident.severity_escalated"
  • incidentIdstring
  • titlestring
  • previousSeveritystring, one of LOW, MEDIUM, HIGH, CRITICAL
  • newSeveritystring, one of LOW, MEDIUM, HIGH, CRITICAL
  • escalatedAtstring

    ISO 8601 date and time, UTC.

  • actorUserIdstring
  • urlstring

    A path in the Quick Policy app, relative to the app address.

Example body
{
  "kind": "incident.severity_escalated",
  "incidentId": "cm3inc0001",
  "title": "Laptop left on a train",
  "previousSeverity": "HIGH",
  "newSeverity": "CRITICAL",
  "escalatedAt": "2026-11-01T10:05:00.000Z",
  "actorUserId": "cm3usr0001",
  "url": "/dashboard/incidents/cm3inc0001"
}

policy.published

A policy passes approval and is published.

  • kindalways "policy.published"
  • policyIdstring
  • titlestring
  • versionany
  • publishedAtstring

    ISO 8601 date and time, UTC.

  • urlstring

    A path in the Quick Policy app, relative to the app address.

Example body
{
  "kind": "policy.published",
  "policyId": "cm3pol0001",
  "title": "Data Protection Policy",
  "version": 3,
  "publishedAt": "2026-11-01T09:30:00.000Z",
  "url": "/dashboard/policies/cm3pol0001"
}

policy.review_overdue

A scheduled policy review is missed.

  • kindalways "policy.review_overdue"
  • policyIdstring
  • reviewDueAtstring

    ISO 8601 date and time, UTC.

  • firedAtstring

    ISO 8601 date and time, UTC.

  • urlstring

    A path in the Quick Policy app, relative to the app address.

Example body
{
  "kind": "policy.review_overdue",
  "policyId": "cm3pol0001",
  "reviewDueAt": "2026-10-31T00:00:00.000Z",
  "firedAt": "2026-11-01T06:00:00.000Z",
  "url": "/dashboard/policies/cm3pol0001"
}

training.overdue

A required training assignment passes its due date.

  • kindalways "training.overdue"
  • assignmentIdstring
  • userIdstring
  • dueAtstring

    ISO 8601 date and time, UTC.

  • expiredAtstring

    ISO 8601 date and time, UTC.

  • urlstring

    A path in the Quick Policy app, relative to the app address.

Example body
{
  "kind": "training.overdue",
  "assignmentId": "cm3trn0001",
  "userId": "cm3usr0002",
  "dueAt": "2026-10-31T00:00:00.000Z",
  "expiredAt": "2026-11-01T06:00:00.000Z",
  "url": "/dashboard/training"
}

vendor.risk_tier_changed

A vendor's risk tier is raised or lowered.

  • kindalways "vendor.risk_tier_changed"
  • vendorIdstring
  • vendorNamestring
  • previousRiskTierany
  • newRiskTierany
  • changedAtstring

    ISO 8601 date and time, UTC.

  • actorUserIdstring
  • urlstring

    A path in the Quick Policy app, relative to the app address.

Example body
{
  "kind": "vendor.risk_tier_changed",
  "vendorId": "cm3ven0001",
  "vendorName": "Acme Payroll Ltd",
  "previousRiskTier": "MEDIUM",
  "newRiskTier": "HIGH",
  "changedAt": "2026-11-01T09:30:00.000Z",
  "actorUserId": "cm3usr0001",
  "url": "/dashboard/vendors/cm3ven0001"
}

risk.severity_escalated

Residual exposure on a risk increases.

  • kindalways "risk.severity_escalated"
  • riskIdstring
  • titlestring
  • codestring, or null
  • previousSeveritystring, one of LOW, MEDIUM, HIGH, CRITICAL
  • newSeveritystring, one of LOW, MEDIUM, HIGH, CRITICAL
  • residualLikelihoodinteger
  • residualImpactinteger
  • escalatedAtstring

    ISO 8601 date and time, UTC.

  • actorUserIdstring
  • urlstring

    A path in the Quick Policy app, relative to the app address.

Example body
{
  "kind": "risk.severity_escalated",
  "riskId": "cm3rsk0001",
  "title": "Single supplier for payroll",
  "code": "R-014",
  "previousSeverity": "MEDIUM",
  "newSeverity": "HIGH",
  "residualLikelihood": 3,
  "residualImpact": 4,
  "escalatedAt": "2026-11-01T09:30:00.000Z",
  "actorUserId": "cm3usr0001",
  "url": "/dashboard/risks/cm3rsk0001"
}

audit_packet.ready

An audit packet finishes generating.

  • kindalways "audit_packet.ready"
  • packetIdstring
  • namestring
  • packetTypestring
  • downloadUrlstring

    A path in the app. Downloading needs a signed-in person; an API key cannot fetch it.

  • urlstring

    A path in the Quick Policy app, relative to the app address.

  • completedAtstring

    ISO 8601 date and time, UTC.

Example body
{
  "kind": "audit_packet.ready",
  "packetId": "cm3pkt0001",
  "name": "ISO 27001 surveillance audit",
  "packetType": "ISO_27001",
  "downloadUrl": "/api/audit-packets/cm3pkt0001/download",
  "url": "/dashboard/audit-packets/cm3pkt0001",
  "completedAt": "2026-11-01T09:30:00.000Z"
}

webhook.test

A test delivery sent from the webhook settings page.

  • kindalways "webhook.test"
  • messagestring
  • timestampstring

    ISO 8601 date and time, UTC.

Example body
{
  "kind": "webhook.test",
  "message": "This is a test delivery from Quick Policy.",
  "timestamp": "2026-11-01T09:30:00.000Z"
}