TrackSERPs
Log in

SERP Tracking Webhooks: Events, Signatures and Retries

Quick answer

TrackSERPs webhooks send a signed HTTPS POST to your endpoint when a run finishes, rankings change, an alert rule matches, a lookup completes or credits run low. Each request carries a TrackSERPs-Signature header holding a timestamp and an HMAC-SHA256 of the timestamp and raw body. Failed deliveries are retried up to 8 attempts over about 44 hours.

Key facts

  • TrackSERPs signs each delivery with HMAC-SHA256 over the timestamp, a dot and the raw body, sent as t=<unix>,v1=<hex> in the TrackSERPs-Signature header.Source: trackserps.com
  • Failed deliveries are retried with delays of 1m, 5m, 30m, 2h, 6h, 12h and 24h, for 8 attempts in total.Source: trackserps.com
  • An endpoint is disabled automatically after 20 consecutive failed deliveries.Source: trackserps.com
  • Python's hmac.compare_digest is designed to resist timing analysis, so use it rather than == to compare signatures.Source: docs.python.org

What a TrackSERPs webhook is, and when to use one

A webhook is an HTTPS POST that TrackSERPs sends to a URL you control when something finishes. It replaces a polling loop. Instead of asking whether a run is done every minute, you wait to be told.

Use webhooks when:

  • a pipeline should react to rank movement (open a ticket, update a CRM, post to chat);
  • you create one-off lookups through the API and want the result without polling;
  • you want to know when credits are running out or scheduled runs are paused.

Do not use them as the only record. Events can be missed if your endpoint is down for longer than the retry window, and an endpoint that fails long enough is disabled. Treat the REST API as the source of truth and the webhook as the nudge to go and read it. The reference documentation lists the contract in short form; this page adds the working detail: payloads, verification code you can run, behaviour under failure, and a troubleshooting table.

Delivery is never earlier than the check behind it. Checks run in a standard collection queue and normally finish in about 10 to 20 minutes, or immediately when today's SERP was already fetched. A webhook is sent as soon as the check finishes.

Webhooks are available from the Growth plan up. The endpoint limit is 2 on Growth, 5 on Pro and 20 on Agency, and Starter has none (the API answers plan_required). Check the pricing page for current plans.

The seven event types

Every event is delivered as a JSON object with the same five top-level fields, followed by the type-specific data:

{
  "id": "evt_c0example0000000000",
  "type": "run.completed",
  "created_at": "2026-11-11T09:12:44.000Z",
  "account_id": "cmwc0f0zz0001rqk7acct0001",
  "data": {}
}
EventSent whendata fields
run.completedA scheduled or manual run finishes settlingproject_id, engine, run_id, status (completed or partial), keywords_checked
run.failedAll keyword checks in a run failedproject_id, engine, run_id
rankings.updatedA run settles and at least one keyword's latest rank changedproject_id, engine, run_id, changes (up to 500), changes_total
alert.triggeredA rank alert rule with webhook delivery on matches after a runrule_id, rule_name, project_id, engine, matches
lookup.completedA one-off lookup finishes, done or failedThe full lookup object
credits.lowBalance is below 20% of the plan's monthly creditsbalance, allowance
credits.exhaustedA scheduled run is paused because credits ran outproject_id, engine

engine is google or bing. These names and shapes are the ones in the OpenAPI document's webhook section, and the event types in the endpoint schemas.

rankings.updated

The change list contains one entry per keyword and device whose rank moved, or whose AI Overview citation state flipped. First-ever checks of a keyword are excluded, because there is nothing to compare with. If nothing changed, no event is sent.

{
  "id": "evt_c0example0000000001",
  "type": "rankings.updated",
  "created_at": "2026-11-11T09:12:45.000Z",
  "account_id": "cmwc0f0zz0001rqk7acct0001",
  "data": {
    "project_id": "cmwc0f1yp0005rqk7w1plnab1",
    "engine": "google",
    "run_id": "cmwc0f2ef0011rqk7runid001",
    "changes": [
      {
        "keyword_id": "cmwc0f2ab0007rqk7x9kd3m2p",
        "phrase": "emergency plumber",
        "device": "desktop",
        "previous_rank": 6,
        "rank": 4,
        "ai_overview": {
          "present": true,
          "cited": true,
          "cited_url": "https://acmeplumbing.com/emergency"
        }
      }
    ],
    "changes_total": 1
  }
}

