> 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

# Package: forms

# Namespace: formSubmissions

# Webhook link: https://dev.wix.com/docs/api-reference/crm/forms/form-submissions/submission-updated.md

# Webhook Permissions Scopes IDs:
Read Submissions: SCOPE.DC-FORMS.READ-SUBMISSIONS

## Introduction

> **Note:** The Form Submission API only works with the Wix Forms app. Call [GetAppInstance](https://dev.wix.com/docs/rest/api-reference/app-management/apps/app-instance/get-app-instance.md) to confirm that the app named `wix_forms` is installed on the site.
<br>
Triggered when:
- Submission is updated.
- Submission order status is updated.
- Submission is confirmed.

---

## REST API

### Schema

```
Webhook: Submission Updated
Description: > **Note:** The Form Submission API only works with the Wix Forms app. Call [GetAppInstance](https://dev.wix.com/docs/rest/api-reference/app-management/apps/app-instance/get-app-instance.md) to confirm that the app named `wix_forms` is installed on the site. <br> Triggered when: - Submission is updated. - Submission order status is updated. - Submission is confirmed.
Event body:
 - name: id | type: string | description: Unique event ID. Allows clients to ignore duplicate events.
 - name: entityFqdn | type: string | description: Fully qualified domain name of the entity associated with the event.
 - name: slug | type: string | description: Event name.
 - name: entityId | type: string | description: ID of the entity associated with the event.
 - name: eventTime | type: string (date-time) | description: Event timestamp.
 - name: triggeredByAnonymizeRequest | type: boolean | description: Whether the event was triggered as a result of a privacy regulation application such as GDPR.
 - name: originatedFrom | type: string | description: If present, indicates the action that triggered the event.
 - name: updatedEvent | type: object | description: Updated event details.
    - name: currentEntity | type: FormSubmission | description: The entity after the update.
        - name: id | type: string | description: Submission GUID.
        - name: formId | type: string | description: GUID of the form which the submission belongs to.
        - name: namespace | type: string | description: The app which the form submissions belong to. A submission inherits the namespace from its form schema, so you can't set it directly.  For example, a submission of a form visible in the Wix Forms app has the namespace `wix.form_app.form`, the namespace of the Wix Forms app, whose app GUID is `225dd912-7dea-4738-8688-4b8c6955ffc2`.  See a list of namespaces for [apps made by Wix](https://dev.wix.com/docs/api-reference/crm/forms/form-schemas/introduction.md#namespaces-of-apps-made-by-wix) section. To retrieve the GUID for a Wix app, see [Apps Created By Wix](https://dev.wix.com/docs/rest/articles/get-started/apps-created-by-wix.md).
        - name: status | type: SubmissionStatus | description: Status of the submission.  The status a submission is created with depends on the form's namespace and on whether the form collects payment, so read it from the response rather than assuming.  A submission for a form that collects payment starts as `PAYMENT_WAITING`. Otherwise, most namespaces record the submission immediately as `CONFIRMED`. Namespaces that need to complete another step first, such as taking payment for a pricing plan, create the submission as `PENDING` and confirm it later with Confirm Submission.  A `PENDING` submission isn't recorded yet, and is deleted automatically if it isn't confirmed in time.
           - enum:
           -     PENDING: A submission is created, but has not yet been recorded in the Wix Forms collection.
           -     CONFIRMED: A submission is recorded in the Wix Forms collection.
           -     PAYMENT_WAITING: A form submission requiring payment is created.
           -     PAYMENT_CANCELED: An order of a form submission is canceled.
        - name: submissions | type: Map<string,Value> | description: Values the visitor submitted.  Each key is the `target` of a field in the form schema, which is the field's stable storage key rather than its GUID or label. Only keys matching a field target are accepted.  Each value's shape follows that field's `inputType`: `STRING` fields submit a string, `NUMBER` a number, `BOOLEAN` a boolean, and `ARRAY` an array of the selected option values. Date and time fields are strings. A choice field submits an option's `value`, not its GUID or its label.  3 input types submit structured values: `ADDRESS` submits an address object, `PAYMENT` an array holding 1 product object per item bought, and `SCHEDULING` an appointment object.  For the full mapping, see [About Submission Values](https://dev.wix.com/docs/api-reference/crm/forms/form-submissions/about-submission-values.md).
           - 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: createdDate | type: string | description: Date and time the form submission was created.
        - name: updatedDate | type: string | description: Date and time the form submission was updated.
        - name: revision | type: string | description: Revision number, which increments by 1 each time the form submission is updated. To prevent conflicting changes, the existing revision must be used when updating a form submission.
        - name: submitter | type: Submitter | description: GUID of the visitor that submitted the form.
           - ONE-OF:
              - name: memberId | type: string | description: Member GUID.
              - name: visitorId | type: string | description: Visitor GUID.
              - name: applicationId | type: string | description: Application GUID.
              - name: userId | type: string | description: User GUID.
        - name: seen | type: boolean | description: Whether a site owner marked a submission as "seen".
        - name: extendedFields | type: ExtendedFields | description: Data extension object that holds users' and apps' fields.
           - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).
        - name: orderDetails | type: OrderDetails | description: Order details. <br> <b>Note</b>: This object is only applicable when submitting a form in the Wix Payments app.
           - name: orderId | type: string | description: GUID of the order related to submission (only applicable if a form has payments).
           - name: number | type: string | description: Order number.
           - name: currency | type: string | description: Currency.
           - name: itemSubtotal | type: string | description: Item subtotal.
           - name: checkoutId | type: string | description: GUID of the checkout related to submission (only applicable if a form has payments).
        - name: contactId | type: string | description: Contact GUID of a site visitor who created the submission.
        - name: accessRestriction | type: string | description: Authorized viewer GUID.
        - name: tags | type: PublicTags | description: Tag GUIDs collections associated with the current entity.
           - name: tags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors.
              - name: tagIds | type: array<string> | description: List of tag GUIDs
        - name: appointmentDetails | type: AppointmentDetails | description: Appointment details. This object is only applicable when submitting a form that creates a booking appointment.
           - name: staffMemberId | type: string | description: GUID of the staff member assigned to the appointment.
           - name: staffMemberName | type: string | description: Name of the staff member assigned to the appointment.
        - name: childMetaSiteId | type: string | description: GUID of the child site the submission was made on.  Only present when the form was submitted on a site that shares its data with a parent site. In that case submissions from every child site are stored on the parent site, and this field identifies which child site the submission came from.
    - name: modifiedFields | type: Map<string,Value> | description: Fields that were updated and their values before the update.

```

### Examples


```curl
{
  "id": "a5db88c3-03b4-4dae-ab59-8cfde44c3109",
  "entityFqdn": "wix.forms.v4.submission",
  "slug": "updated",
  "entityId": "03e2ce4e-de63-4261-9c7d-41d3c3f38909",
  "updatedEvent": {
    "currentEntity": {
      "id": "03e2ce4e-de63-4261-9c7d-41d3c3f38909",
      "formId": "36b0f832-6930-44e3-9c54-a3a45bcce520",
      "namespace": "wix.form_example.form",
      "status": "CONFIRMED",
      "submissions": {
        "email": "apicontactsubmitflorian.medhurst20@gmail.com",
        "last_name": "Medhurst",
        "first_name": "ApiContactSubmitFlorian"
      },
      "properties": { "seen": false },
      "createdDate": "2023-06-15T08:03:00.184Z",
      "updatedDate": "2023-06-15T08:03:00.709Z",
      "revision": "2",
      "owner": { "visitorId": "b8afe426-2b4f-431f-8a23-c673d2b54631" }
    }
  },
  "eventTime": "2023-06-15T08:03:00.741414Z",
  "triggeredByAnonymizeRequest": false,
  "entityEventSequence": "2"
}

```

---

## JavaScript SDK

### Schema

```
Webhook: onSubmissionUpdated
Description: > **Note:** The Form Submission API only works with the Wix Forms app. Call [GetAppInstance](https://dev.wix.com/docs/rest/api-reference/app-management/apps/app-instance/get-app-instance.md) to confirm that the app named `wix_forms` is installed on the site. <br> Triggered when: - Submission is updated. - Submission order status is updated. - Submission is confirmed.
Payload: SubmissionUpdatedEnvelope
  - name: entity | type: FormSubmission | description: none
     - name: _id | type: string | description: Submission GUID.
     - name: formId | type: string | description: GUID of the form which the submission belongs to.
     - name: namespace | type: string | description: The app which the form submissions belong to. A submission inherits the namespace from its form schema, so you can't set it directly.  For example, a submission of a form visible in the Wix Forms app has the namespace `wix.form_app.form`, the namespace of the Wix Forms app, whose app GUID is `225dd912-7dea-4738-8688-4b8c6955ffc2`.  See a list of namespaces for [apps made by Wix](https://dev.wix.com/docs/api-reference/crm/forms/form-schemas/introduction.md#namespaces-of-apps-made-by-wix) section. To retrieve the GUID for a Wix app, see [Apps Created By Wix](https://dev.wix.com/docs/rest/articles/get-started/apps-created-by-wix.md).
     - name: status | type: SubmissionStatus | description: Status of the submission.  The status a submission is created with depends on the form's namespace and on whether the form collects payment, so read it from the response rather than assuming.  A submission for a form that collects payment starts as `PAYMENT_WAITING`. Otherwise, most namespaces record the submission immediately as `CONFIRMED`. Namespaces that need to complete another step first, such as taking payment for a pricing plan, create the submission as `PENDING` and confirm it later with Confirm Submission.  A `PENDING` submission isn't recorded yet, and is deleted automatically if it isn't confirmed in time.
         - enum:
         -     PENDING: A submission is created, but has not yet been recorded in the Wix Forms collection.
         -     CONFIRMED: A submission is recorded in the Wix Forms collection.
         -     PAYMENT_WAITING: A form submission requiring payment is created.
         -     PAYMENT_CANCELED: An order of a form submission is canceled.
     - name: submissions | type: Map<string,Value> | description: Values the visitor submitted.  Each key is the `target` of a field in the form schema, which is the field's stable storage key rather than its GUID or label. Only keys matching a field target are accepted.  Each value's shape follows that field's `inputType`: `STRING` fields submit a string, `NUMBER` a number, `BOOLEAN` a boolean, and `ARRAY` an array of the selected option values. Date and time fields are strings. A choice field submits an option's `value`, not its GUID or its label.  3 input types submit structured values: `ADDRESS` submits an address object, `PAYMENT` an array holding 1 product object per item bought, and `SCHEDULING` an appointment object.  For the full mapping, see [About Submission Values](https://dev.wix.com/docs/api-reference/crm/forms/form-submissions/about-submission-values.md).
        - 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: _createdDate | type: Date | description: Date and time the form submission was created.
     - name: _updatedDate | type: Date | description: Date and time the form submission was updated.
     - name: revision | type: string | description: Revision number, which increments by 1 each time the form submission is updated. To prevent conflicting changes, the existing revision must be used when updating a form submission.
     - name: submitter | type: Submitter | description: GUID of the visitor that submitted the form.
        - ONE-OF:
           - name: memberId | type: string | description: Member GUID.
           - name: visitorId | type: string | description: Visitor GUID.
           - name: applicationId | type: string | description: Application GUID.
           - name: userId | type: string | description: User GUID.
     - name: seen | type: boolean | description: Whether a site owner marked a submission as "seen".
     - name: extendedFields | type: ExtendedFields | description: Data extension object that holds users' and apps' fields.
        - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).
     - name: orderDetails | type: OrderDetails | description: Order details. <br> <b>Note</b>: This object is only applicable when submitting a form in the Wix Payments app.
        - name: orderId | type: string | description: GUID of the order related to submission (only applicable if a form has payments).
        - name: number | type: string | description: Order number.
        - name: currency | type: string | description: Currency.
        - name: itemSubtotal | type: string | description: Item subtotal.
        - name: checkoutId | type: string | description: GUID of the checkout related to submission (only applicable if a form has payments).
     - name: contactId | type: string | description: Contact GUID of a site visitor who created the submission.
     - name: accessRestriction | type: string | description: Authorized viewer GUID.
     - name: tags | type: PublicTags | description: Tag GUIDs collections associated with the current entity.
        - name: tags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors.
           - name: tagIds | type: array<string> | description: List of tag GUIDs
     - name: appointmentDetails | type: AppointmentDetails | description: Appointment details. This object is only applicable when submitting a form that creates a booking appointment.
        - name: staffMemberId | type: string | description: GUID of the staff member assigned to the appointment.
        - name: staffMemberName | type: string | description: Name of the staff member assigned to the appointment.
     - name: childMetaSiteId | type: string | description: GUID of the child site the submission was made on.  Only present when the form was submitted on a site that shares its data with a parent site. In that case submissions from every child site are stored on the parent site, and this field identifies which child site the submission came from.
  - name: modifiedFields | type: Map<string,Value> | description: Fields that were updated and their values before the update.
  - name: metadata | type: EventMetadata | description: none
     - name: instanceId | type: string | description: App instance GUID.
     - name: eventType | type: string | description: Event type.
     - name: identity | type: IdentificationData | description: The identification type and identity data.
        - ONE-OF:
           - name: anonymousVisitorId | type: string | description: GUID of a site visitor that has not logged in to the site.
           - name: memberId | type: string | description: GUID of a site visitor that has logged in to the site.
           - name: wixUserId | type: string | description: GUID of a Wix user (site owner, contributor, etc.).
           - name: appId | type: string | description: GUID of an app.
        - name: identityType | type: WebhookIdentityType | description: 
             - enum: UNKNOWN, ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP
     - name: accountInfo | type: AccountInfo | description: Details related to the account
        - name: accountId | type: string | description: GUID of the Wix account associated with the event.
        - name: parentAccountId | type: string | description: GUID of the parent Wix account. Only included when accountId belongs to a child account.
        - name: siteId | type: string | description: GUID of the Wix site associated with the event. Only included when the event is tied to a specific site.
     - name: _id | type: string | description: Event GUID. With this GUID you can easily spot duplicated events and ignore them.
     - name: entityFqdn | type: string | description: Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities. For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.
     - name: slug | type: string | description: Event action name, placed at the top level to make it easier for users to dispatch messages. For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.
     - name: entityId | type: string | description: GUID of the entity associated with the event.
     - name: eventTime | type: Date | description: Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`.
     - name: triggeredByAnonymizeRequest | type: boolean | description: Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).
     - name: originatedFrom | type: string | description: If present, indicates the action that triggered the event.
     - name: entityEventSequence | type: string | description: A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at `16:00` and then again at `16:01`, the second update will always have a higher sequence number. You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.

```

### Examples


```javascript
import { submissions } from '@wix/forms';

submissions.onSubmissionUpdated((event) => {
    // handle your event here
});
```


```javascript
import { createClient, AppStrategy } from '@wix/sdk';
import { submissions } from '@wix/forms';

const wixClient = createClient({
  auth: AppStrategy({
    appId: 'MY-APP-ID',
    publicKey: 'YOUR_APP_PUBLIC_KEY',
  }),
  modules: {
      submissions,
    },
});

wixClient.submissions.onSubmissionUpdated((event) => {
    // handle your event here
});
```

---