# Forms and Quiz Responses

> Configure optional quiz saving, inspect saved responses, and read generic form submissions.

Canonical URL: https://c22dfdd27662:3005/tools/forms

Use <AppLink to="forms">Forms</AppLink> to browse captured responses.
Quiz questions, branching and recommendations belong to the [Quiz island](/islands/engagement/quiz).
An approved capture policy controls what is saved; a form schema is not the quiz definition.

Generic form-schema creation and editing remain merchant actions in the dashboard.
Managed quizzes have a separate MCP workflow for preparing a policy and activating
it after explicit approval.

## Capture actions

Use the router envelope shown below, not former operation names as top-level
tools. Call `lexsis_discover` for current action schemas.

| Router | Action | Purpose |
|---|---|---|
| `lexsis_capture` | `form_schemas` | Discover generic and managed form entries |
| `lexsis_capture` | `submissions` | Read paginated, redacted generic submissions |
| `lexsis_capture` | `quiz_inspect` | Inspect the exact page version's quizzes and policies |
| `lexsis_drafts` | `quiz_prepare` | Prepare a reversible capture-policy draft |
| `lexsis_live_ops` | `quiz_activate` | Activate the exact approved policy |
| `lexsis_live_ops` | `quiz_deactivate` | Stop capture without deleting retained responses |
| `lexsis_capture` | `quiz_responses` | List saved attempts and completion summaries |
| `lexsis_capture` | `quiz_response` | Inspect permitted answers, revisions and result reference |
| `lexsis_capture` | `network_access` | Read which origins and proxied connections section JS may call |

All actions accept `workspace_id`; provide it when multiple workspaces are
authorized. Quiz actions require `store_id`. Generic reads accept an optional
store filter. Scope is enforced by the service, not merely filtered in the client.

## Quiz capture workflow

### 1. Read the stored version and inspect

Create or update a compiled quiz draft, then read `lexsis_pages` action `source`.
Use its `page_version_id`, an immutable UUID. The integer `version` used for
`expected_version` during editing is a different value.

```json
{
  "name": "lexsis_capture",
  "arguments": {
    "action": "quiz_inspect",
    "args": {
      "workspace_id": "workspace-uuid",
      "store_id": "store-uuid",
      "page_id": "page-uuid",
      "page_version_id": "page-version-uuid"
    }
  }
}
```

Inspection returns quiz instance IDs, server definition hashes, question/catalog
bindings and draft or active policies. Use returned values; do not calculate a
replacement hash or guess an instance ID.

### 2. Prepare the policy

Classify every question as `categorical`, `personal` or `sensitive` and explicitly
choose merchant visibility. Include purpose, shopper disclosure, unfinished and
completed retention, resume window, and any contact fields with their separate purpose.

This one-question example uses illustrative identifiers. Replace them with
inspection results. Retention values are for merchant review, not platform defaults.

```json
{
  "name": "lexsis_drafts",
  "arguments": {
    "action": "quiz_prepare",
    "args": {
      "workspace_id": "workspace-uuid",
      "store_id": "store-uuid",
      "page_version_id": "page-version-uuid",
      "instance_id": "inspected_instance",
      "expected_definition_hash": "returned-64-character-hash",
      "policy": {
        "version": 1,
        "mode": "responses",
        "purpose": "Help shoppers choose a product and review their responses.",
        "disclosure": "If you choose to save, this store will keep your answers and recommendation. Unfinished responses are kept for 2 days and completed responses for 30 days. You can use the quiz without saving.",
        "fields": [
          { "question_id": "priority", "classification": "categorical", "merchant_visible": true }
        ],
        "partial_retention_days": 2,
        "completed_retention_days": 30,
        "resume_ttl_minutes": 60,
        "contact_fields": [],
        "contact_purpose": null
      }
    }
  }
}
```

Supported limits: unfinished responses 1–30 days, completed responses 1–365 days,
and resume access 1–10,080 minutes. Resume access and data retention are different
deadlines, and the resume window cannot exceed unfinished-response retention.
Every question must have a policy entry. Text, textarea, email, phone and date
questions cannot be classified as categorical. Preparation does not enable collection.

### 3. Approve, activate and publish

