Skip to Content
QueryDeck Docs

Webhooks

Subscribe to QueryDeck sync events, verify the QueryDeck-Signature header with your endpoint's whsec_ secret, and handle retries, versions and missed events.

QueryDeck sends signed HTTPS webhooks when a sync finishes. Use them to refresh a cache, start a downstream job or alert a channel without polling the API.

The format follows Stripe's webhooks. If you have verified Stripe events before, the same code works here with a different header name.

Configure endpoints in the app under Developers → Webhooks. Owners and admins can add up to five endpoints per organisation and subscribe each one to one or both events.

Events

EventFires when
sync.completedA Search Console or GA4 sync finished successfully
sync.failedA sync failed; error holds the message recorded on the job
webhook.testYou pressed Send test event in the app. You can't subscribe to it

The event is delivered for the whole job, not per date shard.

Payload

{
	"id": "evt_3f9c2a7b1d4e8f60a2b5c7d9",
	"object": "event",
	"created": 1795641243,
	"type": "sync.completed",
	"livemode": true,
	"data": {
		"sync_job": {
			"id": "816f0f4e-2a2a-4a03-8a2f-2a9f4f1e3b21",
			"source": "gsc",
			"site_id": "4e0c4f3a-9b1a-4b7e-9d5f-7c8e2a1b6d40",
			"site_url": "sc-domain:example.com",
			"status": "succeeded",
			"rows_synced": 18422,
			"error": null
		}
	}
}
  • id is the same for every endpoint that receives the event. Use it to ignore duplicates.
  • created is a Unix timestamp in seconds.
  • livemode is true for real events and false for webhook.test.
  • The resource sits under a key named after it (data.sync_job), not under Stripe's generic data.object.
  • source is gsc or ga4, and status is succeeded or failed.

A webhook.test event carries "data": {"webhook_test": {"endpoint_id": "…", "message": "Webhook connection successful"}}.

Signing secret

Each endpoint has its own secret, which starts with whsec_. The app shows it once, when you add the endpoint. Copy it then: QueryDeck can't show it again.

Lost it, or think it leaked? Press Rotate secret. You get a new secret, and for 24 hours every delivery is signed with both the new and the old one, so you can deploy the new secret without dropping events.

Signature

Every request carries:

QueryDeck-Signature: t=1795641243,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
Content-Type: application/json
User-Agent: QueryDeck-Webhooks/1
PartMeaning
tSigning timestamp, Unix seconds
v1Hex HMAC-SHA256 of "<t>.<raw body>", keyed with your whsec_ secret. During a rotation there are two v1 values: accept the request if either matches

Verify a delivery

Verify against the raw request body, before parsing or re-serialising it. Compare in constant time, and reject timestamps outside a short window (five minutes is reasonable) to stop replays.

import { createHmac, timingSafeEqual } from 'node:crypto'

export function isValidDelivery(rawBody: string, header: string, secret: string): boolean {
	const parts = header.split(',').map((part) => part.split('=') as [string, string])
	const timestamp = Number(parts.find(([key]) => key === 't')?.[1])
	if (!Number.isFinite(timestamp) || Math.abs(Date.now() / 1000 - timestamp) > 300) return false

	const expected = createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest()
	return parts.some(
		([key, value]) =>
			key === 'v1' &&
			value.length === 64 &&
			timingSafeEqual(Buffer.from(value, 'hex'), expected),
	)
}

With Express, read the body with express.raw({ type: 'application/json' }) so the bytes you verify are the bytes QueryDeck signed.

Answer with any 2xx to acknowledge. The response body is ignored. Redirects are not followed, so point the endpoint at the final URL.

API versions

Each endpoint is pinned to an API version, shown next to its URL in the app. The current version is 2026-11-25, and new endpoints start on the latest one. When a newer version ships, the app offers Upgrade on each endpoint. You upgrade when your handler is ready; there is no way back to an older version.

Events already queued keep the version they were queued with, including their retries. Events after the upgrade use the new version.

Delivery and retries

  • Requests time out after 10 seconds.
  • A failed delivery is retried up to five times: after 1 minute, 5 minutes, 30 minutes, 2 hours and 12 hours. The sixth failure marks it failed.
  • If an endpoint keeps failing for 3 days, QueryDeck disables it and stops sending. The app shows Disabled after repeated failures. Fix the endpoint, check it with Send test event, then press Re-enable.
  • Deliveries and their attempts are listed on the endpoint in the app. Press Redeliver on a finished delivery to send the same event again; the body is identical and only the signature changes.
  • Events and delivery records are kept for 30 days.
  • Endpoint URLs must use HTTPS and resolve to public hosts; private and loopback addresses are rejected.

Retries can arrive more than once for the same event, so make your handler idempotent on the event id.

Recover missed events

Your endpoint was down for longer than the retries cover? List what you missed with any API key:

curl https://api.querydeck.si/v1/public/events?limit=20 \
	-H "Authorization: Bearer $QUERYDECK_API_KEY"
{ "object": "list", "data": [{ "id": "evt_…", "object": "event", "…": "…" }], "has_more": true }
  • Events are newest first. limit is 1–100 (default 20).
  • Pass the last id you received as starting_after to get the next page.
  • Filter with type=sync.completed, sync.failed or webhook.test.
  • GET /v1/public/events/<id> returns one event.
  • Events are shown in the latest API version. A key limited to some properties only sees those properties' events.

Managing endpoints

From Developers → Webhooks you can:

  • add an HTTPS endpoint and choose its events;
  • send a test event and see the result at once;
  • rotate the signing secret;
  • upgrade the API version;
  • pause it with the Active switch, or re-enable it after an auto-disable;
  • redeliver a finished delivery;
  • delete it.

Deleting an endpoint stops future deliveries and removes its delivery history.

On this page