Documentation / Integrations

The relay is the integration.

Every stack does the same thing: collect evidence in the browser, send it to your own backend, score it with the secret key, and apply your policy. The framework only changes where the relay lives.

Last updated

Choose the scope first

Volance protects a whole site, selected pages, or a single endpoint. The collector is the same; the placement changes.
ScopeWhere the collector runsWhere the score happensBest for
Whole siteEvery page where you install itYour backendSite-wide visibility and policy.
Selected pagesOnly the pages that need a decisionYour backendCheckout, signup, login, password reset.
API endpointNo page collectorYour edge or backend, with requestSignalsAPIs, trials, server-to-server calls.

The relay in four steps

  1. Get a manifest. Your backend calls GET /api/trace/session with the public key.
  2. Collect evidence. The page collector returns { clientSignals, events } after consent.
  3. Relay. The browser posts the evidence to your same-origin route.
  4. Score. The route calls POST /api/trace/score with the secret key and returns a minimal decision.
The generic relayFramework-neutral pseudo-code
// Browser -> your route -> Volance
const session = await fetch('https://app.volance.com/api/trace/session', {
  headers: { authorization: 'Bearer ' + PUBLIC_KEY },
}).then((r) => r.json());

const result = await fetch('https://app.volance.com/api/trace/score', {
  method: 'POST',
  headers: {
    authorization: 'Bearer ' + SECRET_KEY,
    'content-type': 'application/json',
  },
  body: JSON.stringify({
    publicKey: PUBLIC_KEY,
    sid: session.sessionId,
    manifest: session.manifest,
    page: evidence.page,
    clientSignals: evidence.clientSignals,
    events: evidence.events,
    requestSignals: {
      visitorIp: visitor.ip,
      cookiePresent: visitor.cookiePresent,
      visitorUserAgent: visitor.userAgent,
      acceptLanguage: visitor.acceptLanguage,
    },
  }),
  signal: AbortSignal.timeout(800),
}).then((r) => r.json());

return { action: result.action, score: result.score, requestId: result.requestId };

Pick your stack

Each guide is a real request path, not a conceptual sketch.
StackWhere the relay livesGuide
Next.js App RouterA route handler under app/apiNext.js guide
Cloudflare WorkersThe Worker in front of originWorkers guide
WordPressThe plugin, or a small PHP relayWordPress guide
Python / FastAPIAn async route with httpxPython guide
PHP / LaravelA controller with the HTTP clientPHP guide

What every integration needs

  • A server-side home for the secret. A static site alone is not enough; the relay has to run somewhere you control.
  • A timeout and a fallback. The scoring call is synchronous. Decide per route whether a failure means allow, step-up, or block.
  • A consent gate. The collector starts only after your flow passes { consent: true }.
  • A decision log. Keep requestId, score, verdict, and action — not the raw evidence payload.

Common mistakes

  • Putting sk_ in a client component. The secret is server-only; the public key is the one that may appear in page code.
  • Inventing headerOrder. If the runtime cannot see the original header order, omit it. The matching check simply does not run.
  • Scoring every page view. Score the decision points; the volume is smaller and the evidence is closer to the action.
  • Blocking on a single fired signal. Use the band and the evidence; the middle is a place to gather more evidence.

Related

Free to start. 10,000 scores a month, one project, no credit card.

Get started free