Facededup Developers
Facededup API · v1

Prove a real person is present, then check who they are.

Facededup runs liveness and anti-spoofing on the device and on our servers, then lets you match the live face against NIN, BVN, a document or an enrolled face. Drop in an SDK for capture, verify the signed result on your server, and you're done.

Products

ProductWhat it answersEndpoints
LivenessIs a live human physically in front of the camera, right now?/v1/verify and its setup calls
IdentityDoes this face match the NIN or BVN record?/v1/identity/verify, /search
DocumentsIs the passport or ID valid, and is it this person?/v1/document/mrz, /verify
Face enrollmentIs this the same person who enrolled before, and have we seen this face under another account?/v1/face/enroll, /authenticate, /dedup
AddressWas the person at the address they declared?/v1/address/verify

Base URL for every request: https://facededup.ai. All requests and responses are JSON over HTTPS, and images are sent as base64-encoded JPEG or PNG.

Get started

Quickstart

Each step is one call and the response you should see. Use your sandbox key throughout.

  1. Get your keys

    Your Facededup account team issues a sandbox key (starts with fdk_test_) and a live key. Store them as a secret on your server, for example in an environment variable called FACEDEDUP_KEY. Never ship the live key inside a mobile app's source.

  2. Say hello

    Confirm you can reach the API. This call needs no key.

  3. Check your key

    Any call that needs a key returns 401 when the key is missing or unknown. Reading your webhook settings is a safe first authenticated call, and the response names your tenant.

  4. Run a liveness check

    Drop the capture UI into your page. It handles the camera, the head-movement challenges and the API calls, then gives you the result.

    checkout.html · web SDK
    import { mountLiveness } from "@facededup/liveness-web";
    
    mountLiveness(document.getElementById("kyc"), {
      baseUrl: "https://facededup.ai",
      licenseKey: "fdk_test_…",       // sandbox key
      subjectId: "user_8231",          // your ID for this person
      onResult: async (r) => {
        // r.outcome: "live" | "not_live" | "referred"
        // Send the signed token to YOUR server; don't trust r.outcome alone.
        await fetch("/kyc/liveness", {
          method: "POST",
          headers: { "Content-Type": "application/json" },
          body: JSON.stringify({ token: r.signed_result?.token }),
        });
      },
    });

    Using a mobile app? See React Native, Flutter, Android or iOS.

  5. Confirm the result on your server

    Redeem the token with your key. It's valid for 120 seconds and can be redeemed once, so a captured token can't be replayed. Only grant access when payload.outcome is "live".

Get started

Authentication

Send your key in the X-License-Key header on every request. The key decides which tenant the call belongs to, so a tenant_id in the request body is ignored whenever a key is present.

A WebView that can't set headers may pass the key as a query parameter instead: ?license=fdk_…. Prefer the header everywhere else, because query strings end up in logs.

Keep live keys on your server. Mobile and web SDKs need a key to start a session. Use your sandbox key while building, and talk to your account team about the licence certificate used by the mobile SDKs in production.
Header
X-License-Key: fdk_test_4f1c…
Missing or unknown key · GET /v1/webhook
401 Unauthorized
{ "detail": "a license key is required to configure webhooks" }
Get started

Sandbox & live

Sandbox and live use the same base URL. The key decides the environment: a key beginning fdk_test_ (or sk_test_) marks the call as sandbox, and any other valid key is live. Sandbox calls run the full liveness engine, so test with real people and real devices, not photos.

SandboxLive
Key prefixfdk_test_fdk_ (no test)
Base URLhttps://facededup.ai
DecisionsTagged sandbox in your recordsTagged production
Guides

How a liveness check works

The SDKs make these calls for you. Call them yourself only if you build your own capture. They must happen in this order, and all of them share one request_id.

1 · consentThe person agrees to biometric processing.
2 · requestOpens a check and sets the risk level.
3 · challengeRandom actions and a nonce, valid for 20 s.
4 · verifyFrames go in; a verdict and signed token come out.
5 · redeemYour server confirms the token, once, within 120 s.
StepCallerCallReturns
1SDKPOST /v1/consentconsent_id
2SDKPOST /v1/requestrequest_id
3SDKPOST /v1/challengeactions and nonce, valid 20 s
4SDKPOST /v1/verify with framesoutcome and signed_result.token
5Your serverPOST /v1/result/redeemvalid and the outcome

