Skip to Content
MYIDIIDocs

Websites

Open the scan from any website with @myidii/web, with a bundler or a script tag.

Install

npm install @myidii/web
import { startLiveness } from "@myidii/web";

Start a check

Ask your server for a session url, then hand it to startLiveness:

const { url } = await fetch("/api/start-check", { method: "POST" }).then((r) => r.json());
const result = await startLiveness({ url });

if (result.status === "passed") showNextStep();

By default the scan opens over your page. On a computer it fills the window during the colour check, because the screen's light is part of the check. On phones it's full screen.

Prop

Type

The result

startLiveness resolves with:

Prop

Type

Confirm on your server

Anyone can change what runs in their own browser. Before you unlock anything, read the session on your server with GET /v1/sessions/:id or wait for the session.completed webhook.

Redirect instead of a pop-up

Set return_url when you create the session, and use mode: "redirect". The person goes to the scan, sees the result, and taps a button that takes them back to your return_url. Useful when pop-ups don't suit your flow, or in apps that open links in a webview.

On this page