SDK reference
Server client
createFaceCardServer with users, tokens, usage and offline verification.
import { createFaceCardServer } from '@facecard/sdk';
const facecard = createFaceCardServer({ secretKey: process.env.FACECARD_SECRET_KEY! });| Option | Type | Description |
|---|---|---|
secretKey | string | Your fc_sk_live_... key. Server only. |
users
| Method | API route | Returns |
|---|---|---|
users.list({ limit, cursor }) | GET /v1/users | { users, next_cursor } |
users.get(id) | GET /v1/users/{id} | The user |
users.delete(id) | DELETE /v1/users/{id} | Nothing (the user and their face templates are gone) |
const page = await facecard.users.list({ limit: 50 });
const user = await facecard.users.get('usr_123');
await facecard.users.delete('usr_123');tokens.verify
const result = await facecard.tokens.verify(token);
if (result.valid) console.log(result.claims.sub);
else console.log(result.reason);Calls POST /v1/tokens/verify. Resolves with { valid: true, claims } or { valid: false, reason }. The reason is revoked when the user signed out. This is the revocation aware check.
verifyTokenOffline
const claims = await facecard.verifyTokenOffline(token);Verifies the signature, issuer, audience and expiry against the public keys at /.well-known/jwks.json, with no call to the verify route. Resolves with the claims and rejects with a FaceCardError if the token is invalid or expired. It cannot see a deletion or a sign out that happened after the token was issued, so a signed out token still passes until it expires. Use tokens.verify when revocation matters. See User tokens and JWKS.
usage
const usage = await facecard.usage('2026-10');
// { month, auths, limit, enrolls, matches_ok, matches_failed }Calls GET /v1/usage?month=....