> ## 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 rules & warnings

> Document AI basic rules and custom status rules: unreadable documents, missing required fields, tampering, name mismatch, and field-level cross-references.

## Overview

Document AI produces a status for each uploaded document from two layers of rules, and the per-document statuses combine into the feature status using the precedence **Declined > In Review > Approved**.

1. **Basic rules** — built-in checks, each mapped to a configurable action: `DECLINE`, `REVIEW`, or `NO_ACTION`.
2. **Custom status rules** — your own conditions on any extracted field, including cross-references against other steps.

## Basic rules

Each rule below is detected automatically during extraction and forensic analysis. Configure the action for each in the Document AI feature's **Rules** tab.

| Rule                        | Config field                                 | Triggers when                                                                                                                                                                                                |
| --------------------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Document unreadable**     | `document_ai_unreadable_document_action`     | The document can't be read or no data can be extracted                                                                                                                                                       |
| **Missing required fields** | `document_ai_missing_required_fields_action` | A field marked **required** can't be extracted                                                                                                                                                               |
| **Document tampering**      | `document_ai_document_tampering_action`      | Forensics detect signs of manipulation                                                                                                                                                                       |
| **Name mismatch**           | `document_ai_name_mismatch_action`           | The name on the document doesn't match the verified subject — the holder's identity on a person (KYC) workflow, or the company on a business (KYB) workflow (below `document_ai_name_match_score_threshold`) |
| **Unsupported file**        | `document_ai_unsupported_file_action`        | The uploaded file type is not supported                                                                                                                                                                      |
| **Exceeded attempts**       | `document_ai_max_attempts_exceeded_action`   | The user exceeds `document_ai_max_retry_attempts`                                                                                                                                                            |

The **name mismatch** check compares the document's marked name field against the verified subject using a 0–100 score: on a person (KYC) workflow against the verified ID (and the expected details supplied at session creation), and on a business (KYB) workflow against the verified company (the registry-matched company, or the expected company name). Set the cut-off with `document_ai_name_match_score_threshold`.

## Custom status rules

Custom status rules let you set a status (`Approved`, `In Review`, `Declined`, or `No Action`) when a condition on an extracted field is met. Each rule is:

```json theme={null}
{
  "field": "document_ai.balance",
  "operator": "greater_than",
  "value": 50000,
  "status": "In Review"
}
```

To **cross-reference another step**, set `value_type: "field"` and point `value` at another field path:

```json theme={null}
{
  "field": "document_ai.account_holder",
  "operator": "fuzzy_match",
  "value": "kyc.full_name",
  "value_type": "field",
  "score": 80,
  "status": "Declined"
}
```

Every matching rule contributes its status, and the strictest of those plus the base status wins (Declined > In Review > Approved). A rule can therefore raise severity but never pull a risk-driven `Declined`/`In Review` back up. `No Action` rules are recorded but leave the status unchanged.

<Note>
  Extracted fields are addressable as `document_ai.<field_key>` using the `key` you configured for each field. Number and date fields support comparison operators (`greater_than`, `less_than`, date ranges); text fields support equality, `contains`, and `fuzzy_match`.
</Note>
