Skip to content
Join the waitlist

API Reference

Webhooks

Hear about a decision, a change, an outcome, a report or an alert as it happens: QueryRev sends a signed POST to your server, retries for a day, and tells you when an endpoint keeps failing.

By QueryRev AI Published Updated 3 min read

Key takeaways

  • Each delivery is a JSON POST, signed with HMAC-SHA256 over the timestamp and the raw body.
  • Verify the QueryRev-Signature header before you trust a body, and compare in constant time.
  • A failed delivery is retried with backoff for 24 hours; an endpoint failing for 3 days is disabled, with an email.
  • The body holds ids, kinds, states and a link back to the app, never revenue figures.

Events

Choose the events for each endpoint in Workspace → API. Every event has the same body; type says which one it is.

The events, and when each is sent
  • decision.created
    A new decision is proposed.
  • decision.state_changed
    A decision moves from one state to another, such as approved, executed or succeeded.
  • change.applied
    A change is applied to a site and written to the Change Ledger.
  • change.rolled_back
    A change is rolled back, by a person or as an emergency response.
  • outcome.classified
    The outcome of a change is classified after a read: successful, neutral, failed and so on.
  • report.generated
    A report snapshot is generated.
  • integrity.alert
    A Search Integrity alert fires for a new incident.

The body

The body is id, type, created_at, workspace_id, site_id, data and link. id is the event’s id: the same for every endpoint and every attempt, so you can ignore one you have already handled. data holds ids, codes and states only; link is the page in the app where the event can be looked up.

A body never carries a revenue figure, a query, page text or a person’s name. Read the figures through the API, where each keeps its kind and follows the key’s revenue-view level.

decision.state_changed
{  "id": "c4a81e37-6b2d-4c9f-a0e5-7f3d2b1c8e96",  "type": "decision.state_changed",  "created_at": "2026-10-28T09:14:00.000Z",  "workspace_id": "5d0f9c26-3e8b-41a7-b4d2-9a6e1f7c0b53",  "site_id": "9b2e7d41-0c5a-4f8e-8a63-2d1b6c9e4f07",  "data": {    "decision_id": "3f6c1a52-8d4e-4b7a-9c21-5e0f7b3d9a14",    "from": "proposed",    "to": "approved",    "actor_kind": "person",    "reason_code": null  },  "link": "https://app.queryrev.com/decisions/D-0412"}

Headers

The headers of every delivery
  • QueryRev-Signature
    t=<unix seconds>,v1=<hex>: the timestamp and the signature of this attempt.
  • QueryRev-Delivery
    The delivery’s id. The same for every attempt of one delivery.
  • QueryRev-Event
    The event, as type in the body.
  • Content-Type
    application/json.

Verify the signature

The signed text is the timestamp, a dot and the raw body exactly as received. The signature is its HMAC-SHA256, as lower-case hex, keyed with the endpoint’s signing secret: the whsec_ text shown once when the endpoint was made. Each attempt gets a new timestamp and signature, so a retry hours later still passes the age check.

  1. Read the body as raw text, before any JSON parsing.
  2. Compute HMAC-SHA256 of <t>.<raw body> with your signing secret.
  3. Compare it with v1 in constant time; never with ===, which tells a forger how much of a guess was right.
  4. Refuse a timestamp more than five minutes from your own clock.
verify.js (Node)
import { createHmac, timingSafeEqual } from 'node:crypto'; // rawBody: the body as text, before any JSON parsing.// header: the QueryRev-Signature header. secret: the endpoint’s whsec_ secret.export function isFromQueryRev(rawBody, header, secret, toleranceSeconds = 300) {  const parts = Object.fromEntries(header.split(',').map((part) => part.split('=')));  const expected = createHmac('sha256', secret).update(`${parts.t}.${rawBody}`).digest();  const received = Buffer.from(parts.v1 ?? '', 'hex');  const same = received.length === expected.length && timingSafeEqual(received, expected);  const age = Math.abs(Date.now() / 1000 - Number(parts.t));  return same && age <= toleranceSeconds;}

Retries

A delivery succeeds when your server answers 2xx within 15 seconds. Any other answer, a redirect, a timeout or a refused connection is a failure, and the delivery is tried again after each wait below, give or take a fifth so that many retries do not land at once. The last attempt is at the 24-hour mark; then the delivery stops. Eight attempts at most.

When a failed delivery is tried again
  • 1
    1 minute
  • 2
    5 minutes
  • 3
    30 minutes
  • 4
    2 hours
  • 5
    6 hours
  • 6
    12 hours
  • Last attempt
    At 24 hours from the first attempt

Automatic disabling

An endpoint whose deliveries have failed for 3 days in a row, with no success between, is disabled, and the people who manage API keys and webhooks get a notice in the app and an email. Any success clears the count. Fix the receiver, then turn the endpoint on again in Workspace → API.

The test send

“Send test” on an endpoint in Workspace → API sends one delivery of the type webhook.test, signed like any other, with data.test set to true and no site. It is tried once, never retried, and does not count towards disabling. Up to 10 test sends an endpoint in 10 minutes.

webhook.test
{  "id": "7e2c4a90-1b3d-4f5e-9a7c-0d2e4f6a8b1c",  "type": "webhook.test",  "created_at": "2026-10-28T09:14:00.000Z",  "workspace_id": "5d0f9c26-3e8b-41a7-b4d2-9a6e1f7c0b53",  "site_id": null,  "data": {    "test": true  },  "link": "https://app.queryrev.com/workspace/api"}

Where deliveries go

An endpoint is an https address on port 443 that resolves to a public address. Private, loopback and cloud metadata addresses are refused, the address is checked again when each delivery is sent, and redirects are not followed. Your server’s answer is not read beyond its status.

Cite this page

A suggested citation. Its link goes to this page, whose address does not change.

QueryRev AI. “Webhooks.” QueryRev AI, 7 Nov 2026. https://queryrev.com/docs/api/webhooks

Related