Skip to content

Callbacks

Include callback_url when you submit a query. Once the query reaches a final status (completed, timeout, or failed), the API sends a POST request to that URL.

POST /your/path HTTP/1.1
Content-Type: application/json; charset=utf-8
User-Agent: geoeval-callback
X-Geoeval-Signature: t=1798000095,v1=5257a869e7...

The request body matches GET /v1/queries/{query_id}, including freshly signed recording URLs and a callback field describing the current delivery.

  • Must use https, be publicly reachable, and contain no username, password, or URL fragment.
  • Private and internal IP addresses are rejected, including public hostnames that resolve to internal addresses.
  • Redirects are not followed; provide the final target URL.
  • Respond with any 2xx status within 10 seconds. Run slow processing asynchronously after responding.
  • Failed deliveries retry after 30 s, 1 min, 2 min, and doubling intervals capped at 30 min, up to 10 total attempts. After the final failure, callback.status changes to failed.
  • Deliveries are at-least-once. Use query_id as your idempotency key.

X-Geoeval-Signature uses the format t=<unix seconds>,v1=<hex>, where v1 is HMAC-SHA256(secret, "<t>.<raw body>") computed with the signing secret of the API key that submitted the query. For 24 hours after secret rotation, the header includes two v1 values; accept the callback if either matches. Reject requests whose timestamp differs from current time by more than 5 minutes.

Always compute the HMAC over the raw request body. Parsing and re-serializing JSON alters the byte sequence and breaks verification.

verify-callback.ts
import { createHmac, timingSafeEqual } from "node:crypto";
// Checks X-Geoeval-Signature. rawBody is the request body exactly as received (before any JSON parsing),
// secret is the signing secret of the API key that submitted the query (whsec_...).
export function verifyCallback(rawBody: string | Buffer, header: string, secret: string, toleranceSeconds = 300): boolean {
const parts = header.split(",").map((part) => part.split("="));
const timestamp = parts.find(([name]) => name === "t")?.[1];
if (!timestamp || Math.abs(Date.now() / 1000 - Number(timestamp)) > toleranceSeconds) return false;
const expected = createHmac("sha256", secret).update(`${timestamp}.`).update(rawBody).digest();
// After a rotation there are two v1 values; one of them matching is enough
return parts.some(([name, value = ""]) => {
if (name !== "v1") return false;
const given = Buffer.from(value, "hex");
return given.length === expected.length && timingSafeEqual(given, expected);
});
}

Deleting the API key that submitted a query prevents signing and drops unsent callbacks. Revoking the key does not affect pending callbacks.