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 pathScopeWhat it does
POST /v1/webhookswriteRegister a webhook endpoint
GET /v1/webhooksreadList webhook endpoints
PATCH /v1/webhooks/{id}writeChange a webhook endpoint
DELETE /v1/webhooks/{id}writeDelete a webhook endpoint
POST /v1/webhooks/{id}/testwriteSend a signed test event
GET /v1/webhooks/{id}/deliveriesreadRead 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

EventData keysWhen
EmailSentsend_id, campaign_id, lead_id, mailbox_id, step_order, email, message_idA campaign email was sent.
EmailReplyreply_id, campaign_id, lead_id, mailbox_id, category, from, subjectA reply arrived.
EmailBouncesend_id, campaign_id, lead_id, mailbox_id, emailA campaign email bounced.
LeadCreatedlead_id, email, sourceA lead was added through the API or an import.
EmailUnsubscribelead_id, campaign_id, email, viaA lead unsubscribed. via is one_click, reply or manual.
CreditBalanceLowbalance, thresholdThe credit balance fell below a threshold.
AutopilotRunStatusChangedrun_id, from, toAn autopilot run moved to a new state.
DfyOrderCompletedorder_id, kind, statusA done-for-you domain or mailbox order finished.
MailboxDisconnectedmailbox_id, address, reasonA connected mailbox stopped working.
CampaignCompletedcampaign_id, nameA 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.

JSON
{
  "id": "evt_...",
  "type": "EmailReply",
  "created_at": "2026-10-17T12:00:00.000Z",
  "data": { "reply_id": "...", "campaign_id": "...", "category": "other" }
}
HeaderValue
X-ColdAgentAI-TimestampUnix seconds when the delivery was signed.
X-ColdAgentAI-Signaturev1=<hex>, the HMAC-SHA256 described below. During a secret rotation it can hold several comma-separated v1 values.
X-ColdAgentAI-Event-IdThe event id, the same on every retry. Use it to deduplicate.
X-ColdAgentAI-Event-TypeThe event name.
X-ColdAgentAI-Delivery-IdThe id of this delivery.
X-ColdAgentAI-AttemptThe 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.

  1. Read the raw request body as bytes. Do not parse and re-serialize it, because the signature covers the exact bytes.
  2. 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.
  3. Compute HMAC-SHA256 with your endpoint secret over the timestamp, a period, then the raw body: "<timestamp>.<body>". Write the result as lowercase hex.
  4. Compare "v1=" plus your hex with each v1 value in X-ColdAgentAI-Signature using a constant-time comparison. Any one match is enough.
  5. Answer with a 2xx status. Anything else, including a redirect, is retried.
Node
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.
Webhooks