ProctorKit

ProctorKit docs

ProctorKit adds proctoring to the quiz page you already have. A small browser library runs a system check, gets consent, keeps the test in full screen with the entire screen shared and the camera on, and records the session against each question. You keep your questions, answers and scoring.

There are two ways to use it:

Step-by-step guides: React, Next.js, plain HTML.

The SDK is written in TypeScript, ships its type declarations, and is MIT licensed on GitHub. Coding agents can read these docs as plain text at /llms-full.txt.

Requirements

Install

npm install proctorkit

Or with a script tag, which gives you a global ProctorKit with the same exports:

<script src="https://cdn.jsdelivr.net/npm/proctorkit/dist/proctorkit.global.js"></script>
<script>
  const proctor = ProctorKit.createProctor({
    key: 'pk_pub_...',
    candidate: { id: 'c-1042', name: 'Asha Rao' },
    test: { id: 'sales-1', name: 'Sales screening' },
  });
</script>

What is recorded

During the test the SDK records the webcam and the screen as video, and takes a photo of each about every 10 seconds, plus extra photos when something happens. Every part of the recording carries the question that was on screen. You can turn the video off with clips: false, or both with snapshots: false.

The candidate is told all of this on the consent screen before anything is recorded.

Which key

Does your quiz have its own backend? Then use a server key: one for all your tests, kept on your server. If it is only a web page, use a page key, one per website. Either way, your quiz names each test, and the dashboard lists candidates under that name. A key is only access: the websites it works on, the plan and a daily limit.

Quick start with a page key

5 lines in your quiz, and no server code. Results appear in your dashboard.

1. Get a page key. Create an account, answer No to "Does your quiz have its own backend?", give the key a name you will recognise (like your site's), add the website it runs on, and choose Recording only or AI review. You get a key that starts with pk_pub_. It goes in the page, so anyone taking the test can copy it. It works only on the websites listed on it (and on localhost), up to a daily limit you set, and it spends your AI-reviewed sessions. For AI review we recommend a server key instead: your server starts each session and the key never reaches the page.

2. Add it to your quiz. React:

import { useEffect, useState } from 'react';
import { createProctor } from 'proctorkit';

export function Quiz({
  user,
  questions,
}: {
  user: { id: string; name: string; email?: string };
  questions: { id: string }[];
}) {
  // once per candidate; the dashboard lists them under the test
  const [proctor] = useState(() =>
    createProctor({
      key: 'pk_pub_...',
      candidate: { id: user.id, name: user.name, email: user.email },
      test: { id: 'sales-1', name: 'Sales screening' },
    }),
  );
  const [started, setStarted] = useState(false);
  const [i, setI] = useState(0);

  // the Start button: system check, consent, then the test
  const begin = async () => {
    const check = await proctor.runChecks();
    if (check.ok && proctor.start()) setStarted(true);
  };

  // tell ProctorKit which question is on screen
  useEffect(() => {
    if (started) proctor.setContext({ questionId: questions[i].id });
  }, [started, i]);

  const submit = () => {
    proctor.stop(); // then save the answers as you do today
  };
  // ...render the quiz once started
}

candidate.id and candidate.name are required with a key; email is optional. test: { id, name } names the test, so one key can serve several tests; a session without it is listed under the key's name.

runChecks() shows its own system check (camera, entire screen shared, full screen, consent) and resolves when the candidate is ready, or with the reason they are not. Use any question ID; ProctorKit never sees your questions or answers.

3. Read the results. Each candidate appears in your dashboard under their test, with the recording and flags laid out by question. With AI review, each also gets a review priority from 0 to 100, so you can look at the riskiest first. A person makes the decision.

If the key is refused or the service cannot be reached, the test still runs with the on-device checks, the SDK fires a cloud_unavailable event and logs the reason to the console. Proctoring problems never block a candidate's test.

With a server key

Use this when your quiz has its own backend. Your account has one secret server key (pk_live_) for all its tests. Your server starts each candidate's session, naming the test, and hands the page a short-lived session token. The page code is the same apart from how the proctor is created.

1. Create a session on your server when a candidate opens the test:

curl -X POST https://proctorkit.com/api/v1/sessions \
  -H "Authorization: Bearer $PROCTORKIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "candidate": { "id": "c-1042", "name": "Asha Rao", "email": "asha@example.com" },
    "test": { "id": "sales-1", "name": "Sales screening" }
  }'