rank and previous_rank are integers or null. Null means the domain was not found in the top 100 for that check, or there was no earlier value. changes is capped at 500 entries; changes_total is the true count, so compare the two when a very large project moves.

alert.triggered

matches holds one entry per matching keyword and device:

{
  "rule_id": "rule_sample",
  "rule_name": "Left the top 10",
  "project_id": "cmwc0f1yp0005rqk7w1plnab1",
  "engine": "google",
  "matches": [
    {
      "keyword_id": "cmwc0f2ab0007rqk7x9kd3m2p",
      "phrase": "emergency plumber",
      "device": "desktop",
      "previous_rank": 8,
      "rank": 14,
      "previous_url": "https://acmeplumbing.com/emergency",
      "url": "https://acmeplumbing.com/emergency"
    }
  ]
}

There is no precomputed change field and no condition name. Work out the delta from rank and previous_rank, and read the rule's meaning from rule_name. To receive the event, the alert rule needs its option to publish alert.triggered to webhook endpoints switched on, and the endpoint must subscribe to that event. Having only one of the two sends nothing.

lookup.completed

data is the same lookup object the API returns from GET /v1/lookups/{id}: id, phrase, phrase_normalised, domain, url, match, location_code, language_code, device, engine, fresh, status, credits_held, credits_charged, result, error, created_at, completed_at, expires_at. The result holds rank, rank_absolute, url, matched_url_rank, serp_features, ai_overview, top, checked_at, fresh and cached. It is null when the lookup failed, and then error explains why. The event fires for failures too, and a failed lookup's credit is refunded, so branch on status.

Ping

Pressing Send test in the app, or calling POST /v1/webhooks/{id}/test, sends a ping event whose data is endpoint_id, url and message. It goes to that endpoint regardless of its subscriptions, is attempted once and never retried, and does not count towards auto-disable. Write receivers so an unknown type returns 200 and is ignored.

What the request looks like

Besides the JSON body, each delivery carries these headers:

HeaderValue
Content-Typeapplication/json
User-AgentTrackSERPs-Webhooks/1.0
TrackSERPs-Signaturet=<unix seconds>,v1=<hex>
TrackSERPs-EventThe event type, for example run.completed
TrackSERPs-DeliveryThe ID of this delivery record

Headers are case-insensitive in HTTP, so your framework may present the signature header in lowercase.

Verifying the signature

Anyone who learns your endpoint URL can POST to it. The signature proves a request came from TrackSERPs and was not altered. The scheme as implemented:

  1. Parse t and every v1 value from the header.
  2. Reject the request if the current time differs from t by more than 300 seconds. This blocks replay of captured requests.
  3. Build the signed string: t, a literal dot, then the raw request body exactly as received.
  4. Compute HMAC-SHA256 of that string using your endpoint secret (it starts whsec_) and take the lowercase hex digest.
  5. Compare with each v1 value in constant time. One match is enough.

The secret is shown once, when you create the endpoint or rotate it.

Node.js

This standalone function uses only the standard library. It accepts one secret or an array, which matters during rotation, and it handles several v1 values.

import crypto from "node:crypto";

export function verifyTrackSerps(
  rawBody: string,
  header: string | undefined,
  secrets: string | string[],
  toleranceSeconds = 300,
  now = Math.floor(Date.now() / 1000),
): boolean {
  if (!header) return false;

  let timestamp: number | null = null;
  const signatures: string[] = [];
  for (const part of header.split(",")) {
    const i = part.indexOf("=");
    if (i <= 0) continue;
    const key = part.slice(0, i).trim();
    const value = part.slice(i + 1).trim();
    if (key === "t" && /^\d+$/.test(value)) timestamp = Number(value);
    if (key === "v1" && /^[0-9a-f]{64}$/i.test(value)) {
      signatures.push(value.toLowerCase());
    }
  }
  if (timestamp === null || signatures.length === 0) return false;
  if (Math.abs(now - timestamp) > toleranceSeconds) return false;

  let ok = false;
  for (const secret of ([] as string[]).concat(secrets)) {
    const expected = crypto
      .createHmac("sha256", secret)
      .update(`${timestamp}.${rawBody}`, "utf8")
      .digest();
    for (const sig of signatures) {
      const got = Buffer.from(sig, "hex");
      if (got.length === expected.length && crypto.timingSafeEqual(got, expected)) {
        ok = true;
      }
    }
  }
  return ok;
}

