Quickstart
Run your first check in the sandbox, from your server to the scan and back.
Get a sandbox key
Sign in to the dashboard, open Developers, and create a secret key. It starts
with sk_test_. Keep it on your server, in an environment variable:
MYIDII_SECRET_KEY=sk_test_...Create a session on your server
npm install @myidii/nodeimport { Myidii } from "@myidii/node";
const myidii = new Myidii(process.env.MYIDII_SECRET_KEY!);
// Your endpoint, e.g. POST /api/start-check
const session = await myidii.sessions.create({
reference: user.id, // your own id for the person
});
return { url: session.url }; // send only the url to the browserThe url works once and expires after 10 minutes.
Open the scan in your page
import { startLiveness } from "@myidii/web";
const { url } = await fetch("/api/start-check", { method: "POST" }).then((r) => r.json());
const result = await startLiveness({ url });result.status is passed, failed, expired or cancelled. Use it to update your page, not to make decisions.
Read the verdict on your server
const checked = await myidii.sessions.retrieve(sessionId);
if (checked.status === "passed") {
// A real person was at the camera. Carry on.
}Or skip the polling and let us tell you: add a webhook for session.completed.
Testing a failure
In the sandbox, pass simulate: "fail" when you create the session to see what a failed check looks like.
See Testing in the sandbox.