Webhooks API
Base path: /api/v1/webhooks/. Python: client.webhooks. API-key scope: webhooks
(scopes).
A webhook posts account events to your URL. The redirect_url callback on a single conversion
is a separate mechanism with its own key, see
Verifying the callback.
| Method | Path | Python | Purpose |
|---|---|---|---|
POST | / | webhooks.create({"url": ..., "events": [...], "description": ...}) | Create; answers 201 with webhook and the raw secret |
GET | / | webhooks.list() | Your webhooks |
GET | /{webhook_id}/ | webhooks.get(webhook_id) | One webhook |
PATCH | /{webhook_id}/ | webhooks.update(webhook_id, {...}) | Change url, events, is_active or description |
DELETE | /{webhook_id}/ | webhooks.delete(webhook_id) | Delete it and its delivery history |
GET | /{webhook_id}/deliveries/ | webhooks.deliveries(webhook_id, page=1) | Recent delivery attempts, newest first |
POST | /{webhook_id}/test/ | webhooks.test(webhook_id) | Queue a webhook.test delivery |
POST | /{webhook_id}/rotate-secret/ | webhooks.rotate_secret(webhook_id) | New secret and masked_secret |
The raw secret is returned only by create and rotate_secret; afterwards the API shows
masked_secret. Rotation takes effect at once, so deliveries signed after the call no longer
verify with the old secret.
Events
conversion.started, conversion.completed, conversion.failed, batch.completed,
batch.failed, credits.low, credits.exhausted, and webhook.test for test deliveries.
Verifying a delivery
Each delivery is a JSON POST with these headers:
| Header | Value |
|---|---|
X-Indox-Event | The event name |
X-Indox-Delivery | The delivery id |
X-Indox-Timestamp | Unix seconds when the delivery was signed |
X-Indox-Signature | v1= followed by the hex HMAC-SHA256 of <timestamp>.<raw body> |
The HMAC key is the SHA-256 hex digest of your raw secret. Compute the signature over the raw request bytes before parsing the JSON, and compare in constant time:
import hashlib
import hmac
def verify(secret: str, timestamp: str, body: bytes, signature: str) -> bool:
key = hashlib.sha256(secret.encode()).hexdigest().encode()
expected = "v1=" + hmac.new(key, f"{timestamp}.".encode() + body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, signature)Drop a delivery whose timestamp is far from your clock, for example more than five minutes.