Concepts

Installation Surfaces

What each install option can see and enforce, how to combine them, and how to join their events

KYA installs in five ways, and they are not interchangeable: each surface sees a different slice of the request, and only some can act on it. This page compares them, shows the recommended combinations, and documents the two operational details every integration eventually asks about: how to join events across surfaces, and where client IP and geo really come from.

The five surfaces at a glance

SurfaceInstallDetection runsCan enforce?Unique signals
Pixel<script src="https://kya.vouched.id/pixel.js" data-project-id="…">Server-side, per eventNo (observe-only)Browser and device attributes, headless/automation probes, behavioural counters, visitor geo
Beacon<script src="https://kya.vouched.id/beacon.js" data-project-id="…"> or the @kya-os/checkpoint-beacon npm packageServer-side, per event (engine + interaction scoring)No (observe-only)Device entropy from the versioned signal registry, visitor geo
SDK middleware@kya-os/checkpoint-nextjs, @kya-os/checkpoint-express, Checkpoint.AspNetCore, ai.knowthat.checkpoint:checkpoint-servletIn-process (WASM engine, no network call)Yes: permit, block, challenge, redirect, instruct, plus observe modeFull VerifyResult with trace[] and engineInfo, RFC 9421 and delegation verification
DNS gatewayCNAME your hostname to cname.checkpoint-gateway.aiIn the Cloudflare worker, before your originYes: allow, block, redirect, challenge, log, instructTLS fingerprint from the handshake, WWW-Authenticate: Delegation challenges
Direct APIPOST /api/v1/detect or /api/v1/enforce with an API keyServer-side, on the fields you send/enforce returns the decision; acting on it is your codeCaller-supplied requestId echo, get_policy

Three facts worth internalizing before choosing:

  • Only the pixel and beacon see the browser. Screen, timezone, languages, cookies, headless and automation probes, and behavioural counters exist only on client-originated events.
  • Only the DNS gateway sees the TLS handshake. Other surfaces get TLS evidence only when your own edge forwards it (see Forward edge evidence).
  • SDKs see headers only, but see them all. The middleware reads the full header map (signatures, delegation credentials, user agent) and runs the complete engine pipeline in-process, so it is the strongest enforcement point for agent identity. It just knows nothing about the device.

Recommended combination

For a web property, pair the pixel (device and behavioural signal, visitor geo) with either the SDK middleware or the DNS gateway (enforcement and cryptographic verification), and join their events with a correlation id as described below. Neither client surface can enforce on its own, and neither server surface can see the device on its own.

Joining events across surfaces

Every persisted detection carries a 32-hex correlation_id, resolved in this order:

  1. The trace id of an inbound traceparent header.
  2. An x-kya-correlation-id header.
  3. A correlationId (or pixel requestId) field in the request body.
  4. A freshly minted id when none of the above is present.

That makes traceparent the one identifier you can carry from the browser, through your own backend, into KYA, and back out to your logs. The recipe:

// 1. Browser: send the same trace context to your backend and to the pixel.
const traceparent = `00-${traceId}-${spanId}-01`;
fetch('/api/checkout', { headers: { traceparent } });
// The pixel accepts a correlationId field on its events; pass the same traceId.

// 2. Your backend: forward the header when you call /enforce.
await fetch('https://kya.vouched.id/api/v1/enforce', {
  method: 'POST',
  headers: { 'x-api-key': process.env.CHECKPOINT_API_KEY, traceparent },
  body: JSON.stringify({ userAgent, ipAddress, path, method }),
});

Both events now persist with the same correlation_id, and the DNS gateway echoes it back to the client as KYA-Request-Id.

This recipe joins a caller that explicitly threads traceparent into its own /detect or /enforce calls. Whether the SDK middleware's own telemetry report joins the same way depends on the SDK: the Java middleware forwards a propagated traceparent / x-kya-correlation-id as correlationId; the TypeScript and .NET middleware carry neither field, so their rows always get a freshly minted correlation_id. See Detection Semantics for the full picture.

What the other identifiers are for:

IdentifierWhere it appearsNotes
requestId/detect and /enforce responses, X-Request-ID headerCaller-supplied echo (or generated); not persisted as a column
eventId/pixel responsesPixel-family only; /beacon and /log-detection return 202 with no id
sessionIdPixel and beacon events, echoed backBoth read the _as_beacon_session cookie (pixel 1.3.0 and later), so one browser visit shares one id across the two and the gateway forwards the same value; a pixel visitor on a Shopify storefront who has not allowed analytics sends no pixel events
deviceIdPixel, beacon, Java SDK eventsThe checkpoint_user cookie's deviceId (beacon 1.4.3 and later, Java SDK), held back under DNT, an unanswered or denied Shopify consent, or an ungranted pixel data-require-consent
correlation_idPersisted on every surfaceThe cross-surface join key; never echoed in a response body except as the gateway's KYA-Request-Id

