# detect_fields

> Run field detection on a previously uploaded document and persist the detected fields, exactly as the AppliFlo app does: the form's sections and skip rules are saved, block-letter forms are noted, and corrections the workspace made to this same form before come back (remembered = how many).

Tool of the AppliFlo MCP server at `https://appliflo.com/api/mcp`. Kind: destructive: it emails people or cancels a send, so clients ask you first.

Run field detection on a previously uploaded document and persist the detected fields, exactly as the AppliFlo app does: the form's sections and skip rules are saved, block-letter forms are noted, and corrections the workspace made to this same form before come back (remembered = how many). Precondition: document_id must reference a document uploaded via upload_document. Returns the full field list, the choice questions (groups[]: one question answered by ticking boxes, e.g. Title = Mr/Mrs/Miss/Ms), plus flagged_count — fields with flagged:true are low-confidence detections (wrong type, bad box, or unclear label). Never fill a flagged field blindly: either call correct_field to fix it first, or surface it to a human for review before fill_document. match: true (for a first read of a scanned or flat PDF) first checks whether it is a government form AppliFlo already has; if so nothing is read (no AI pages used), fields is empty and official_match + notice say what to do. vision_skipped:true means an AI-reading limit was reached, so only the PDF's built-in fillable fields were read and the list may be incomplete; tell the user. vision_pages is how many pages AI read. ai_pages is the workspace's AI page allowance ({used, limit, remaining, exhausted, resets_at}); when ai_pages.exhausted is true, relay `notice` to the user.

## Inputs

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `document_id` | string | yes | Id returned by upload_document |
| `match` | boolean | no | true to check first whether a new flat upload is a government form AppliFlo already has (default false: always read the boxes). Only for a document with no boxes yet (409 otherwise) |