The same in Node, as an Express route:

app.post('/api/proctor-session', async (req, res) => {
  const r = await fetch('https://proctorkit.com/api/v1/sessions', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.PROCTORKIT_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      candidate: {
        id: req.user.id,
        name: req.user.name,
        email: req.user.email,
      },
      test: { id: 'sales-1', name: 'Sales screening' },
    }),
  });
  if (!r.ok) return res.status(502).json({ error: (await r.json()).error });
  const s = await r.json();
  // keep these on your side
  await saveForCandidate(req.user.id, {
    sessionId: s.sessionId,
    reportUrl: s.reportUrl,
  });
  res.json({
    endpoint: s.endpoint,
    sessionToken: s.sessionToken,
    settings: s.settings,
    organisation: s.organisation,
    retentionDays: s.retentionDays,
  });
});

The full response is under Create a session.

2. Start it on the page:

const s = await fetch('/api/proctor-session', { method: 'POST' }).then((r) =>
  r.json(),
);
const proctor = createProctor({
  cloud: { endpoint: s.endpoint, sessionToken: s.sessionToken },
  settings: s.settings,
  consent: { organisation: s.organisation, retentionDays: s.retentionDays },
});
// then runChecks, start, setContext and stop, as in the quick start

Pass endpoint exactly as you received it; it can carry a query string. The page never needs the session ID: your server kept it in step 1, so proctor.sessionId stays null with a server key.

Create the proctor once per attempt, after the session response arrives. In React, fetch the session in a parent and mount the quiz component only when it is there, so useState(() => createProctor(...)) runs exactly once:

function TestPage() {
  const [s, setS] = useState(null);
  useEffect(() => {
    fetch('/api/proctor-session', { method: 'POST' })
      .then((r) => r.json())
      .then(setS);
  }, []);
  return s ? <Quiz session={s} /> : <p>Loading…</p>;
}

function Quiz({ session: s }) {
  // runs once: Quiz mounts only after the session has arrived
  const [proctor] = useState(() =>
    createProctor({
      cloud: { endpoint: s.endpoint, sessionToken: s.sessionToken },
      settings: s.settings,
      consent: { organisation: s.organisation, retentionDays: s.retentionDays },
    }),
  );
  // ...the quiz, as in the React guide
}

Creating it in the component that fetches (on every render, or before the response is in) makes several proctors, each asking for the camera.

3. Read the result: open the reportUrl, set a webhook to be told when it is ready, or call Get a session.

On its own, without an account

const proctor = createProctor({
  consent: { organisation: 'Acme Hiring', retentionDays: 30 },
  onEvent: (event) => sendToYourServer(event),
  // the session video, half a minute at a time
  onClip: (clip) => uploadToYourStorage(clip.mp4),
  // optional: a photo about every 10 s as well
  onSnapshot: (snapshot) => uploadToYourStorage(snapshot.dataUrl),
});

Everything else is the same: runChecks(), start(), setContext(), stop(). Nothing leaves the page except through your handlers. The video is built only when onClip is given.

You store the recording, so you decide how long it is kept. Set consent.retentionDays to what your storage really does; if you leave it out, the consent notice tells candidates the recording is kept as set out in your privacy notice, instead of promising a period.

Each clip is an MP4 of JPEG pictures. Some browsers will not play it in a <video> element; clipFrames(bytes) returns the pictures, so you can show them as a slideshow.

Pauses and your timer

If the candidate leaves full screen, stops sharing, loses the camera or plugs in a second display, the test pauses and tells them how to fix it. ProctorKit has no timer of its own. Drive your countdown from proctor.activeMs(), which leaves out paused time, or listen:

// e.data.reason: 'fullscreen' | 'screen' | 'camera' | 'display'
proctor.on('paused', (e) => myTimer.stop());
// e.data.pausedMs: how long this pause lasted
proctor.on('resumed', (e) => myTimer.start());

