> ## Documentation Index
> Fetch the complete documentation index at: https://docs.didit.me/llms.txt
> Use this file to discover all available pages before exploring further.

# Document AI 自定义文件数据提取

> Didit 支持收集最多 3 份自定义文件，并通过 AI 精确提取所定义的字段，随后与其他步骤及自定义规则进行交叉核对。

Document AI 允许您收集不符合固定模板的证件（资金证明、工资单、财富来源信函、税务报表等各类证件），并精确提取**您**所定义的字段。您配置每份证件在屏幕上显示的标题与描述（会自动翻译为每种验证语言）以及需要读取的数据点列表。Didit 的 AI 会提取这些字段，并可选择将其与其它验证步骤进行交叉核对，然后应用您的规则生成状态。

Document AI 集成提示词
        将提示词复制到剪贴板



      
      

\<pre>

\`# Goal
Integrate Didit Document AI (configurable multi-document upload + AI field extraction + cross-checks) into your app.

\# Setup (Business Console or POST /v3/workflows/)
Add the DOCUMENT_AI feature to your workflow and configure:
\- document_ai_documents: up to 3 documents. Each has { document_key, title, description, fields[] }.
Each field is { key, name, instruction, type: "text" | "number" | "date", required, is_full_name }.
title and description are auto-translated into every verification language on save.
\- is_full_name: optional boolean on a field. Marks the field whose value is compared automatically against the
verified subject: on a person (KYC) workflow the document holder's full name (the ID-verification name, or the
session's expected details), and on a business (KYB) workflow the verified company name (the registry-matched
company, or the session's expected company name). A low match below document_ai_name_match_score_threshold
triggers document_ai_name_mismatch_action. At most one field per document may set it, and it is optional — a
document may mark none (no name check runs).
\- Basic rules (per-risk action DECLINE | REVIEW | NO_ACTION): document_ai_unreadable_document_action,
document_ai_missing_required_fields_action, document_ai_document_tampering_action,
document_ai_name_mismatch_action, document_ai_unsupported_file_action, document_ai_max_attempts_exceeded_action.
\- document_ai_name_match_score_threshold (0-100), document_ai_max_retry_attempts (2-5).
\- status_rules[]: custom rules on any extracted field. Reference an extracted field as document_ai.<field_key>
and cross-reference other steps with value_type:"field" (e.g. document_ai.account_holder equals kyc.full_name).

\# Flow
1\. Create a session — POST /v3/session/ with { workflow_id, vendor_data, callback }. See /sessions-api/create-session.
2\. Open session.url for the user (or mount the Web/Mobile SDK). The user uploads each configured document.
3\. The user uploads documents to POST /v3/document-ai/documents/ (handled by the hosted flow/SDK):
multipart/form-data with { document_key, document, locale? }, Session-Token auth.
Response: { valid?, next_step, document_ai_status, uploaded_document_keys[], required_document_keys[] }.
The step completes once every configured document_key is uploaded.
4\. Fetch the decision — GET /v3/session/{sessionId}/decision/ or subscribe to session.status.updated.

\# Decision surface
DOCUMENT_AI appears in the decision features[] array as { feature: "DOCUMENT_AI", node_id }.
Per-document statuses combine via precedence Declined > In Review > Approved.

\# See also
\- Report: /core-technology/document-ai/report-document-ai
\- Rules & warnings: /core-technology/document-ai/warnings-document-ai
\- Configure in the console: /console/workflows
\- Standalone API (server-to-server, no hosted UI): POST /v3/document-ai/ — /standalone-apis/document-ai`

\</pre>



      
      

粘贴到

> [!NOTE]
>
> 服务器上已经有证件？您可以直接调用 [Document AI API](https://docs.didit.me/zh/standalone-apis/document-ai.md)：只需在单次 `POST /v3/document-ai/` 请求中发送文件和字段定义，即可同步获取提取的字段、姓名匹配结果和状态，无需托管流程。每份证件 \$0.20。## 工作原理**1. 配置证件与字段**在工作流构建器中，您最多可以定义 **3 份证件**。对于每份证件，您可以设置：| 设置 | 描述 |
| - | - |
| **标题与描述** | 在上传屏幕上向用户显示。仅需输入一次，即可**自动翻译**为每种验证语言。 |
| **要提取的字段** | 带有类型的字段列表：每个字段均包含名称、给 AI 的提取指令、类型（`text`、`number`、`date`）、必填标记以及可选的**姓名**标记。 |
| **姓名字段** | 可选地将每份证件中的一个文本字段标记为要匹配的姓名。在个人（KYC）工作流中，它是**姓名**，会与已验证的身份进行比对；在企业（KYB）工作流中，它是**公司名称**，会与已验证的公司进行比对。`document_ai_name_mismatch_action` 决定不匹配时的处理方式。该配置为可选：留空则跳过该证件的姓名检查。 |您可以从[模板](#入门模板)开始，也可以从头构建。**2. 用户上传证件**用户为每份配置的证件上传一个文件（PDF 或图片）。每次上传均独立处理；当所有必填证件都已提供后，该步骤即告完成。**3. AI 提取**Didit 会渲染每份证件，并基于您定义的字段架构运行视觉语言模型。提取的值会以相应类型返回（数字作为数字，日期格式为 `YYYY-MM-DD`）并按证件分别存储。系统还会运行 PDF/EXIF 取证分析以检测篡改。**4. 交叉核对与规则**提取的字段可以与其它步骤进行交叉核对（例如，将证件持有人姓名与已验证身份进行比对，或将任意字段与问卷回答进行比对），并根据您的**基础规则**和**自定义状态规则**进行评估。生成的各证件状态将综合形成该功能的状态。## 入门模板添加 Document AI 节点时，您可以从现成模板开始，模板已预先填好标题、描述和带类型的字段。之后您可以自定义任何内容。| 模板 | 常见字段 |
| - | - |
| **资金证明** | 账户持有人、余额、币种、对账单日期 |
| **收入证明（工资单）** | 雇主、员工姓名、税前/税后工资、薪资周期 |
| **财富来源** | 来源类型、金额、日期、机构 |
| **税务证件** | 纳税人姓名、纳税年度、申报收入、税号 |## 交叉核对其他步骤Document AI 字段可以通过 `document_ai.<field_key>` 进行寻址，并能使用 `value_type: "field"` 的自定义状态规则与其它已完成步骤的字段进行比对。例如：- `document_ai.account_holder` **equals** `kyc.full_name`：证件持有人与已验证身份匹配。
- `document_ai.balance` **greater\_than** `50000`：标记高额余额以供审核。匹配规则按照平台优先级 **已拒绝 > 审核中 > 已通过** 纳入决策，因此规则可以提高严重级别，但绝不能覆盖更严格的基于风险决定的状态。请参阅[规则与警告](https://docs.didit.me/zh/core-technology/document-ai/warnings-document-ai.md)。## 证件要求| 要求 | 详情 |
| - | - |
| **每步证件数** | 最多 3 份，每份独立配置 |
| **支持的格式** | PDF、JPG、JPEG、PNG、TIFF、WebP |
| **页面** | 支持多页 PDF |
| **质量** | 原始证件或高质量扫描件；无数码编辑或篡改 |> [!NOTE]
>
> Document AI 执行非结构化文本读取，这会导致每份证件产生数秒的延迟。Webhook 仅在整个工作流步骤完成后触发；在此期间，轮询决策 endpoint 的频率请勿超过每 5 秒一次。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.