# Verify Paragon webhooks

Paragon doesn't sign Webhook Destination requests, so nothing proves a body is unchanged. You add a secret header to the destination, and your receiver compares it with its stored value to confirm the sender knows the secret. Paragon's docs name no SDK for this check.

These pages cover Webhook Destinations, which report failures in your Paragon project. [Managed Sync webhooks](https://docs.useparagon.com/managed-sync/webhooks) and [ActionKit Triggers](https://docs.useparagon.com/tutorials/actionkit-guide/first-trigger) are separate features with their own payloads and setup.

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

> Independent reference generated from hookdeck/webhook-registry (commit ff7f882, 20 Nov 2026). [Paragon's official docs](https://docs.useparagon.com/monitoring/event-destinations).

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

## The facts

| Fact | Value | Source |
|---|---|---|
| Signature header | `None (unsigned)` | [Paragon docs](https://docs.useparagon.com/monitoring/event-destinations) |
| What to build | `Compare the header you added with your stored value in constant time` | [Paragon docs](https://docs.useparagon.com/monitoring/event-destinations) |
| Key | `shared secret` | [Paragon docs](https://docs.useparagon.com/monitoring/event-destinations) |

## Paragon webhook secret

You choose it. A project Admin adds the header and value to the destination, because Paragon issues no secret for Webhook Destinations. Keep it in an environment variable, not in source code.

- Generate a long random value, and add it under Show more request options when you create or update the destination.
- The header's name is yours too. Paragon documents neither a reserved name nor a format.
- It's set per destination. Event Destinations belong to one Paragon project.
- Paragon documents no rotation flow or overlap, so change the destination and your receiver together.
- Only Admin users can manage Event Destinations, and Webhook Destinations need a paid plan.

Source: [Paragon docs](https://docs.useparagon.com/monitoring/event-destinations)

## Code

### Express

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

```javascript
// Generated with: paragon-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);
}

/**
 * Paragon does not sign Webhook Destination requests. You add a header (name and value
 * are yours to choose) under "Show more request options". We compare the WHOLE header
 * value with PARAGON_WEBHOOK_SECRET: a "Bearer " prefix is not parsed or stripped.
 * Express lowercases incoming header names, so the lookup is case-insensitive.
 */
function verifyParagonRequest(
  headers,
  secret = process.env.PARAGON_WEBHOOK_SECRET,
  headerName = process.env.PARAGON_WEBHOOK_HEADER || 'Authorization'
) {
  if (!secret) return false; // never accept when unconfigured
  const received = headers[headerName.toLowerCase()];
  return typeof received === 'string' && received !== '' && safeEqual(received, secret);
}

function handleEvent(payload) {
  const { type, message } = payload;

  switch (type) {
    case 'workflow_failure':
      console.log(`Workflow failed: ${message}`);
      // Your code: alert the team (payload.workflow, payload.user, payload.data.error, payload.data.executionUrl)
      break;

    case 'credentials_failure':
      console.log(`Credential failed: ${message}`);
      // Your code: ask payload.user.id to reconnect payload.integration.type in your Connect Portal
      break;

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

// Read the body raw (any content type) so the request is authenticated before parsing.
app.post('/webhooks/paragon', express.raw({ type: '*/*' }), (req, res) => {
  if (!verifyParagonRequest(req.headers)) {
    return res.status(401).json({ error: 'Invalid or missing webhook credential' });
  }

  let payload;
  try {
    const raw = Buffer.isBuffer(req.body) ? req.body.toString('utf8') : '';
    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 Paragon event:', err);
    return res.status(500).json({ error: 'Handler error' });
  }

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

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

module.exports = app;
module.exports.verifyParagonRequest = verifyParagonRequest;

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: POST http://localhost:${PORT}/webhooks/paragon`);
  });
}
```

### Next.js

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

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

interface ParagonPayload {
  type?: string;
  message?: string;
  [key: string]: unknown;
}

function handleEvent(payload: ParagonPayload): void {
  const { type, message } = payload;

  switch (type) {
    case 'workflow_failure':
      console.log(`Workflow failed: ${message}`);
      // Your code: alert the team (payload.workflow, payload.user, payload.data.error, payload.data.executionUrl)
      break;

    case 'credentials_failure':
      console.log(`Credential failed: ${message}`);
      // Your code: ask payload.user.id to reconnect payload.integration.type in your Connect Portal
      break;

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

export async function POST(request: NextRequest) {
  // Authenticate before reading or parsing the body.
  if (!verifyParagonRequest(request.headers)) {
    return NextResponse.json({ error: 'Invalid or missing webhook credential' }, { status: 401 });
  }

  let payload: unknown;
  try {
    // Read as text so any content type is accepted.
    payload = JSON.parse(await request.text());
  } 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 ParagonPayload);
  } catch (err) {
    console.error('Error handling Paragon event:', err);
    return NextResponse.json({ error: 'Handler error' }, { status: 500 });
  }

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

### FastAPI

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

```python
# Generated with: paragon-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 comparison: compare_digest on bytes (both sides encoded, never str,
    which raises on non-ASCII), here via equal-length SHA-256 digests."""
    return hmac.compare_digest(
        hashlib.sha256(a.encode("utf-8")).digest(),
        hashlib.sha256(b.encode("utf-8")).digest(),
    )


def verify_paragon_request(headers, secret=None, header_name=None) -> bool:
    """Paragon does not sign Webhook Destination requests. You add a header (name and
    value are yours to choose) under "Show more request options". We compare the WHOLE
    header value with PARAGON_WEBHOOK_SECRET: a "Bearer " prefix is not parsed or stripped.
    The header name is looked up case-insensitively.
    """
    secret = secret if secret is not None else os.environ.get("PARAGON_WEBHOOK_SECRET")
    header_name = header_name or os.environ.get("PARAGON_WEBHOOK_HEADER") or "Authorization"
    if not secret:
        return False  # never accept when unconfigured
    wanted = header_name.lower()
    received = next((v for k, v in headers.items() if k.lower() == wanted), None)
    return bool(received) and safe_equal(received, secret)


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


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

    if event_type == "workflow_failure":
        print(f"Workflow failed: {message}")
        # Your code: alert the team (payload["workflow"], payload["user"], payload["data"]["error"], payload["data"]["executionUrl"])

    elif event_type == "credentials_failure":
        print(f"Credential failed: {message}")
        # Your code: ask payload["user"]["id"] to reconnect payload["integration"]["type"] in your Connect Portal

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


@app.post("/webhooks/paragon", dependencies=[Depends(require_paragon_credential)])
async def paragon_webhook(request: Request):
    # Read the raw body so any content type is accepted.
    raw_body = await request.body()

    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 Paragon 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 Paragon webhooks skill: `npx skills add hookdeck/webhook-skills --skill paragon-webhooks`

## Common failures

- **The header was never added.** Request headers are optional and sit under Show more request options, so a destination can be saved without one. Update the destination and add it.
- **The header name doesn't match.** The name is yours to choose, so read it from your configuration, and look it up case-insensitively.
- **A prefix was left out of the comparison.** Compare the whole value you gave Paragon. If you typed `Bearer abc`, compare against `Bearer abc`, not `abc`.
- **The value was rotated on one side.** Paragon documents no rotation flow or overlap. Change the header on the destination and in your receiver together.

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

---

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