Webhooks

Set one webhook address for your account in the dashboard (Account, then Webhook), and ProctorKit posts to it for every session any of your keys starts. data.test tells you which test it came from:

Event When
session.ended The candidate finished; or left without finishing: within about 2 minutes of closing the page, or after 10 minutes with no contact (the session then has a left_unfinished flag)
session.reviewed The result is final: AI review is done (or did not run), usually within a minute or two of the end

Each delivery is a POST with a JSON body:

{
  "id": "whd_7f3a…",
  "event": "session.reviewed",
  "createdAt": "2026-11-19T10:46:02.000Z",
  "data": {
    "sessionId": "3f6c1e2a-…",
    "candidate": {
      "id": "c-1042",
      "name": "Asha Rao",
      "email": "asha@example.com"
    },
    "test": { "id": "sales-1", "name": "Sales screening" },
    "status": "ended",
    "riskScore": 62,
    "…": "…"
  }
}

data has the same fields as Get a session.

Optional: check that it came from us. You get deliveries either way; checking the signature lets your server ignore anything not sent by ProctorKit. The ProctorKit-Signature header looks like t=1795100000,v1=5f2b…. Compute HMAC-SHA256 of "<t>.<raw body>" with your account's signing secret (Account, then Webhook), compare it to v1 in constant time, and reject deliveries whose t is more than 5 minutes old.

Sign the body exactly as it arrived. If your framework parses the JSON first and you JSON.stringify it again, the bytes change (spacing, key order, escaped characters) and every signature fails with your server answering 400. Express needs express.raw() on this route, as below:

import crypto from 'node:crypto';
app.post(
  '/proctorkit',
  express.raw({ type: 'application/json' }),
  (req, res) => {
    const [t, v1] = (req.get('ProctorKit-Signature') || '')
      .split(',')
      .map((p) => p.split('=')[1]);
    const want = crypto
      .createHmac('sha256', process.env.PROCTORKIT_WEBHOOK_SECRET)
      .update(`${t}.${req.body}`)
      .digest('hex');
    const ok =
      v1 &&
      want.length === v1.length &&
      crypto.timingSafeEqual(Buffer.from(want), Buffer.from(v1));
    if (!ok || Math.abs(Date.now() / 1000 - Number(t)) > 300)
      return res.sendStatus(400);
    const delivery = JSON.parse(req.body); // delivery.event, delivery.data
    res.sendStatus(200);
  },
);

In a Next.js route handler, read the text before anything parses it:

// app/api/proctorkit-webhook/route.ts
import crypto from 'node:crypto';

export async function POST(req: Request) {
  const raw = await req.text(); // not req.json(): the signature covers these exact bytes
  const [t, v1] = (req.headers.get('ProctorKit-Signature') || '')
    .split(',')
    .map((p) => p.split('=')[1]);
  const want = crypto
    .createHmac('sha256', process.env.PROCTORKIT_WEBHOOK_SECRET!)
    .update(`${t}.${raw}`)
    .digest('hex');
  const ok =
    v1 &&
    want.length === v1.length &&
    crypto.timingSafeEqual(Buffer.from(want), Buffer.from(v1));
  if (!ok || Math.abs(Date.now() / 1000 - Number(t)) > 300)
    return new Response('bad signature', { status: 400 });
  const delivery = JSON.parse(raw); // delivery.event, delivery.data
  return new Response('ok');
}

Answer with any 2xx within 10 seconds. Anything else is retried after 1, 5, 30, 120, 360, 720 and 1,440 minutes. A delivery can arrive more than once; use id to ignore repeats. The header ProctorKit-Event carries the event name, and Send a test event in the dashboard posts a ping. The Account page shows each delivery of the last 30 events, with the exact request, your server's answer and a Send again button.

Teams and sharing

REST API

Base URL: https://proctorkit.com/api

Your server calls the routes under /v1 with a server key in the Authorization header. They send no CORS headers, so a browser page cannot call them, and the key must never be in a page. The SDK calls the other routes for you.

