Node SDK

Install the client, schedule a session, mint a join link, and read the evidence when it ends.

4 min read

The Node SDK is the API plus the parts every integration otherwise rebuilds: typed errors, retries that honour Retry-After, idempotency keys on writes, pagination iterators, evidence downloads that re-verify their own checksum, and webhook signature verification.

npm install @proctor/sdk

Schedule a session

import { Proctor } from "@proctor/sdk";

const proctor = new Proctor({
  apiKey: process.env.PROCTOR_API_KEY!,
  baseUrl: process.env.PROCTOR_BASE_URL!,
});

const { session } = await proctor.sessions.create({ externalId: "req-42" });
const link = await proctor.sessions.createJoinLink(session.id, { role: "candidate" });

console.log(link.url); // send this to the candidate

Errors are typed

import { ProctorApiError } from "@proctor/sdk";

try {
  await proctor.sessions.get("ses_missing");
} catch (error) {
  if (error instanceof ProctorApiError && error.is("not_found")) {
    // branch on the code, never on the message
  }
  throw error;
}

Read the evidence

evidence.download mints a short-lived link, fetches the bytes *without* sending your API key to the storage host, and re-hashes them against the published digest before handing them back. A download that does not match what was uploaded throws rather than returning silently corrupted bytes.

for await (const item of proctor.evidence.iterate({ sessionId: session.id })) {
  const bytes = await proctor.evidence.download(item.id);
  // …store or inspect
}

Follow a live session

for await (const event of proctor.events.stream({ sessionId: session.id })) {
  console.log(event.type, event.occurredAt);
}
NextWebhooks