> 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

# QueryIntakeForms

# Package: contentCollector

# Namespace: IntakeForms

# Method link: https://dev.wix.com/docs/api-reference/account-level/studio-workspace/content-collector/intake-form-v1/query-intake-forms.md

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

## Introduction

Retrieves a list of up to 100 intake forms, given the provided paging, filtering, and sorting.

Results are scoped to the caller's account. Intake forms belonging to other
accounts are never returned.

Use Query Intake Forms for precise structured filtering and sorting, for
example to export forms by `submission.submittedDate`. To match intake forms
by a free-text expression on client name or project name, or to get
aggregations, call [Search Intake Forms](https://dev.wix.com/docs/api-reference/account-level/partners/content-collector/intake-form-v1/search-intake-forms.md) instead.

To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md), [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md), and [Field Projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection.md).

---

## REST API

### Schema

```
 Method: queryIntakeForms
 Description: Retrieves a list of up to 100 intake forms, given the provided paging, filtering, and sorting.  Results are scoped to the caller's account. Intake forms belonging to other accounts are never returned.  Use Query Intake Forms for precise structured filtering and sorting, for example to export forms by `submission.submittedDate`. To match intake forms by a free-text expression on client name or project name, or to get aggregations, call [Search Intake Forms](https://dev.wix.com/docs/api-reference/account-level/partners/content-collector/intake-form-v1/search-intake-forms.md) instead.  To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md), [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md), and [Field Projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection.md).
 URL: https://www.wixapis.com/partners/content-collector/v1/intake-forms/query
 Method: POST
 Method parameters:
   param name: fields | type: array<fields> | description: Fields to include in the response.  | validation: maxItems 5
                 - enum: CONTEXT, SOURCE_MATERIALS
   param name: query | type: CursorQuery    
     - name: cursorPaging | type: CursorPaging | description: Cursor paging options.  Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#cursor-paging).  
        - name: limit | type: integer | description: Maximum number of items to return in the results.  | validation: minimum 0, maximum 100, format int32
        - name: cursor | type: string | description: Pointer to the next or previous page in the list of results.  Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request.  | validation: maxLength 16000
        - name: filter | type: object | description: Filter object.  Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#the-filter-section).  
        - name: sort | type: array<Sorting> | description: Sort object.  Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#the-sort-section).  | validation: maxItems 5
           - name: fieldName | type: string | description: Name of the field to sort by.  | validation: maxLength 512
           - name: order | type: SortOrder | description: Sort order.  
                 - enum: ASC, DESC
 Query fields:
   - field: createdDate | operators: $eq, $ne, $exists, $in, $hasSome, $lt, $lte, $gt, $gte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: id | operators: $eq, $ne, $exists, $in, $hasSome, $startsWith, $gt, $lt, $lte, $gte | sort: none | aggregatable: undefined | searchable: undefined
   - field: accountId | operators: $eq, $ne, $exists, $in, $hasSome, $startsWith, $gt, $lt, $lte, $gte | sort: none | aggregatable: undefined | searchable: undefined
   - field: userId | operators: $eq, $ne, $exists, $in, $hasSome, $startsWith, $gt, $lt, $lte, $gte | sort: none | aggregatable: undefined | searchable: undefined
   - field: publishDate | operators: $eq, $ne, $exists, $in, $hasSome, $lt, $lte, $gt, $gte | sort: none | aggregatable: undefined | searchable: undefined
   - field: submission.submittedDate | operators: $eq, $ne, $exists, $in, $hasSome, $lt, $lte, $gt, $gte | sort: none | aggregatable: undefined | searchable: undefined
   - field: project.name | operators: $eq, $ne, $exists, $in, $hasSome, $startsWith, $gt, $lt, $lte, $gte | sort: none | aggregatable: undefined | searchable: undefined
   - field: project.industry | operators: $eq, $ne, $exists, $in, $hasSome | sort: none | aggregatable: undefined | searchable: undefined
   - field: teamMemberIds | operators: $eq, $ne, $exists, $in, $hasSome, $hasAll | sort: none | aggregatable: undefined | searchable: undefined
 Return type: QueryIntakeFormsResponse
  - name: intakeForms | type: array<IntakeForm> | description: List of IntakeForms.  
     - 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
  - name: pagingMetadata | type: CursorPagingMetadata | description: Paging metadata  
     - name: count | type: integer | description: Number of items returned in current page.  | validation: format int32
     - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both.  
        - name: next | type: string | description: Cursor string pointing to the next page in the list of results.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor pointing to the previous page in the list of results.  | validation: maxLength 16000
     - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page.  + `true`: Another page of results can be retrieved. + `false`: This is the last page.  


```

### Examples

### Query Intake Forms
Queries intake forms created after a given date, sorted by creation date

