> ## 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のDocument AIのリファレンスです。書類アップロードエンドポイント、書類ごとの抽出フィールドJSON、ステータス、判定のfeatures[]エントリーを解説します。

## 概要

Document AIは、1ステップにつき最大3件の書類（PDFまたは画像：PDF、JPG、JPEG、PNG、TIFF、WebP）を受け付けます。各書類は設定された`document_key`によって分類され、フィールド定義から構築されたスキーマに基づいて視覚言語モデルが読み取り、PDF/EXIFフォレンジックによる検査を受けます。書類ごとに以下の情報を保存します。

* **抽出フィールド**：設定したフィールドの`key`をキーとするマップで、値は宣言した型に従います（`text` → 文字列、`number` → 数値、`date` → `YYYY-MM-DD`）。読み取れなかったフィールドは`null`になります。
* **検出されたQRコードとバーコード**：レンダリングされた各ページについて、デコードされたペイロードとピクセル座標を返します。位置は特定できたもののデコードできなかったQRコードも、`parsed_payload: null`として返されます。
* **書類ステータス**：`Approved`、`In Review`、`Declined`、`Not Finished`のいずれかです。
* **書類メタデータ**：オーバーレイや改ざんの痕跡を含むファイルフォレンジックです。
* **クロスチェック結果**：検証済みの本人情報との氏名照合、およびカスタムフィールドの相互参照の結果です。

## 書類のアップロード

書類はDocument AIエンドポイントに1件ずつアップロードします。ホスト型セッションやSDKのフローではこの処理が自動で行われます。仕様は次のとおりです。

```text theme={null}
POST https://verification.didit.me/v3/document-ai/documents/
multipart/form-data — Session-Token: <session token>
```

| フィールド | 必須 | 説明 |
| - | - | - |
| `document_key` | はい | このファイルが該当する、設定済みの書類 |
| `document` | はい | アップロードするファイル |
| `locale` | いいえ | 画面上のタイトルや説明を決定するために使用するロケール |

レスポンスによってフローが進みます。

```json theme={null}
{
  "valid": true,
  "next_step": "DOCUMENT_AI",
  "document_ai_status": "In Progress",
  "uploaded_document_keys": ["proof_of_funds"],
  "required_document_keys": ["proof_of_funds", "payslip"]
}
```

`required_document_keys`のすべての項目が`uploaded_document_keys`に含まれ、未完了の書類が残っていない状態になると、ステップが完了します（`next_step`が`DOCUMENT_AI`の先へ進みます）。

## APIレスポンスでの表示箇所

`GET /v3/session/{sessionId}/decision/`は、ユーザー認証(KYC)と法人確認(KYB)のどちらのセッションでも、Document AIの結果を2か所で返します。`document_ai_documents[]`配列とPDFレポートは、`session_kind`に関係なく同一です。

* **`features[]`**：Document AIノードごとのサマリー項目で、実行された機能を列挙するために使用します。

  ```json theme={null}
  { "features": [ { "feature": "DOCUMENT_AI", "node_id": "feature_document_ai_1" } ] }
  ```

* **`document_ai_documents[]`**：完全な結果で、Document AIノードごとに1つのグループがあります。各グループには、ノード全体の`status`、アップロードされた`items`の一覧、および`warnings`が含まれます。アップロードされた各書類は1つの項目として、設定したフィールド（`extracted_data`内）、検出されたコード（`detected_codes`内）、その書類自体の`status`、フィールド定義、フォレンジック情報の`document_metadata`、`cross_check_result`を持ちます。

各ノードでは、書類ごとのステータスが**Declined > In Review > Approved**の優先順位でノードのステータスに統合されます。

## 判定の例

`account_holder`（text）、`balance`（number）、`currency`（text）、`statement_date`（date）を設定した**資金証明**書類の場合：

```json theme={null}
{
  "document_ai_documents": [
    {
      "node_id": "feature_document_ai_1",
      "status": "Approved",
      "items": [
        {
          "uuid": "5c1f0a2e-9b3d-4c7a-8f21-0a4e8e7d6c12",
          "document_key": "proof_of_funds",
          "status": "Approved",
          "original_filename": "statement.pdf",
          "extracted_data": {
            "account_holder": "Sophia Martinez",
            "balance": 18450.75,
            "currency": "EUR",
            "statement_date": "2026-05-31"
          },
          "detected_codes": [
            {
              "type": "QR_CODE",
              "page_number": 2,
              "position": [[124, 86], [306, 86], [306, 268], [124, 268]],
              "x": 124,
              "y": 86,
              "width": 182,
              "height": 182,
              "page_width": 1190,
              "page_height": 1684,
              "raw_payload": "SU5WLTIwMjYtMDA0Mg==",
              "parsed_payload": "INV-2026-0042"
            }
          ],
          "fields": [
            { "key": "account_holder", "name": "Account holder", "type": "text", "required": true },
            { "key": "balance", "name": "Balance", "type": "number", "required": false },
            { "key": "currency", "name": "Currency", "type": "text", "required": false },
            { "key": "statement_date", "name": "Statement date", "type": "date", "required": false }
          ],
          "document_metadata": { "is_tampered": false },
          "cross_check_result": null,
          "created_at": "2026-05-31T10:12:00Z"
        }
      ],
      "warnings": []
    }
  ]
}
```

`page_number`は1から始まります。`position`には検出された多角形が含まれ、`x`、`y`、`width`、`height`はその外接矩形を表します。すべての座標はレンダリングされたページのピクセル空間を基準とし、その寸法は`page_width`と`page_height`です。サポート対象のコードが見つからない場合、`detected_codes`は空の配列になります。`parsed_payload: null`の項目は、デコードされた値ではなく、項目の存在と位置のみを示すものとして扱ってください。

すべてのフィールドは`document_ai.<field_key>`として参照できるため、`extracted_data`の値に基づいて分岐や[カスタムステータスルール](https://docs.didit.me/ja/core-technology/document-ai/warnings-document-ai.md)を直接制御できます。`kyc.full_name`やアンケートの回答など、他のステップとの相互参照にも対応しています。


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