What we check

On the device, the SDK coaches positioning, confirms each action and looks for screen replays. On our servers, we re-check the actions in the frames you send, look for print, screen and injected-video attacks, and, on supported iPhones, require real 3D depth from the TrueDepth camera. Every decision is written to a tamper-evident, hash-chained audit log.

Guides

Trusting results on your server

A result that passes through the browser or app can be edited. Every /v1/verify response therefore carries signed_result.token, an Ed25519-signed statement of the outcome. Confirm it on your server in one of two ways.

Option A · redeem (recommended)

Send the token to POST /v1/result/redeem. We check the signature and expiry, and enforce single use, so a stolen token is useless after its first redemption.

Option B · verify offline

Fetch our public key once from GET /v1/result/public-key and verify the signature yourself. This works without a network call per check, but it can't enforce single use, so record redeemed decision_ids on your side.

The token is base64url-encoded JSON: {"payload": {…}, "sig": "…"}. The signature covers the payload serialised with sorted keys and no spaces.

Decoded token payload
signed_result.token → payload
{
  "request_id": "9f0c4c1e-6a1d-4f7e-9d0b-2a5c8e1f3b77",
  "decision_id": "d3b7a2e4-1c5f-4a8e-b6d9-7e2f0c1a9b44",
  "subject_id": "user_8231",
  "outcome": "live",
  "score": 0.9132,
  "threshold_version": "2026-06-07.1",
  "issued_at": "2026-11-25T10:42:07Z",
  "expires_at": "2026-11-25T10:44:07Z",
  "single_use": true
}
Mobile SDKs. The Android and iOS SDKs return the full result as payload_json, or as encrypted_payload when your account uses tenant encryption. Only your private key can decrypt it.
Guides

Webhooks

Register one HTTPS endpoint per tenant with POST /v1/webhook. The response includes a signing secret (whsec_…) that's shown once, so store it straight away.

Webhooks are sent for checks submitted through offline capture, where the verdict arrives after the person has left. For live checks, use the response from /v1/verify directly.

Verify every delivery

Each POST carries X-Facededup-Signature: sha256=<hex>, the HMAC-SHA256 of the raw request body using your secret. Compute it over the exact bytes you received, before parsing the JSON, and compare in constant time. We time out after 8 seconds, so acknowledge quickly and do slow work afterwards.

Event payload
POST to your endpoint · liveness.decision
{
  "event": "liveness.decision",
  "client_txn_id": "agent-07-000412",
  "decision_id": "d3b7a2e4-1c5f-4a8e-b6d9-7e2f0c1a9b44",
  "subject_id": "user_8231",
  "outcome": "live",
  "is_live": true,
  "score": 0.9132,
  "threshold": 0.6,
  "tenant": "acme",
  "captured_at": "2026-11-25T09:58:11Z",
  "submitted_at": "2026-11-25T10:42:07Z",
  "offline": true,
  "metadata": { "branch": "Ikeja" }
}
Verify the signature · Node.js
import crypto from "node:crypto";

// rawBody: the exact bytes received (Buffer), before JSON.parse
function isFromFacededup(rawBody, header, secret) {
  const expected = "sha256=" + crypto
    .createHmac("sha256", secret).update(rawBody).digest("hex");
  const a = Buffer.from(expected), b = Buffer.from(header || "");
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}
Guides

Outcomes & score bands

Liveness outcome

outcomeMeaningWhat to do
liveA live person completed the challenge and passed every anti-spoofing check.Continue, after you've confirmed the token.
not_liveLiveness wasn't proven: a likely spoof, a failed challenge, or a borderline score.Let the person retry with better light and a steadier phone, up to max_attempts.
referredSent to a human: attempts ran out, or you used the assisted route.Hold the account and wait for a review decision.

score is a number from 0 to 1. The threshold is 0.6 at baseline risk and 0.8 at stepup.

Face match bands (identity, documents, enrollment)

match_score runs from 0 to 100.