Present the exact fields, visibility, purpose, disclosure and retention for
merchant approval. Reuse explicit approval already given for the same reviewed
scope; changes to collection details need review.

```json
{
  "name": "lexsis_live_ops",
  "arguments": {
    "action": "quiz_activate",
    "args": {
      "workspace_id": "workspace-uuid",
      "store_id": "store-uuid",
      "definition_id": "prepared-definition-uuid",
      "expected_definition_hash": "returned-64-character-hash",
      "expected_active_definition_id": null
    }
  }
}
```

Use `null` only when inspection confirms no active definition for the relevant
scope. Otherwise pass its returned ID. Conflicts require fresh inspection.

Activation and [page publication](/pages/publishing) are separate operations.
Publish under the user's explicit publication authorization. Production capture
requires the matching active policy and current published page version.
After any new page version, inspect and prepare a matching definition; an old
version's policy is not silently carried forward.

### 4. Verify the published journey

The shopper chooses whether to save. Verify confirmed saving, edits that remove
obsolete downstream answers, completed reload and correct product/variant
selection. Retrying a failed acknowledgement must not create another completion.

Check saving with analytics denied: it should still save, with no quiz analytics.
A no-save journey should still reach its result. Saved contact information does
not automatically send email or create a marketing subscription.

`preview=1` does not collect production responses or quiz events and is not proof
of real cart behavior. Use the returned published URL for live checks. Record
supported review results through MCP without local JSON dumps or screenshot reports.

## Read quiz responses

```json
{
  "name": "lexsis_capture",
  "arguments": {
    "action": "quiz_responses",
    "args": {
      "workspace_id": "workspace-uuid",
      "store_id": "store-uuid",
      "definition_id": "definition-uuid",
      "status": "completed",
      "test_mode": false,
      "limit": 50,
      "offset": 0
    }
  }
}
```

Optional filters: `definition_id`, `status` (`in_progress`, `completed`, `expired`),
`test_mode`, `limit` (1–200) and `offset`. The response is
`{items, total, limit, offset}`; paginate using the returned total. Records beyond
their retention deadline are hidden even before physical cleanup.

Summaries include attempt ID, page/version, policy, status/revision, result
reference, retention deadline and analytics linkage, without raw answers or contact.
Call `quiz_response` with workspace/store scope and `attempt_id` for the answer
timeline. It distinguishes current answers from replaced revisions. Agents receive
only merchant-visible categorical values, never personal/sensitive values,
contact information or credentials.

In Forms, authorized merchant users can filter attempts, inspect replaced
answers, explicitly reveal permitted protected values and export displayed answers.
Test-mode records are excluded by default. An intentional test on a normal
published page is still production-mode data; the test filter does not identify
it automatically.

## Stop collection

Call `lexsis_live_ops.quiz_deactivate` after explicit authorization, using the
same identity/hash/expected-active arguments as activation. It stops capture and
answer changes. Retained responses follow their existing retention policy;
deactivation is not deletion.

## Generic form reads

Use `lexsis_capture.form_schemas` before referencing a generic `schema_id` or
`form_key`. Optional parameters are `workspace_id`, `store_id` and
`include_archived`. It returns schema entries with identity, fields, settings
and archive state.

| Built-in form key | Source |
|---|---|
| `email_capture` | EmailCapture |
| `notify_me` | BuyBox out-of-stock notification |
| `newsletter` | Footer newsletter |

Any other `form_key` is a merchant-created form. A page fills it with the
[`FormCapture` island](/islands/engagement/form-capture) or from section JS
with `lifecycle.forms.submit(form_key, data, { consent })`. See
[Custom Forms and Network Access](/guides/custom-forms-and-network). An unknown
or archived key is rejected; it is never created on the fly.

Use `lexsis_capture.submissions` with optional workspace/store scope,
`schema_id` or `form_key`, `limit` (1–200, default 50) and `offset` (default 0).
It returns `{items, total, limit, offset}`. Personal fields are redacted; this
is not the raw merchant export.

Managed quiz entries are created through the approved quiz-policy lifecycle.
Use quiz response actions for their answer history. Do not construct a generic
form submission to bypass quiz policy or duplicate its records.
