> 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

# UpdateIntakeForm

# Package: contentCollector

# Namespace: IntakeForms

# Method link: https://dev.wix.com/docs/api-reference/account-level/partners/content-collector/intake-form-v1/update-intake-form.md

## Permission Scopes:
SCOPE.PARTNERS.CONTENT-COLLECTOR: SCOPE.PARTNERS.CONTENT-COLLECTOR

## Introduction

Updates an intake form.

Each time the intake form is updated, `revision` increments by 1. The current
`revision` must be passed when updating the intake form. This ensures you're
working with the latest intake form and prevents unintended overwrites.

Only the fields included in `fieldMask.paths` are updated. To share the form
with a client, add their email address to `clientEmails`. Adding the first
email stamps `publishDate`; removing all emails clears it.

To update multiple intake forms in a single request, call [Bulk Update Intake Forms](https://dev.wix.com/docs/api-reference/account-level/partners/content-collector/intake-form-v1/bulk-update-intake-forms.md).

---

## REST API

### Schema

```
 Method: updateIntakeForm
 Description: Updates an intake form.  Each time the intake form is updated, `revision` increments by 1. The current `revision` must be passed when updating the intake form. This ensures you're working with the latest intake form and prevents unintended overwrites.  Only the fields included in `fieldMask.paths` are updated. To share the form with a client, add their email address to `clientEmails`. Adding the first email stamps `publishDate`; removing all emails clears it.  To update multiple intake forms in a single request, call [Bulk Update Intake Forms](https://dev.wix.com/docs/api-reference/account-level/partners/content-collector/intake-form-v1/bulk-update-intake-forms.md).
 URL: https://www.wixapis.com/partners/content-collector/v1/intake-forms/{intakeForm.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:  intakeForm, intakeForm.id, intakeForm.revision
 Method parameters: 
   param name: fields | type: array<fields> | description: Fields to include in the response.  | validation: maxItems 5
                 - enum: CONTEXT, SOURCE_MATERIALS
   param name: intakeForm | type: IntakeForm | description: An intake form gathers project information from a partner's client. It wraps a questionnaire with project context, the source materials used to tailor that questionnaire, the clients the form is shared with, and the client's submission state.  The questionnaire is generated with AI the first time the form is opened, and the resulting `context` is stored on the intake form. This API stores the generated content but doesn't perform the generation itself. | required: true 
        - name: id | type: string | description: Intake form GUID. | required: true | validation: format GUID
        - name: revision | type: string | description: Revision number, which increments by 1 each time the intake form is updated. To prevent conflicting changes, the current revision must be passed when updating the intake form.  Ignored when creating an intake form. | required: true | validation: format int64
        - name: context | type: string | description: AI-generated background context for the intake form, stored as free-form text. Used as input when generating the questionnaire; stored and returned as-is and not otherwise interpreted by this service. Returned only when `CONTEXT` is included in the request's `fields`.  | validation: maxLength 2147483647
        - name: clientName | type: string | description: Client name.  | validation: maxLength 42
        - name: project | type: Project | description: Project information.  
           - name: name | type: string | description: Project name.  | validation: maxLength 255
           - name: industry | type: Industry | description: Industry vertical.  
                 - enum: RESTAURANT, TECHNOLOGY, TRAVEL_AND_TOURISM, WELLNESS, FITNESS, CONSULTING, FOOD_AND_BEVERAGE, EDUCATION, HEALTHCARE, REAL_ESTATE, OTHER
        - name: sourceMaterials | type: SourceMaterials | description: Source materials used as input for AI generation.  
           - name: projectMaterials | type: string | description: User-provided project description used as input for AI generation.  | validation: maxLength 2147483647
           - name: filesMarkdown | type: string | description: Markdown rendering of the files uploaded by the user, used as input for AI generation.  | validation: maxLength 2147483647
           - name: existingQuestionnaire | type: string | description: Existing questionnaire provided by the user, used as input for AI generation.  | validation: maxLength 2147483647
        - name: teamMemberIds | type: array<string> | description: IDs of the team members to notify about the form. Listed team members are notified through Wix Automations when the client submits the form or adds a note to it.  | validation: maxItems 50, format GUID
        - name: clientEmails | type: array<string> | description: Email addresses of the clients the form is shared with. Adding the first email shares the form and stamps `publishDate`; removing all emails clears `publishDate` (see `publishDate`). A client can retrieve the form through `GetClientIntakeForm` only if their email is listed here.  | validation: maxItems 20, format EMAIL
        - name: customFields | type: object | description: Free-form custom data stored verbatim with the intake form. Accepts any JSON structure, isn't interpreted or validated by the service, and is returned as-is. Use it to attach your own structured data to an intake form.  
 Return type: UpdateIntakeFormResponse
  - name: intakeForm | type: IntakeForm | description: Updated IntakeForm.  
     - name: id | type: string | description: Intake form GUID.  | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the intake form is updated. To prevent conflicting changes, the current revision must be passed when updating the intake form.  Ignored when creating an intake form.  | validation: format int64
     - name: createdDate | type: string | description: Date and time the IntakeForm was created.  | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the IntakeForm was last updated.  | validation: format date-time
     - name: context | type: string | description: AI-generated background context for the intake form, stored as free-form text. Used as input when generating the questionnaire; stored and returned as-is and not otherwise interpreted by this service. Returned only when `CONTEXT` is included in the request's `fields`.  | validation: maxLength 2147483647
     - name: clientName | type: string | description: Client name.  | validation: maxLength 42
     - name: project | type: Project | description: Project information.  
        - name: name | type: string | description: Project name.  | validation: maxLength 255
        - name: industry | type: Industry | description: Industry vertical.  
             - enum: RESTAURANT, TECHNOLOGY, TRAVEL_AND_TOURISM, WELLNESS, FITNESS, CONSULTING, FOOD_AND_BEVERAGE, EDUCATION, HEALTHCARE, REAL_ESTATE, OTHER
     - name: userId | type: string | description: Owner user GUID.  | validation: format GUID
     - name: sourceMaterials | type: SourceMaterials | description: Source materials used as input for AI generation.  
        - name: projectMaterials | type: string | description: User-provided project description used as input for AI generation.  | validation: maxLength 2147483647
        - name: filesMarkdown | type: string | description: Markdown rendering of the files uploaded by the user, used as input for AI generation.  | validation: maxLength 2147483647
        - name: existingQuestionnaire | type: string | description: Existing questionnaire provided by the user, used as input for AI generation.  | validation: maxLength 2147483647
     - name: submission | type: Submission | description: Submission state of the form. Populated asynchronously from Wix Forms submission events once the client submits, so these fields may be empty until a submission has been received and processed.  
        - name: submittedDate | type: string | description: Date and time the client submitted the form.  | validation: format date-time
        - name: lastEditDate | type: string | description: Date and time the client last edited the form.  | validation: format date-time
     - name: accountId | type: string | description: Account GUID.  | validation: format GUID
     - name: teamMemberIds | type: array<string> | description: IDs of the team members to notify about the form. Listed team members are notified through Wix Automations when the client submits the form or adds a note to it.  | validation: maxItems 50, format GUID
     - name: clientEmails | type: array<string> | description: Email addresses of the clients the form is shared with. Adding the first email shares the form and stamps `publishDate`; removing all emails clears `publishDate` (see `publishDate`). A client can retrieve the form through `GetClientIntakeForm` only if their email is listed here.  | validation: maxItems 20, format EMAIL
     - name: customFields | type: object | description: Free-form custom data stored verbatim with the intake form. Accepts any JSON structure, isn't interpreted or validated by the service, and is returned as-is. Use it to attach your own structured data to an intake form.  
     - name: publishDate | type: string | description: Date and time the form was first shared with clients (the first time client emails were added). Cleared if all client emails are removed; re-stamped if client emails are added again.  | validation: format date-time


```

### Examples

### Update Intake Form
Shares the form with a client by adding a client email

```curl
curl -X PATCH \
  'https://www.wixapis.com/intake-forms/v1/intake-forms/8046df3c-7575-4098-a5ab-c91ad8f33c47' \
  -H 'Authorization: <AUTH>' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "intakeForm": {
      "id": "8046df3c-7575-4098-a5ab-c91ad8f33c47",
      "revision": "1",
      "clientEmails": ["jane@bloombakery.com"]
    }
  }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.contentCollectorIntakeForms.contentCollectorIntakeForms.updateIntakeForm(_id, intakeForm, options)
 Description: Updates an intake form.  Each time the intake form is updated, `revision` increments by 1. The current `revision` must be passed when updating the intake form. This ensures you're working with the latest intake form and prevents unintended overwrites.  Only the fields included in `fieldMask.paths` are updated. To share the form with a client, add their email address to `clientEmails`. Adding the first email stamps `publishDate`; removing all emails clears it.  To update multiple intake forms in a single request, call [Bulk Update Intake Forms](https://dev.wix.com/docs/api-reference/account-level/partners/content-collector/intake-form-v1/bulk-update-intake-forms.md).
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  intakeForm, _id, intakeForm.revision
 Method parameters: 
   param name: _id | type: string | description: Intake form GUID. | required: true | validation: format GUID
   param name: intakeForm | type: UpdateIntakeForm | description: An intake form gathers project information from a partner's client. It wraps a questionnaire with project context, the source materials used to tailor that questionnaire, the clients the form is shared with, and the client's submission state.  The questionnaire is generated with AI the first time the form is opened, and the resulting `context` is stored on the intake form. This API stores the generated content but doesn't perform the generation itself. | required: true 
        - name: revision | type: string | description: Revision number, which increments by 1 each time the intake form is updated. To prevent conflicting changes, the current revision must be passed when updating the intake form.  Ignored when creating an intake form. | required: true | validation: format int64
        - name: context | type: string | description: AI-generated background context for the intake form, stored as free-form text. Used as input when generating the questionnaire; stored and returned as-is and not otherwise interpreted by this service. Returned only when `CONTEXT` is included in the request's `fields`.  | validation: maxLength 2147483647
        - name: clientName | type: string | description: Client name.  | validation: maxLength 42
        - name: project | type: Project | description: Project information.  
           - name: name | type: string | description: Project name.  | validation: maxLength 255
           - name: industry | type: Industry | description: Industry vertical.  
                 - enum: RESTAURANT, TECHNOLOGY, TRAVEL_AND_TOURISM, WELLNESS, FITNESS, CONSULTING, FOOD_AND_BEVERAGE, EDUCATION, HEALTHCARE, REAL_ESTATE, OTHER
        - name: sourceMaterials | type: SourceMaterials | description: Source materials used as input for AI generation.  
           - name: projectMaterials | type: string | description: User-provided project description used as input for AI generation.  | validation: maxLength 2147483647
           - name: filesMarkdown | type: string | description: Markdown rendering of the files uploaded by the user, used as input for AI generation.  | validation: maxLength 2147483647
           - name: existingQuestionnaire | type: string | description: Existing questionnaire provided by the user, used as input for AI generation.  | validation: maxLength 2147483647
        - name: teamMemberIds | type: array<string> | description: IDs of the team members to notify about the form. Listed team members are notified through Wix Automations when the client submits the form or adds a note to it.  | validation: maxItems 50, format GUID
        - name: clientEmails | type: array<string> | description: Email addresses of the clients the form is shared with. Adding the first email shares the form and stamps `publishDate`; removing all emails clears `publishDate` (see `publishDate`). A client can retrieve the form through `GetClientIntakeForm` only if their email is listed here.  | validation: maxItems 20, format EMAIL
        - name: customFields | type: object | description: Free-form custom data stored verbatim with the intake form. Accepts any JSON structure, isn't interpreted or validated by the service, and is returned as-is. Use it to attach your own structured data to an intake form.  
   param name: options | type: UpdateIntakeFormOptions  none  
        - name: fields | type: array<RequestedFields> | description: Fields to include in the response.  | validation: maxItems 5
             - enum: CONTEXT, SOURCE_MATERIALS
 Return type: PROMISE<IntakeForm>
  - name: _id | type: string | description: Intake form GUID.  | validation: format GUID
  - name: revision | type: string | description: Revision number, which increments by 1 each time the intake form is updated. To prevent conflicting changes, the current revision must be passed when updating the intake form.  Ignored when creating an intake form.  | validation: format int64
  - name: _createdDate | type: Date | description: Date and time the IntakeForm was created.  
  - name: _updatedDate | type: Date | description: Date and time the IntakeForm was last updated.  
  - name: context | type: string | description: AI-generated background context for the intake form, stored as free-form text. Used as input when generating the questionnaire; stored and returned as-is and not otherwise interpreted by this service. Returned only when `CONTEXT` is included in the request's `fields`.  | validation: maxLength 2147483647
  - name: clientName | type: string | description: Client name.  | validation: maxLength 42
  - name: project | type: Project | description: Project information.  
     - name: name | type: string | description: Project name.  | validation: maxLength 255
     - name: industry | type: Industry | description: Industry vertical.  
         - enum: RESTAURANT, TECHNOLOGY, TRAVEL_AND_TOURISM, WELLNESS, FITNESS, CONSULTING, FOOD_AND_BEVERAGE, EDUCATION, HEALTHCARE, REAL_ESTATE, OTHER
  - name: userId | type: string | description: Owner user GUID.  | validation: format GUID
  - name: sourceMaterials | type: SourceMaterials | description: Source materials used as input for AI generation.  
     - name: projectMaterials | type: string | description: User-provided project description used as input for AI generation.  | validation: maxLength 2147483647
     - name: filesMarkdown | type: string | description: Markdown rendering of the files uploaded by the user, used as input for AI generation.  | validation: maxLength 2147483647
     - name: existingQuestionnaire | type: string | description: Existing questionnaire provided by the user, used as input for AI generation.  | validation: maxLength 2147483647
  - name: submission | type: Submission | description: Submission state of the form. Populated asynchronously from Wix Forms submission events once the client submits, so these fields may be empty until a submission has been received and processed.  
     - name: submittedDate | type: Date | description: Date and time the client submitted the form.  
     - name: lastEditDate | type: Date | description: Date and time the client last edited the form.  
  - name: accountId | type: string | description: Account GUID.  | validation: format GUID
  - name: teamMemberIds | type: array<string> | description: IDs of the team members to notify about the form. Listed team members are notified through Wix Automations when the client submits the form or adds a note to it.  | validation: maxItems 50, format GUID
  - name: clientEmails | type: array<string> | description: Email addresses of the clients the form is shared with. Adding the first email shares the form and stamps `publishDate`; removing all emails clears `publishDate` (see `publishDate`). A client can retrieve the form through `GetClientIntakeForm` only if their email is listed here.  | validation: maxItems 20, format EMAIL
  - name: customFields | type: object | description: Free-form custom data stored verbatim with the intake form. Accepts any JSON structure, isn't interpreted or validated by the service, and is returned as-is. Use it to attach your own structured data to an intake form.  
  - name: publishDate | type: Date | description: Date and time the form was first shared with clients (the first time client emails were added). Cleared if all client emails are removed; re-stamped if client emails are added again.  


```

### Examples

### Update an intake form
Shares the form with a client by adding a client email

```javascript
import { contentCollectorIntakeForms } from "@wix/content-collector-intake-forms";

const intakeFormId = "8046df3c-7575-4098-a5ab-c91ad8f33c47";

const intakeForm = {
  revision: "1",
  clientEmails: ["jane@bloombakery.com"],
};

async function updateIntakeForm() {
  const response = await contentCollectorIntakeForms.updateIntakeForm(
    intakeFormId,
    intakeForm
  );
}

/* Promise resolves to:
 * {
 *   "_id": "8046df3c-7575-4098-a5ab-c91ad8f33c47",
 *   "revision": "2",
 *   "_createdDate": "2024-03-18T17:22:10.299Z",
 *   "_updatedDate": "2024-03-19T09:14:02.118Z",
 *   "clientName": "Jane Cohen",
 *   "project": {
 *     "name": "Bloom Bakery Website",
 *     "industry": "FOOD_AND_BEVERAGE"
 *   },
 *   "clientEmails": ["jane@bloombakery.com"],
 *   "userId": "f1a2b3c4-d5e6-4789-9abc-1234567890ab",
 *   "accountId": "a9b8c7d6-e5f4-4321-8765-0fedcba98765",
 *   "publishDate": "2024-03-19T09:14:02.118Z"
 * }
 */

```

### updateIntakeForm (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 { contentCollectorIntakeForms } from '@wix/content-collector-intake-forms';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function updateIntakeForm(_id,intakeForm,options) {
  const response = await myWixClient.contentCollectorIntakeForms.updateIntakeForm(_id,intakeForm,options);
};
```

---