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
| Scope | Where the collector runs | Where the score happens | Best for |
|---|---|---|---|
| Whole site | Every page where you install it | Your backend | Site-wide visibility and policy. |
| Selected pages | Only the pages that need a decision | Your backend | Checkout, signup, login, password reset. |
| API endpoint | No page collector | Your edge or backend, with requestSignals | APIs, trials, server-to-server calls. |
The relay in four steps
- Get a manifest. Your backend calls
GET /api/trace/sessionwith the public key. - Collect evidence. The page collector returns
{ clientSignals, events }after consent. - Relay. The browser posts the evidence to your same-origin route.
- Score. The route calls
POST /api/trace/scorewith 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
| Stack | Where the relay lives | Guide |
|---|---|---|
| Next.js App Router | A route handler under app/api | Next.js guide |
| Cloudflare Workers | The Worker in front of origin | Workers guide |
| WordPress | The plugin, or a small PHP relay | WordPress guide |
| Python / FastAPI | An async route with httpx | Python guide |
| PHP / Laravel | A controller with the HTTP client | PHP 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
- Quickstart — the first integration
- Score endpoint — the full request and response
- Operations — timeouts and fallbacks
- Troubleshooting — when the relay does not work