> ## Documentation Index
> Fetch the complete documentation index at: https://docs.staging.sdk.aurorax.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks & HMAC Verification

> Receive real-time signed lifecycle events and verify X-Aurora-Signature headers.

Configure a default webhook URL on your project in the Developer Portal, or pass a per-request `webhook_uri` (public HTTPS URL) when calling `POST /api/v1/requests` or MCP `create_request`.

## Event Types

| Event | When Emitted |
| - | - |
| `request.needs_input` | Clarification form (`pending_form`) is ready for the end user. |
| `request.in_progress` | Intake finished and outbound business discovery/calling has started. |
| `request.call.created` | Emitted once when an outbound call record is first created for a target. |
| `request.call.updated` | Emitted when an existing call changes status (`queued`, `scheduled`, `ringing`, `connected`, `completed`, `failed`). |
| `request.result.created` | A structured business result card has been materialized. |
| `request.completed` | Terminal event — final `overall_summary` and ranked `results` are ready. |
| `request.failed` | Terminal event — request could not be completed. |
| `request.cancelled` | Terminal event — request was cancelled via REST, Dashboard, or MCP. |

## Delivery Headers

Every webhook `POST` includes:

| Header | Description |
| - | - |
| `X-Aurora-Event` | Event name (e.g. `request.call.created`). |
| `X-Aurora-Delivery-Id` | Unique delivery UUID — store this to make your webhook handler idempotent. |
| `X-Aurora-Signature` | HMAC-SHA256 signature formatted as `t=<unix_seconds>,v1=<hex_digest>`. |

## Verifying `X-Aurora-Signature`

Compute `HMAC-SHA256(signing_secret, "{t}.{raw_request_body}")` using the exact raw request bytes and compare in constant time. Reject timestamps outside a 5-minute tolerance window to guard against replay attacks.

```python Python theme={null}
import hashlib
import hmac
import time


def verify_aurora_signature(
    secret: str,
    raw_body: bytes,
    signature_header: str,
    tolerance_seconds: int = 300,
) -> bool:
    parts = dict(item.split("=", 1) for item in signature_header.split(",") if "=" in item)
    ts = parts.get("t")
    sig = parts.get("v1")
    if not ts or not sig:
        return False
    if abs(int(time.time()) - int(ts)) > tolerance_seconds:
        return False
    signed_payload = f"{ts}.".encode("utf-8") + raw_body
    expected = hmac.new(secret.encode("utf-8"), signed_payload, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, sig)
```

```typescript TypeScript theme={null}
import crypto from "node:crypto";

export function verifyAuroraSignature(
  secret: string,
  rawBody: Buffer,
  signatureHeader: string,
  toleranceSeconds = 300,
): boolean {
  const parts = Object.fromEntries(
    signatureHeader.split(",").map((kv) => kv.split("=", 2)),
  );
  const ts = Number(parts.t);
  const sig = parts.v1;
  if (!ts || !sig) return false;
  if (Math.abs(Math.floor(Date.now() / 1000) - ts) > toleranceSeconds) return false;

  const expected = crypto
    .createHmac("sha256", secret)
    .update(Buffer.concat([Buffer.from(`${ts}.`, "utf8"), rawBody]))
    .digest("hex");

  const a = Buffer.from(expected, "hex");
  const b = Buffer.from(sig, "hex");
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}
```

> [!NOTE]
>
> Return any `2xx` HTTP status code within 10 seconds to acknowledge receipt. Non-`2xx` responses and timeouts are retried automatically with exponential backoff. You can inspect delivery logs and rotate your signing secret in Project Settings.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.