> For the complete documentation index, see [llms.txt](https://docs.uptiq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uptiq.ai/document-ai/document-ai-1/fraud-detection.md).

# Fraud Detection

Fraud Detection runs alongside Document Extraction:

* a **pre-OCR** phase checks the raw file for visual forensic signals during upload
* a **post-extraction** phase evaluates the extracted data against configurable rules (math/logic checks, compliance checks, and more).

Both phases run in the background so they don't block extraction. Rules can come from pre-built templates, be authored in natural language, or written as custom logic.

In the UI, rule configuration for a document type is reached via Document Types > Configure > Fraud Detection tab > Edit Rules.

<figure><img src="/files/Cw79hbDZsVgt1OOdPDA0" alt=""><figcaption></figcaption></figure>

| Capability               | Description                                                                                      | Limit                                            |
| ------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------ |
| Pre-OCR analysis         | Visual forensic checks on the raw file, before OCR                                               | Runs automatically if enabled; background thread |
| Post-extraction analysis | Rule-based evaluation of extracted field data                                                    | Runs automatically if enabled; background thread |
| Rule categories          | `math_logic`, `visual_forensic`, `social_engineering`, `compliance`, `completeness`, `threshold` | —                                                |
| Rule sources             | Pre-built templates, natural-language rules, custom rule logic                                   | 70+ document types have recommended templates    |
| Rule weighting           | Each rule contributes a weight toward the overall risk score                                     | Weight range 0–100                               |
| Risk levels              | Aggregate score maps to a risk level                                                             | CLEAN, LOW, MEDIUM, HIGH, CRITICAL               |
| Testing harness          | Run fraud rules against a previous extraction before enabling them live                          | Test extraction listing capped at 100 results    |
| Tenant configuration     | Enable/disable phases, adjust category weights and risk thresholds, per document type            | Master on/off switch is admin-only               |

{% hint style="info" %}
Generic pre-OCR templates apply to all document types automatically when the pre-OCR phase is enabled — only custom rules can be toggled per document type.
{% endhint %}

{% hint style="warning" %} <mark style="color:$warning;">The rule weight range documented here (0–100) doesn't match the live rule-editing UI, where rule cards and the Create/Edit Custom Rule form both scale weight 0–10 (default 5).</mark>
{% endhint %}

<figure><img src="/files/tom9lQanVgwP7aKJnakv" alt=""><figcaption></figcaption></figure>

### Workflow

1. **Configure** — set up fraud rules for a document type: start from a recommended template, write a natural-language rule, or define custom rule logic.
2. **Tune thresholds** — enable the pre-OCR and post-extraction phases you want, then set category weights and risk thresholds for the document type.
3. **AI review** — before saving, the assembled rule set is scored by an LLM (an overall score, plus strengths and improvement suggestions you can turn directly into new rules) so gaps can be addressed before the ruleset goes live.
4. **Test** — before going live, run the rule set against a previous extraction using the testing panel to confirm it behaves as expected.
5. **Pre-OCR check** — when a document is uploaded, if the pre-OCR phase is enabled, visual forensic checks run against the raw file.
6. **Post-extraction check** — once extraction completes, the post-extraction phase evaluates extracted fields against the configured rules.
7. **Score & flag** — each rule passes, fails, is skipped, or errors. Category scores roll up into an overall score and risk level.
8. **Review** — open the fraud analysis for an extraction to see the risk level, category breakdown, and the detail behind each failed rule.

<figure><img src="/files/FJqmlTjZ7hmxEn582gyx" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/sr5ZJknOdEF9sXhR3Zwm" alt=""><figcaption></figcaption></figure>

Confirmed for Owner and Admin: full access to rule configuration (through the AI review step of the Edit Rules wizard) and the testing harness. Member and Viewer can view the same rule set and use the Validate tab's testing harness, but the **Edit Rules** entry-point button doesn't render for either role — there's no way to reach the rule-editing wizard at all as Member or Viewer.

```
Rule config → Pre-OCR analysis ⎫
                                 ⎬→ Consolidated result → Risk level
              Post-extraction analysis ⎭
```

***

### Related pages

* [Document Types](/document-ai/document-ai-1/document-types.md) defines the document types and recommended templates used during setup.
* [Document Extraction](/document-ai/document-ai-1/document-extraction.md) provides the extracted fields this flow evaluates after processing.
* [Test Dashboard](/document-ai/document-ai-1/test-dashboard.md) helps validate extraction quality before you tighten fraud rules in production.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.uptiq.ai/document-ai/document-ai-1/fraud-detection.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
