> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runpulse.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Core Processing

> Control extraction context, refinement, selection detection, and figure guidance.

Core processing settings change the primary extraction result. They are top-level request fields on `/extract`, separate from `extensions`, which add derived outputs such as chunks or alternate formats.

```json theme={null}
{
  "additional_prompt": "Preserve account labels and signed amounts.",
  "refine": {
    "modes": ["tables", "text"],
    "prompt": "Keep source row and column order."
  },
  "detect_selections": true
}
```

## Refinement

Refinement is off unless you enable it with `refine`. It accepts a boolean, an array of modes, or an object with `modes` and an optional `prompt`:

```json theme={null}
// Boolean — general refinement pass
{ "refine": true }

// Array — only the listed modes
{ "refine": ["tables", "text"] }

// Object — modes plus guidance in one place
{ "refine": { "modes": ["tables", "layout"], "prompt": "..." } }
```

| Mode | What it corrects |
| - | - |
| `tables` | Table structure, headers, and cell content |
| `text` | OCR text, missing content, and numerical accuracy |
| `formatting` | Bold, italic, strikethrough, super/subscript, and LaTeX formatting |
| `layout` | Layout correctness pass (fixed behavior) |

Refinement changes `markdown`, `bounding_boxes`, and table content in place; there is no second response tree to merge.

## Refinement prompts

* `refine.prompt` — a string applies to the whole refinement pass; an object keyed by mode (`{"tables": "...", "text": "..."}`) scopes guidance per mode. Prompt keys must be a subset of the requested modes, and `layout` does not accept a custom prompt.
* `refine_prompt` — a sibling alias for the same guidance, convenient when you pass `refine` as a boolean or array. `refine.prompt` wins when both are present.

## Selection marks

`detect_selections` controls the specialized pass for checkboxes, radio buttons, handwritten checkmarks, X marks, and similar controls. It defaults to `true`. Detected states appear on the relevant bounding-box elements and in `bounding_boxes.SelectionMarks` when marks are available.

## Prompts

* `additional_prompt` gives the extraction engine document or domain context.
* `refine.prompt` / `refine_prompt` apply only to refinement.
* `custom_image_prompt` applies to figure and chart interpretation.

Prompts guide extraction; they do not change the response schema.

## Processing versus extensions

| Use | Location | Result |
| - | - | - |
| Correct or steer the primary extraction | `refine`, `refine_prompt`, `additional_prompt`, `detect_selections` | Updates core markdown/layout output |
| Describe or return visuals | `figure_processing.*`, `custom_image_prompt` | Updates markdown and `bounding_boxes.Images[]` |
| Add chunks, metadata, footnote links, or alternate output | `extensions.*` | Adds fields under `response.extensions` |

> [card] [Extract API](https://docs.runpulse.com/api-reference/endpoint/extract.md)
>
> Complete request and response contract.

> [card] [Bounding Boxes](https://docs.runpulse.com/api-reference/bounding-boxes.md)
>
> Table cells, words, categories, and coordinates.


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