Skip to main content

Collector API

In one sentence

The collector's public API is a single function, verify(config), which collects signals and posts them to your edge.

verify(config)

import { verify } from '@octetproof/collector';

await verify(config);

Collects the browser signals and posts them to ${config.apiUrl}/v1/signals, opening a short-lived latency channel at ${config.apiUrl}/v1/ws. Returns a promise that resolves when collection completes.

Designed to run in a secure (HTTPS) context and triggers no permission prompts.

config

FieldTypeRequiredDescription
apiUrlstringyesBase URL of your edge. The collector posts to ${apiUrl}/v1/signals and connects the WebSocket at ${apiUrl}/v1/ws.
sessionRefstringrecommendedOpaque, partner-issued reference for this session. Required if you intend to fetch the verdict server-to-server.
wsUrlstringnoOverride the latency-channel URL. Defaults to the ws/wss form of apiUrl + /v1/ws.
passiveOnlybooleannoSkip the active network measurements for a faster, lighter pass. Lowers confidence.
signalAbortSignalnoAbort an in-flight verify() (e.g. on navigation).

Return value

The promise resolves when collection finishes. Do not use the resolved value to make a security decision — anything produced in the browser is client-controlled. Read the authoritative verdict on your backend via Fetch the Verdict. Treat verify() as fire-and-forget from the page's side, and catch errors so a failed collection doesn't surface to the user:

verify({ apiUrl: 'https://yourapp.com/octet', sessionRef }).catch(() => {
/* collection failed; the backend verdict fetch will simply be "pending" */
});

Where to go next