Send refer results to a person for manual review rather than rejecting them outright.

Guides

Full verification in the browser

One call runs the whole check in your page: consent, liveness, an ID number, an ID document, or any mix. Your server mints a short-lived session token and the page uses that, so your API key never reaches the browser.

  1. On your server, call POST /v1/sessions with your key and choose a flow.
  2. In the page, pass the returned token to mountVerification().
  3. On your server, act on the signed callback. The browser result tells you the flow finished; the callback is the authority.

Flows

flowSteps
livenessConsent, liveness
identity (or biometric_kyc)Consent, liveness, NIN/BVN with face match
document (or document_verification)Consent, liveness, ID document with face match
identity_and_documentConsent, liveness, NIN/BVN, ID document
customer_onboarding, director_verificationIdentity plus a name match (and PEP/sanctions screening for directors). Needs subject.name.

Or pass your own steps list, for example ["liveness", "document"].

Session options

FieldWhat it does
id_selectionWhich countries and ID types to offer, e.g. {"NG": ["nin", "passport"]}. Default: everything in Supported IDs. With one choice, the picker is skipped.
consent{"granted": true, "granted_at": "…"} if you already collected consent. Skips the consent screen.
subjectname, role, organisation, reference, email, phone, and an expected id_type + id_number.
options.capture_videoRecords a 3 to 5 second clip of the selfie attempt (MP4/H.264 where the browser can, otherwise WebM) and sends it with the frames. The check is refused without it. Default false.
options.require_locationMakes the geo-tag mandatory: the person is asked for their location before the camera opens, and the check is refused without it. Default false.
options.allow_agent_modeAdds a switch-camera control so staff can capture someone else with the rear camera.
options.strictStricter liveness.
options.document_capture_modes["camera"] (default) or ["camera", "upload"].
options.auto_captureautoCapture (default), autoCaptureOnly or manualCaptureOnly.
options.auto_capture_timeoutMilliseconds before the manual shutter appears. Default 20000, between 3000 and 30000.
brand_name, brand_color, logo_url, policy_urlShown on the consent screen and header.
languageen, pcm, fr or ar.
callback_url, redirect_url, metadata, expires_in_hoursWhere the result goes, where the person lands, your own references, and the lifetime.

The result in the page

onResult fires exactly once.

statusMeaning
successThe flow finished. value.decision is approved, review or declined.
failureerror.code is one of CONFIG_INVALID, SESSION_INIT_FAILED, SESSION_EXPIRED, CONSENT_DENIED, CAMERA_UNAVAILABLE, SUBMISSION_FAILED, with message and retryable.
cancelledYou called close() before it finished.
Sandbox. A session made with a sandbox key is a sandbox session. Pass environment: "sandbox" (or "production") to mountVerification and it refuses to start if the session doesn't match, which catches a mixed-up key before a customer does.
Your server
curl https://facededup.ai/v1/sessions \
  -H "X-License-Key: $FACEDEDUP_KEY" \
  -H "content-type: application/json" \
  -d '{
    "flow": "identity_and_document",
    "subject": { "reference": "user-8841" },
    "id_selection": { "NG": ["nin", "bvn", "passport"] },
    "callback_url": "https://api.example.com/hooks/verify"
  }'
201 Created
{
  "object": "verification_session",
  "id": "vl_4c1d0a9be2f37a55",
  "token": "vlt_7K3M9QHT2X",
  "environment": "sandbox",
  "flow": "identity_and_document",
  "steps": ["consent", "liveness", "identity", "document"],
  "expires_at": "2026-11-30T10:00:00Z"
}
Your page
import { mountVerification } from "https://facededup.ai/sdk/v0.9.9/index.js";

const flow = mountVerification(document.getElementById("verify"), {
  token,                       // from your server
  environment: "sandbox",
  onResult: (r) => {
    if (r.status === "success") showThanks(r.value.decision);
    else if (r.status === "failure") report(r.error.code);
  },
});
// flow.close() leaves early and reports "cancelled"
Guides

Supported IDs

GET /v1/supported-ids lists every country and ID type the flow accepts. It needs no key. The ID picker in the SDK and on hosted links is built from this list at run time, so new ID types appear without an SDK update.

