> 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`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # UpdateSubmission # Package: forms # Namespace: FormSubmissionService # Method link: https://dev.wix.com/docs/api-reference/crm/forms/form-submissions/update-submission.md ## Permission Scopes: Manage Submissions: SCOPE.DC-FORMS.MANAGE-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.
Updates a submission.
Each time the submission is updated, `revision` increments by 1. The existing `revision` must be included when updating the submission. This ensures you're working with the latest submission information, and prevents unintended overwrites. --- ## REST API ### Schema ``` Method: updateSubmission 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.
Updates a submission.
Each time the submission is updated, `revision` increments by 1. The existing `revision` must be included when updating the submission. This ensures you're working with the latest submission information, and prevents unintended overwrites. URL: https://www.wixapis.com/v4/submissions/{submission.id} Method: PATCH # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: submission, submission.id, submission.formId, submission.revision Method parameters: param name: submission | type: FormSubmission | description: Form submission that was created or retrieved. | required: true - name: id | type: string | description: Submission GUID. | required: true - name: formId | type: string | description: GUID of the form which the submission belongs to. | required: true - name: status | type: SubmissionStatus | description: Status of the submission. - 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 | description: Submission values where `key` is the form field and `value` is the data submitted for the given field. - 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 | description: - name: createdDate | type: string | description: Date and time the form submission was created. - 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. | required: true - 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.
Note: This object is only applicable when submitting a form in the Wix Payments app. - 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 | 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. Return type: UpdateSubmissionResponse - name: submission | type: FormSubmission | description: The updated submission. - 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. For example, the namespace for the Wix Forms app is `wix.form_app.form`. Call `Get Submission` to retrieve the namespace. - name: status | type: SubmissionStatus | description: Status of the submission. - 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 | description: Submission values where `key` is the form field and `value` is the data submitted for the given field. - 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 | 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.
Note: 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 | 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. Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: SUBMISSION_VALIDATION | Description: Form submission contains validation errors. ``` ### Examples ### UpdateSubmission ```curl ~~~cURL curl -X PATCH \ 'http://www.wixapis.com/form-submission/v4/submissions/e62e3011-55cf-4de3-a497-e097b52d86b7' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ -d '{ "submission": { "id": "e62e3011-55cf-4de3-a497-e097b52d86b7", "seen": true } }' ~~~ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.forms.FormSubmissionService.updateSubmission(_id, submission) 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.
Updates a submission.
Each time the submission is updated, `revision` increments by 1. The existing `revision` must be included when updating the submission. This ensures you're working with the latest submission information, and prevents unintended overwrites. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: submission, _id, submission.formId, submission.revision Method parameters: param name: _id | type: string | description: Submission GUID. | required: true param name: submission | type: UpdateSubmission | description: Form submission that was created or retrieved. | required: true - name: formId | type: string | description: GUID of the form which the submission belongs to. | required: true - name: status | type: SubmissionStatus | description: Status of the submission. - 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 | description: Submission values where `key` is the form field and `value` is the data submitted for the given field. - 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 | description: - name: _createdDate | type: Date | description: Date and time the form submission was created. - 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. | required: true - 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.
Note: This object is only applicable when submitting a form in the Wix Payments app. - 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 | 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. Return type: PROMISE - 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. For example, the namespace for the Wix Forms app is `wix.form_app.form`. Call `Get Submission` to retrieve the namespace. - name: status | type: SubmissionStatus | description: Status of the submission. - 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 | description: Submission values where `key` is the form field and `value` is the data submitted for the given field. - 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 | 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.
Note: 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 | 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. Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: SUBMISSION_VALIDATION | Description: Form submission contains validation errors. ``` ### Examples ### Update a submission (with elevated permissions) ```javascript import { submissions } from '@wix/forms'; import { auth } from '@wix/essentials'; /* Sample _id value: "abb9b5c9-a881-467c-9c34-b9bea43ca5f0" Sample submission value: { "formId": "21bcb6c7-02b3-4ed1-b6db-7856094fac03", "seen": false, "status": "CONFIRMED", "revision": "6", "submissions": { "first_name": "Jane", "last_name": "McBride" } } */ const elevatedUpdateSubmission = auth.elevate(submissions.updateSubmission); export async function myUpdateSubmissionFunction(_id, submission) { try { const updatedSubmission = await elevatedUpdateSubmission(_id, submission); console.log('Success! Updated submission:', updatedSubmission); return updatedSubmission; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: { "formId": "21bcb6c7-02b3-4ed1-b6db-7856094fac03", "namespace": "wix.form_app.form", "status": "CONFIRMED", "submissions": { "last_name": "McBride", "first_name": "Jane" }, "revision": "6", "submitter": { "applicationId": "151e476a-715e-ec33-db9a-a7ff4d51f70a" }, "seen": false, "_id": "abb9b5c9-a881-467c-9c34-b9bea43ca5f0", "_createdDate": "2023-12-28T12:54:04.652Z", "_updatedDate": "2023-12-28T14:33:02.571Z" } */ ``` ### Update a submission ```javascript import { submissions } from '@wix/forms'; /* Sample _id value: "abb9b5c9-a881-467c-9c34-b9bea43ca5f0" Sample submission value: { "formId": "21bcb6c7-02b3-4ed1-b6db-7856094fac03", "seen": false, "status": "CONFIRMED", "revision": "6", "submissions": { "first_name": "Jane", "last_name": "McBride" } } */ export async function myUpdateSubmissionFunction(_id, submission) { try { const updatedSubmission = await submissions.updateSubmission(_id, submission); console.log('Success! Updated submission:', updatedSubmission); return updatedSubmission; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: { "formId": "21bcb6c7-02b3-4ed1-b6db-7856094fac03", "namespace": "wix.form_app.form", "status": "CONFIRMED", "submissions": { "last_name": "McBride", "first_name": "Jane" }, "revision": "6", "submitter": { "applicationId": "151e476a-715e-ec33-db9a-a7ff4d51f70a" }, "seen": false, "_id": "abb9b5c9-a881-467c-9c34-b9bea43ca5f0", "_createdDate": "2023-12-28T12:54:04.652Z", "_updatedDate": "2023-12-28T14:33:02.571Z" } */ ``` ### updateSubmission (self-hosted) Self-hosted 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 { submissions } from '@wix/forms'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { submissions }, // Include the auth strategy and host as relevant }); async function updateSubmission(_id,submission) { const response = await myWixClient.submissions.updateSubmission(_id,submission); }; ``` ---