A minimal Express route around it:

import express from "express";

const app = express();

app.post("/webhooks/trackserps", express.raw({ type: "application/json" }), (req, res) => {
  const rawBody = req.body.toString("utf8");
  const secrets = [process.env.TRACKSERPS_WEBHOOK_SECRET!];
  if (process.env.TRACKSERPS_WEBHOOK_PREVIOUS_SECRET) {
    secrets.push(process.env.TRACKSERPS_WEBHOOK_PREVIOUS_SECRET);
  }

  if (!verifyTrackSerps(rawBody, req.header("trackserps-signature"), secrets)) {
    return res.status(401).send("invalid signature");
  }

  const event = JSON.parse(rawBody);
  res.status(200).json({ received: true }); // acknowledge first
  setImmediate(() => void handleEvent(event)); // then do the real work, off the request path
});

If you already use the Node SDK, verifyWebhook(rawBody, header, secretOrSecrets) from @trackserps/sdk does the same job and returns a boolean. It does not parse the body for you.

Python

Note the parsing: a header with two v1 values breaks any code that builds a dictionary from the pairs, because the second value overwrites the first. This version keeps a list.

import hashlib
import hmac
import re
import time


def verify_trackserps(raw_body: bytes, header: str, secrets: list[str],
                      tolerance: int = 300, now: float | None = None) -> bool:
    if not header:
        return False
    timestamp = None
    signatures = []
    for part in header.split(","):
        key, sep, value = part.strip().partition("=")
        if not sep:
            continue
        if key == "t" and value.isdigit():
            timestamp = int(value)
        elif key == "v1" and re.fullmatch(r"[0-9a-fA-F]{64}", value):
            signatures.append(value.lower())
    if timestamp is None or not signatures:
        return False
    if abs((now if now is not None else time.time()) - timestamp) > tolerance:
        return False

    signed = str(timestamp).encode() + b"." + raw_body
    ok = False
    for secret in secrets:
        expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
        for sig in signatures:
            if hmac.compare_digest(sig, expected):
                ok = True
    return ok

In Flask, call it with request.get_data() and request.headers.get("TrackSERPs-Signature", ""). Python's own documentation says hmac.compare_digest is designed to resist timing analysis, and recommends it over == for comparing a computed digest with one supplied from outside.

Both functions agree with the shared test vector in the TrackSERPs repository (secret whsec_test_secret_1234567890abcdef, timestamp 1731215460): each accepts the valid signature, rejects a body with one extra byte, rejects an expired timestamp, and accepts a two-signature header when the secret matches either value.

Secret rotation without dropping events

Rotating a secret (in the app, or POST /v1/webhooks/{id}/rotate-secret) issues a new whsec_ value, shown once. The old secret stays valid for 24 hours, and during that window every delivery is signed with both, so the header contains two v1 values: t=...,v1=<new>,v1=<old>. A receiver holding either secret passes.

A safe sequence: rotate, deploy the new secret to the receiver while still accepting the old one, then drop the old one after the window. Your verification code must support a list of secrets, as above.

Retries and failure handling

A delivery succeeds when your endpoint returns any 2xx status within 10 seconds. Anything else is a failed attempt: a 4xx or 5xx status, a timeout, a connection error, a TLS error, a redirect (they are never followed), or a destination that resolves to a non-public address.

Failed attempts are retried on a fixed schedule. There are 8 attempts in total, one initial and seven retries:

AttemptWaits after the previous failureCumulative time since first attempt
1none0
21 minute1 minute
35 minutes6 minutes
430 minutes36 minutes
52 hours2 hours 36 minutes
66 hours8 hours 36 minutes
712 hours20 hours 36 minutes
824 hours44 hours 36 minutes

Add up to 10 seconds per attempt for timeouts. Retries run on a dedicated queue, so a slow receiver does not hold up deliveries to others. The delay is applied from the failure, so timing is approximate.

Auto-disable

