API, Webhooks, CI Gates & MCP Documentation

Integrate deterministic website intelligence into CI/CD workflows, monitoring alerts, and AI agents.

1. Authentication

Generate an API key from your Dashboard and pass it via Authorization: Bearer pa_live_... or X-API-Key: pa_live_....

Base URL: https://pulseaudit.dev

2. Audit Endpoints

Single Audit — GET or POST /v1/audit

curl -sS -X POST "https://pulseaudit.dev/v1/audit" \
  -H "Authorization: Bearer pa_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","forceRefresh":false}'

Batch Audit — POST /v1/audit/batch

curl -sS -X POST "https://pulseaudit.dev/v1/audit/batch" \
  -H "X-API-Key: pa_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"urls":["https://example.com","https://hono.dev"]}'

Monitors CRUD — GET / POST / PATCH / DELETE /v1/monitors

Also supports GET /v1/monitors/:id/deliveries and POST /v1/monitors/:id/test-webhook.

curl -sS -X POST "https://pulseaudit.dev/v1/monitors" \
  -H "Authorization: Bearer pa_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","intervalMinutes":60,"scoreThreshold":80,"webhookUrl":"https://hooks.example.com/pulseaudit"}'

3. Webhook HMAC-SHA256 Verification

Monitor regression alerts include X-PulseAudit-Signature (t=<unix>,v1=<hmac_hex>), X-PulseAudit-Timestamp, and X-PulseAudit-Delivery-Id.

import { createHash, createHmac, timingSafeEqual } from "node:crypto";

export function verifyPulseAuditWebhook(
  rawBody: string,
  signatureHeader: string, // "sha256=<hex>" (X-PulseAudit-Signature)
  timestampHeader: string, // "<unix_seconds>" (X-PulseAudit-Timestamp)
  webhookSecret: string,
): boolean {
  if (!signatureHeader.startsWith("sha256=") || !/^[0-9]+$/.test(timestampHeader)) return false;
  const expected = "sha256=" + createHmac("sha256", webhookSecret)
    .update(`${timestampHeader}.${rawBody}`)
    .digest("hex");
  const digestA = createHash("sha256").update(signatureHeader).digest();
  const digestB = createHash("sha256").update(expected).digest();
  return timingSafeEqual(digestA, digestB);
}

4. GitHub Actions CI Gate

Block deployments when overall score drops below your threshold.

name: PulseAudit CI Gate
on: [push, pull_request]
jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - name: Run PulseAudit check
        env:
          PULSEAUDIT_API_KEY: ${{ secrets.PULSEAUDIT_API_KEY }}
        run: |
          SCORE=$(curl -sf -X POST "https://pulseaudit.dev/v1/audit" \
            -H "Authorization: Bearer $PULSEAUDIT_API_KEY" \
            -H "Content-Type: application/json" \
            -d '{"url":"https://example.com"}' | jq -r '.report.overallScore')
          echo "PulseAudit score: $SCORE"
          test "$SCORE" -ge 80

5. Model Context Protocol (MCP) Server

Connect AI agents directly to POST /mcp (JSON-RPC 2.0) with tools audit_url, get_public_report, and compare_domains.

{
  "mcpServers": {
    "pulseaudit": {
      "url": "https://pulseaudit.dev/mcp",
      "transport": "http",
      "headers": {
        "Authorization": "Bearer pa_live_YOUR_API_KEY"
      }
    }
  }
}
curl -sS -X POST "https://pulseaudit.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"audit_url","arguments":{"url":"https://example.com"}}}'