sessionId joins browser surfaces only

Pixel, beacon, and gateway rows for the same browser share the _as_beacon_session cookie's value. Server-to-server /detect and /enforce calls carry no such cookie, so to tie those to browser rows send the same traceparent alongside both, or scope your analysis to correlation_id. If any install method already wrote a row for the session in the last 30 seconds, the pixel writes no row of its own and answers with the newest one already there. Two pixel events are written anyway: an identify call, and an event whose request signature verified, unless the session already has a verified signature in that window.

Client IP: what each surface reads

The Express and Next adapters accept an observed client address only from a supported ingress boundary. A forwarding header or profile name does not authenticate its source.

ProfileExpressNext.js
directActual socket peer, unless Express regards it as a proxy; known proxy sockets return unavailableLegacy platform-provided request.ip only; current NextRequest objects normally supply no address
vercelOverwritten singleton platform header inside Vercel's managed runtimeSame managed-runtime boundary; outside Vercel this profile acts as direct
cloudflareSingleton CF-Connecting-IP after authenticating the origin socket peer against an allowlistUnavailable: NextRequest exposes no origin socket peer
trusted-proxyExact forwarding chain after authenticating the socket peer against an allowlistUnavailable: selecting this profile cannot supply the missing socket peer

For Express behind a proxy, configure both the peer allowlist and an explicit SDK profile. This example uses a documentation address; replace it with the proxy address your origin receives:

app.set('trust proxy', '192.0.2.10/32');
app.use(
  withCheckpoint({
    clientIpPolicy: { platform: 'trusted-proxy', trustedHops: 0 },
  })
);

trustedHops counts addresses to the client's right in X-Forwarded-For, excluding the socket peer. One proxy uses 0 and sends exactly one address. A two-address chain uses 1. Missing, extra, malformed, or duplicate entries return no address. There is no x-real-ip, framework, or proxy-socket fallback after a failed chain check.

Express's default direct policy withholds a peer that its trust proxy function accepts, including blanket true and numeric hop settings. Those settings cannot authenticate forwarding headers. Use an address/CIDR allowlist or a peer predicate with an explicit SDK profile. Reused Express predicates receive the unchanged socket address and hop index 0; explicit SDK isTrustedPeer callbacks receive the canonical address.

For self-hosted Next, keep client-address evidence unavailable until a transport-aware ingress authenticates it. Do not copy forwarding headers into request.ip or set VERCEL=1 manually to restore header trust. A Cloudflare Worker does not supply the origin socket required by the authenticated Cloudflare profile.

These guarantees apply to the migrated Express/Next adapters and the KYA web API. Gateway and bouncer consumers of legacy resolveClientIp retain their prior behavior. Java and .NET use separate adapter contracts. None of those paths gain authenticated-ingress qualification from this TypeScript change.

The Express/Next address contract was checked against resolver and adapter tests on 17 October 2026.

On the server-to-server routes (/detect, /enforce, /log-detection) the IP that matters is the one you pass in ipAddress: always send the end client's address explicitly rather than relying on connection headers, which describe your server, not your visitor.

Geo and ASN: sourced from edge headers, not a GeoIP database

KYA does not run a GeoIP lookup. Geo columns are filled from the edge headers of whatever request reached us:

  • Country: x-vercel-ip-country, else cf-ipcountry
  • Region: x-vercel-ip-country-region, else cf-region
  • City: x-vercel-ip-city, else cf-ipcity
  • ASN / AS organization: cf-asn / cf-asorganization (present only when the request traverses a Cloudflare zone with those headers enabled)

The consequences, per surface:

  • Pixel and beacon events carry correct visitor geo, because the visitor's own browser made the request.
  • Server-to-server calls carry your server's geo. When your backend calls /enforce, the edge headers describe your data-center PoP, not the end user: treat geo on those rows as absent.
  • DNS-gateway detections carry no geo at all today; the worker's recorded event does not include geo fields.
  • ASN is best-effort. Rows served by Vercel infrastructure have no ASN source; expect NULL unless the request came through Cloudflare with cf-asn present.

Not every detection carries network data

Where IP intelligence is available for an address, a detection's network field classifies its routing type and flags proxies, VPNs, and Tor exits. A detection with no network field had no data for that address, so don't read it as a clean address. See Captured context.

Where to go next