Each delivery that fails all 8 attempts adds one to the endpoint's consecutive_failures. Any success resets the count to zero. At 20, the endpoint is disabled, disabled_at and disabled_reason are set, and the account receives an email. Because one counted failure takes about 44 hours to accumulate, this is a slow fuse, but a dead endpoint does reach it.

Events that occur while an endpoint is disabled are not queued for it. Re-enable by toggling it in the app, or PATCH /v1/webhooks/{id} with {"enabled": true}, which also clears the failure count. If you missed events, read the current state through the REST API.

Idempotency: handle duplicates

Delivery is at-least-once. If your server processes an event but times out before replying, the retry carries the same event. Dedupe on the envelope id, which is stable across all attempts and manual redeliveries.

// pseudo-store: use a unique index or Redis SET NX in production
const seen = new Set<string>();

async function handleEvent(event: { id: string; type: string; data: unknown }) {
  if (seen.has(event.id)) return;
  seen.add(event.id);
  // ...handle once
}

In a database, add a unique constraint on the event id and insert before acting. Do not dedupe on TrackSERPs-Delivery: a manual redelivery creates a new delivery record with the same event id, so the delivery header changes while the event does not.

Two more design rules follow from the retry schedule:

  • Do not rely on order. A retried run.completed can arrive after a later event. Use created_at or read current state from the API.
  • Respond first. The 10-second limit is short. Acknowledge, put the work on your own queue, and return 200. Doing heavy work inline is the commonest reason a healthy receiver shows timeouts.

Managing endpoints through the API

Everything in the Settings, API, Webhooks screen is also available in the REST API, using a key with the webhooks:write scope:

CallPurpose
POST /v1/webhooksCreate an endpoint with url, events and optional description. The whsec_ secret is returned once
GET /v1/webhooksList endpoints, with enabled and consecutive_failures
GET /v1/webhooks/{id}Read one endpoint
PATCH /v1/webhooks/{id}Change URL, events, description or enabled
DELETE /v1/webhooks/{id}Remove it and cancel pending retries
POST /v1/webhooks/{id}/rotate-secretIssue a new secret
POST /v1/webhooks/{id}/testSend a ping and return the outcome
GET /v1/webhooks/{id}/deliveriesDelivery log, 30 days, limit up to 200

Creating an endpoint:

curl -X POST https://api.trackserps.com/v1/webhooks \
  -H "Authorization: Bearer ts_test_REPLACE_ME" \
  -H "Idempotency-Key: create-endpoint-acme-1" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/api/webhooks/trackserps",
    "description": "Production rank alerts",
    "events": ["run.completed", "rankings.updated", "alert.triggered"]
  }'

The URL must be HTTPS and resolve to a public address, on port 443. Loopback, link-local and private ranges are refused. Re-sending a POST with the same Idempotency-Key and body is safe; see idempotency in the API docs. A ts_test_ key returns a synthetic endpoint without creating one, which suits CI.

The delivery log shows attempts, status codes, a response snippet (the first 1 KB of your reply), duration and the next scheduled attempt. A response snippet is the quickest way to see what your server actually said. The dashboard can redeliver any logged delivery; the redelivery is attempted once, with the original event id and payload.

Testing locally

There are two separate things to test.

1. Your handler, with no network

Sign a sample body yourself and POST it to your local server. This checks parsing, verification and dedupe without TrackSERPs involved:

// sign-and-send.mjs  (node sign-and-send.mjs)
import crypto from "node:crypto";

const secret = "whsec_local_dev_secret";
const body = JSON.stringify({
  id: "evt_local_0001",
  type: "run.completed",
  created_at: new Date().toISOString(),
  account_id: "cmwc0f0zz0001rqk7acct0001",
  data: { project_id: "cmwc0f1yp0005rqk7w1plnab1", engine: "google", run_id: "run_local",
          status: "completed", keywords_checked: 10 },
});
const t = Math.floor(Date.now() / 1000);
const v1 = crypto.createHmac("sha256", secret).update(`${t}.${body}`).digest("hex");

const res = await fetch("http://localhost:3000/webhooks/trackserps", {
  method: "POST",
  headers: { "Content-Type": "application/json", "TrackSERPs-Signature": `t=${t},v1=${v1}` },
  body,
});
console.log(res.status, await res.text());

Then break it on purpose: change one character of body after signing, subtract 400 from t, or use a different secret. Each must give a 401. Send the same body twice and confirm the second is ignored.

