Skip to content

Webhooks

Get told at a URL of yours when something happens.

6 min read Updated

A webhook is a call from Rabbitflare to a URL of yours when something happens on your account: a server is ready, a site is live, a token was made. Instead of asking the API every few seconds whether anything changed, you hear about it at once.

How it works

  1. You add an endpoint: an https URL of yours, the events it wants, and optionally only some servers.
  2. When one of those events happens, we send it to the URL as a POST with a small JSON body (like server.ready, site.ready or api_token.created), signed with the endpoint's secret.
  3. Your endpoint checks the signature and answers 2xx. Any other answer, or none, and we try again later.

Add an endpoint

In the panel

  1. Open the Webhooks tab

    In the control panel, open API in the sidebar, then the Webhooks tab, and choose Add endpoint.

  2. Say where and what

    Enter your URL, and choose the events: All events (types added later included), or the ones you want. Leave it on all servers, or choose some: an endpoint for some servers still gets the events of the account as a whole. Then enter the code from your authenticator app: adding an endpoint asks for it, as making a token does, and so does a change that sends its events to another URL or sends it more of them. We email you after each.

  3. Copy the signing secret

    The endpoint's signing secret is shown once, when it's made: keep it where your receiver can read it (see Verify signatures).

Through the API

Add one with POST /v1/webhooks/endpoints, with a token that has Manage webhooks. The answer carries the signing secret in secret, this once.

curl -X POST "https://api.rabbitflare.com/v1/webhooks/endpoints" \
  -H "Authorization: Bearer $RABBITFLARE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://hooks.example.com/rabbitflare",
  "description": "Deploy notifications",
  "events": [
    "server.ready",
    "site.ready",
    "site.install_failed"
  ]
}'

Send ["*"] for every type, including types added later. A token can only make an endpoint for the events it may read itself: server events need servers:read, site events sites:read, and ["*"] needs the read scope of every group sent today (servers:read, sites:read, support:read and account:read). The types are listed by GET /v1/webhooks/event-types and in Event types. A token limited to some servers can only make an endpoint for those servers: send their ids in serverIds (sent without allServers, it means allServers: false). An account can have 10 endpoints.