Every error has the same shape, with an HTTP status code that says what kind it is:

{
  "error": "This key has reached its daily limit of sessions. Raise it in the dashboard."
}

Create a session

POST /v1/sessions, with Authorization: Bearer pk_live_...

Body field Type Notes
candidate object, required { id, name, email? }. id is your ID for the candidate (up to 200 characters), name is shown in the dashboard and report
test object, optional { id?, name? }. One server key serves all your tests: this is how the dashboard tells them apart. Without it, sessions are listed together as "Server key"
aiReview boolean, optional false for a Recording only session, true for AI review. Defaults to the plan set on your server key
metadata object, optional Anything you want back later. Up to 4,000 characters as JSON
ttlMinutes number, optional How long the session token stays valid. 10 to 720, default 240

Response 201:

{
  "sessionId": "3f6c1e2a-8b4d-4c1e-9a7f-2d5b8e0c4a91",
  "sessionToken": "pks_6e0f…",
  "expiresAt": "2026-11-19T14:00:00.000Z",
  "endpoint": "https://proctorkit.com/api?…",
  "settings": { "snapshotIntervalSec": 10, "automatedChecks": true, "…": "…" },
  "organisation": "Acme Hiring",
  "retentionDays": 90,
  "reportToken": "pkr_9b2d…",
  "reportUrl": "https://proctorkit.com/report/?s=3f6c1e2a-8b4d-4c1e-9a7f-2d5b8e0c4a91&k=pkr_9b2d…"
}
Field What to do with it
sessionToken, endpoint Send to the page and pass as cloud: { endpoint, sessionToken }, unchanged
settings Send to the page and pass as settings, unchanged. automatedChecks says whether AI review runs for this session: it is false when the account has no AI-reviewed sessions left, and the test records only
organisation, retentionDays Send to the page for the consent notice
sessionId Keep on your server, to fetch the result
reportUrl, reportToken Keep on your server and give the link to the reviewer. It is private: never send it to the candidate's page
expiresAt When the session token stops working
Status When
400 candidate.id or candidate.name is missing, or metadata is too large
401 The key is missing, wrong or deleted
403 The key is switched off in the dashboard
429 The key reached its daily limit of sessions

Get a session

GET /v1/sessions/{sessionId}, with Authorization: Bearer pk_live_...

Response 200:

{
  "sessionId": "3f6c1e2a-8b4d-4c1e-9a7f-2d5b8e0c4a91",
  "candidate": {
    "id": "c-1042",
    "name": "Asha Rao",
    "email": "asha@example.com"
  },
  "test": { "id": "sales-1", "name": "Sales screening" },
  "metadata": {},
  "status": "ended",
  "createdAt": "2026-11-19T10:00:00.000Z",
  "startedAt": "2026-11-19T10:01:12.000Z",
  "endedAt": "2026-11-19T10:44:05.000Z",
  "blocksBilled": 1.5,
  "riskScore": 62,
  "flagCounts": { "info": 14, "warn": 3, "high": 2 },
  "flagSummary": {
    "phone_in_use": { "incidents": 1, "frames": 3, "seconds": 20 },
    "focus_returned": { "incidents": 2, "frames": 0, "seconds": 0 }
  },
  "verdict": null,
  "verdictNote": null,
  "verdictAt": null,
  "automatedChecks": true,
  "aiReviewSkipped": null,
  "flags": [
    {
      "type": "phone_in_use",
      "severity": "high",
      "source": "server",
      "at": "2026-11-19T10:12:40.000Z",
      "ms": 688000,
      "endMs": 716000,
      "context": { "questionId": "Q07" }
    },
    {
      "type": "focus_returned",
      "severity": "warn",
      "source": "client",
      "at": "2026-11-19T10:20:03.000Z",
      "ms": 1131000,
      "context": { "questionId": "Q11" },
      "data": { "awayMs": 9400 }
    }
  ],
  "note": "Flags are prompts for a person to review. Do not fail a candidate on a score alone."
}
Field Meaning
status created (token issued, test not started), active, ended, expired (the page never said it finished), archived (the recording was deleted at the end of the retention period; the result is kept)
blocksBilled Candidate sessions charged so far: 1 for up to 30 minutes, then by the minute (45 minutes is 1.5). Always 0 for Recording only keys during launch
riskScore The review priority, 0 to 100: who to look at first, not a test result. Computed from browser events alone when AI review is off
flagCounts Number of flags by severity
flagSummary For each kind of flag: how many separate incidents, and roughly how long they lasted
verdict, verdictNote, verdictAt What a reviewer recorded in the dashboard: clear, concern or null
automatedChecks, aiReviewSkipped Whether AI review ran. When the key asks for AI review but the account had none left, automatedChecks is false and aiReviewSkipped is no_credits; otherwise aiReviewSkipped is null
flags Every warn and high flag in time order (up to 1,000), each with the question on screen in context. source is server for AI review, client for the browser. Some flags cover a stretch of time: then endMs is set, and the event happened at some moment between ms and endMs

