Didit ID Verification API
Overview
Verifies identity documents by submitting images of the front and back sides. Performs OCR extraction, MRZ parsing, authenticity checks, and document liveness detection.
Key constraints:
- - Supported formats: JPEG, PNG, WebP, TIFF
- Maximum file size: 5MB per image
- All document corners must be visible, full-color, no glare/shadows
- Original real-time photos only (no screenshots, scans, or digital copies)
Coverage: 4,000+ document types, 220+ countries, 130+ languages. Supports passports, national ID cards, driver's licenses, and residence permits.
Processing pipeline:
- 1. Intelligent capture & document type detection
- OCR text extraction + MRZ/barcode parsing
- Template matching, security feature validation, tamper detection
- Document liveness (detects screen captures, printed copies, portrait manipulation)
API Reference: https://docs.didit.me/standalone-apis/id-verification
Feature Guide: https://docs.didit.me/core-technology/id-verification/overview
Supported Documents: https://docs.didit.me/core-technology/id-verification/supported-documents-id-verification
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 | Constraints | Description |
|---|
| INLINECODE12 | file | Yes | — | JPEG/PNG/WebP/TIFF, max 5MB | Front image of ID document |
| INLINECODE13 |
file | No | — | Same as above | Back image (when applicable) |
|
save_api_request | boolean | No |
true | — | Save in Business Console Manual Checks |
|
vendor_data | string | No | — | — | Your identifier for session tracking |
Example
CODEBLOCK1
CODEBLOCK2
Response (200 OK)
CODEBLOCK3
Status Values
| Status | Meaning |
|---|
| INLINECODE17 | Document verified successfully |
| INLINECODE18 |
Verification failed (see
warnings) |
|
"In Review" | Requires manual review |
Error Responses
| Code | Meaning | Action |
|---|
| INLINECODE21 | Invalid request | Check file format, size, parameters |
| INLINECODE22 |
Invalid API key | Verify
x-api-key header |
|
403 | Insufficient credits | Top up at business.didit.me |
Response Field Reference
| Field | Type | Description |
|---|
| INLINECODE25 | string | INLINECODE26 , "Declined", INLINECODE28 |
| INLINECODE29 |
string |
"Passport",
"Identity Card",
"Driver's License",
"Residence Permit" |
|
document_number | string | Document ID number |
|
personal_number | string | Personal/national ID number |
|
first_name,
last_name,
full_name | string | Extracted name fields |
|
date_of_birth | string |
YYYY-MM-DD |
|
age | integer | Calculated age |
|
gender | string |
"M",
"F",
"U" |
|
nationality,
issuing_state | string | ISO 3166-1 alpha-3 |
|
expiration_date,
date_of_issue | string |
YYYY-MM-DD |
|
portrait_image | string | Base64-encoded portrait from document |
|
mrz | object | Machine Readable Zone data |
|
parsed_address | object | Geocoded address:
{city, region, postal_code, country, street_1} |
|
warnings | array |
{risk, log_type, short_description, long_description} |
Warning Tags
Auto-Decline (always)
| Tag | Description |
|---|
| INLINECODE57 | Document in blocklist (previously flagged) |
| INLINECODE58 |
No portrait found on document |
|
DOCUMENT_EXPIRED | Document expiration date has passed |
|
DOCUMENT_NOT_SUPPORTED_FOR_APPLICATION | Document type not accepted |
Configurable (Decline / Review / Approve)
| Category | Tags |
|---|
| Document liveness | INLINECODE61 , PRINTED_COPY_DETECTED, INLINECODE63 |
| MRZ issues |
MRZ_NOT_DETECTED,
MRZ_VALIDATION_FAILED,
MRZ_AND_DATA_EXTRACTED_FROM_OCR_NOT_SAME |
|
Data issues |
NAME_NOT_DETECTED,
DATE_OF_BIRTH_NOT_DETECTED,
DOCUMENT_NUMBER_NOT_DETECTED,
DATA_INCONSISTENT |
|
Duplicates |
POSSIBLE_DUPLICATED_USER |
|
Expected mismatch |
FULL_NAME_MISMATCH_WITH_PROVIDED,
DOB_MISMATCH_WITH_PROVIDED,
GENDER_MISMATCH_WITH_PROVIDED |
|
Geolocation |
DOCUMENT_COUNTRY_MISMATCH |
Common Workflows
Basic ID Verification
CODEBLOCK4
Full Identity Verification Pipeline
CODEBLOCK5
Utility Scripts
CODEBLOCK6
Didit 身份证件验证 API
概述
通过提交身份证件正面和背面图像来验证身份证明文件。执行OCR提取、MRZ解析、真实性检查和证件活体检测。
关键限制:
- - 支持的格式:JPEG、PNG、WebP、TIFF
- 最大文件大小:每张图像 5MB
- 所有证件边角必须可见,全彩色,无眩光/阴影
- 仅限原始实时照片(不接受截图、扫描件或数字副本)
覆盖范围: 4,000+ 种证件类型,220+ 个国家/地区,130+ 种语言。支持护照、国民身份证、驾驶执照和居留许可。
处理流程:
- 1. 智能采集与证件类型检测
- OCR文本提取 + MRZ/条码解析
- 模板匹配、安全特征验证、篡改检测
- 证件活体检测(检测屏幕截图、打印副本、人像篡改)
API 参考文档: https://docs.didit.me/standalone-apis/id-verification
功能指南: https://docs.didit.me/core-technology/id-verification/overview
支持的证件: https://docs.didit.me/core-technology/id-verification/supported-documents-id-verification
身份验证
所有请求都需要 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/id-verification/
请求标头
| 标头 | 值 | 必需 |
|---|
| x-api-key | 您的 API 密钥 | 是 |
| Content-Type |
multipart/form-data |
是 |
请求参数(multipart/form-data)
| 参数 | 类型 | 必需 | 默认值 | 限制 | 描述 |
|---|
| frontimage | 文件 | 是 | — | JPEG/PNG/WebP/TIFF,最大 5MB | 身份证件正面图像 |
| backimage |
文件 | 否 | — | 同上 | 背面图像(适用时) |
| save
apirequest | 布尔值 | 否 | true | — | 保存在业务控制台手动审核中 |
| vendor_data | 字符串 | 否 | — | — | 您的会话跟踪标识符 |
示例
python
import requests
response = requests.post(
https://verification.didit.me/v3/id-verification/,
headers={x-api-key: YOURAPIKEY},
files={
front_image: (front.jpg, open(front.jpg, rb), image/jpeg),
back_image: (back.jpg, open(back.jpg, rb), image/jpeg),
},
data={vendor_data: user-123},
)
typescript
const formData = new FormData();
formData.append(front_image, frontImageFile);
formData.append(back_image, backImageFile);
formData.append(vendor_data, user-123);
const response = await fetch(https://verification.didit.me/v3/id-verification/, {
method: POST,
headers: { x-api-key: YOURAPIKEY },
body: formData,
});
响应(200 OK)
json
{
request_id: a1b2c3d4-...,
id_verification: {
status: Approved,
document_type: Identity Card,
document_number: YZA123456,
personal_number: X9876543L,
first_name: Elena,
last_name: Martínez Sánchez,
full_name: Elena Martínez Sánchez,
dateofbirth: 1985-03-15,
age: 40,
gender: F,
nationality: ESP,
issuing_state: ESP,
issuingstatename: Spain,
expiration_date: 2030-08-21,
dateofissue: 2020-08-21,
address: Calle Mayor 10, Madrid,
formatted_address: Calle Mayor 10, 28013 Madrid, Spain,
placeofbirth: Valencia,
portrait_image: ,
frontdocumentimage: ,
backdocumentimage: ,
mrz: {
surname: MARTINEZ SANCHEZ,
given_name: ELENA,
document_type: I,
document_number: YZA123456,
country: ESP,
nationality: ESP,
birth_date: 850315,
expiry_date: 300821,
sex: F
},
parsedaddress: {city: Madrid, region: ..., postalcode: 28013, country: ES},
warnings: []
},
created_at: 2025-05-01T13:11:07.977806Z
}
状态值
| 状态 | 含义 |
|---|
| Approved | 证件验证成功 |
| Declined |
验证失败(参见 warnings) |
| In Review | 需要人工审核 |
错误响应
| 状态码 | 含义 | 操作 |
|---|
| 400 | 无效请求 | 检查文件格式、大小、参数 |
| 401 |
无效 API 密钥 | 验证 x-api-key 标头 |
| 403 | 额度不足 | 在 business.didit.me 充值 |
响应字段参考
| 字段 | 类型 | 描述 |
|---|
| status | 字符串 | Approved、Declined、In Review |
| document_type |
字符串 | Passport、Identity Card、Drivers License、Residence Permit |
| document_number | 字符串 | 证件 ID 号码 |
| personal_number | 字符串 | 个人/国民 ID 号码 |
| first
name、lastname、full_name | 字符串 | 提取的姓名字段 |
| date
ofbirth | 字符串 | YYYY-MM-DD |
| age | 整数 | 计算得出的年龄 |
| gender | 字符串 | M、F、U |
| nationality、issuing_state | 字符串 | ISO 3166-1 alpha-3 |
| expiration
date、dateof_issue | 字符串 | YYYY-MM-DD |
| portrait_image | 字符串 | 从证件提取的 Base64 编码人像 |
| mrz | 对象 | 机器可读区域数据 |
| parsed
address | 对象 | 地理编码地址:{city, region, postalcode, country, street_1} |
| warnings | 数组 | {risk, log
type, shortdescription, long_description} |
警告标签
自动拒绝(始终)
| 标签 | 描述 |
|---|
| IDDOCUMENTINBLOCKLIST | 证件在黑名单中(之前被标记过) |
| PORTRAITIMAGENOTDETECTED |
未在证件上检测到人像 |
| DOCUMENT_EXPIRED