Skip to content
VPNDetection

Webhooks

Have VPNDetection call your endpoint with a signed event each time a database you chose is updated, then verify each delivery and download the build.

View as Markdown

A webhook destination calls your endpoint with a database.updated event each time a database you chose is published with new contents. The event names the build and links each file with its size and SHA-256, so your receiver can download it straight away with the Database API, or note that it's there.

Use a webhook when your own job should decide when and where to download, but you'd rather be told about a build than poll for one. Every delivery is signed to the Standard Webhooks spec, so your receiver can check that each one came from VPNDetection before it acts on it.

Before you begin

  • The Manage database delivery permission in your organization, which owners and admins have.
  • An endpoint at an https:// address on the public internet, which answers each delivery with a 2xx within 30 seconds.
  • An API key with the db.download scope, for the downloads the events link.

1. Add the destination

In the console, under Database > Delivery, click Add destination and pick Webhook.

2. Enter your endpoint

Under Connection, enter your endpoint's address in Endpoint URL, then click Save. The endpoint has to be https:// on a public address, so an http:// address, a private address or a name that resolves to one is refused when you save.

3. Choose the databases

Under Databases, tick Announce beside each database the endpoint should hear about, then click Save. You can choose any database your organization holds a license for, the Open ones included.

4. Store the signing secret

Once the URL is saved, the destination shows Signing secret. Click Reveal to show the secret your receiver verifies with, and store it where your receiver reads its configuration, never in its code.

Rotate replaces the secret. The old secret keeps signing beside the new one for 24 hours, so you can update your receiver without missing a delivery.

5. Test and activate

Click Test connection: VPNDetection sends a database.test event and waits for a 2xx answer. Once the test passes, click Activate. Each database you chose is announced once straight away, then on every new build.

Events

Each event has a type, and your endpoint receives these four:

EventSent when
database.updatedA database you chose was published with new contents.
database.deliveredNew files reached one of your organization's storage destinations.
database.delivery_failedDeliveries to one of your storage destinations have failed for a day.
database.testYou tested this destination from the console.

Every webhook destination in your organization receives database.delivered and database.delivery_failed for the organization's storage destinations too, so one receiver can follow them all.

Each event is a JSON body of type, timestamp and data:

json
{
  "type": "database.updated",
  "timestamp": "2026-10-21T06:12:03.000Z",
  "data": {
    "dataset": "vpn_ip_v1",
    "name": "VPN IP",
    "build": "20261021.l0ux5c",
    "published_at": "2026-10-21T06:09:51.839Z",
    "files": [
      {
        "format": "mmdb",
        "size": 1203039,
        "sha256": "6e2ec045663adaccbbafbafdea348108b1079e46e320cca399be2b6d1f8327e8",
        "url": "https://api.vpndetection.io/api/v1/database/download?id=vpn_ip_v1&format=mmdb&build=20261021.l0ux5c"
      }
    ]
  }
}

A url takes your API key as any download does, as a header or by adding &apikey=. It names its build, so it downloads the file that sha256 describes even once a newer build is live. Builds are kept for 7 days. After that, the build's url answers 410 with BUILD_GONE, and the same link without &build= downloads the live build.

database.delivered carries the destination (id, name, kind), the build and each file's dataset, format, path, sha256, size and build. database.delivery_failed carries the destination, failing_since, an error_code and the provider's error. database.test carries only the destination you tested, its id and name, and goes to that destination alone. It names no build and links no file, so answer it with a 2xx and do nothing else.

Verify a delivery

To make sure an event came from VPNDetection and wasn't changed on the way, verify its signature before you act on it. Every delivery is signed to the Standard Webhooks spec, so any of its libraries verifies it, and each request carries three headers:

HeaderHolds
webhook-idThe message's ID, the same on every retry of it. Use it to drop a duplicate.
webhook-timestampWhen it was sent, in Unix seconds.
webhook-signatureOne or more v1,<signature>, separated by spaces. During a rotation there are two.

The signature is an HMAC-SHA256 of <webhook-id>.<webhook-timestamp>.<body>, keyed with the secret after its whsec_ prefix, base64-decoded. Verify against the raw body, before any JSON parsing, and refuse a timestamp more than five minutes old:

python
import base64, hashlib, hmac, time

def verify(secret: str, headers: dict, body: bytes) -> bool:
    if abs(time.time() - int(headers["webhook-timestamp"])) > 300:
        return False
    key = base64.b64decode(secret.removeprefix("whsec_"))
    signed = f'{headers["webhook-id"]}.{headers["webhook-timestamp"]}.'.encode() + body
    expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode()
    return any(
        hmac.compare_digest(sig.split(",", 1)[1], expected)
        for sig in headers["webhook-signature"].split()
    )

Answer each delivery

Answer with any 2xx within 30 seconds. The body of your answer is ignored. Do the work after answering, or a slow download makes the delivery look failed.

Anything else, or no answer, is tried again 5 seconds later, then after 5 minutes, 30 minutes, 2 hours, 5 hours, and twice more 10 hours apart, about 28 hours in all. An event can arrive more than once, so key what you do on webhook-id.

Verify that a build arrived

The destination's History tab lists every delivery with the answer your endpoint gave: Delivered, Will retry, Failed or Sending, with the status code beside it. Below that, each announcement reads New build under Why and Delivered under Result.

To check the whole path, download one of an event's urls with your key and compare the file's SHA-256 with the event's sha256.

When a delivery fails

If the test fails, the result says which step failed and why. A host that couldn't be reached usually means the endpoint doesn't accept connections from the internet, or doesn't answer within 30 seconds. If your receiver refuses every delivery, check that it verifies the raw body before any JSON parsing, and that it uses the secret after its whsec_ prefix, base64-decoded.

An endpoint that has answered nothing but failures for three days is paused, and VPNDetection emails the people who manage delivery in your organization. Resume it from the console once it's fixed, and the current build of each database you chose is announced once. The destination's History lists every delivery with the status your endpoint returned, and Resend sends one again.

Next steps

Your endpoint now hears about each new build and can prove each event is genuine. Next, have your receiver download the build the event links, or add a storage destination, such as AWS S3, so the same receiver follows its database.delivered events too.