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
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:
- The trace id of an inbound
traceparentheader. - An
x-kya-correlation-idheader. - A
correlationId(or pixelrequestId) field in the request body. - 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:
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.
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, elsecf-ipcountry - Region:
x-vercel-ip-country-region, elsecf-region - City:
x-vercel-ip-city, elsecf-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
NULLunless the request came through Cloudflare withcf-asnpresent.
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
- Detection Semantics for what a persisted row means once multiple surfaces are running together: row volume, confidence, session identity, and timing.
- Pixel setup and Beacon setup for the client surfaces.
- Middleware and Gateway for the enforcement surfaces.
- API Reference for the
/detectand/enforcecontracts.