Skip to content

Webhooks

A webhook endpoint is a URL on your side. When an event you subscribed to happens, zemoData sends it a POST with a JSON body, signed with the endpoint’s secret. Add and manage endpoints on the portal’s Webhooks page (owners, admins and developers), or with a live key that has the webhooks scope: GET /v1/webhooks, POST /v1/webhooks (url, events, description; the answer holds the secret once), DELETE /v1/webhooks/{id} and POST /v1/webhooks/{id}/test. Test keys can’t manage endpoints (403 auth.forbidden).

Event Sent when data
credits.low A call takes your balance below your low-balance threshold (set on the portal’s Organization page). Sent once per crossing. balance, threshold
credits.granted Credits are added: a plan renewal, a pack, a coupon, a grant from zemoData, a trial. kind, credits, ledger_entry_id
key.revoked An API key is revoked, by a member, by zemoData, or automatically (for example a leaked key). key_id, public_id
invoice.paid An invoice is paid. invoice_id, amount_paid_cents, currency
invoice.payment_failed Collecting an invoice failed; update the payment method. invoice_id, amount_due_cents
bulk_job.completed A bulk job finished; get its result from GET /v1/bulk/jobs/{id}. job_id, kind, status, env, rows, matched, charged_credits
bulk_job.failed A bulk job stopped (failed or expired); rows done before it stopped are in its result file. job_id, kind, status, env, error_code, error_message, matched, charged_credits
product.updated A data product you hold has a new version (its segment, bundles or price may differ). product_id, version_id, version
webhook.test You press Send test event in the portal. endpoint_id
POST /hooks/zemodata HTTP/1.1
Content-Type: application/json
User-Agent: zemoData-Webhooks/1.0
Zemo-Event-Id: evt_01JD3K8ZQ4V6W9XG2M5N7P0R1S
Zemo-Event-Type: credits.low
Zemo-Delivery-Id: whd_01JD3K9A2B3C4D5E6F7G8H9J0K
Zemo-Delivery-Attempt: 1
Zemo-Signature: t=1764064800,v1=9e0623871740b6580b8b9e30737125ff552eebd8830dc037acc0ac8bd84f064d
{"created_at":"2026-11-25T10:00:00Z","data":{"balance":480,"threshold":500},"id":"evt_01JD3K8ZQ4V6W9XG2M5N7P0R1S","type":"credits.low"}

The body is always { id, type, created_at, data }. id is the event’s ID: the same event can reach you more than once (a retry after a timeout, for example), so use id to handle each event once. Answer with any 2xx status within 10 seconds; do the work afterwards.

Zemo-Signature is t=<unix time>,v1=<hex>, where the hex is HMAC-SHA256 of t, a dot and the raw body, keyed with the endpoint’s signing secret (whsec_…, shown once when you add the endpoint). Compute it over the exact bytes you received, before any JSON parsing, compare in constant time, and refuse anything signed more than 5 minutes ago. (The example above is signed with the made-up secret whsec_0123456789012345678901234567890123456789.)

python/verify_webhook.py
"""Check that a webhook delivery came from zemoData: the `Zemo-Signature` header.
Use `verify` in your endpoint with the raw request body (the exact bytes, before any JSON parsing).
Run as a script, it checks one delivery given in environment variables.
"""
import hashlib
import hmac
import os
import sys
import time
TOLERANCE_SECONDS = 300 # refuse deliveries signed more than 5 minutes ago (replays)
def verify(secret: str, header: str, raw_body: bytes, now: float | None = None) -> bool:
"""True if `header` (`t=<unix>,v1=<hex>[,v1=<hex>]`) signs `raw_body` with `secret`."""
timestamp = ""
signatures = []
for part in header.split(","):
name, _, value = part.strip().partition("=")
if name == "t":
timestamp = value
elif name == "v1":
signatures.append(value)
if not timestamp.isdigit() or not signatures:
return False
if abs((now or time.time()) - int(timestamp)) > TOLERANCE_SECONDS:
return False
expected = hmac.new(secret.encode(), timestamp.encode() + b"." + raw_body, hashlib.sha256).hexdigest()
# During a secret rotation a delivery carries two v1 signatures: either may match.
return any(hmac.compare_digest(expected, signature) for signature in signatures)
if __name__ == "__main__":
secret = os.environ["ZEMO_WEBHOOK_SECRET"] # whsec_…, shown once when you add the endpoint
header = os.environ["ZEMO_SIGNATURE"] # the Zemo-Signature header
with open(os.environ["ZEMO_WEBHOOK_BODY_FILE"], "rb") as body_file: # the raw body
body = body_file.read()
if verify(secret, header, body):
print("signature valid")
else:
print("signature invalid: reject the delivery with 400")
sys.exit(1)

These samples run as tests against deliveries signed by the platform’s own code.

Replace secret in the portal shows a new secret once. For the overlap you choose (none, 1, 24 or 72 hours) each delivery carries two v1= signatures, one per secret, so a receiver with either secret accepts it. Deploy the new secret, then let the overlap run out.

A delivery that gets no 2xx answer (an error status, a timeout, a refused connection or a TLS error) is retried after 1 minute, 5 minutes, 30 minutes, 2, 6, 12 and 24 hours: eight attempts over about two days, then it is marked failed. Redirects are not followed.

The portal’s delivery log shows each event, its status (waiting, delivered, retrying, failed), the attempts, the last HTTP status and response time, the reason it failed, and the body. Send again retries a failed delivery at once.

An endpoint is turned off after 50 deliveries in a row fail every attempt (the limit is the setting webhooks.disable_after_failures), and we email your billing address. Turn it back on in the portal once it works.

Endpoint URLs must be public https addresses, without a user name, password or #fragment. We resolve the host name when you save the endpoint and again before every delivery, and refuse private, loopback, link-local, carrier-grade NAT, multicast and reserved addresses (including cloud metadata addresses such as 169.254.169.254); the delivery connects to the address that was checked. An organization can have 10 endpoints by default (webhooks.max_endpoints, which can differ by plan).

Problem When
422 validation with errors[].code url.https_required, url.invalid, url.unresolvable or url.private_address The URL is not one we accept (see above).
422 validation with events.required or events.unknown No events chosen, or an event that doesn’t exist.
409 webhooks.limit The organization already has the most endpoints it may have.
409 webhooks.endpoint_disabled A test send or retry for an endpoint that is turned off.
409 webhooks.delivery_state A retry for a delivery that is waiting or already delivered.