Bulk-delete matching fields
prune_fieldsBulk-delete fields matching ALL given criteria (detection noise) in the active workspace.
Filter & guardrail semantics: permanently deletes every field in `workspace_id`
that satisfies **all** non-`None` filter criteria (`field_type`,
`confidence_below`, `width_below`, `height_below`, `page_index`). At least one
criterion **must** be provided — omitting all five criteria (`None`) is
rejected with `{"error": ...}` to prevent accidentally deleting all fields.
Thresholds (`confidence_below`, `width_below`, `height_below`) are
strictly-less-than (`<`); `width_below` and `height_below` are in `%` of page
width/height (`0.0`–`100.0`). Pass `exclude_ids` as a guardrail allowlist of
`field_id`s that must be preserved even when they match the criteria. Returns
`{"removed": <count>, "removed_ids": [...], "fields_remaining": <count>}` so
deletions are auditable (and reversible via `add_field`). Does not affect
saved templates unless `save_template` is called.
When to use:
- Use `prune_fields` for rule-based bulk cleanup of detection noise (e.g.
tiny table cells or low-confidence boxes).
- Use `remove_fields` to delete an explicit list of known `field_id`s, or
`remove_field` to delete a single field by ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| field_type | No | Exact field type to match for deletion (e.g. `'cell'`, `'field'`, `'text'`, `'checkbox'`). Omit or pass `None` to match any type. | |
| page_index | No | 0-based page index (`0` to `page_count - 1`) to restrict pruning to a single page. Omit or pass `None` to prune matching fields across all pages. | |
| exclude_ids | No | Optional guardrail allowlist of `field_id`s to protect and keep in the workspace even if they match all pruning criteria. | |
| width_below | No | Strictly-less-than width threshold as a percentage of page width (`0.0`–`100.0`); only fields with `w < width_below` match. Omit or pass `None` for no width filter. | |
| height_below | No | Strictly-less-than height threshold as a percentage of page height (`0.0`–`100.0`); only fields with `h < height_below` match. Omit or pass `None` for no height filter. | |
| workspace_id | Yes | Active workspace ID returned by `open_pdf` (`summary.workspace_id`). | |
| confidence_below | No | Strictly-less-than ML confidence threshold (`0.0`–`1.0`); only fields with `confidence < confidence_below` match. Omit or pass `None` for no confidence filter. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||