Skip to content
VaultDBDocs

Webhooks

A webhook sends an HTTPS POST to your URL when rows in a database change. Webhooks are available on the Starter plan and above. The number of webhooks you can have is counted across all databases on your account: 3 on Starter, 25 on Pro, unlimited on Business.

Managing webhooks needs the Databases.webhooks permission. A webhook receives every change, whatever the table's row-level policies say, so grant the permission only to a key that may see every row.

Create a webhook

curl -X POST https://api.vaultdb.io/api/databases/shop/webhooks \
  -H "Authorization: Bearer $VAULTDB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.com/hooks/vaultdb", "events": "insert,update" }'
Field Required Description
url Yes An https:// URL. Its host must resolve to public internet addresses: localhost, private networks and link-local addresses are refused.
events No A comma-separated list of insert, update and delete. Default: all three.

Returns 201:

{
  "message": "Webhook created",
  "webhook": {
    "id": "8b0c…",
    "database_name": "shop",
    "url": "https://example.com/hooks/vaultdb",
    "events": "insert,update",
    "status": "active",
    "secret": "3f9a…",
    "created_at": "2026-10-07 12:00:00"
  },
  "note": "..."
}

Store secret now. You need it to verify deliveries, and no endpoint returns it again. If you lose it, delete the webhook and create a new one.

List and delete webhooks

curl https://api.vaultdb.io/api/databases/shop/webhooks \
  -H "Authorization: Bearer $VAULTDB_API_KEY"

curl -X DELETE https://api.vaultdb.io/api/databases/shop/webhooks/WEBHOOK_ID \
  -H "Authorization: Bearer $VAULTDB_API_KEY"

The list never includes secrets. There is no endpoint to edit a webhook: delete it and create a new one.

What a delivery looks like

Each delivery is a POST with these headers:

Header Value
Content-Type application/json
User-Agent VaultDB-Webhook/1.0
X-VaultDB-Signature The HMAC-SHA256 of the raw request body, keyed with the webhook's secret, as lowercase hex.

The body:

{
  "event": "insert",
  "database": "shop",
  "table": "orders",
  "data": { "customer": "ada", "total": 120.5 },
  "changes": 1,
  "timestamp": "2026-10-07T12:00:00.000Z"
}

changes is the number of rows affected. What data holds depends on the write:

Write data
Insert of one row (REST or GraphQL) The row as it was sent.
Insert of several rows { "count": n }
CSV import { "count": n, "source": "csv-import" }
REST update { "data": {...}, "where": {...} } from the request.
REST delete { "where": {...} } from the request.
GraphQL update { "id": ..., "values": {...} }
GraphQL delete { "id": ... }

Writes made with raw SQL or by a scheduled query do not send webhooks.

Verify the signature

Compute the HMAC-SHA256 of the body exactly as you received it, before parsing it as JSON, and compare it with X-VaultDB-Signature using a constant-time comparison. Reject the request if they differ.

Node.js:

import { createHmac, timingSafeEqual } from 'node:crypto'

function isValidVaultDBSignature(rawBody, signatureHeader, secret) {
  const expected = createHmac('sha256', secret).update(rawBody).digest('hex')
  const received = String(signatureHeader ?? '')
  return expected.length === received.length &&
    timingSafeEqual(Buffer.from(expected), Buffer.from(received))
}

Python:

import hashlib
import hmac

def is_valid_vaultdb_signature(raw_body: bytes, signature_header: str, secret: str) -> bool:
    expected = hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature_header or "")

The signature covers the body only. To reject old deliveries, check the timestamp field in the body.

Delivery rules

Deliveries are best effort:

  • Each delivery is sent once. A failed delivery is not retried.
  • VaultDB waits up to 10 seconds for your server to respond.
  • Redirects are not followed.
  • The URL is checked again before each delivery. If its host now resolves to a private address, the delivery is skipped.
  • Each account can trigger webhook deliveries for at most 60 data changes per minute. Changes past that in the same minute send no webhooks. Realtime events are not affected by this limit.

A delivery that fails never fails the write that caused it.