An endpoint added through the API follows the token that added it until its URL is changed in the panel: it's sent only the events that token may read now, of the servers it reaches; only that token can change it, turn it on or rotate its secret (another token that reaches it may read it, send it a test event or a delivery again, turn it off or delete it, and gets 403 panel_only for anything else); and it's turned off when the token no longer covers it, expires, revokes itself or is revoked by support, and when you revoke the token in the panel unless you choose to keep it on (it's then still sent only what the token could read). Its disabledReason is then token (admin when support revoked the token). Turning on again in the panel an endpoint whose token has ended asks for your authenticator code.

The URL

It's checked when you save it, and again before every call:

  • https on port 443 or 8443, with a certificate valid for its name.
  • A domain name, not an IP address, whose addresses are on the public internet.
  • No user name or password in it, and at most 2,000 characters.
  • Redirects aren't followed: use the final URL.

Send a test event

Send a test event to check your endpoint: a ping event, signed like any other, sent to this endpoint only. The answer is the delivery, which shows how your endpoint answered.

What we send

A POST to your URL, with these headers:

HeaderWhat it holds
Content-Type application/json
User-Agent Rabbitflare-Webhooks/1, with a link to this page.
Rabbitflare-Event-Id The event's id, as in the body's id: the same on every attempt and for every endpoint. Remember it to ignore an event you've handled.
Rabbitflare-Event-Type The event type, as in the body's type.
Rabbitflare-Delivery-Id This delivery's id (this event sent to this endpoint), the same on every attempt: GET /webhooks/deliveries/{deliveryId} shows it.
Rabbitflare-Delivery-Attempt Which attempt this is, from 1. A delivery sent again goes on counting.
Rabbitflare-Signature t=<Unix time>,v1=<signature>: the signature is the hex HMAC-SHA256 of t, a dot and the raw body, made with the endpoint's signing secret. For 24 hours after the secret is rotated, a second v1= made with the old secret follows. Compare in constant time, and refuse a t more than 5 minutes from your clock.

And a JSON body like this one:

Body
{
  "id": "5f0d2a7c-3b1e-4c8d-9a6f-2e7b1c4d5a60",
  "type": "site.ready",
  "apiVersion": "v1",
  "createdAt": "2026-11-18T08:46:49.000Z",
  "accountId": "0b9f2c1e-5d0b-4b53-9a7e-2f1a3a6d7b11",
  "data": {
    "level": "success",
    "message": "“Blog” is live at https://blog-k3x9q.rabbitflare.link",
    "actor": {
      "type": "system",
      "name": null
    },
    "server": {
      "id": "6f0c6c0e-5d0b-4b53-9a7e-2f1a3a6d7b11",
      "name": "web-1"
    },
    "site": {
      "id": "9b1e4f2a-7c3d-4e5f-8a9b-0c1d2e3f4a5b",
      "name": "Blog"
    },
    "mailDomain": null,
    "resource": {
      "type": "site",
      "id": "9b1e4f2a-7c3d-4e5f-8a9b-0c1d2e3f4a5b",
      "url": "https://api.rabbitflare.com/v1/sites/9b1e4f2a-7c3d-4e5f-8a9b-0c1d2e3f4a5b"
    }
  }
}

It's small on purpose: what happened, who did it, where, and data.resource, the thing it's about with its address in the API. Read that resource with your API token for its full, current state. The same event sent again (a later attempt, or a delivery sent again) has the same body, byte for byte; Event types describes every field and every type.

What your endpoint must do

Check the signature
Anyone can send a request to your URL. Act only on calls whose Rabbitflare-Signature matches your secret, over the raw body (see Verify signatures).
Answer within 10 seconds
Any 2xx counts. Answer first and do the work afterwards, from a queue: a call that takes longer counts as failed, and is sent again.
Handle each event once
The same event can come more than once: when an answer is lost, when you send a delivery again, or to two of your endpoints. Remember each event's id (also in Rabbitflare-Event-Id) and skip the ones you've handled.
Don't rely on the order
Events can arrive in another order than they happened, after a retry for example. Go by createdAt, or read the resource for where it stands now.
Ignore types you don't know
New event types can appear at any time. Answer 2xx and skip them.

On a WordPress site, a small plugin does all of this: see Receive webhooks in WordPress.

Retries

A delivery that fails is tried again later: 8 attempts in all, over about 45 hours. A failure is any answer other than 2xx, no answer within 10 seconds, a connection that can't be made, or a redirect. Each wait is a little longer at random, so that retries don't all arrive together.

AttemptWhenAfter the first
1 At once –
2 1 minute later 1 minute
3 5 minutes later 6 minutes
4 30 minutes later 36 minutes
5 2 hours later 2 hours 36 minutes
6 6 hours later 8 hours 36 minutes
7 12 hours later 20 hours 36 minutes
8 24 hours later 44 hours 36 minutes

After the last attempt the delivery is failed. An endpoint that answers an event with 410 Gone is turned off at once: answer it from a URL you no longer use. A test event's 410 only fails that test.

When an endpoint keeps failing

While its deliveries fail, the endpoint's failingSince says since when. After 5 days of failures with no success in between, we turn it off: its status becomes disabled with the reason failing, its waiting deliveries fail, and we email you. Fix the endpoint, then turn it on again in the panel or with PATCH and { "status": "enabled" } (with the token that added it). Events that happened while it was off aren't sent: read them from the Events API (below).

Deliveries

Each event sent to an endpoint is a delivery, kept for 30 days. List an endpoint's deliveries (the failed ones with state=failed), or read one: the JSON that was sent, the start of your endpoint's answer, and each attempt.

Send a delivery again once your endpoint is fixed: the same body, with a new signature, at once. An account can send 60 deliveries again an hour. The event keeps its id, so a receiver that handled it already skips it.

Reading events instead

The same events, with the same ids, are listed by GET /v1/events, newest first. Read them to catch up after your endpoint was down, or instead of webhooks when polling suits you better (a script run by cron, say).

An event can be recorded a little after newer ones, so a poller that only asks for what came after the newest event it has seen can miss one. Read again from 5 minutes before it, and skip the ids you've handled:

// Run every minute (from cron, say): prints what happened since the last run, oldest first, each event once.
// It reads again from 5 minutes before the newest event it has seen, because an event can be recorded
// a little after newer ones, and skips the ids it has handled. Its place is kept in a file beside it.
import { existsSync, readFileSync, writeFileSync } from "node:fs";

const STATE = new URL("rabbitflare-events.json", import.meta.url);
const OVERLAP_MS = 5 * 60_000;
const state = existsSync(STATE)
  ? JSON.parse(readFileSync(STATE, "utf8"))
  : { newest: new Date(Date.now() - 3_600_000).toISOString(), handled: {} };

const url = new URL("https://api.rabbitflare.com/v1/events");
url.searchParams.set("since", new Date(Date.parse(state.newest) - OVERLAP_MS).toISOString());
url.searchParams.set("limit", "100");
const events = [];
let cursor = null;
do {
  if (cursor) url.searchParams.set("cursor", cursor);
  const res = await fetch(url, { headers: { Authorization: `Bearer ${process.env.RABBITFLARE_TOKEN}` } });
  if (!res.ok) throw new Error(`Rabbitflare API error ${res.status}: ${await res.text()}`);
  const page = await res.json();
  events.push(...page.data);
  cursor = page.pagination.nextCursor;
} while (cursor);

// The list is newest first: handle the events oldest first.
for (const event of events.reverse()) {
  if (state.handled[event.id]) continue; // Read again in the overlap: handled already.
  state.handled[event.id] = event.createdAt;
  if (event.createdAt > state.newest) state.newest = event.createdAt;
  console.log(`${event.createdAt} ${event.type}: ${event.message}`);
}

// Forget the ids the next run can't read again, and keep the place for it.
const oldest = new Date(Date.parse(state.newest) - OVERLAP_MS).toISOString();
for (const [id, createdAt] of Object.entries(state.handled)) if (createdAt < oldest) delete state.handled[id];
writeFileSync(STATE, JSON.stringify(state));

Still have a question?

Our team answers support tickets about the API, and other developers answer in the community.

Contact support

Popular

API docs