Webhooks
Webhooks announce what happened: ten events, signed so you can verify them, delivered with bounded retries.
For AI agents: the docs index is at /llms.txt, and every page is also served as markdown at its URL plus .md.
#Manage endpoints
You register an HTTPS endpoint and the events it receives, change or delete it, send a signed test event, and read the delivery log. Registering, changing, deleting and testing need a write key; listing and reading the log need only a read key.
| Method and path | Scope | What it does |
|---|---|---|
POST /v1/webhooks | write | Register a webhook endpoint |
GET /v1/webhooks | read | List webhook endpoints |
PATCH /v1/webhooks/{id} | write | Change a webhook endpoint |
DELETE /v1/webhooks/{id} | write | Delete a webhook endpoint |
POST /v1/webhooks/{id}/test | write | Send a signed test event |
GET /v1/webhooks/{id}/deliveries | read | Read an endpoint's delivery log |
These are your own events. Stripe billing events are a separate thing: Stripe calls POST /v1/billing/webhook, which is documented in the API reference.
#The ten events
| Event | Data keys | When |
|---|---|---|
EmailSent | send_id, campaign_id, lead_id, mailbox_id, step_order, email, message_id | A campaign email was sent. |
EmailReply | reply_id, campaign_id, lead_id, mailbox_id, category, from, subject | A reply arrived. |
EmailBounce | send_id, campaign_id, lead_id, mailbox_id, email | A campaign email bounced. |
LeadCreated | lead_id, email, source | A lead was added through the API or an import. |
EmailUnsubscribe | lead_id, campaign_id, email, via | A lead unsubscribed. via is one_click, reply or manual. |
CreditBalanceLow | balance, threshold | The credit balance fell below a threshold. |
AutopilotRunStatusChanged | run_id, from, to | An autopilot run moved to a new state. |
DfyOrderCompleted | order_id, kind, status | A done-for-you domain or mailbox order finished. |
MailboxDisconnected | mailbox_id, address, reason | A connected mailbox stopped working. |
CampaignCompleted | campaign_id, name | A campaign finished all its steps. |
An endpoint can also receive a webhook.test event, a sample sent on demand so you can check your receiver.
#The delivery body
Each delivery is a JSON POST with the event id, the type, a creation time and the event data. Bodies are at most 64 KB.
{
"id": "evt_...",
"type": "EmailReply",
"created_at": "2026-10-17T12:00:00.000Z",
"data": { "reply_id": "...", "campaign_id": "...", "category": "other" }
}| Header | Value |
|---|---|
X-ColdAgentAI-Timestamp | Unix seconds when the delivery was signed. |
X-ColdAgentAI-Signature | v1=<hex>, the HMAC-SHA256 described below. During a secret rotation it can hold several comma-separated v1 values. |
X-ColdAgentAI-Event-Id | The event id, the same on every retry. Use it to deduplicate. |
X-ColdAgentAI-Event-Type | The event name. |
X-ColdAgentAI-Delivery-Id | The id of this delivery. |
X-ColdAgentAI-Attempt | The attempt number, starting at 1. |
#Verify a delivery
Check the signature before you trust a delivery. The signature is v1= followed by the hex HMAC-SHA256 of <timestamp>.<raw body>, keyed with the endpoint secret.
- Read the raw request body as bytes. Do not parse and re-serialize it, because the signature covers the exact bytes.
- Read X-ColdAgentAI-Timestamp and reject the request if it is more than five minutes from your own clock. This stops a captured delivery from being replayed later.
- Compute HMAC-SHA256 with your endpoint secret over the timestamp, a period, then the raw body: "<timestamp>.<body>". Write the result as lowercase hex.
- Compare "v1=" plus your hex with each v1 value in X-ColdAgentAI-Signature using a constant-time comparison. Any one match is enough.
- Answer with a 2xx status. Anything else, including a redirect, is retried.
import { createHmac, timingSafeEqual } from 'node:crypto';
const TOLERANCE_SECONDS = 300;
/** rawBody is the exact request body (Buffer or string), never a re-serialized object. */
export function verifyColdAgentAIWebhook(secret, rawBody, headers) {
const timestamp = headers['x-coldagentai-timestamp'];
const signature = headers['x-coldagentai-signature'];
if (!timestamp || !signature || !/^\d{1,12}$/.test(timestamp)) return false;
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > TOLERANCE_SECONDS) return false;
const expected = Buffer.from(
createHmac('sha256', secret).update(`${timestamp}.`).update(rawBody).digest('hex'),
'utf8',
);
return signature.split(',').some((part) => {
const match = /^\s*v1=([0-9a-fA-F]{64})\s*$/.exec(part);
if (!match) return false;
const provided = Buffer.from(match[1].toLowerCase(), 'utf8');
return provided.length === expected.length && timingSafeEqual(provided, expected);
});
}Use the raw body your framework hands you before any JSON parsing. Deduplicate on X-ColdAgentAI-Event-Id, because a retry carries the same id.
#Retries and limits
- A 2xx answer within 10 seconds is success. Anything else is a failure, including a redirect, which is never followed.
- A delivery gets 8 attempts in all. After a failed attempt the waits are 30 seconds, 2 minutes, 8 minutes, 32 minutes, about 2 hours 8 minutes, 6 hours, 6 hours. After the last failed attempt the delivery is marked dead.
- Endpoint URLs must use HTTPS. Before each delivery the host is resolved, and a host that points at a loopback, private, link-local or cloud metadata address is refused and not retried.
- The signing secret is shown once when the endpoint is created and can be rotated. During a rotation the signature header can hold two values.
- An account can hold at most 20 endpoints.
- Queued deliveries are sent by scheduled jobs on the platform server: a webhook delivery job every minute, and the send job that runs every five minutes delivers them too. No route handler of your own is involved.