Skip to main content

JavaScript SDK

Collect device signals in the browser with a public API key (kv_pk_…). Send the billable event_id / requestId to your backend and verify on the server.

Install

npm

CDN (no npm)

Load the ESM bundle from cdn.keverd.com. Put your public key in the URL path — start() reads it automatically.
Replace YOUR_PUBLIC_API_KEY with kv_pk_test_… or kv_pk_live_….
CDN and browser SDKs use public keys only. Never put kv_sk_… or whsec_… in frontend code.
start() can also take an explicit key: start('kv_pk_…') or start({ apiKey: 'kv_pk_…', endpoint: 'https://api.keverd.com' }) if you are not loading from the keyed CDN path.

Initialize (npm)

Collect

SDK aliases (same values): visitorIdvisitor_id, requestIdevent_id.

Response JSON

Canonical fields are visitor_id, event_id, risk_score, browser. Extra keys are aliases (same values) so older installed SDKs keep working. Collect does not return authoritative action / reasons — use POST /v2/verify. Send this to your backend (JSON body example):
Your server then calls POST /v2/verify with { "event_id": "…" }.
Do not use Keverd.get() for the verify flow. It returns a string, not an object with event_id.

Optional use-case helpers (public key — still collection)

These return the same collect JSON shape. They do not replace server verify().

Next