AI review finishes shortly after the test ends, so a session read straight away can still gain flags. Use the session.reviewed webhook, or read it again a minute or two later.

List sessions

GET /v1/sessions, with Authorization: Bearer pk_live_...

Newest first. Query parameters, all optional:

Parameter Meaning
candidateId Only this candidate's sessions (every attempt)
testId Only this test's sessions
status created, active, ended, expired or archived
since Only sessions created after this ISO time
limit 1 to 200, default 50
cursor The next value from the previous page

Response 200: { "sessions": [ … ], "next": "2026-11-18T09:12:00.000Z" }. Each entry has the top-level fields of Get a session without flags. next is null on the last page.

Get the recording

GET /v1/sessions/{sessionId}/media, with Authorization: Bearer pk_live_...

Links to the session's photos and video, to copy into your own storage. Links expire after 10 minutes; ask again for fresh ones.

{
  "photos": [
    {
      "kind": "webcam",
      "reason": "interval",
      "ms": 12000,
      "at": "…",
      "context": { "questionId": "Q1" },
      "url": "https://…"
    }
  ],
  "clips": [
    {
      "kind": "screen",
      "startMs": 0,
      "endMs": 28000,
      "frames": 15,
      "flagged": false,
      "url": "https://…"
    }
  ],
  "next": null,
  "linksExpireInSeconds": 600
}

A photo's reason is interval (the regular photo), event (taken because something happened) or evidence (the picture that shows a flag from AI review). Photos come 500 at a time by default (limit up to 1,000); pass afterMs with the next value for the next page. flagged marks parts of the video that raised a flag. An archived session returns empty lists.

Flag types

Type From Meaning
other_person_near AI review Another person close to the candidate or their screen
other_person_background AI review Another person in the room, away from the desk
phone_in_use AI review A phone held, at the ear, or propped up facing the candidate or screen
phone_idle AI review A phone lying flat on the desk
candidate_absent AI review Nobody at the device
camera_covered AI review The camera's view is covered or blank. Replaces candidate_absent for the same moment
looking_away AI review Keeps looking away from the screen at something out of view (below the camera, to the side, at a wrist). Writing on rough paper does not count. Only ever worth a look
other_app_visible AI review Another app or window on the shared screen
test_not_visible AI review The test is not the main window on screen
focus_returned Browser Came back to the test after leaving it; data.awayMs says for how long
page_closed Browser The tab was closed, reloaded or left while the test ran
left_unfinished Server The test stopped without finishing: the page was closed (data.closed), or the browser went silent for 10 minutes. The session ends at the last contact
fullscreen_exit, screen_share_stopped, camera_lost, extra_display Browser A requirement broke and the test paused
no_face Browser No face in view for a while; the candidate was prompted
camera_blocked Browser No face and a featureless picture for a few seconds, as when the lens is covered (or the room is very dark); the candidate was prompted. Reported instead of no_face. From SDK 0.2.5
paste_blocked, copy_blocked, cut_blocked Browser A clipboard attempt was blocked
pointer_left_page Browser The pointer left the page for a while
screen_surface_unverified Browser The browser did not say what was shared
virtual_camera Browser The camera's name says it is software (OBS, ManyCam and the like)
virtual_machine Browser The test ran inside a virtual machine (VMware, VirtualBox, Parallels, QEMU), so the real computer was out of sight. From SDK 0.2.6