2. The real pipeline, through a tunnel

TrackSERPs only delivers to public HTTPS URLs on port 443 and rejects loopback and private addresses, so http://localhost:3000 cannot be registered. Run any tunnelling tool that gives your machine a public HTTPS URL, register that URL, and press Send test. The delivery log shows whether your server answered with a 2xx and what it said. Use a throwaway endpoint, not your production one, and delete it afterwards. Tunnel services have their own terms and pricing, which I have not compared here.

A ping verifies signatures and connectivity but not your event handling. For a real payload, redeliver a logged delivery from the dashboard.

Troubleshooting

SymptomLikely causeFix
Signature check always failsBody parsed before verifying, or a proxy altered itVerify the raw bytes; compare lengths of what you hash
Fails only after rotationReceiver only knows one secret, or Python dict kept the last v1Accept a list of secrets; parse every v1
Fails intermittentlyServer clock drift beyond 300 secondsSync time with NTP
401 from your own code on valid eventsHeader name case or missing tRead the header case-insensitively
Endpoint creation rejectedURL not HTTPS, not port 443, private address, or plan limitUse a public HTTPS URL; check endpoint count
plan_required on createStarter planUpgrade to Growth or above
Many retries on one eventReceiver is slow or returns non-2xxReply 200 first, work later
Redirects show as failuresEndpoint answers 301 or 302Register the final URL
No alert.triggered eventRule has webhook publishing off, or no subscriptionTurn it on in the rule and subscribe the endpoint
No rankings.updated after a first checkFirst checks have no previous rankWait for the next run
Endpoint is disabled20 consecutive failed deliveriesFix the receiver, then re-enable
Duplicate processingRetry or redelivery of the same eventDedupe on envelope id
Events later than expectedThe check itself takes about 10 to 20 minutesNothing to fix

Choosing a receiver

Match the destination to the job. Your own service is the right home when you need to verify signatures and run logic; the REST API guide covers reading data back. If you want no code, point an endpoint at a workflow tool: Zapier with Webhooks by Zapier (there is no native TrackSERPs Zapier app), the n8n node, or Make. For a chat message only, alert rules can post to Slack directly; see Slack rank alerts. The ranking-drop webhooks guide covers choosing thresholds, and the API quickstart gets you a key.

Frequently asked questions

What events does TrackSERPs send over webhooks?
Seven: run.completed, run.failed, rankings.updated, credits.low, credits.exhausted, alert.triggered and lookup.completed. You choose which ones each endpoint subscribes to. A ping event is also sent when you press Send test, whatever the subscription, so your receiver should accept and ignore unknown types.
How is the TrackSERPs-Signature header built?
It reads t=<unix seconds>,v1=<hex>. The hex value is the HMAC-SHA256 of the string t, a dot, then the exact raw request body, keyed with your whsec_ signing secret. During the 24 hours after a secret rotation the header holds two v1 values, one per active secret.
What response should my endpoint return?
Any 2xx status within 10 seconds counts as success. Anything else, a timeout or a connection error counts as a failure and is retried. Redirects are not followed, so a 301 or 302 is a failure. Return quickly and do slow work after responding.
Will I receive the same event twice?
Possibly. A retry after a timeout, or a manual redelivery, sends the same event id again. Store processed event ids and skip repeats. The id is stable across every attempt and every redelivery of the same event.
How do I test a webhook on my laptop?
Two ways. For the handler, sign a sample body yourself with the same HMAC scheme and POST it to localhost. For the real pipeline, expose the receiver on a public HTTPS URL on port 443 with a tunnel, because TrackSERPs refuses loopback and private addresses.
Which plans include webhooks?
Webhook endpoints are included from the Growth plan up: 2 endpoints on Growth, 5 on Pro and 20 on Agency. Starter has none. See the pricing page for plan details.
Are webhooks real-time?
No. A webhook is sent as soon as a check finishes, but checks run in a standard collection queue and normally take about 10 to 20 minutes. A same-day cached result can finish immediately. The webhook adds delivery time on top of the check, never less than it.

Sources & references

  1. TrackSERPs API docs — Webhooks and signatures(checked 2026-11-11)
  2. Python documentation — hmac, keyed-hashing for message authentication(checked 2026-11-11)