kindHow it's verified
numberNIN and BVN (Nigeria). The number is looked up in the government registry and the live face is matched to the registry photo.
documentPassport, driver's licence, voter's card, national ID. The person photographs the document and the live face is matched to the photo on it. The document image is kept for review.
What the document check is. It confirms the live person matches the photo on the document. It doesn't read the printed text or check the document against its issuer. For a registry check, use an ID number.
GET /v1/supported-ids
{
  "object": "supported_ids",
  "countries": [
    { "country": "NG", "name": "Nigeria", "ids": [
      { "id": "nin", "label": "NIN", "kind": "number", "digits": 11 },
      { "id": "passport", "label": "International passport",
        "kind": "document", "sides": 1 },
      { "id": "drivers_licence", "label": "Driver's licence",
        "kind": "document", "sides": 2 }
    ] }
  ]
}
SDKs

Web

@facededup/liveness-web 0.9.9. Requires HTTPS (or localhost) and camera permission. Load it as an ES module from our CDN, pinned to a version, or install the package.

ExportUse it for
mountVerificationThe whole flow from a session token: consent, liveness, ID number, ID document.
mountLivenessJust the liveness capture UI, with on-device face tracking.
mountDocumentCaptureJust document capture: frame guide, automatic capture, manual shutter fallback, optional upload.
LivenessClientThe headless client, if you build your own UI.

Web components

Import elements.js once and use the tags in any framework: <mefa-verification>, <mefa-liveness>, <mefa-document-capture>. Attributes are strings (hide-attribution="true"). Results are DOM events that bubble: mefa-verification.result, mefa-liveness.result, mefa-liveness.error, mefa-document.captured.

Languages

English, Nigerian Pidgin, French and Arabic (right-to-left) are built in. Override any text, or add a language, with translation.locales on mountVerification and strings on mountLiveness. STRING_KEYS lists every key.

Liveness options

sessionToken (preferred in a web page) or licenseKey, brandColor, language, strings, showBranding, allowAgentMode, camera (front or rear), onResult, onCancel, and onError, whose error carries a code: CAMERA_DENIED, CAMERA_UNAVAILABLE, TIMEOUT, NETWORK, NOT_AUTHORISED or VERIFY_FAILED.

Use a session token in web pages. Anything in a page can be read by the person using it. licenseKey still works for testing, but a session token is scoped to one verification and expires.
Load from the CDN (pinned)
<script type="module">
  import { mountVerification }
    from "https://facededup.ai/sdk/v0.9.9/index.js";
</script>
Or install
npm i https://swiftend-assets-348761024048.s3.eu-west-2.amazonaws.com/sdk/npm/facededup-liveness-web-0.9.0.tgz
Web component
<script type="module"
  src="https://facededup.ai/sdk/v0.9.9/elements.js"></script>

<mefa-verification token="vlt_7K3M9QHT2X" language="fr"></mefa-verification>

<script>
  document.addEventListener("mefa-verification.result", (e) => {
    console.log(e.detail.status, e.detail.value ?? e.detail.error);
  });
</script>
Your own wording
mountVerification(el, {
  token,
  translation: {
    language: "en",
    locales: { en: { "consent.agree": "Continue" } },
  },
});
React (liveness only)
import { FacededupLiveness } from "@facededup/liveness-web/react";

<FacededupLiveness
  baseUrl="https://facededup.ai"
  licenseKey={KEY}
  subjectId={userId}
  onResult={(r) => (r.is_live ? next(r) : retry(r))}
/>
SDKs

React Native

@facededup/liveness-react-native 2.0.0-beta.66, wrapping the native SDK 2.0.0-beta.62. Runs the full native capture flow with no WebView, on React Native 0.74 to 0.86+ in both the old and new architecture.

Android setup: set minSdkVersion 24, and add the Facededup Maven repository to allprojects.repositories in your root android/build.gradle: https://swiftend-assets-348761024048.s3.eu-west-2.amazonaws.com/m2

iOS: the framework ships inside the package, so pod install is enough. Add NSCameraUsageDescription to Info.plist.