New flag types can be added over time. Treat a type you do not recognise as something to look at.

Routes the SDK calls

You do not call these yourself; they are listed so you know what the page sends.

Route Sent by What it does
POST /page/session The SDK, with a page key Opens a session for this candidate. Refusals reach your page as a cloud_unavailable event with data.code: key_invalid, key_off, domain_not_allowed, daily_cap, candidate_required or unavailable. Running out of AI-reviewed sessions is not a refusal: the session records only
POST /clip The SDK Half a minute of the webcam or screen video, as an MP4, with the session token in the X-PK-Token header
POST /snapshot The SDK One webcam photo or screenshot, with the session token, the time and the question on screen
POST /events The SDK A batch of browser events, every 5 seconds

Limits you can set

Setting Default How to change it
Candidates a day, per key 50 for a page key, 2,000 for a server key Keys, then Edit: any number up to 100,000
Session token lifetime 240 minutes ttlMinutes when your server creates a session: 10 to 720
How long AI-reviewed recordings are kept 90 days Account (owners): 7, 14, 30, 60 or 90 days, for tests that start after the change

Parts of an AI-reviewed video with nothing flagged go after 7 days, and Recording only keeps recordings 30 days. Results and flags stay until you delete the record. Upload sizes and rates are handled by the SDK; there is nothing to manage.

What counts as a candidate session

When AI-reviewed sessions run out

Nothing stops. A test that starts after the last AI-reviewed session is used still runs and records, kept 30 days, without AI review. A test already under way finishes with AI review. The dashboard marks those candidates Recorded only, and the session has aiReviewSkipped set.

Account owners get an email when 10 AI-reviewed sessions are left and another when none are left, and the dashboard shows the same notice. AI review starts again on the next candidate once sessions are added.

Prices are ₹ for customers in India and US$ elsewhere: AI review is ₹15 or $0.25 per candidate session; after launch, Recording only is ₹5 or $0.10 per session beyond the free 100 a month.

SDK reference

createProctor(config)

Every option is optional, except candidate when you pass a key.

Option Type Default What it does
key string A page key (pk_pub_) from the dashboard. The page opens its own session
candidate { id: string; name: string; email?: string } Who is taking the test. Required with key
test { id?: string; name?: string } the key's name Groups candidates by test in the dashboard
cloud { endpoint: string; sessionToken: string } A session your server created with a server key
require { camera?, screenShare?, fullscreen?, singleDisplay?: boolean } all true What must be true before and during the test
clips false | { frameSec?: number; windowSec?: number } on The session video. Built only when something receives it: a key, cloud or onClip
snapshots false | { intervalSec?: number } every 10 s Photos of the webcam and screen. false also turns the video off
blockClipboard boolean true Block copy, cut, paste and right-click, and log each attempt
consent { organisation?, retentionDays?, seenBy? } Shown in the consent notice. Filled in for you with a key. Without one, set retentionDays to what your storage really does
faceDetection false | FaceDetectionOptions on The on-device face-in-view check. See the README for hosting its files yourself
ui 'default' | 'headless' 'default' headless renders nothing, so you can build your own screens
theme 'light' | 'dark' | 'auto' 'auto'
cameraTile boolean setup only The candidate's own camera preview
strings Partial<Record<string, string>> Replace any text the candidate sees; keys are in defaultStrings
settings Partial<ProctorSettings> built in Timings and thresholds. With a server key, pass settings from the session response
context Record<string, string | number | null> {} Starting context carried by events and the recording
onEvent (event: ProctorEvent) => void Called for every event
onClip (clip: Clip) => void Called with each part of the session video
onSnapshot (snapshot: Snapshot) => void Called with every photo

Methods

