Skip to Content
Web SDKGetting startedOverview

Getting started

This page gets a working face enrollment running in under ten minutes. It is the only happy path; alternatives live in Guides.

Before you start, read Prerequisites and confirm you have what you need.

1. Install

The SDK lives on a private registry, so map the @sladeid scope to it once. Put this in the .npmrc next to your package.json and commit it — it holds no secret:

@sladeid:registry=https://npmjs.slade360.co.ke/

Then put your registry token in user-level config, once per machine (never in the project .npmrc — see Prerequisites for why that form fails under pnpm):

pnpm config set "//npmjs.slade360.co.ke/:_authToken" <your-token> # or npm config set "//npmjs.slade360.co.ke/:_authToken" <your-token>

Now install normally. No --registry flag: the scope mapping already routes @sladeid.

pnpm add @sladeid/slade-id-sdk npm install @sladeid/slade-id-sdk yarn add @sladeid/slade-id-sdk

Any additional runtime assets are installed as transitive dependencies.

2. Configure

import { SladeID } from '@sladeid/slade-id-sdk'; const sdk = new SladeID({ middlewareUrl: 'https://id.example.com', auth: { type: 'tokenProvider', getToken: async () => fetchSladeIdToken(), // minted by your backend — see Concepts → Authentication }, });

That is the entire required config. Everything else is optional and covered in the configuration reference.

3. Mount the capture surface

<video id="camera" autoplay muted playsinline></video> <button id="capture">Capture</button> <pre id="status"></pre>

4. Capture and submit

import { SladeID, type FaceCaptureResult } from '@sladeid/slade-id-sdk'; const sdk = new SladeID({ middlewareUrl: 'https://id.example.com', auth: { type: 'tokenProvider', getToken: async () => fetchSladeIdToken(), // minted by your backend — see Concepts → Authentication }, }); const video = document.querySelector<HTMLVideoElement>('#camera')!; const status = document.querySelector<HTMLPreElement>('#status')!; const button = document.querySelector<HTMLButtonElement>('#capture')!; const session = sdk.createFaceSession(video, { autoCapture: true, }); session.on('guidance', (g) => { status.textContent = `phase: ${g.phase}`; }); session.on('captured', async ({ result }: { result: FaceCaptureResult }) => { try { const enrolled = await sdk.enrollFace('demo-subject-001', result); status.textContent = `enrolled id=${enrolled.id}`; } catch (err) { status.textContent = `error: ${(err as Error).message}`; } }); button.addEventListener('click', () => session.start());

Expected response shape from enrollFace:

{ "id": "f3c4b2a8-...", "enrollee": "demo-subject-001", "createdAt": "2026-05-14T10:00:00Z", "raw": { "...": "untouched backend payload" } }

What just happened

  • SladeID wired up the authenticated transport and the biometrics API for you.
  • createFaceSession opened the camera, loaded the face landmarker, and started a per-frame guidance loop. See Capture session lifecycle.
  • The 'captured' event fired once the face passed the quality gate. See Quality scoring.
  • enrollFace submitted the capture to the Slade ID backend over HTTPS with your token.

Next