Webhooks

How Codeego notifies your system when an API assessment finishes: the events, the payload, how to verify the HMAC-SHA256 signature, the retry schedule and how to rotate the signing secret.

When you create an assessment through the external API with a webhook_url, Codeego sends an HTTP POST to that URL when the assessment reaches a final state. Webhooks are available only for assessments created through the API.

Events#

assessment.completed
The assessment finished and its results are available.
assessment.failed
The assessment finished without results.

Request format#

HeaderValue
Content-Typeapplication/json
X-Codeego-Eventassessment.completed or assessment.failed
X-Codeego-Signaturet=<unix timestamp>,v1=<hex HMAC-SHA256>
X-Codeego-DeliveryA UUID identifying the delivery. It stays the same across retries of the same event.

The body is the same JSON object that GET /api/external/v1/assessments/{id} returns at that moment, including results with signed URLs for a completed assessment, or error for a failed one. The signed URLs expire one hour after the delivery; fetch the files promptly or request the assessment again later.

{
  "id": "019524ab-7c1e-7d2a-9b1f-3a6c2e8d4f10",
  "status": "failed",
  "mode": "starter",
  "created_at": "2026-11-20T10:15:00+00:00",
  "started_at": "2026-11-20T10:15:04+00:00",
  "finished_at": null,
  "progress": null,
  "error": { "code": "analysis_failed", "message": "..." },
  "results": null
}
Body of an assessment.failed delivery

Verify the signature#

Each organisation has one webhook signing secret, separate from the API keys. The signature is an HMAC-SHA256, keyed with that secret, of the string <t>.<raw body>, where <t> is the timestamp from the header. To verify a delivery:

  1. Read the raw request body as bytes, before any JSON parsing.
  2. Split X-Codeego-Signature on commas and read t and v1.
  3. Reject the delivery if t is more than five minutes from your current time. This limits replay.
  4. Compute the HMAC-SHA256 of t, a full stop and the raw body, and compare its hex digest with v1 using a constant-time comparison.
import hashlib, hmac, time

def verify(header: str, body: bytes, secret: str, tolerance: int = 300) -> bool:
    try:
        parts = dict(p.split("=", 1) for p in header.split(","))
        ts, received = int(parts["t"]), parts["v1"]
    except (KeyError, ValueError):
        return False
    if abs(time.time() - ts) > tolerance:
        return False
    expected = hmac.new(secret.encode(), f"{ts}.".encode() + body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, received)
Python
const crypto = require("crypto");

function verify(header, bodyBuffer, secret, tolerance = 300) {
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=", 2)));
  const ts = Number.parseInt(parts.t, 10);
  if (!parts.v1 || Number.isNaN(ts)) return false;
  if (Math.abs(Date.now() / 1000 - ts) > tolerance) return false;
  const expected = crypto
    .createHmac("sha256", secret)
    .update(Buffer.concat([Buffer.from(ts + "."), bodyBuffer]))
    .digest("hex");
  const a = Buffer.from(expected, "hex");
  const b = Buffer.from(parts.v1, "hex");
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}
Node.js (bodyBuffer is the raw body as a Buffer)

Acknowledgement and retries#

Return any 2xx status within 10 seconds to acknowledge the delivery. A timeout, a connection error or any other status counts as a failure. Codeego makes up to four attempts: the first immediately, then after 10 seconds, 60 seconds and 10 minutes. Each attempt carries a fresh timestamp and signature. After the fourth failure the event is not sent again; poll the assessment to recover its state.

Because a delivery can be retried after your endpoint has processed it (for example when your acknowledgement arrives late), use X-Codeego-Delivery or the assessment id to ignore duplicates.

Reveal and rotate the signing secret#

Owners and Admins manage the secret in Settings, API Keys, card Webhook Signing Secret. Reveal shows the current value. Rotate secret replaces it after a confirmation.