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

# Webhooks and events

> Receive signed event batches and use cursor polling for reconciliation.

## Register and test an HTTPS endpoint

Register the endpoint for the key that owns the events. Store the returned `webhook_secret` securely when registering the URL, and avoid recording the response in shared logs. Delivery starts with new events after registration. The test call sends one signed `webhook.test` event. Check `delivered` and the receiver's log after your verifier has loaded the secret.

```bash theme={null}
curl -fsS -X PUT "$INTERACTIVE_LAYERS_BASE/v1/keys/me/webhook" \
  -H "X-API-Key: $INTERACTIVE_LAYERS_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://receiver.example/interactivelayers/events"}'

curl -fsS -X POST "$INTERACTIVE_LAYERS_BASE/v1/keys/me/webhook/test" \
  -H "X-API-Key: $INTERACTIVE_LAYERS_API_KEY"
```

## Verify the original body bytes

Use `X-InteractiveLayers-Key-Id` to select the configured secret. Read `X-InteractiveLayers-Timestamp` and `X-InteractiveLayers-Signature`. The signature is hex HMAC-SHA256 over the timestamp, a period and the exact HTTP body bytes. Verify before decoding JSON. Older `X-Clipma-*` names can accompany the current headers during the transition.

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


def verify(secret: str, timestamp: str, raw_body: bytes, signature: str) -> bool:
    if not re.fullmatch(r"[0-9]{1,12}", timestamp):
        return False
    if not re.fullmatch(r"[0-9a-f]{64}", signature):
        return False
    if abs(time.time() - int(timestamp)) > 300:
        return False
    signed_bytes = timestamp.encode("ascii") + b"." + raw_body
    expected = hmac.new(secret.encode("utf-8"), signed_bytes, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature)
```

The body is `{"events":[...]}`. Acknowledge a batch after storing it durably. Deduplicate by event `id`. A batch that fails three times is skipped. For reconciliation, poll `GET /v1/events?since=0&types=break.signal,source.error` with `events:read`. Persist `next_since` even after an empty page, and reuse it for the next request with the same filters. Treat `seq` as the cursor position. Common types include `opportunity.detected`, `brand_safety.hold`, `break.announced`, `break.signal`, `break.decided` and `vod.scan.completed`. The special test event has `seq: 0` and is useful for checking your receiver. [Errors and retries](https://docs.interactivelayers.com/errors.md)


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