# Verify Baserow webhooks

Baserow doesn't sign webhook requests. To authenticate them, you add a secret custom header to the webhook and compare its whole value in constant time when a call arrives. A match shows the sender knows your secret, but nothing covers the body, and a captured request can be replayed.

Agent skill: `npx skills add hookdeck/webhook-skills --skill baserow-webhooks` ([details](https://hookdeck.com/webhooks/baserow/skill))

> Independent reference generated from hookdeck/webhook-registry (commit ff7f882, 20 Nov 2026). [Baserow's official docs](https://baserow.io/user-docs/webhooks).

[Overview](https://hookdeck.com/webhooks/baserow) · [Webhook events (13)](https://hookdeck.com/webhooks/baserow/events) · [MCP events](https://hookdeck.com/webhooks/baserow/mcp-events) · [Verify signatures](https://hookdeck.com/webhooks/baserow/verify) · [Production guide](https://hookdeck.com/webhooks/baserow/guide-duplicates-ordering-retries-timeouts) · [Agent skill](https://hookdeck.com/webhooks/baserow/skill)

## The facts

| Fact | Value | Source |
|---|---|---|
| Signature header | `None (unsigned)` | [Baserow docs](https://baserow.io/user-docs/webhooks) |
| What to build | `Compare your custom header's whole value with the one you stored, in constant time` | [Baserow docs](https://baserow.io/user-docs/webhooks) |
| Key | `shared secret` | [Baserow docs](https://baserow.io/user-docs/webhooks) |

## Baserow webhook secret

Baserow doesn't issue a secret. You choose a header name and value and add them to the webhook as a custom header. Keep it in an environment variable, not in source code.

- You choose both the header name and the value when you create or edit the webhook. Baserow generates neither, and the header is optional.
- It belongs to that one webhook, so each webhook can have its own.
- Baserow sends the value exactly as you entered it, so `Bearer abc123` arrives as `Bearer abc123`.
- Change it in the webhook's **Edit** view. Calls already queued or being retried keep the header value from when the event fired, so accept both values briefly when you rotate.

Source: [Baserow docs](https://baserow.io/user-docs/webhooks)

## Code

### Express

From [webhook-skills: skills/baserow-webhooks/examples/express/src/index.js](https://github.com/hookdeck/webhook-skills/blob/556a89753e3e66e85d2a3ce50558e95b96c08571/skills/baserow-webhooks/examples/express/src/index.js)

```javascript
// Generated with: baserow-webhooks skill
// https://github.com/hookdeck/webhook-skills
require('dotenv').config({ quiet: true });
const crypto = require('crypto');
const express = require('express');

const app = express();

/**
 * Constant-time string comparison. Hashing both sides first gives equal-length
 * buffers, so timingSafeEqual never throws and the secret's length isn't leaked.
 */
function safeEqual(a, b) {
  const ha = crypto.createHash('sha256').update(String(a)).digest();
  const hb = crypto.createHash('sha256').update(String(b)).digest();
  return crypto.timingSafeEqual(ha, hb);
}

/**
 * Baserow does not sign payloads. You add a secret custom header to the webhook; the header name
 * is yours to choose (BASEROW_WEBHOOK_HEADER, default 'Authorization') and the expected value is
 * the exact, whole header value (BASEROW_WEBHOOK_SECRET), including any 'Bearer ' prefix you typed.
 * Do not strip or parse a prefix.
 */
function verifyBaserowRequest(
  headers,
  name = process.env.BASEROW_WEBHOOK_HEADER || 'Authorization',
  secret = process.env.BASEROW_WEBHOOK_SECRET
) {
  if (!secret) return false; // never accept when unconfigured
  const received = headers[name.toLowerCase()]; // Node lowercases header names
  return Boolean(received) && safeEqual(received, secret);
}

function handleEvent(payload) {
  const { event_type: eventType, event_id: eventId } = payload;

  switch (eventType) {
    case 'rows.created':
      console.log(`Rows created (${eventId}): ${(payload.items || []).length} row(s)`);
      // Your code: sync payload.items to your system
      break;

    case 'rows.updated':
      console.log(`Rows updated (${eventId}): ${(payload.items || []).length} row(s)`);
      // Your code: apply payload.items changes
      break;

    case 'rows.deleted':
      console.log(`Rows deleted (${eventId})`);
      // Your code: remove the rows downstream
      break;

    case 'view.created':
    case 'view.updated':
    case 'view.deleted':
      console.log(`View event ${eventType} (${eventId})`);
      // Your code: audit the schema change (payload.view)
      break;

    case 'field.created':
    case 'field.updated':
    case 'field.deleted':
      console.log(`Field event ${eventType} (${eventId})`);
      // Your code: update your schema mirror (payload.field)
      break;

    default:
      console.log(`Unhandled event: ${eventType}`);
  }
}

// The sender chooses the method in Baserow, so accept all of them (a JSON body is sent even on GET).
// Read the body raw (any content type) so the request is authenticated before parsing.
function webhookHandler(req, res) {
  if (!verifyBaserowRequest(req.headers)) {
    return res.status(401).json({ error: 'Invalid or missing webhook secret header' });
  }

  const raw = Buffer.isBuffer(req.body) ? req.body.toString('utf8') : '';
  if (raw.trim() === '') {
    // Empty body: nothing to dispatch.
    return res.status(200).json({ received: true });
  }

  let payload;
  try {
    payload = JSON.parse(raw);
  } catch {
    return res.status(400).json({ error: 'Invalid JSON body' });
  }

  if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
    return res.status(400).json({ error: 'Expected a JSON object' });
  }

  try {
    handleEvent(payload);
  } catch (err) {
    console.error('Error handling Baserow event:', err);
    return res.status(500).json({ error: 'Handler error' });
  }

  res.status(200).json({ received: true });
}

for (const method of ['post', 'put', 'patch', 'get', 'delete']) {
  app[method]('/webhooks/baserow', express.raw({ type: '*/*' }), webhookHandler);
}

app.get('/health', (req, res) => {
  res.json({ status: 'ok' });
});

module.exports = app;
module.exports.verifyBaserowRequest = verifyBaserowRequest;

if (require.main === module) {
  const PORT = process.env.PORT || 3000;
  app.listen(PORT, () => {
    console.log(`Server running on http://localhost:${PORT}`);
    console.log(`Webhook endpoint: http://localhost:${PORT}/webhooks/baserow (POST, PUT, PATCH, GET, DELETE)`);
  });
}
```

### Next.js

From [webhook-skills: skills/baserow-webhooks/examples/nextjs/app/webhooks/baserow/route.ts](https://github.com/hookdeck/webhook-skills/blob/556a89753e3e66e85d2a3ce50558e95b96c08571/skills/baserow-webhooks/examples/nextjs/app/webhooks/baserow/route.ts)

```typescript
// Generated with: baserow-webhooks skill
// https://github.com/hookdeck/webhook-skills
import { NextRequest, NextResponse } from 'next/server';
import { verifyBaserowRequest } from '../../../lib/verify-baserow';

interface BaserowPayload {
  event_type?: string;
  event_id?: string;
  table_id?: number;
  items?: unknown[];
  [key: string]: unknown;
}

function handleEvent(payload: BaserowPayload): void {
  const { event_type: eventType, event_id: eventId } = payload;

  switch (eventType) {
    case 'rows.created':
      console.log(`Rows created (${eventId}): ${(payload.items || []).length} row(s)`);
      // Your code: sync payload.items to your system
      break;

    case 'rows.updated':
      console.log(`Rows updated (${eventId}): ${(payload.items || []).length} row(s)`);
      // Your code: apply payload.items changes
      break;

    case 'rows.deleted':
      console.log(`Rows deleted (${eventId})`);
      // Your code: remove the rows downstream
      break;

    case 'view.created':
    case 'view.updated':
    case 'view.deleted':
      console.log(`View event ${eventType} (${eventId})`);
      // Your code: audit the schema change (payload.view)
      break;

    case 'field.created':
    case 'field.updated':
    case 'field.deleted':
      console.log(`Field event ${eventType} (${eventId})`);
      // Your code: update your schema mirror (payload.field)
      break;

    default:
      console.log(`Unhandled event: ${eventType}`);
  }
}

// The sender chooses the method in Baserow, so every method is exported below.
async function handleWebhook(request: NextRequest) {
  // Authenticate before reading or parsing the body.
  if (!verifyBaserowRequest(request.headers)) {
    return NextResponse.json({ error: 'Invalid or missing webhook secret header' }, { status: 401 });
  }

  // Read as text so any content type is accepted; a body may be empty.
  const raw = await request.text();
  if (raw.trim() === '') {
    return NextResponse.json({ received: true });
  }

  let payload: unknown;
  try {
    payload = JSON.parse(raw);
  } catch {
    return NextResponse.json({ error: 'Invalid JSON body' }, { status: 400 });
  }

  if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
    return NextResponse.json({ error: 'Expected a JSON object' }, { status: 400 });
  }

  try {
    handleEvent(payload as BaserowPayload);
  } catch (err) {
    console.error('Error handling Baserow event:', err);
    return NextResponse.json({ error: 'Handler error' }, { status: 500 });
  }

  return NextResponse.json({ received: true });
}

export const POST = handleWebhook;
export const PUT = handleWebhook;
export const PATCH = handleWebhook;
export const GET = handleWebhook;
export const DELETE = handleWebhook;

// GET handlers are static by default in some Next.js setups; this one reads headers per request.
export const dynamic = 'force-dynamic';
```

### FastAPI

From [webhook-skills: skills/baserow-webhooks/examples/fastapi/main.py](https://github.com/hookdeck/webhook-skills/blob/556a89753e3e66e85d2a3ce50558e95b96c08571/skills/baserow-webhooks/examples/fastapi/main.py)

```python
# Generated with: baserow-webhooks skill
# https://github.com/hookdeck/webhook-skills
import hashlib
import hmac
import json
import os

from dotenv import load_dotenv
from fastapi import Depends, FastAPI, HTTPException, Request

load_dotenv()

app = FastAPI()


def safe_equal(a: str, b: str) -> bool:
    """Constant-time string comparison. Both sides are encoded to bytes first
    (compare_digest raises TypeError on non-ASCII str) and hashed to equal length."""
    return hmac.compare_digest(
        hashlib.sha256(a.encode("utf-8")).digest(),
        hashlib.sha256(b.encode("utf-8")).digest(),
    )


def verify_baserow_request(headers, name=None, secret=None) -> bool:
    """Baserow does not sign payloads. You add a secret custom header to the webhook; the header
    name is yours to choose (BASEROW_WEBHOOK_HEADER, default 'Authorization') and the expected
    value is the exact, whole header value (BASEROW_WEBHOOK_SECRET), including any 'Bearer '
    prefix you typed. Do not strip or parse a prefix.
    """
    name = name or os.environ.get("BASEROW_WEBHOOK_HEADER") or "Authorization"
    secret = secret if secret is not None else os.environ.get("BASEROW_WEBHOOK_SECRET")
    if not secret:
        return False  # never accept when unconfigured
    received = headers.get(name.lower())  # Starlette headers are case-insensitive
    return bool(received) and safe_equal(received, secret)


async def require_baserow_secret(request: Request) -> None:
    """FastAPI dependency: reject the request before the body is parsed."""
    if not verify_baserow_request(request.headers):
        raise HTTPException(status_code=401, detail="Invalid or missing webhook secret header")


def handle_event(payload: dict) -> None:
    event_type = payload.get("event_type")
    event_id = payload.get("event_id")

    if event_type == "rows.created":
        print(f"Rows created ({event_id}): {len(payload.get('items') or [])} row(s)")
        # Your code: sync payload["items"] to your system

    elif event_type == "rows.updated":
        print(f"Rows updated ({event_id}): {len(payload.get('items') or [])} row(s)")
        # Your code: apply payload["items"] changes

    elif event_type == "rows.deleted":
        print(f"Rows deleted ({event_id})")
        # Your code: remove the rows downstream

    elif event_type in ("view.created", "view.updated", "view.deleted"):
        print(f"View event {event_type} ({event_id})")
        # Your code: audit the schema change (payload["view"])

    elif event_type in ("field.created", "field.updated", "field.deleted"):
        print(f"Field event {event_type} ({event_id})")
        # Your code: update your schema mirror (payload["field"])

    else:
        print(f"Unhandled event: {event_type}")


# The sender chooses the method in Baserow, so accept all of them (a JSON body is sent even on GET).
@app.api_route(
    "/webhooks/baserow",
    methods=["POST", "PUT", "PATCH", "GET", "DELETE"],
    dependencies=[Depends(require_baserow_secret)],
)
async def baserow_webhook(request: Request):
    # Read the raw body so any content type is accepted.
    raw_body = await request.body()

    if not raw_body.strip():
        # Empty body: nothing to dispatch.
        return {"received": True}

    try:
        payload = json.loads(raw_body)
    except (json.JSONDecodeError, UnicodeDecodeError):
        raise HTTPException(status_code=400, detail="Invalid JSON body")

    if not isinstance(payload, dict):
        raise HTTPException(status_code=400, detail="Expected a JSON object")

    try:
        handle_event(payload)
    except Exception as err:  # noqa: BLE001
        print(f"Error handling Baserow event: {err}")
        raise HTTPException(status_code=500, detail="Handler error")

    return {"received": True}


@app.get("/health")
async def health():
    return {"status": "ok"}


if __name__ == "__main__":
    import uvicorn

    uvicorn.run(app, host="0.0.0.0", port=8000)
```

Or install the Baserow webhooks skill: `npx skills add hookdeck/webhook-skills --skill baserow-webhooks`

## Common failures

- **The custom header was never added.** Custom headers are optional in Baserow, and a webhook without one carries nothing to check, so your endpoint rejects every call. Baserow's docs list missing authentication headers as a common issue.
- **Comparing with part of the value.** Baserow sends the value exactly as you typed it. If you entered `Bearer abc123`, compare against all of that, prefix included.
- **Looking the header up with the wrong case.** Node.js lowercases incoming header names, so a header you added as `X-Secret` is at `x-secret`. Read it case-insensitively.
- **Rotating while calls are pending.** In Baserow's open-source code, calls already queued or waiting to retry keep the header value from when the event fired. Accept both values briefly when you change it.

From [Hookdeck's Baserow guide](https://hookdeck.com/webhooks/baserow/guide-duplicates-ordering-retries-timeouts).

---

Not affiliated with Baserow. Facts are compiled from public sources and linked inline. [View as JSON](https://hookdeck.com/webhooks/baserow.json) · [Report a correction](https://hookdeck.com/contact)