Install
npm install @facededup/liveness-react-native
cd ios && pod install
App.tsx
import { startLiveness } from "@facededup/liveness-react-native";

const r = await startLiveness({
  baseUrl: "https://facededup.ai",
  subjectId: "user_8231",
  licenseCert: "…",        // issued by your account team
  showBranding: false,     // optional: remove the NINAuth mark
});
// r.outcome: "live" | "not_live" | "referred" | "captured" | "cancelled" | "error"
SDKs

Flutter

facededup_liveness 2.0.0-beta.62. The same native capture flow as React Native. Android needs minSdkVersion 24 and the Facededup Maven repository; iOS needs pod install.

pubspec.yaml · main.dart
dependencies:
  facededup_liveness: ^2.0.0-beta.62

final r = await FacededupLiveness.start(LivenessConfig(
  baseUrl: 'https://facededup.ai',
  subjectId: 'user_8231',
  licenseCert: '…',
));
if (r.outcome == 'live') { /* continue */ }
SDKs

Android

ng.facededup:facededup-live 2.0.0-beta.62. Kotlin with Jetpack Compose, CameraX and ML Kit. Minimum SDK 24. Launch it as a ready-made activity, or embed the composable screen in your own UI.

build.gradle.kts
repositories {
  maven { url = uri("https://swiftend-assets-348761024048.s3.eu-west-2.amazonaws.com/m2") }
}
dependencies {
  implementation("ng.facededup:facededup-live:2.0.0-beta.62")
}
Compose
LivenessScreen(
  config = FacededupConfig(baseUrl = "https://facededup.ai", subjectId = "user_8231"),
  onResult = { r -> if (r.isLive) proceed() else retry() },
  onCancel = { finish() },
)
SDKs

iOS

FacededupLive 2.0.0-beta.62. Swift and SwiftUI with AVFoundation and Vision; on Face ID iPhones it uses ARKit and the TrueDepth camera. iOS 14.3+. Set requireDepth: true to fail any capture that shows no real 3D depth on TrueDepth devices. Other iPhones fall back to the standard checks.

SwiftUI
import FacededupLive

FacededupLiveness(config: FacededupConfig(
  baseURL: "https://facededup.ai",
  subjectId: "user_8231",
  requireDepth: true          // optional TrueDepth anti-spoof gate
)) { result in
  // result.outcome: "live" | "not_live" | "referred" | "captured" | "error"
} onCancel: { dismiss() }
Reference

Errors

Errors use standard HTTP status codes and a JSON body with a detail field. detail is usually a string; a few errors return an object with more context, shown below.

StatusUsually meansWhat to do
400A field has an invalid value, or a token couldn't be redeemed: bad signature, expired, or already used.Fix the field named in detail. For tokens, run a fresh check instead of retrying the redeem.
401The key is missing or unknown.Send X-License-Key with a valid key, and check that sandbox and live keys aren't mixed up.
403Consent is missing, refused or withdrawn; the challenge expired, was already used, or the nonce doesn't match; attempts are exhausted; or the risk engine denied the request.Call /v1/challenge again (it lasts 20 s). If detail.error mentions risk, read detail.reasons.
404The request_id, enrollment or place doesn't exist, or the feature isn't enabled for your account.Check the ID came from the same environment (sandbox or live) as your key.
409The face is already enrolled under another account.Read detail.dedup and route the case to review.
422Validation failed: a bad field type, more than 30 frames, no readable face, a NIN or BVN that isn't 11 digits, or poor image quality.For quality, detail.findings says what to fix (light, blur, framing). Let the person retry.
423The request is locked after too many attempts.Start a new check with /v1/request, or refer the person to a human.
503A dependency isn't available or isn't configured for your account.Retry with backoff. If it persists, contact support with the time and request_id.
String detail
403 Forbidden
{ "detail": "challenge expired" }
Object detail · quality
422 Unprocessable Entity
{ "detail": {
  "error": "low_quality",
  "findings": ["too_dark", "face_too_small"],
  "attempts": 2,
  "referred": false
} }
More

Changelog

