Didit Face Search API (1:N)
Overview
Compares a reference face against all previously approved verification sessions to detect duplicate accounts and blocklisted faces. Returns ranked matches with similarity scores.
Key constraints:
- - Supported formats: JPEG, PNG, WebP, TIFF
- Maximum file size: 5MB
- Compares against all approved sessions in your application
- Blocklist matches cause automatic decline
Similarity score guidance:
| Range | Interpretation |
|---|
| 90%+ | Strong likelihood of same person |
| 70-89% |
Possible match, may need manual review |
| Below 70% | Likely different individuals |
API Reference: https://docs.didit.me/standalone-apis/face-search
Feature Guide: https://docs.didit.me/core-technology/face-search/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 INLINECODE2 - 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 INLINECODE5
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 |
|---|
| INLINECODE9 | Your API key | Yes |
| INLINECODE10 |
multipart/form-data |
Yes |
Request Parameters (multipart/form-data)
| Parameter | Type | Required | Default | Description |
|---|
| INLINECODE12 | file | Yes | — | Face image to search (JPEG/PNG/WebP/TIFF, max 5MB) |
| INLINECODE13 |
boolean | No |
false | Try 0/90/180/270 rotations for non-upright faces |
|
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 |
|---|
| INLINECODE18 | No concerning matches found | Proceed — new unique user |
| INLINECODE19 |
Matches above similarity threshold | Review
matches[] for potential duplicates |
|
"Declined" | Blocklist match or policy violation | Check
matches[].is_blocklisted and
warnings |
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
Match Object
| Field | Type | Description |
|---|
| INLINECODE28 | string | UUID of the matching session |
| INLINECODE29 |
integer | Session number |
|
similarity_percentage | float | 0-100 similarity score |
|
vendor_data | string | Your reference from the matching session |
|
verification_date | string | ISO 8601 timestamp |
|
user_details.name | string | Name from the matching session |
|
user_details.document_type | string | Document type used |
|
user_details.document_number | string | Partially masked document number |
|
match_image_url | string | Temporary URL (expires
60 min) |
|
status | string | Status of the matching session |
|
is_blocklisted | boolean | Whether the match is from the blocklist |
User Image Object
| Field | Type | Description |
|---|
| INLINECODE39 | string | Estimated age |
| INLINECODE40 |
array | Face bounding box
[x1, y1, x2, y2] |
|
entities[].confidence | float | Detection confidence (0-1) |
|
entities[].gender | string |
"male" or
"female" |
|
best_angle | integer | Rotation applied (0, 90, 180, 270) |
Warning Tags
Auto-Decline
| Tag | Description |
|---|
| INLINECODE47 | No face found in image |
| INLINECODE48 |
Face matches a blocklisted entry |
Configurable
| Tag | Description |
|---|
| INLINECODE49 | Multiple faces detected — unclear which to use |
Similarity threshold and allow multiple faces settings are configurable in Console.
Warning severity: error (→ Declined), warning (→ In Review), information (no effect).
Common Workflows
Duplicate Account Detection
CODEBLOCK4
Combined Verification + Dedup
CODEBLOCK5
Security: Match image URLs expire after 60 minutes. Store only session_id and similarity_percentage — minimize biometric data on your servers.
Utility Scripts
search_faces.py: Search for matching faces from the command line.
CODEBLOCK6
Didit 人脸搜索 API (1:N)
概述
将参考人脸与所有先前已批准的验证会话进行比较,以检测重复账户和黑名单中的人脸。返回带有相似度得分的排名匹配结果。
关键限制:
- - 支持的格式:JPEG、PNG、WebP、TIFF
- 最大文件大小:5MB
- 与您应用中所有已批准的会话进行比较
- 黑名单匹配会导致自动拒绝
相似度得分指南:
| 范围 | 解释 |
|---|
| 90% 以上 | 同一人的可能性很高 |
| 70-89% |
可能匹配,可能需要人工审核 |
| 低于 70% | 很可能是不同个体 |
API 参考: https://docs.didit.me/standalone-apis/face-search
功能指南: https://docs.didit.me/core-technology/face-search/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/face-search/
请求头
| 请求头 | 值 | 必需 |
|---|
| x-api-key | 您的 API 密钥 | 是 |
| Content-Type |
multipart/form-data |
是 |
请求参数(multipart/form-data)
| 参数 | 类型 | 必需 | 默认值 | 描述 |
|---|
| userimage | 文件 | 是 | — | 要搜索的人脸图像(JPEG/PNG/WebP/TIFF,最大 5MB) |
| rotateimage |
布尔值 | 否 | false | 尝试 0/90/180/270 度旋转以处理非正立人脸 |
| save
apirequest | 布尔值 | 否 | true | 保存在业务控制台中 |
| vendor_data | 字符串 | 否 | — | 用于会话跟踪的标识符 |
示例
python
import requests
response = requests.post(
https://verification.didit.me/v3/face-search/,
headers={x-api-key: YOURAPIKEY},
files={user_image: (photo.jpg, open(photo.jpg, rb), image/jpeg)},
)
print(response.json())
typescript
const formData = new FormData();
formData.append(user_image, photoFile);
const response = await fetch(https://verification.didit.me/v3/face-search/, {
method: POST,
headers: { x-api-key: YOURAPIKEY },
body: formData,
});
响应(200 OK)
json
{
request_id: a1b2c3d4-...,
face_search: {
status: Approved,
total_matches: 1,
matches: [
{
session_id: uuid-...,
session_number: 1234,
similarity_percentage: 95.2,
vendor_data: user-456,
verification_date: 2025-06-10T10:30:00Z,
user_details: {
name: Elena Martinez,
document_type: Identity Card,
document_number: *456
},
matchimageurl: https://example.com/match.jpg,
status: Approved,
is_blocklisted: false
}
],
user_image: {
entities: [
{age: 27.6, bbox: [40, 40, 120, 120], confidence: 0.95, gender: female}
],
best_angle: 0
},
warnings: []
}
}
状态值及处理
| 状态 | 含义 | 操作 |
|---|
| Approved | 未发现可疑匹配 | 继续 — 新的唯一用户 |
| In Review |
匹配超过相似度阈值 | 检查 matches[] 以发现潜在重复 |
| Declined | 黑名单匹配或策略违规 | 检查 matches[].is_blocklisted 和 warnings |
错误响应
| 状态码 | 含义 | 操作 |
|---|
| 400 | 无效请求 | 检查文件格式、大小、参数 |
| 401 |
无效 API 密钥 | 验证 x-api-key 标头 |
| 403 | 额度不足 | 在 business.didit.me 充值 |
响应字段参考
匹配对象
| 字段 | 类型 | 描述 |
|---|
| sessionid | 字符串 | 匹配会话的 UUID |
| sessionnumber |
整数 | 会话编号 |
| similarity_percentage | 浮点数 | 0-100 相似度得分 |
| vendor_data | 字符串 | 匹配会话中的引用标识 |
| verification_date | 字符串 | ISO 8601 时间戳 |
| user_details.name | 字符串 | 匹配会话中的姓名 |
| user
details.documenttype | 字符串 | 使用的证件类型 |
| user
details.documentnumber | 字符串 | 部分遮盖的证件号码 |
| match
imageurl | 字符串 | 临时 URL(
60 分钟后过期) |
| status | 字符串 | 匹配会话的状态 |
| is_blocklisted | 布尔值 | 匹配是否来自黑名单 |
用户图像对象
| 字段 | 类型 | 描述 |
|---|
| entities[].age | 字符串 | 估计年龄 |
| entities[].bbox |
数组 | 人脸边界框 [x1, y1, x2, y2] |
| entities[].confidence | 浮点数 | 检测置信度(0-1) |
| entities[].gender | 字符串 | male 或 female |
| best_angle | 整数 | 应用的旋转角度(0、90、180、270) |
警告标签
自动拒绝
| 标签 | 描述 |
|---|
| NOFACEDETECTED | 图像中未检测到人脸 |
| FACEINBLOCKLIST |
人脸匹配黑名单条目 |
可配置
| 标签 | 描述 |
|---|
| MULTIPLEFACESDETECTED | 检测到多张人脸 — 不清楚使用哪张 |
相似度阈值和允许多张人脸设置可在控制台中配置。
警告严重级别:error(→ 已拒绝)、warning(→ 审核中)、information(无影响)。
常见工作流
重复账户检测
- 1. 新用户注册期间
- POST /v3/face-search/ → {userimage: 自拍照}
- 如果 totalmatches == 0 → 新的唯一用户
如果找到匹配 → 检查 similarity_percentage:
90% 以上 → 很可能是重复,调查 matches[].vendor_data
70-89% → 可能匹配,标记为人工审核
组合验证 + 去重
- 1. POST /v3/passive-liveness/ → 验证用户是真人
- POST /v3/face-search/ → 检查现有账户
- POST /v3/id-verification/ → 验证身份证明文件
- POST /v3/face-match/ → 比较自拍照与证件照片
5