Skip to Content
MYIDIIDocs

Your server

Create sessions, read results and fetch photos with @myidii/node, or call the API from any language.

Node.js

npm install @myidii/node
import { Myidii } from "@myidii/node";

const myidii = new Myidii(process.env.MYIDII_SECRET_KEY!);

The client refuses anything that isn't a secret key (sk_test_ or sk_live_), so a publishable key can't slip in.

Create a session

const session = await myidii.sessions.create({
  reference: "user_4821",                      // your id for the person, optional
  return_url: "https://yourapp.com/verified", // for redirect mode, optional
});

session.url;        // give this to the browser
session.id;         // keep this to look up the result
session.expires_at; // the url expires 10 minutes after creation

A live session is charged when it's created ($0.06, up to three tries). If your wallet can't cover it, the call fails with insufficient_funds.

Read the result

const s = await myidii.sessions.retrieve(session.id);
// s.status, s.score, s.checks, s.attempts, s.photo_url

List recent sessions with myidii.sessions.list({ limit: 20 }).

Fetch the photo

Live checks that pass come with a clean still photo:

const jpeg = await myidii.sessions.photo(session.id); // Uint8Array

Errors

Failed calls throw a MyidiiError with type, status and a readable message:

import { MyidiiError } from "@myidii/node";

try {
  await myidii.sessions.create();
} catch (e) {
  if (e instanceof MyidiiError && e.type === "insufficient_funds") notifyFinance();
}

See every error type.

Any other language

Call the API with your secret key as a bearer token:

curl https://api.myidii.com/v1/sessions \
  -H "Authorization: Bearer $MYIDII_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"reference": "user_4821"}'

The full API is in the reference.

On this page