> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# CreateInteractiveFormSessionStreamed

# Package: forms

# Namespace: InteractiveFormSessionsService

# Method link: https://dev.wix.com/docs/api-reference/crm/forms/interactive-form-sessions/create-interactive-form-session-streamed.md

## Permission Scopes:
View Forms: SCOPE.FORMS.VIEW-FORM

## Introduction

Creates an interactive form session for AI-powered conversational form completion, with real-time streaming.

For implementations that prefer to wait for the complete response, call [Create Interactive Form Session](https://dev.wix.com/docs/api-reference/crm/forms/interactive-form-sessions/create-interactive-form-session.md) instead.

---

## REST API

### Schema

```
 Method: createInteractiveFormSessionStreamed
 Description: Creates an interactive form session for AI-powered conversational form completion, with real-time streaming.  For implementations that prefer to wait for the complete response, call [Create Interactive Form Session](https://dev.wix.com/docs/api-reference/crm/forms/interactive-form-sessions/create-interactive-form-session.md) instead.
 URL: https://www.wixapis.com/forms/ai/v1/interactive-form-sessions/create-streamed
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  formId
 Method parameters: 
   param name: clientTime | type: ClientTime    
        - name: currentTime | type: string | description: Current date and time in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) UTC format. For example, `2023-10-01T12:00:00Z`.  | validation: minLength 1, maxLength 200
        - name: timeZone | type: string | description: Browser's timezone identifier for localizing date and time values in IANA timezone format (for example, `Europe/Vilnius`, `America/New_York`).  | validation: minLength 1, maxLength 50
   param name: currentValues | type: currentValues | description: Pre-filled values to apply to the form, to initialize the session with existing data. Field keys must match the form schema field names. For example: `{"firstName": "John", "email": "john@example.com", "age": 25}`. These values are merged with any data extracted during the conversation.  
   param name: dryRun | type: dryRun | description: Whether the session should run in dry run mode when no actual form submission occurs. In dry run mode, the full conversational flow works normally and form data is extracted, but no actual form submission occurs.  Default: `false`  | validation: immutable
   param name: formId | type: formId | description: Form GUID to create an interactive session for. | required: true | validation: format GUID
 Return type: CreateInteractiveFormSessionStreamedResponse
  - name: responseChunk | type: InteractiveFormSessionResponseChunk | description: AI assistant response chunk, streamed in real-time. Process each chunk as it arrives to provide progressive user feedback.  
     - ONE-OF: 
        - name: textDetails | type: TextDetails | description: Conversational text message for display.  
           - name: text | type: string | description: Text content to display.  | validation: minLength 1, maxLength 10000
           - name: style | type: Style | description: Text formatting style for visual presentation.  
                 - enum:
                 -     NORMAL: Regular conversational text.
                 -     BOLD: Bold text for emphasis.
        - name: textDataDetails | type: TextDataDetails | description: Structured data extracted from user input and mapped to specific form fields.  
           - name: fieldTarget | type: string | description: Form field identifier that this extracted data maps to. Matches a field name in the form schema.  | validation: minLength 1, maxLength 200
           - name: text | type: string | description: Human-readable text representation of the extracted data to display.  | validation: minLength 1, maxLength 10000
           - name: value | type: Value | description: Structured value for form submission (for example, boolean `true`/`false`, number, or string). This is the actual data value that will be submitted with the form.  
              - ONE-OF: 
                 - name: nullValue | type:  | description:   
                 - name: numberValue | type: number | description:   
                 - name: stringValue | type: string | description:   
                 - name: boolValue | type: boolean | description:   
                 - name: structValue | type: object | description:   
                 - name: listValue | type: ListValue | description:   
                    - name: values | type: array<Value> | description:   
           - name: displayValue | type: string | description: User-friendly display representation of the value (for example, "Yes"/"No" for boolean, "25 years old" for age). Use this to display confirmation of what was extracted from the user's input.  | validation: minLength 1, maxLength 10000
        - name: multiSelectInputDetails | type: MultiSelectInputDetails | description: Selector for selecting multiple options from a predefined list.  
           - name: fieldTarget | type: string | description: Form field identifier for the multi-select input.  | validation: minLength 1, maxLength 200
           - name: options | type: array<Option> | description: Options available for selection, when relevant. Users can choose multiple options from this list.  | validation: minItems 1, maxItems 100
              - name: value | type: string | description: Value to be submitted when this option is selected. This is the technical value used in form processing and submission.  | validation: minLength 1, maxLength 10000
              - name: label | type: string | description: Human-readable label for display for this option.  | validation: minLength 1, maxLength 10000
           - name: allowedCustomValue | type: CustomValue | description: When present, allows users to provide custom values not in the predefined options list.  
              - name: description | type: string | description: Description of the expected custom value format or content. Displayed to guide users when they choose to provide a custom option.  | validation: maxLength 10000
        - name: numberInputDetails | type: NumberInputDetails | description: Selector for numeric input with optional range and validation constraints.  
           - name: fieldTarget | type: string | description: Form field identifier for the numeric input.  | validation: minLength 1, maxLength 200
           - name: rangeLimit | type: NumberRangeLimit | description: Minimum and maximum value constraints for the numeric input.  
              - ONE-OF: 
                 - name: maxInclusiveValue | type: number | description: Maximum allowed value (inclusive).  | validation: format double
                 - name: maxExclusiveValue | type: number | description: Maximum allowed value (exclusive).  | validation: format double
              - name: minInclusiveValue | type: number | description: Minimum allowed value (inclusive).  | validation: format double
           - name: multipleOf | type: number | description: When provided, restricts input to multiples of this value. For example, `2.5` would allow 2.5, 5.0, 7.5, and so on.  | validation: format double
        - name: separatorDetails | type: SeparatorDetails | description: Visual separator element for organizing conversation flow.  
           - name: type | type: Type | description: Type of visual separator to display in the conversation flow.  
                 - enum:
                 -     PARAGRAPH: Paragraph break for visual content separation.
        - name: singleSelectInputDetails | type: SingleSelectInputDetails | description: Selector for selecting a single option from a predefined list.  
           - name: fieldTarget | type: string | description: Form field identifier for the single-select input.  | validation: minLength 1, maxLength 200
           - name: options | type: array<Option> | description: Options available for selection. Users can choose only one option from this list.  | validation: minItems 1, maxItems 100
           - name: allowedCustomValue | type: CustomValue | description: When present, allows users to provide a custom value not in the predefined options list.  
        - name: errorDetails | type: ErrorDetails | description: Error information when processing fails or validation errors occur.  
           - name: messageText | type: string | description: Error message detailing what went wrong during processing. For display to the user when the AI cannot process their input or when validation fails.  | validation: minLength 1, maxLength 1000
        - name: submissionDetails | type: SubmissionDetails | description: Form submission confirmation including a form submission GUID. A checkout GUID will also be returned here if the user selected products for purchase.  
           - name: submissionId | type: string | description: Form submission GUID created when the form is successfully completed and submitted.  | validation: format GUID
           - name: checkoutId | type: string | description: Wix eCommerce checkout GUID when the form includes payment processing. Only present for forms that have payment fields or are connected to eCommerce flows.  | read-only: true | validation: format GUID
        - name: importantTextDetails | type: ImportantTextDetails | description: Important contextual information that may influence data extraction or user decisions.  
           - name: fieldTarget | type: string | description: Form field identifier that this important information relates to.  | validation: minLength 1, maxLength 200
           - name: text | type: string | description: Important contextual information to highlight. This might include validation requirements, format expectations, or clarifying questions.  | validation: minLength 1, maxLength 10000
        - name: debugDetails | type: DebugDetails | description: Diagnostic information for development, debugging, and performance monitoring.  
           - name: data | type: object | description: Diagnostic data for development and troubleshooting. Contains information such as AI tools called, processing times, and internal state.  
        - name: endOfResponseDetails | type: EndOfResponseDetails | description: Stream completion signal indicating no more chunks will be sent in this response.  
           - name: success | type: boolean | description: Whether the response stream completed successfully. When `false`, there may have been processing errors or interruptions.  
        - name: fileUploadDetails | type: FileUploadDetails | description: Input for file upload with field targeting. Not supported.  
           - name: fieldTarget | type: string | description: Form field identifier for the file upload input.  | validation: minLength 1, maxLength 200
        - name: signatureDetails | type: SignatureDetails | description: Input for digital signature capture with field targeting. Not supported.  
           - name: fieldTarget | type: string | description: Form field identifier for the digital signature input.  | validation: minLength 1, maxLength 200
     - name: chunkType | type: ChunkType | description: Response chunk type, that determines how the content should be processed and displayed.  
         - enum:
         -     TEXT: Text message for display to the user.
         -     TEXT_DATA: Structured data extracted from user input and mapped to form fields.
         -     MULTI_SELECT_INPUT: Selector for selecting multiple options from a list.
         -     NUMBER_INPUT: Selector for numeric input with optional validation.
         -     SEPARATOR: Visual separator element such as paragraph breaks.
         -     SINGLE_SELECT_INPUT: Selector for selecting one option from a list.
         -     ERROR: Error message when processing fails or validation errors occur.
         -     SUBMISSION: Form submission confirmation including a submission ID.
         -     IMPORTANT_TEXT: Highlighted information that may influence form data extraction.
         -     DEBUG: Diagnostic information for troubleshooting and development.
         -     END_OF_RESPONSE: Signals the completion of a response stream.
         -     FILE_UPLOAD: Input for file upload. Not supported.
         -     SIGNATURE: Input for digital signature capture. Not supported.
     - name: meaningfulInput | type: MeaningfulInput | description: Indicates which portion of the original user input was meaningful for data extraction. Can be used to highlight relevant parts of the user's message in the UI.  
        - name: startOffset | type: integer | description: Character position (0-indexed) where the meaningful portion of user input begins.  | validation: minimum 0, maximum 10000
        - name: length | type: integer | description: Length in characters of the meaningful portion of user input. Use this with `startOffset` to highlight the relevant text that was processed for data extraction.  | validation: minimum 0, maximum 10000
  - name: interactiveFormSession | type: InteractiveFormSession | description: Information about the created interactive form session. Only included in the first chunk of the stream to provide session details immediately.  
     - name: id | type: string | description: Interactive form session GUID.  | read-only: true | validation: format GUID
     - name: formId | type: string | description: Form GUID.  | validation: format GUID


```

### Examples

### Create Interactive Form Session (Streamed response)
```curl
curl -X POST "https://www.wixapis.com/forms/ai/v1/interactive-form-sessions/create-streamed" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -H "Accept: text/event-stream" \
  -d '{
    "formId": "12345678-1234-1234-1234-123456789abc",
    "currentValues": {},
    "dryRun": false,
    "clientTime": {
      "currentTime": "2024-01-15T14:30:00Z",
      "timeZone": "Europe/London"
    }
  }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.forms.interactiveFormSessions.createInteractiveFormSessionStreamed(formId, options)
 Description: Creates an interactive form session for AI-powered conversational form completion, with real-time streaming.  For implementations that prefer to wait for the complete response, call [Create Interactive Form Session](https://dev.wix.com/docs/api-reference/crm/forms/interactive-form-sessions/create-interactive-form-session.md) instead.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  formId
 Method parameters: 
   param name: formId | type: string | description: Form GUID to create an interactive session for. | required: true | validation: format GUID
   param name: options | type: CreateInteractiveFormSessionStreamedOptions  none  
        - name: currentValues | type: object | description: Pre-filled values to apply to the form, to initialize the session with existing data. Field keys must match the form schema field names. For example: `{"firstName": "John", "email": "john@example.com", "age": 25}`. These values are merged with any data extracted during the conversation.  
        - name: dryRun | type: boolean | description: Whether the session should run in dry run mode when no actual form submission occurs. In dry run mode, the full conversational flow works normally and form data is extracted, but no actual form submission occurs.  Default: `false`  | validation: immutable
        - name: clientTime | type: ClientTime | description: Caller's local date and time.  
           - name: currentTime | type: string | description: Current date and time in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) UTC format. For example, `2023-10-01T12:00:00Z`.  | validation: minLength 1, maxLength 200
           - name: timeZone | type: string | description: Browser's timezone identifier for localizing date and time values in IANA timezone format (for example, `Europe/Vilnius`, `America/New_York`).  | validation: minLength 1, maxLength 50
 Return type: PROMISE<CreateInteractiveFormSessionStreamedResponse>
  - name: responseChunk | type: InteractiveFormSessionResponseChunk | description: AI assistant response chunk, streamed in real-time. Process each chunk as it arrives to provide progressive user feedback.  
     - ONE-OF: 
        - name: textDetails | type: TextDetails | description: Conversational text message for display.  
           - name: text | type: string | description: Text content to display.  | validation: minLength 1, maxLength 10000
           - name: style | type: Style | description: Text formatting style for visual presentation.  
                 - enum:
                 -     NORMAL: Regular conversational text.
                 -     BOLD: Bold text for emphasis.
        - name: textDataDetails | type: TextDataDetails | description: Structured data extracted from user input and mapped to specific form fields.  
           - name: fieldTarget | type: string | description: Form field identifier that this extracted data maps to. Matches a field name in the form schema.  | validation: minLength 1, maxLength 200
           - name: text | type: string | description: Human-readable text representation of the extracted data to display.  | validation: minLength 1, maxLength 10000
           - name: value | type: Value | description: Structured value for form submission (for example, boolean `true`/`false`, number, or string). This is the actual data value that will be submitted with the form.  
              - ONE-OF: 
                 - name: nullValue | type:  | description:   
                 - name: numberValue | type: number | description:   
                 - name: stringValue | type: string | description:   
                 - name: boolValue | type: boolean | description:   
                 - name: structValue | type: object | description:   
                 - name: listValue | type: ListValue | description:   
                    - name: values | type: array<Value> | description:   
           - name: displayValue | type: string | description: User-friendly display representation of the value (for example, "Yes"/"No" for boolean, "25 years old" for age). Use this to display confirmation of what was extracted from the user's input.  | validation: minLength 1, maxLength 10000
        - name: multiSelectInputDetails | type: MultiSelectInputDetails | description: Selector for selecting multiple options from a predefined list.  
           - name: fieldTarget | type: string | description: Form field identifier for the multi-select input.  | validation: minLength 1, maxLength 200
           - name: options | type: array<Option> | description: Options available for selection, when relevant. Users can choose multiple options from this list.  | validation: minItems 1, maxItems 100
              - name: value | type: string | description: Value to be submitted when this option is selected. This is the technical value used in form processing and submission.  | validation: minLength 1, maxLength 10000
              - name: label | type: string | description: Human-readable label for display for this option.  | validation: minLength 1, maxLength 10000
           - name: allowedCustomValue | type: CustomValue | description: When present, allows users to provide custom values not in the predefined options list.  
              - name: description | type: string | description: Description of the expected custom value format or content. Displayed to guide users when they choose to provide a custom option.  | validation: maxLength 10000
        - name: numberInputDetails | type: NumberInputDetails | description: Selector for numeric input with optional range and validation constraints.  
           - name: fieldTarget | type: string | description: Form field identifier for the numeric input.  | validation: minLength 1, maxLength 200
           - name: rangeLimit | type: NumberRangeLimit | description: Minimum and maximum value constraints for the numeric input.  
              - ONE-OF: 
                 - name: maxInclusiveValue | type: number | description: Maximum allowed value (inclusive).  
                 - name: maxExclusiveValue | type: number | description: Maximum allowed value (exclusive).  
              - name: minInclusiveValue | type: number | description: Minimum allowed value (inclusive).  
           - name: multipleOf | type: number | description: When provided, restricts input to multiples of this value. For example, `2.5` would allow 2.5, 5.0, 7.5, and so on.  
        - name: separatorDetails | type: SeparatorDetails | description: Visual separator element for organizing conversation flow.  
           - name: type | type: Type | description: Type of visual separator to display in the conversation flow.  
                 - enum:
                 -     PARAGRAPH: Paragraph break for visual content separation.
        - name: singleSelectInputDetails | type: SingleSelectInputDetails | description: Selector for selecting a single option from a predefined list.  
           - name: fieldTarget | type: string | description: Form field identifier for the single-select input.  | validation: minLength 1, maxLength 200
           - name: options | type: array<Option> | description: Options available for selection. Users can choose only one option from this list.  | validation: minItems 1, maxItems 100
           - name: allowedCustomValue | type: CustomValue | description: When present, allows users to provide a custom value not in the predefined options list.  
        - name: errorDetails | type: ErrorDetails | description: Error information when processing fails or validation errors occur.  
           - name: messageText | type: string | description: Error message detailing what went wrong during processing. For display to the user when the AI cannot process their input or when validation fails.  | validation: minLength 1, maxLength 1000
        - name: submissionDetails | type: SubmissionDetails | description: Form submission confirmation including a form submission GUID. A checkout GUID will also be returned here if the user selected products for purchase.  
           - name: submissionId | type: string | description: Form submission GUID created when the form is successfully completed and submitted.  | validation: format GUID
           - name: checkoutId | type: string | description: Wix eCommerce checkout GUID when the form includes payment processing. Only present for forms that have payment fields or are connected to eCommerce flows.  | read-only: true | validation: format GUID
        - name: importantTextDetails | type: ImportantTextDetails | description: Important contextual information that may influence data extraction or user decisions.  
           - name: fieldTarget | type: string | description: Form field identifier that this important information relates to.  | validation: minLength 1, maxLength 200
           - name: text | type: string | description: Important contextual information to highlight. This might include validation requirements, format expectations, or clarifying questions.  | validation: minLength 1, maxLength 10000
        - name: debugDetails | type: DebugDetails | description: Diagnostic information for development, debugging, and performance monitoring.  
           - name: data | type: object | description: Diagnostic data for development and troubleshooting. Contains information such as AI tools called, processing times, and internal state.  
        - name: endOfResponseDetails | type: EndOfResponseDetails | description: Stream completion signal indicating no more chunks will be sent in this response.  
           - name: success | type: boolean | description: Whether the response stream completed successfully. When `false`, there may have been processing errors or interruptions.  
        - name: fileUploadDetails | type: FileUploadDetails | description: Input for file upload with field targeting. Not supported.  
           - name: fieldTarget | type: string | description: Form field identifier for the file upload input.  | validation: minLength 1, maxLength 200
        - name: signatureDetails | type: SignatureDetails | description: Input for digital signature capture with field targeting. Not supported.  
           - name: fieldTarget | type: string | description: Form field identifier for the digital signature input.  | validation: minLength 1, maxLength 200
     - name: chunkType | type: ChunkType | description: Response chunk type, that determines how the content should be processed and displayed.  
         - enum:
         -     TEXT: Text message for display to the user.
         -     TEXT_DATA: Structured data extracted from user input and mapped to form fields.
         -     MULTI_SELECT_INPUT: Selector for selecting multiple options from a list.
         -     NUMBER_INPUT: Selector for numeric input with optional validation.
         -     SEPARATOR: Visual separator element such as paragraph breaks.
         -     SINGLE_SELECT_INPUT: Selector for selecting one option from a list.
         -     ERROR: Error message when processing fails or validation errors occur.
         -     SUBMISSION: Form submission confirmation including a submission ID.
         -     IMPORTANT_TEXT: Highlighted information that may influence form data extraction.
         -     DEBUG: Diagnostic information for troubleshooting and development.
         -     END_OF_RESPONSE: Signals the completion of a response stream.
         -     FILE_UPLOAD: Input for file upload. Not supported.
         -     SIGNATURE: Input for digital signature capture. Not supported.
     - name: meaningfulInput | type: MeaningfulInput | description: Indicates which portion of the original user input was meaningful for data extraction. Can be used to highlight relevant parts of the user's message in the UI.  
        - name: startOffset | type: integer | description: Character position (0-indexed) where the meaningful portion of user input begins.  | validation: minimum 0, maximum 10000
        - name: length | type: integer | description: Length in characters of the meaningful portion of user input. Use this with `startOffset` to highlight the relevant text that was processed for data extraction.  | validation: minimum 0, maximum 10000
  - name: interactiveFormSession | type: InteractiveFormSession | description: Information about the created interactive form session. Only included in the first chunk of the stream to provide session details immediately.  
     - name: _id | type: string | description: Interactive form session GUID.  | read-only: true | validation: format GUID
     - name: formId | type: string | description: Form GUID.  | validation: format GUID


```

### Examples

### createInteractiveFormSessionStreamed
```javascript
import { interactiveFormSessions } from '@wix/forms';

async function createInteractiveFormSessionStreamed(formId,options) {
  const response = await interactiveFormSessions.createInteractiveFormSessionStreamed(formId,options);
};
```

### createInteractiveFormSessionStreamed (with elevated permissions)
```javascript
import { interactiveFormSessions } from '@wix/forms';
import { auth } from '@wix/essentials';

async function myCreateInteractiveFormSessionStreamedMethod(formId,options) {
  const elevatedCreateInteractiveFormSessionStreamed = auth.elevate(interactiveFormSessions.createInteractiveFormSessionStreamed);
  const response = await elevatedCreateInteractiveFormSessionStreamed(formId,options);
}
```

### createInteractiveFormSessionStreamed (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { interactiveFormSessions } from '@wix/forms';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { interactiveFormSessions },
  // Include the auth strategy and host as relevant
});


async function createInteractiveFormSessionStreamed(formId,options) {
  const response = await myWixClient.interactiveFormSessions.createInteractiveFormSessionStreamed(formId,options);
};
```

---