```curl
curl -X POST \
  'https://www.wixapis.com/intake-forms/v1/intake-forms/query' \
  -H 'Authorization: <AUTH>' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "query": {
      "filter": {
        "createdDate": { "$gt": "2024-03-01T00:00:00.000Z" }
      },
      "sort": [
        { "fieldName": "createdDate", "order": "ASC" }
      ],
      "cursorPaging": { "limit": 50 }
    }
  }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.contentCollectorIntakeForms.contentCollectorIntakeForms.queryIntakeForms(query, options)
 Description: Retrieves a list of up to 100 intake forms, given the provided paging, filtering, and sorting.  Results are scoped to the caller's account. Intake forms belonging to other accounts are never returned.  Use Query Intake Forms for precise structured filtering and sorting, for example to export forms by `submission.submittedDate`. To match intake forms by a free-text expression on client name or project name, or to get aggregations, call [Search Intake Forms](https://dev.wix.com/docs/api-reference/account-level/partners/content-collector/intake-form-v1/search-intake-forms.md) instead.  To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md), [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md), and [Field Projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection.md).
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  query
 Method parameters: 
   param name: options | type: QueryIntakeFormsOptions  none  
        - name: fields | type: array<RequestedFields> | description: Fields to include in the response.  | validation: maxItems 5
             - enum: CONTEXT, SOURCE_MATERIALS
   param name: query | type: IntakeFormQuery   | required: true 
     - name: cursorPaging | type: CursorPaging | description: Cursor paging options.  Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#cursor-paging).  
        - name: limit | type: integer | description: Maximum number of items to return in the results.  | validation: minimum 0, maximum 100, format int32
        - name: cursor | type: string | description: Pointer to the next or previous page in the list of results.  Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request.  | validation: maxLength 16000
        - name: filter | type: object | description: Filter object.  Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#the-filter-section).  
        - name: sort | type: array<Sorting> | description: Sort object.  Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#the-sort-section).  | validation: maxItems 5
           - name: fieldName | type: string | description: Name of the field to sort by.  | validation: maxLength 512
           - name: order | type: SortOrder | description: Sort order.  
                 - enum: ASC, DESC
 Query fields:
   - field: _createdDate | operators: $eq, $ne, $exists, $in, $hasSome, $lt, $lte, $gt, $gte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: _id | operators: $eq, $ne, $exists, $in, $hasSome, $startsWith, $gt, $lt, $lte, $gte | sort: none | aggregatable: undefined | searchable: undefined
   - field: accountId | operators: $eq, $ne, $exists, $in, $hasSome, $startsWith, $gt, $lt, $lte, $gte | sort: none | aggregatable: undefined | searchable: undefined
   - field: userId | operators: $eq, $ne, $exists, $in, $hasSome, $startsWith, $gt, $lt, $lte, $gte | sort: none | aggregatable: undefined | searchable: undefined
   - field: publishDate | operators: $eq, $ne, $exists, $in, $hasSome, $lt, $lte, $gt, $gte | sort: none | aggregatable: undefined | searchable: undefined
   - field: submission.submittedDate | operators: $eq, $ne, $exists, $in, $hasSome, $lt, $lte, $gt, $gte | sort: none | aggregatable: undefined | searchable: undefined
   - field: project.name | operators: $eq, $ne, $exists, $in, $hasSome, $startsWith, $gt, $lt, $lte, $gte | sort: none | aggregatable: undefined | searchable: undefined
   - field: project.industry | operators: $eq, $ne, $exists, $in, $hasSome | sort: none | aggregatable: undefined | searchable: undefined
   - field: teamMemberIds | operators: $eq, $ne, $exists, $in, $hasSome, $hasAll | sort: none | aggregatable: undefined | searchable: undefined
 Return type: PROMISE<QueryIntakeFormsResponse>
  - name: intakeForms | type: array<IntakeForm> | description: List of IntakeForms.  
     - 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.  
  - name: pagingMetadata | type: CursorPagingMetadata | description: Paging metadata  
     - name: count | type: integer | description: Number of items returned in current page.  | validation: format int32
     - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both.  
        - name: next | type: string | description: Cursor string pointing to the next page in the list of results.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor pointing to the previous page in the list of results.  | validation: maxLength 16000
     - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page.  + `true`: Another page of results can be retrieved. + `false`: This is the last page.  


```

### Examples

### Query intake forms
Queries intake forms created after a given date, sorted by creation date

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

async function queryIntakeForms() {
  const response = await contentCollectorIntakeForms
    .queryIntakeForms()
    .gt("_createdDate", new Date("2024-03-01T00:00:00.000Z"))
    .ascending("_createdDate")
    .limit(50)
    .find();
}

/* Promise resolves to:
 * {
 *   "items": [
 *     {
 *       "_id": "8046df3c-7575-4098-a5ab-c91ad8f33c47",
 *       "revision": "3",
 *       "_createdDate": "2024-03-18T17:22:10.299Z",
 *       "_updatedDate": "2024-03-20T11:05:44.000Z",
 *       "clientName": "Jane Cohen",
 *       "project": {
 *         "name": "Bloom Bakery Website",
 *         "industry": "FOOD_AND_BEVERAGE"
 *       },
 *       "userId": "f1a2b3c4-d5e6-4789-9abc-1234567890ab",
 *       "accountId": "a9b8c7d6-e5f4-4321-8765-0fedcba98765",
 *       "publishDate": "2024-03-19T09:14:02.118Z",
 *       "submission": {
 *         "submittedDate": "2024-03-20T11:05:44.000Z",
 *         "lastEditDate": "2024-03-20T11:05:44.000Z"
 *       }
 *     }
 *   ],
 *   "length": 1,
 *   "pageSize": 50,
 *   "cursors": {}
 * }
 */

```

### queryIntakeForms (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 queryIntakeForms(query,options) {
  const response = await myWixClient.contentCollectorIntakeForms.queryIntakeForms(query,options);
};
```

---