Didit Passive Liveness API
Overview
Verifies that a user is physically present by analyzing a single captured image — no explicit movement or interaction required.
Key constraints:
- - Supported formats: JPEG, PNG, WebP, TIFF
- Maximum file size: 5MB
- Image must contain exactly one clearly visible face
- Original real-time photo only (no screenshots or printed photos)
Accuracy: 99.9% liveness detection accuracy, <0.1% false acceptance rate (FAR).
Capabilities: Liveness scoring, face quality assessment, luminance analysis, age/gender estimation, spoof detection (screen captures, printed copies, masks, deepfakes), duplicate face detection across sessions, blocklist matching.
Liveness methods: This standalone endpoint uses PASSIVE method (single-frame CNN). Workflow mode also supports ACTIVE_3D (action + flash, highest security) and FLASHING (3D flash, high security).
API Reference: https://docs.didit.me/standalone-apis/passive-liveness
Feature Guide: https://docs.didit.me/core-technology/liveness/overview
Authentication
All requests require x-api-key header. Get your key from Didit Business Console → API & Webhooks, or via programmatic registration (see below).
Getting Started (No Account Yet?)
If you don't have a Didit API key, create one in 2 API calls:
- 1. Register:
POST https://apx.didit.me/auth/v2/programmatic/register/ with INLINECODE5 - Check email for a 6-character OTP code
- Verify:
POST https://apx.didit.me/auth/v2/programmatic/verify-email/ with {"email": "you@gmail.com", "code": "A3K9F2"} → response includes INLINECODE8
To add credits: GET /v3/billing/balance/ to check, POST /v3/billing/top-up/ with {"amount_in_dollars": 50} for a Stripe checkout link.
See the didit-verification-management skill for full platform management (workflows, sessions, users, billing).
Endpoint
CODEBLOCK0
Headers
| Header | Value | Required |
|---|
| INLINECODE12 | Your API key | Yes |
| INLINECODE13 |
multipart/form-data |
Yes |
Request Parameters (multipart/form-data)
| Parameter | Type | Required | Default | Constraints | Description |
|---|
| INLINECODE15 | file | Yes | — | JPEG/PNG/WebP/TIFF, max 5MB | User's face image |
| INLINECODE16 |
integer | No | — | 0-100 | Scores below this = Declined |
|
rotate_image | boolean | No | — | — | Try rotations to find upright face |
|
save_api_request | boolean | No |
true | — | Save in Business Console |
|
vendor_data | string | No | — | — | Your identifier for session tracking |
Example
CODEBLOCK1
CODEBLOCK2
Response (200 OK)
CODEBLOCK3
Status Values & Handling
| Status | Meaning | Action |
|---|
| INLINECODE21 | User is physically present | Proceed with your flow |
| INLINECODE22 |
Liveness check failed | Check
warnings. May be a spoof or poor image quality |
Error Responses
| Code | Meaning | Action |
|---|
| INLINECODE24 | Invalid request | Check file format, size, parameters |
| INLINECODE25 |
Invalid API key | Verify
x-api-key header |
|
403 | Insufficient credits | Top up at business.didit.me |
Response Field Reference
| Field | Type | Description |
|---|
| INLINECODE28 | string | INLINECODE29 or INLINECODE30 |
| INLINECODE31 |
string | Always
"PASSIVE" for this endpoint |
|
score | integer | 0-100 liveness confidence (higher = more likely real).
null if no face |
|
face_quality | float | 0-100 face image quality score.
null if no face |
|
face_luminance | float | Face luminance value.
null if no face |
|
entities[].age | float | Estimated age |
|
entities[].bbox | array | Face bounding box
[x1, y1, x2, y2] |
|
entities[].confidence | float | Face detection confidence (0-1) |
|
entities[].gender | string |
"male" or
"female" |
|
warnings | array |
{risk, log_type, short_description, long_description} |
Warning Tags
Auto-Decline (always)
| Tag | Description |
|---|
| INLINECODE48 | No face detected in image |
| INLINECODE49 |
Potential spoofing attempt (printed photo, screen, mask) |
|
FACE_IN_BLOCKLIST | Face matches a blocklisted entry |
|
POSSIBLE_FACE_IN_BLOCKLIST | Possible blocklist match detected |
Configurable (Decline / Review / Approve)
| Tag | Description | Notes |
|---|
| INLINECODE52 | Score below threshold | Configurable review + decline thresholds |
| INLINECODE53 |
Matches another approved session | — |
|
POSSIBLE_DUPLICATED_FACE | May match another user | Configurable similarity threshold |
|
MULTIPLE_FACES_DETECTED | Multiple faces (largest used for scoring) | Passive only |
|
LOW_FACE_QUALITY | Image quality below threshold | Passive only |
|
LOW_FACE_LUMINANCE | Image too dark | Passive only |
|
HIGH_FACE_LUMINANCE | Image too bright/overexposed | Passive only |
Common Workflows
Basic Liveness Check
CODEBLOCK4
Liveness + Face Match (combined)
CODEBLOCK5
Utility Scripts
CODEBLOCK6
Didit 被动活体检测 API
概述
通过分析单张捕获图像来验证用户是否真实在场——无需明确的动作或交互。
关键限制:
- - 支持的格式:JPEG、PNG、WebP、TIFF
- 最大文件大小:5MB
- 图像必须包含且仅包含一张清晰可见的人脸
- 仅限原始实时照片(不接受截图或打印照片)
准确率: 活体检测准确率99.9%,错误接受率(FAR)<0.1%。
功能: 活体评分、人脸质量评估、亮度分析、年龄/性别估计、欺诈检测(屏幕截图、打印副本、面具、深度伪造)、跨会话重复人脸检测、黑名单匹配。
活体检测方法: 此独立端点使用PASSIVE方法(单帧CNN)。工作流模式还支持ACTIVE_3D(动作+闪光,最高安全性)和FLASHING(3D闪光,高安全性)。
API参考: https://docs.didit.me/standalone-apis/passive-liveness
功能指南: https://docs.didit.me/core-technology/liveness/overview
身份验证
所有请求都需要x-api-key标头。从Didit业务控制台 → API和Webhooks获取您的密钥,或通过程序化注册获取(见下文)。
快速入门(还没有账户?)
如果您没有Didit API密钥,通过2次API调用创建一个:
- 1. 注册: POST https://apx.didit.me/auth/v2/programmatic/register/,携带{email: you@gmail.com, password: MyStr0ng!Pass}
- 检查邮箱获取6位OTP验证码
- 验证: POST https://apx.didit.me/auth/v2/programmatic/verify-email/,携带{email: you@gmail.com, code: A3K9F2} → 响应包含api_key
添加积分: GET /v3/billing/balance/检查余额,POST /v3/billing/top-up/携带{amountindollars: 50}获取Stripe结账链接。
有关完整平台管理(工作流、会话、用户、计费),请参阅didit-verification-management技能。
端点
POST https://verification.didit.me/v3/passive-liveness/
标头
| 标头 | 值 | 必需 |
|---|
| x-api-key | 您的API密钥 | 是 |
| Content-Type |
multipart/form-data |
是 |
请求参数(multipart/form-data)
| 参数 | 类型 | 必需 | 默认值 | 限制 | 描述 |
|---|
| userimage | 文件 | 是 | — | JPEG/PNG/WebP/TIFF,最大5MB | 用户人脸图像 |
| facelivenessscoredecline_threshold |
整数 | 否 | — | 0-100 | 低于此分数的结果 = 拒绝 |
| rotate_image | 布尔值 | 否 | — | — | 尝试旋转以找到正立人脸 |
| save
apirequest | 布尔值 | 否 | true | — | 保存在业务控制台中 |
| vendor_data | 字符串 | 否 | — | — | 用于会话跟踪的标识符 |
示例
python
import requests
response = requests.post(
https://verification.didit.me/v3/passive-liveness/,
headers={x-api-key: YOURAPIKEY},
files={user_image: (selfie.jpg, open(selfie.jpg, rb), image/jpeg)},
data={facelivenessscoredeclinethreshold: 80},
)
typescript
const formData = new FormData();
formData.append(user_image, selfieFile);
formData.append(facelivenessscoredeclinethreshold, 80);
const response = await fetch(https://verification.didit.me/v3/passive-liveness/, {
method: POST,
headers: { x-api-key: YOURAPIKEY },
body: formData,
});
响应(200 OK)
json
{
request_id: a1b2c3d4-...,
liveness: {
status: Approved,
method: PASSIVE,
score: 95,
user_image: {
entities: [
{age: 22.16, bbox: [156, 234, 679, 898], confidence: 0.717, gender: male}
],
best_angle: 0
},
warnings: [],
face_quality: 85.0,
face_luminance: 50.0
},
created_at: 2025-05-01T13:11:07.977806Z
}
状态值及处理
| 状态 | 含义 | 操作 |
|---|
| Approved | 用户真实在场 | 继续您的流程 |
| Declined |
活体检测失败 | 检查warnings。可能是欺诈或图像质量差 |
错误响应
| 状态码 | 含义 | 操作 |
|---|
| 400 | 无效请求 | 检查文件格式、大小、参数 |
| 401 |
无效API密钥 | 验证x-api-key标头 |
| 403 | 积分不足 | 在business.didit.me充值 |
响应字段参考
| 字段 | 类型 | 描述 |
|---|
| status | 字符串 | Approved或Declined |
| method |
字符串 | 此端点始终为PASSIVE |
| score | 整数 | 0-100活体置信度(越高越可能是真人)。未检测到人脸时为null |
| face_quality | 浮点数 | 0-100人脸图像质量评分。未检测到人脸时为null |
| face_luminance | 浮点数 | 人脸亮度值。未检测到人脸时为null |
| entities[].age | 浮点数 | 估计年龄 |
| entities[].bbox | 数组 | 人脸边界框[x1, y1, x2, y2] |
| entities[].confidence | 浮点数 | 人脸检测置信度(0-1) |
| entities[].gender | 字符串 | male或female |
| warnings | 数组 | {risk, log
type, shortdescription, long_description} |
警告标签
自动拒绝(始终)
| 标签 | 描述 |
|---|
| NOFACEDETECTED | 图像中未检测到人脸 |
| LIVENESSFACEATTACK |
潜在的欺诈尝试(打印照片、屏幕、面具) |
| FACE
INBLOCKLIST | 人脸匹配黑名单条目 |
| POSSIBLE
FACEIN_BLOCKLIST | 检测到可能的黑名单匹配 |
可配置(拒绝/审核/批准)
| 标签 | 描述 | 备注 |
|---|
| LOWLIVENESSSCORE | 分数低于阈值 | 可配置审核和拒绝阈值 |
| DUPLICATED_FACE |
匹配另一个已批准的会话 | — |
| POSSIBLE
DUPLICATEDFACE | 可能匹配另一个用户 | 可配置相似度阈值 |
| MULTIPLE
FACESDETECTED | 检测到多张人脸(使用最大人脸进行评分) | 仅被动模式 |
| LOW
FACEQUALITY | 图像质量低于阈值 | 仅被动模式 |
| LOW
FACELUMINANCE | 图像过暗 | 仅被动模式 |
| HIGH
FACELUMINANCE | 图像过亮/过度曝光 | 仅被动模式 |
常见工作流
基本活体检测
- 1. 捕获用户自拍
- POST /v3/passive-liveness/ → {user_image: selfie}
- 如果Approved → 用户是真人,继续
如果Declined → 检查警告:
- NO
FACEDETECTED → 要求用户重新拍摄,确保人脸清晰可见
- LOW
FACEQUALITY → 要求更好的光线/位置
- LIVENESS
FACEATTACK → 标记为潜在欺诈
活体检测 + 人脸匹配(组合)