Tenant admin

What an app builder does with the management API, on the demo’s own tenant. The server reads it with a read-only org API key that never reaches your browser, so nothing here can be changed.

  • https://demo.synq.build/api/webhooks/synq: * (on)

Verified deliveries

  1. user.created at 2026-11-19T18:40:02.085Z
  2. brand.deleted at 2026-11-19T00:31:56.770Z
  3. api_key.revoked at 2026-11-19T00:31:22.305Z
  4. file.uploaded at 2026-11-19T00:22:32.020Z
  5. file.uploaded at 2026-11-19T00:22:28.507Z
  6. app.created at 2026-11-19T00:22:24.486Z
  7. file.uploaded at 2026-11-19T00:22:22.136Z
  8. file.uploaded at 2026-11-19T00:22:18.260Z
  9. app.created at 2026-11-19T00:22:14.431Z
  10. file.uploaded at 2026-11-19T00:22:09.630Z
  11. app.created at 2026-11-19T00:22:04.571Z
  12. brand.updated at 2026-11-19T00:22:03.840Z
  13. brand.updated at 2026-11-19T00:22:02.910Z
  14. file.uploaded at 2026-11-19T00:21:59.104Z
  15. file.uploaded at 2026-11-19T00:21:57.643Z
  16. brand.created at 2026-11-19T00:21:55.232Z
  17. brand.updated at 2026-11-19T00:21:54.618Z
  18. brand.updated at 2026-11-19T00:21:54.196Z
  19. brand.updated at 2026-11-19T00:21:53.589Z
  20. file.uploaded at 2026-11-19T00:21:52.347Z
  21. brand.updated at 2026-11-19T00:21:50.287Z
  22. app.created at 2026-11-19T00:21:49.809Z
  23. file.uploaded at 2026-11-19T00:21:49.440Z
  24. file.uploaded at 2026-11-19T00:21:47.998Z
  25. brand.created at 2026-11-19T00:21:45.301Z
  26. brand.updated at 2026-11-19T00:21:44.725Z
  27. brand.updated at 2026-11-19T00:21:44.105Z
  28. brand.updated at 2026-11-19T00:21:43.625Z
  29. file.uploaded at 2026-11-19T00:21:41.276Z
  30. file.uploaded at 2026-11-19T00:21:39.769Z
  31. brand.updated at 2026-11-19T00:21:36.066Z
  32. token_gate.updated at 2026-11-19T00:21:35.720Z
  33. app.created at 2026-11-19T00:21:35.024Z
  34. app.created at 2026-11-18T17:24:29.403Z
  35. brand.created at 2026-11-18T17:24:28.380Z
  36. app.created at 2026-11-18T17:24:27.024Z
  37. brand.updated at 2026-11-18T17:24:25.877Z
  38. api_key.rotated at 2026-11-18T17:18:16.188Z
src/examples/admin/Webhooks.tsx
import { recentDeliveries } from '../../lib/deliveries'
import { demoOrg } from '../../lib/management'

// The org's webhook subscriptions, and the deliveries the demo's own
// receiver (src/examples/webhooks/receiver.ts) verified and kept.
export async function Webhooks() {
  const tenant = await demoOrg()
  if (!tenant) return <p>The demo tenant isn’t set up.</p>
  const { data } = await tenant.synq.get('/v1/orgs/{org}/webhooks', {
    path: { org: tenant.org.id },
  })
  const deliveries = recentDeliveries()
  return (
    <>
      <ul aria-label="Subscriptions">
        {data.map((hook) => (
          <li key={hook.id}>
            <code>{hook.url}</code>: {hook.events.join(', ')} ({hook.enabled ? 'on' : 'off'})
          </li>
        ))}
      </ul>
      <h2 className="mt-6 font-bold">Verified deliveries</h2>
      <ol aria-label="Verified deliveries">
        {deliveries.length === 0 && <li>None yet: sign in, and watch them arrive.</li>}
        {deliveries.map((d) => (
          <li key={d.id}>
            <code>{d.type}</code> at {d.receivedAt}
          </li>
        ))}
      </ol>
    </>
  )
}
src/examples/webhooks/receiver.ts
import { isSynqError } from '@synqauth/js'
import { verifyWebhook } from '@synqauth/js/server'

import { remember } from '../../lib/deliveries'

// Receiving Synq's webhooks: check each delivery's signature before you
// trust a byte of it, then act on the event. verifyWebhook checks the
// Standard Webhooks signature against the subscription's whsec_ secret, and
// that Synq signed it in the last five minutes, so a captured delivery can't
// be replayed. Read the raw body: parsing the JSON first changes the bytes
// that were signed.

export async function POST(request: Request): Promise<Response> {
  const secret = process.env.SYNQ_WEBHOOK_SECRET
  if (!secret) return new Response('not set up', { status: 503 })
  const body = await request.text()
  try {
    const { id, event } = await verifyWebhook(body, request.headers, secret)
    // `id` is the same on every retry of one delivery: handle each once.
    remember({ id, type: event.type, receivedAt: new Date().toISOString(), data: event.data })
    return new Response(null, { status: 204 })
  } catch (error) {
    // A delivery that fails its check gets a 401; Synq tries it again later.
    if (isSynqError(error)) return new Response(error.code, { status: 401 })
    throw error
  }
}