> ## 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.

# apply-filing-session-event

Applies one event to a filing session and returns the resulting form.

This command authenticates with the session token returned by
[create-filing-session](/cli-reference/filing-sessions/create-filing-session),
not an API key. Pass it with `--token`.

## Flags

<ParamField body="--state-version" type="integer" required>
  The state version of the session that this event applies to. Use the
  `state_version` from your most recent response.
</ParamField>

<ParamField body="--event" type="json" required>
  The event to process, as a JSON object. Its `kind` is `set_field`, `action`,
  or `search`. See [apply filing session
  event](/api-reference/filing-sessions/apply-filing-session-event#request) for
  the shape of each.
</ParamField>

## Response

<ResponseField name="form" type="object">
  The form to render after the event was applied. See the [form
  reference](/api-reference/filing-sessions/form).
</ResponseField>

<ResponseField name="state_version" type="integer">
  The new state version of the session.
</ResponseField>

## Example

```sh theme={null}
rhetoric apply-filing-session-event \
  --token $SESSION_TOKEN \
  --state-version 1 \
  --event '{ "kind": "set_field", "field": "court_system", "value": "illinois" }'
```

```json theme={null}
{
  "form": {
    "title": "Select a court system",
    "blocks": [
      {
        "id": "field_group:court_system",
        "items": [
          {
            "kind": "field",
            "key": "court_system",
            "label": "Court system",
            "description": "The court system where your case will be filed.",
            "required": true,
            "disabled": false,
            "sensitive": false,
            "ty": "string",
            "options": [
              { "value": "california", "label": "California" },
              { "value": "illinois", "label": "Illinois" }
            ],
            "validations": [],
            "value": "illinois",
            "errors": []
          }
        ],
        "actions": []
      }
    ],
    "actions": [{ "action_id": "next", "label": "Next", "primary": true }],
    "breadcrumbs": ["Start filing", "Select a court system"],
    "errors": []
  },
  "state_version": 2
}
```


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