API: webhooks

With a webhook you hear straight away what happens in your workspace, instead of having to keep checking yourself.

New

Version 1 of the API has just opened up for your own scripts, with API keys per workspace. What is between [brackets] we have yet to fill in.

Setting up a webhook

You create a webhook in the dashboard, under Developer, on the Webhooks tab. For that you need the Manage API keys permission. You enter an https address and choose the events it should receive. After creating it you see, once, the secret every event is signed with; with New secret you replace it later.

Send test sends an event of the type webhook.ping to the address, to try out your receiver.

An event

Every event is a POST with JSON. It only contains ids: read the rest with an API key through the API. That way an event never contains more than your key may see, and what you read is always up to date.

Event
POST /servur HTTP/1.1
Content-Type: application/json
Servur-Event: dns-zone.changed
Servur-Event-Id: 9f2c4f63-1e2b-4c33-9c8e-0d7f2b6a1c55
Servur-Delivery-Id: 019a6b00-0000-7000-8000-000000000001
Servur-Signature: t=1762963200,v1=5f0e...c2a1

{
  "id": "9f2c4f63-1e2b-4c33-9c8e-0d7f2b6a1c55",
  "type": "dns-zone.changed",
  "createdAt": "2026-11-12T16:00:00.000Z",
  "workspaceId": "019a6b00-0000-7000-8000-000000002205",
  "data": { "zoneId": "019a6a00-0000-7000-8000-000000007500", "versionId": "019a..." }
}

id is the same for every webhook that receives the event and for every attempt. An event can arrive more than once, and the order is not guaranteed: do not process an id you have already seen a second time.

Checking the signature

Servur-Signature contains a timestamp t and v1, the HMAC-SHA256 of t, a full stop and the body as it arrived, with the webhook's secret. Calculate it yourself, compare in constant time, and refuse an event whose t is more than five minutes old.

Node.js
import { createHmac, timingSafeEqual } from 'node:crypto';

// `body` is the request body as it arrived, before any JSON parsing.
export const isFromServur = (secret, header, body) => {
  const parts = Object.fromEntries(header.split(',').map((part) => part.split('=')));
  const age = Math.abs(Date.now() / 1000 - Number(parts.t));
  const expected = createHmac('sha256', secret).update(`${parts.t}.${body}`).digest('hex');

  return age < 300 && expected.length === parts.v1?.length && timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
};
PHP
<?php

$body = file_get_contents('php://input');
parse_str(str_replace(',', '&', $_SERVER['HTTP_SERVUR_SIGNATURE'] ?? ''), $parts);
$expected = hash_hmac('sha256', ($parts['t'] ?? '') . '.' . $body, getenv('SERVUR_WEBHOOK_SECRET'));

if (abs(time() - (int) ($parts['t'] ?? 0)) > 300 || !hash_equals($expected, $parts['v1'] ?? '')) {
    http_response_code(400);
    exit;
}

Retrying and switching off

Respond within ten seconds with a 2xx status. Any other response, a timeout or a redirect counts as failed: we try again, a little later each time, for about a day. If every event fails for three days, we switch the webhook off and the people who manage the API keys get an email. In the dashboard you see the events of the last thirty days for each webhook, with what your receiver answered, and you can send one again.

All events

Services

TypeWhen
service.activatedA service has been set up and is running.
service.renewal-dueA service's next period is on the next invoice.
service.renewedA service runs for another period.
service.suspendedA service has been put on hold.
service.unsuspendedA service that was on hold is running again.
service.cancelledA service has been cancelled and stopped.
service.expiredA service ran out without renewal.

Billing

TypeWhen
order.paidAn order has been paid or started by direct debit.
invoice.issuedAn invoice or credit note has been sent.
invoice.paidAn invoice has been paid.

DNS and domain names

TypeWhen
dns-zone.changedThe records of a zone have changed.
domain.transferredA transferred domain name has arrived.
domain.nameservers-changedA domain name's nameservers have changed.

Email

TypeWhen
mailbox.createdA mailbox has been added.
mailbox.deletedA mailbox has been deleted.
Was this helpful?

Everything for your online success, all in one place

Create an account