> 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

# QueryStandaloneForms

# Package: forms

# Namespace: FormStandaloneService

# Method link: https://dev.wix.com/docs/api-reference/crm/forms/standalone-form-v1/query-standalone-forms.md

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

## Introduction

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

Query Standalone Forms runs with these defaults, which you can override:

- `createdDate` is sorted in `DESC` order
- `cursorPaging.limit` is `50`

Supported properties for filtering and sorting: `id`, `formId`, `metaSiteId`, `createdDate`, `updatedDate`.

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: queryStandaloneForms
 Description: Retrieves a list of up to 100 standalone forms, given the provided paging, filtering, and sorting.  Query Standalone Forms runs with these defaults, which you can override:  - `createdDate` is sorted in `DESC` order - `cursorPaging.limit` is `50`  Supported properties for filtering and sorting: `id`, `formId`, `metaSiteId`, `createdDate`, `updatedDate`.  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/forms/v4/standalone-forms/query
 Method: POST
 # 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: query | type: CursorQuery   | required: true 
     - name: cursorPaging | type: CursorPaging | description: Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`.  
        - name: limit | type: integer | description: Number of items to load.  | validation: minimum 0, maximum 100, format int32
        - name: cursor | type: string | description: Pointer to the next or previous page in the list of results.  You can get 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 in the following format: `"filter" : { "fieldName1": "value1", "fieldName2":{"$operator":"value2"} }` Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`  
        - name: sort | type: array<Sorting> | description: Sort object in the following format: `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`  | validation: maxItems 3
           - 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
 Return type: QueryStandaloneFormsResponse
  - name: standaloneForms | type: array<StandaloneForm> | description: Retrieved standalone forms.  | validation: maxItems 100
     - name: id | type: string | description: Standalone form GUID.  Used in the standalone form's public URL. See `accountSlug` for the URL format.  | read-only: true | validation: maxLength 36
     - name: formId | type: string | description: GUID of the [form](https://dev.wix.com/docs/api-reference/crm/forms/form-schemas/introduction.md) that the standalone form marks as standalone.  The form must exist before you create the standalone form.  | validation: format GUID
     - name: metaSiteId | type: string | description: GUID of the site that owns the standalone form.  Set to the site your request is authorized for when the standalone form is created.  | read-only: true | validation: format GUID
     - name: createdDate | type: string | description: Date and time the standalone form was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the standalone form was last updated.  | read-only: true | validation: format date-time
     - name: accountSlug | type: string | description: Account slug of the site owner, used in the standalone form's public URL.  The standalone form's public URL is: - `https://{accountSlug}.wixforms.com/f/{id}` when `accountSlug` is set. - `https://www.wixforms.com/f/{id}` when `accountSlug` is empty.  Set when the standalone form is created and doesn't change afterward.  | read-only: true | validation: maxLength 50
  - name: metadata | type: CursorPagingMetadata | description: Paging metadata.  
     - name: count | type: integer | description: Number of items returned in the response.  | validation: format int32
     - name: cursors | type: Cursors | description: Offset that was requested.  
        - name: next | type: string | description: Cursor pointing to next page in the list of results.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor pointing to previous page in the list of results.  | validation: maxLength 16000
     - name: hasNext | type: boolean | description: Indicates if there are more results after the current page. If `true`, another page of results can be retrieved. If `false`, this is the last page.  


```

### Examples

### Query standalone forms by form ID
Retrieves the standalone form for a specific form, sorted by creation date.

```curl
curl -X POST \
'https://www.wixapis.com/forms/v4/standalone-forms/query' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "query": {
    "filter": {
      "formId": "3c8f2a1e-6b4d-4f7a-9e2c-5d1b8a7f6e30"
    },
    "sort": [
      {
        "fieldName": "createdDate",
        "order": "DESC"
      }
    ],
    "cursorPaging": {
      "limit": 10
    }
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.standaloneForms.standaloneForms.queryStandaloneForms(query)
 Description: Retrieves a list of up to 100 standalone forms, given the provided paging, filtering, and sorting.  Query Standalone Forms runs with these defaults, which you can override:  - `createdDate` is sorted in `DESC` order - `cursorPaging.limit` is `50`  Supported properties for filtering and sorting: `id`, `formId`, `metaSiteId`, `createdDate`, `updatedDate`.  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: query | type: CursorQuery   | required: true 
     - name: cursorPaging | type: CursorPaging | description: Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`.  
        - name: limit | type: integer | description: Number of items to load.  | validation: minimum 0, maximum 100, format int32
        - name: cursor | type: string | description: Pointer to the next or previous page in the list of results.  You can get 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 in the following format: `"filter" : { "fieldName1": "value1", "fieldName2":{"$operator":"value2"} }` Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`  
        - name: sort | type: array<Sorting> | description: Sort object in the following format: `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`  | validation: maxItems 3
           - 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
 Return type: PROMISE<QueryStandaloneFormsResponse>
  - name: standaloneForms | type: array<StandaloneForm> | description: Retrieved standalone forms.  | validation: maxItems 100
     - name: _id | type: string | description: Standalone form GUID.  Used in the standalone form's public URL. See `accountSlug` for the URL format.  | read-only: true | validation: maxLength 36
     - name: formId | type: string | description: GUID of the [form](https://dev.wix.com/docs/api-reference/crm/forms/form-schemas/introduction.md) that the standalone form marks as standalone.  The form must exist before you create the standalone form.  | validation: format GUID
     - name: metaSiteId | type: string | description: GUID of the site that owns the standalone form.  Set to the site your request is authorized for when the standalone form is created.  | read-only: true | validation: format GUID
     - name: _createdDate | type: Date | description: Date and time the standalone form was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the standalone form was last updated.  | read-only: true 
     - name: accountSlug | type: string | description: Account slug of the site owner, used in the standalone form's public URL.  The standalone form's public URL is: - `https://{accountSlug}.wixforms.com/f/{id}` when `accountSlug` is set. - `https://www.wixforms.com/f/{id}` when `accountSlug` is empty.  Set when the standalone form is created and doesn't change afterward.  | read-only: true | validation: maxLength 50
  - name: metadata | type: CursorPagingMetadata | description: Paging metadata.  
     - name: count | type: integer | description: Number of items returned in the response.  | validation: format int32
     - name: cursors | type: Cursors | description: Offset that was requested.  
        - name: next | type: string | description: Cursor pointing to next page in the list of results.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor pointing to previous page in the list of results.  | validation: maxLength 16000
     - name: hasNext | type: boolean | description: Indicates if there are more results after the current page. If `true`, another page of results can be retrieved. If `false`, this is the last page.  


```

### Examples

### Query standalone forms by form ID
Retrieves the standalone form for a specific form, sorted by creation date.

```javascript
import { standaloneForms } from "@wix/standalone-forms";

async function queryStandaloneForms() {
  const response = await standaloneForms.queryStandaloneForms({
    filter: { formId: "3c8f2a1e-6b4d-4f7a-9e2c-5d1b8a7f6e30" },
    sort: [{ fieldName: "createdDate", order: "DESC" }],
    cursorPaging: { limit: 10 },
  });
}

/* Promise resolves to:
 * {
 *   "standaloneForms": [
 *     {
 *       "_id": "7390125846218437120",
 *       "formId": "3c8f2a1e-6b4d-4f7a-9e2c-5d1b8a7f6e30",
 *       "metaSiteId": "9f1d7c3a-2e8b-4a6f-b5c4-1d0e9a8b7c62",
 *       "_createdDate": "2024-01-15T10:30:00.000Z",
 *       "_updatedDate": "2024-01-15T10:30:00.000Z",
 *       "accountSlug": "maple-studio"
 *     }
 *   ],
 *   "metadata": {
 *     "count": 1,
 *     "cursors": {},
 *     "hasNext": false
 *   }
 * }
 */

```

### queryStandaloneForms (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 { standaloneForms } from '@wix/standalone-forms';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function queryStandaloneForms(query) {
  const response = await myWixClient.standaloneForms.queryStandaloneForms(query);
};
```

---