ReleaseChange
Native 2.0.0-beta.62showBranding option to remove the NINAuth mark. iOS adds requireDepth, a TrueDepth 3D-depth anti-spoof gate.
React Native beta.66Builds on React Native 0.86. The iOS framework ships inside the npm package, so there's no download step. Removed an unused codegenConfig.
Web 0.9.9Background removal: removeBackground on mountLiveness, options.remove_background on a link. The selfie is also produced with the person on a plain colour and sent as portrait_b64, an extra picture kept with the attempt. The frames the liveness checks read are not altered.
Web 0.9.8First screen of a verification link: back to one narrow column on wide screens, with shorter text and the four tips two by two, so it still fits one screen.
Web 0.9.7Older browsers: the build now runs on Chrome 71+, Safari 12.1+ and Samsung Internet 11+ (was Chrome 80 / Safari 13.1). Where the on-device face tracker cannot load, capture falls back to timed mode as before.
Web 0.9.6On trial for data-collection links (depth_check in the challenge): a move-closer step after Hold still. The face is measured at two distances; a flat picture grows evenly, a face does not. Measurements are sent as perspective with the verify call and recorded. They do not affect the verdict.
Web 0.9.5On trial for data-collection links (strict_moves in the challenge): head movements must answer the prompts. A movement only counts from straight ahead, a clear movement the wrong way is a strike (two end the attempt), and a random hold at centre separates movements. A link session is limited to 8 challenges.
Web 0.9.4Shorter check: four colours during Hold still (about 1.4 s), then two head movements in random directions. No blink or smile. Applies to verification links and the web SDK (head_only on /v1/challenge); other callers are unchanged.
Web 0.9.3During the light check the camera view is shown as a line drawing in the flash colour, so the oval lights the face too. The frames sent for the check still come straight from the camera.
Web 0.9.2The first screen of a verification link fits one screen: picture beside the text on a wide screen; on a phone the consent box and the button stay pinned at the bottom.
Web 0.9.1The lit half of the ring now fills as the head moves and completes when the movement passes. Links: options.light_only for data collection (no head movements; the coloured-light check alone decides the session; needs metadata.collection; not for production).
Web 0.9.0Light check judged by pattern, with a glare rule for glass; pure primary colours; the screen is kept awake; a slower second pass with a "turn your brightness up" prompt when the light is too faint. Link sessions now send device and camera facts (camera name, hardware controls, frame timing, graphics renderer), recorded with the attempt and not acted on.
Web 0.8.0Continue on your phone, with follow-along: the QR code sits at the top of the first screen on a computer; when a phone scans it the computer switches to a live progress view and shows the result when the phone finishes. Text is set in Google Sans Flex.
Web 0.7.0Light check against screen replays: during "Hold still" the screen shows a short colour sequence chosen by the server, and the server measures whether the face reflected it. Always on for verification links; other callers pass illumination: true to /v1/challenge. A failed check returns not_live with illumination_no_reflection.
Web 0.6.0Motion and smarter guidance: screens ease in and the card resizes smoothly, icons draw themselves, the capture shows one dot per step, coaching follows the person's movement and replays the example if they stall, leaving the tab restarts the check, the ID field counts digits and cleans pasted numbers, and on a computer a QR code offers to continue on a phone. Honours reduced-motion.
Web 0.5.0Optional attempt video (captureVideo / options.capture_video) and mandatory geo-tag (requireLocation / options.require_location), both enforced by the server for link sessions. New error codes LOCATION_DENIED, LOCATION_UNAVAILABLE, VIDEO_UNSUPPORTED.
Web 0.4.0New look for the whole flow, from the Mefa design: a first screen with tips, consent and a data-privacy panel; a progress ring around the face with a short clip showing each movement; clear screens for a blocked camera, no camera, checking, retry, offline and every link state. The camera now opens as soon as the person starts, and Back works on every step. onError now always carries error.code for camera failures.
Web 0.3.0mountVerification runs the whole flow from a session token. Adds document capture, an ID picker driven by the API, French and Arabic, text overrides, agent mode, web components, error codes, and a pinned CDN path.
APIPOST /v1/sessions, POST /v1/links with multi-use links and PATCH, the document step, and GET /v1/supported-ids.
Web 0.2.2Face-centred frames and deeper motion proofs, fixing false not_live results on desktop webcams.