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

# The form

> The form object returned by the filing session operations.

A filing session steps a filer through a sequence of forms. [Resume filing
session](/api-reference/filing-sessions/resume-filing-session) and [apply filing
session event](/api-reference/filing-sessions/apply-filing-session-event) both
return a `form` that describes the current step: what to show, what to collect,
and what can be done next. Render it, collect input, and send events back.

Tolerate fields you do not recognize in responses. New ones may be added over
time.

## Form

<ResponseField name="title" type="string">
  The step's heading.
</ResponseField>

<ResponseField name="blocks" type="object[]">
  The step's content, in order. See [blocks](#blocks).
</ResponseField>

<ResponseField name="actions" type="object[]">
  The actions available on this step. See [actions](#actions).
</ResponseField>

<ResponseField name="breadcrumbs" type="string[]">
  Labels for the steps leading to this one, outermost first, with the current
  step last.
</ResponseField>

<ResponseField name="errors" type="string[]">
  Form-wide error messages that are not tied to a single field.
</ResponseField>

## Blocks

A block groups related content. It places no restriction on what it holds, so
input, information, and explanatory text can sit side by side.

<ResponseField name="id" type="string">
  A stable identifier for the block.
</ResponseField>

<ResponseField name="title" type="string">
  A heading for the block, if it has one.
</ResponseField>

<ResponseField name="items" type="object[]">
  The content of the block, in order. Each item has a `kind`:
  [`field`](#fields), [`data`](#data), or [`text`](#text).
</ResponseField>

<ResponseField name="actions" type="object[]">
  Actions scoped to this block, in addition to the form's own.
</ResponseField>

## Items

Each item in a block has a `kind`: `field`, `data`, or `text`.

### Data

A `data` item is a labeled, read-only value.

<ResponseField name="label" type="string">
  The human readable name for the data.
</ResponseField>

<ResponseField name="value" type="string">
  The value, already formatted for display, such as `$435.00`.
</ResponseField>

<ResponseField name="detail" type="string">
  Secondary information about the value, such as a document's type and page
  count or a party's role.
</ResponseField>

### Text

A `text` item is a paragraph of explanatory text, such as guidance or a note
about what the step does.

<ResponseField name="text" type="string">
  The text, as plain text with no formatting. Longer text arrives as several
  `text` items, one per paragraph.
</ResponseField>

### Fields

A `field` item is something to provide. Set a field's value with a `set_field`
event that uses its `key`.

<ResponseField name="key" type="string">
  The key identifying the field. Use it as `field` in `set_field` and `search`
  events.
</ResponseField>

<ResponseField name="label" type="string">
  The human readable label.
</ResponseField>

<ResponseField name="description" type="string">
  Help text to show with the field.
</ResponseField>

<ResponseField name="required" type="boolean">
  Whether the field must be filled before the step can advance.
</ResponseField>

<ResponseField name="disabled" type="boolean">
  Whether the field can currently be edited. A disabled field is usually waiting
  on another field in the step.
</ResponseField>

<ResponseField name="sensitive" type="boolean">
  Whether the value is a secret, such as a password or a payment detail.
  Renderers should mask it, for example with a password input instead of a plain
  text one.
</ResponseField>

<ResponseField name="ty" type="string">
  The representation of the value. One of `string`, `number`, `bool`, or `file`.
</ResponseField>

<ResponseField name="options" type="object[]">
  Present when the field takes one of a fixed set of values. See
  [options](#options).
</ResponseField>

<ResponseField name="search" type="object">
  Present, instead of `options`, when the field takes one of a set of values too
  large to send whole. See [search](#search).
</ResponseField>

<ResponseField name="validations" type="object[]">
  Rules a value you type should satisfy. See [validations](#validations).
</ResponseField>

<ResponseField name="value" type="any">
  The current value, if there is one. A field that already has a value does not
  need to be set again.
</ResponseField>

<ResponseField name="errors" type="string[]">
  Problems with the current value that the server reported, if any.
</ResponseField>

<ResponseField name="autocomplete" type="string">
  A hint for browser autofill, as an HTML autofill token such as `cc-number` or
  `billing address-line1`. Renderers other than browsers can ignore it.
</ResponseField>

<ResponseField name="input_mode" type="string">
  A hint for the keyboard to prefer for a text field. One of `text`, `numeric`,
  `decimal`, `tel`, or `email`. Renderers other than browsers can ignore it.
</ResponseField>

#### Options

A field with `options` takes one of a fixed set of values. Each option is an
object with a `value`, in the field's `ty` representation, and a human readable
`label`. Set the field to an option's `value` exactly as given. An empty list
means there is nothing to choose yet.

When a field has no `options` and no `search`, any value of its `ty` is allowed,
subject to its validations.

#### Search

Some sets of values are too large to send whole, such as the courts in Texas. A
field like that has `search` instead of `options`. At most one of `options` and
`search` is present, and a field may use either depending on the court system, so
handle both.

<ResponseField name="query" type="string">
  The query that `results` answer, if a search has been made.
</ResponseField>

<ResponseField name="results" type="object[]">
  The values that match the query, each a `value` and a `label` like an option.
  The server caps how many it returns.
</ResponseField>

<ResponseField name="selected" type="object">
  The field's current value with its label. This may not be among the `results`,
  so use it to show what is selected.
</ResponseField>

<ResponseField name="total" type="integer">
  How many values match the query. When it is larger than the number of
  `results`, the results were cut off. It is absent if the server cannot say.
</ResponseField>

To find a value, send a `search` event with a `query`. How a query matches is
up to the field. For courts, every word of the query must appear, in any case,
in a court's name or code, so `harris district` finds Harris County district
courts. If `total` exceeds the number of `results`, make the query more specific
rather than choosing from a partial list. Then set the field to a result's
`value` exactly as given, with a `set_field` event.

Searching does not set the field's value, and it does change the session's state
version like any other event. The server keeps the most recent query, so
resuming the session shows the same results.

#### Validations

Each validation is an object with a `label`, the message for a value that breaks
the rule, and a `rule` with a `kind`:

<ResponseField name="pattern" type="rule">
  The value must match `pattern`, a regular expression in JavaScript syntax.
</ResponseField>

<ResponseField name="extension" type="rule">
  The value must be a file whose extension is one of `extensions`, lowercase and
  without a leading dot, such as `pdf`.
</ResponseField>

Validations are hints that let you check a value before sending it. Rely on the
server's response, which reports problems on the field or in the form's
`errors`. Validations are often empty, and are not used when a field has
`options`.

#### Files

A field with a `ty` of `file` takes a document. Its `validations` include an
`extension` rule that lists the accepted extensions. Set it with a `set_field`
event whose `value` is an object:

```json theme={null}
{
  "file_name": "complaint.pdf",
  "content_type": "application/pdf",
  "content": "<base64-encoded file bytes>",
  "size_bytes": 12345
}
```

When the form reports the document back, its `value` has only `file_name`,
`content_type`, and `size_bytes`. The content is never returned.

The document travels in the request body, which can be up to 50 MB. Each court
also sets its own maximum attachment size, and a document over it is reported on
the form.

## Actions

An action is something the filer can do. Invoke one with an `action` event.

<ResponseField name="action_id" type="string">
  The ID of the action. Use it as `action_id` in an `action` event.
</ResponseField>

<ResponseField name="label" type="string">
  The human readable label.
</ResponseField>

<ResponseField name="primary" type="boolean">
  Whether this is the step's primary action, usually the one that submits the
  step and advances.
</ResponseField>


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