Method Returns What it does
runChecks() Promise<CheckResult> Runs the system check and consent. Call it from a click handler
start() boolean Starts guarding and recording. false if the checks have not passed
stop() ProctorReport Stops, releases camera and screen, removes the interface
setContext(patch) void Merges values into the context carried by later events and the recording
on(type, listener) () => void Listens for one event type, or '*' for all. Returns an unsubscribe function
activeMs() number Time since start(), not counting pauses
isBlocked() boolean True while the system check or a pause is on screen
pausedFor() ('fullscreen' | 'screen' | 'camera' | 'display')[] Why the test is paused right now
retry(reason) Promise<boolean> Tries to fix one pause reason, for headless screens
getReport() ProctorReport The report so far, without stopping
support() { ok: boolean; missing: string[] } Missing browser features, without asking for anything
ready() boolean True when every requirement is met and start() would succeed
requestCamera(), prepareFaceDetection(), requestScreenShare(), giveConsent() The separate steps, for headless screens
sessionId string | null The cloud session's ID once a page key has connected. With a server key it stays null in the page: your server already has it from Create a session

With the built-in screens, runChecks() resolves with { ok: true } once every check has passed; a failed step stays on screen with a way to try again. With ui: 'headless' it resolves at the first requirement that fails with { ok: false, reason }, where reason is unsupported (with missing), extra_display, camera, face_detection, screen_share or consent. What each means is under Troubleshooting.

Events

Every event has type, at (ISO time), ms (since start()), severity (info, warn or high), context (the question on screen and anything else you set) and sometimes data.

Type Severity data
unsupported high missing
check_passed, check_failed info check: camera, face_detection, face_visible or screen_share
consent_given info retentionDays
started, stopped info
cloud_connected info sessionId (page key only; with a server key your server has it)
cloud_unavailable warn code, message: why the page key was refused or the service could not be reached
context_changed info the values that changed
paused, resumed info reason; pausedMs on resumed
fullscreen_exit warn
screen_share_stopped, camera_lost high
screen_share_resumed, camera_restored info
no_face warn seconds without a face
face_returned info awayMs
screen_surface_unverified warn
virtual_camera high label
virtual_machine warn renderer; once, at start(). From SDK 0.2.6
extra_display warn before the test, high during phase
focus_lost warn sinceQuestionMs
focus_returned info, or warn after 5 s away awayMs
page_closed warn the tab was closed, reloaded or left while the test ran
pointer_left_page info awayMs
copy_blocked, cut_blocked, paste_blocked, contextmenu_blocked info target
clip info kind, startMs, endMs, frames, bytes (the video goes to onClip)
clip_upload_failed warn kind, startMs; the photos still cover that stretch
snapshot info kind, reason, bytes
snapshot_upload_failed warn

TypeScript

The package ships its declarations. These are exported:

import {
  createProctor,
  Proctor,
  defaultSettings,
  defaultStrings,
  clipFrames,
} from 'proctorkit';
import type {
  ProctorConfig,
  ProctorEvent,
  ProctorEventType,
  Severity,
  ProctorContext,
  ProctorSettings,
  Snapshot,
  Clip,
  Candidate,
  TestInfo,
  CheckResult,
  ProctorReport,
  ConsentInfo,
  FaceDetectionOptions,
} from 'proctorkit';

The shapes you will use most:

interface ProctorEvent {
  type: ProctorEventType;
  at: string; // ISO time
  ms: number; // since start(); 0 before the test starts
  severity: 'info' | 'warn' | 'high';
  // e.g. { questionId: 'Q07' }
  context: Record<string, string | number | boolean | null>;
  data?: Record<string, unknown>;
}

interface Clip {
  kind: 'webcam' | 'screen';
  startMs: number; // since start()
  endMs: number;
  frames: number;
  // clipFrames(new Uint8Array(await mp4.arrayBuffer())) gives the pictures
  mp4: Blob;
  context: Record<string, string | number | boolean | null>;
}

interface Snapshot {
  kind: 'webcam' | 'screen';
  // JPEG; webcam up to 600 px, screen up to 1200 px on the longer side
  dataUrl: string;
  // regular cadence, or taken because something happened
  reason: 'interval' | 'event';
  at: string;
  ms: number;
  context: Record<string, string | number | boolean | null>;
}

