Browse documentation
Guides

Webhook notifications

Receive a low-balance or repeated-error notification at your HTTPS endpoint.

Set up a receiver

Open Notifications, save the HTTPS receiver URL, set an alert threshold or enable API error alerts. Store the signing secret on the receiving server. Send a test from the same screen and inspect its delivery status.

Event payload

Example response · selected fields
{
  "id": "42",
  "type": "webhook.test",
  "created": 1795200000,
  "data": {
    "test": true
  }
}

balance.low includes data.balance_usd. Five consecutive API errors trigger requests.errors with data.consecutive_errors.

Verify the signature

Python
import hashlib, hmac

def valid_signature(secret, headers, raw_body):
    stamp = headers["X-Kavren-Timestamp"].encode()
    signed = stamp + b"." + raw_body
    digest = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
    return hmac.compare_digest("sha256=" + digest, headers["X-Kavren-Signature"])

Verify the original body bytes before decoding JSON. Reject stale timestamps according to your receiver policy and deduplicate by event ID. Return a 2xx status after accepting the event. Failed production deliveries may be retried up to six attempts in total.

Search Kavren