interface CheckResult {
  ok: boolean;
  reason?:
    | 'unsupported'
    | 'extra_display'
    | 'camera'
    | 'face_detection'
    | 'screen_share'
    | 'consent'
    | 'cancelled';
  missing?: string[]; // when reason is 'unsupported'
}

interface ProctorReport {
  startedAt: string | null;
  endedAt: string | null;
  durationMs: number;
  pausedMs: number; // time behind the pause screen
  awayMs: number; // time the test page was out of focus
  context: Record<string, string | number | boolean | null>;
  counts: Partial<Record<ProctorEventType, number>>;
  events: ProctorEvent[];
}

Common mistakes

Troubleshooting

What the candidate sees, and what it means. The built-in system check keeps the candidate on the step that failed, with the message below and a way to try again. With ui: 'headless', runChecks() resolves with { ok: false, reason } instead, and your screen shows the message.

The candidate sees reason (headless) Usually
"Camera access was denied." camera They clicked Block, or the browser or operating system blocks the camera for this site.
"Part of the camera check didn't download." (before 0.2.5: "The camera check could not be loaded.") face_detection The on-device face check's files could not be fetched: a slow or filtered network, or a Content Security Policy that blocks them (allowed sources are in the Next.js guide). Not a camera problem.
"We could not see your face." face_detection The camera works but no face was found: poor light, or sitting out of frame.
"Screen sharing was cancelled." or "That shared a window or tab." screen_share They cancelled, or chose a window or tab instead of the entire screen.
"A second screen is connected." extra_display A second monitor is attached.
"This test needs a desktop browser…" unsupported A phone, or a browser without camera or screen sharing; missing lists what is absent.

"The camera check could not be loaded" on a good connection (SDK before 0.2.2). Some bundlers rewrote the SDK's on-demand import of the face check. Update to 0.2.2 or later: npm install proctorkit@latest.

Every webhook gets 400 from your server. Almost always the signature is computed on a re-serialised body. Read the raw text before parsing, as in Webhooks. Send a test event on the Account page shows your server's answer, and Copy exact body gives the bytes we sent.

proctor.sessionId is null. Expected with a server key: the ID is in your server's Create a session response. With a page key it is set once cloud_connected fires.

The camera asks twice, or two camera tiles appear. More than one proctor was created: in React, create it in useState(() => createProctor(...)) in a component that mounts once per attempt, as in With a server key.

cloud_unavailable fires. The key was refused or the service could not be reached; the event's data says which, and the console logs it. The test keeps running with the on-device checks.

What changed in a release. See the changelog or the releases page.

What is flagged, and what is not

From the browser From AI review
Leaving the test window, and for how long; leaving full screen; stopping the screen share; camera off or covered; a software camera; a second display; no face in view; paste, copy and right-click attempts; a virtual machine (SDK 0.2.6) Another person close to the candidate; someone else in the room for a while; a phone in use; the candidate out of view; another app or window on screen; the test window hidden

What it can't see

It sees only what the camera and the shared screen show, records no sound, and does not check identity. So these can get through:

It's built to catch everyday cheating and make it easy to spot, not to stop people set on beating it. Telling candidates the rules up front also discourages casual cheating.

For your coding agent

Paste this into Claude Code, Cursor or the tool that built your quiz. Your dashboard gives you the same prompt with your key already in it.

Add ProctorKit proctoring to this quiz. Read https://proctorkit.com/llms-full.txt first. Page key (it goes in the page; it only works on your website): PASTE_YOUR_pk_pub_KEY 1. npm install proctorkit. Create one proctor per attempt (in React, inside useState(() => ...) so a re-render does not make a new one): createProctor({ key, candidate: { id, name, email }, test: { id, name } }). candidate.id and candidate.name are required. 2. When the candidate clicks Start, await proctor.runChecks(); show the quiz only if .ok and proctor.start() returns true. 3. Call proctor.setContext({ questionId }) whenever the visible question changes. 4. Call proctor.stop() when the test is submitted. Do not add a timer, and change nothing else.

More

The SDK's source, its README with every setting, and the issue tracker are on GitHub.