> 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

# QueryFolders

# Package: sites

# Namespace: SiteFoldersServiceV2

# Method link: https://dev.wix.com/docs/api-reference/account-level/sites/site-folders/query-folders.md

## Introduction

Retrieves a list folders, given the provided paging, sorting and filtering.
> **Important**: You can only call this method when authenticated as a Wix user or by using an account level API key.

---

## REST API

### Schema

```
 Method: queryFolders
 Description: Retrieves a list folders, given the provided paging, sorting and filtering. > **Important**: You can only call this method when authenticated as a Wix user or by using an account level API key.
 URL: https://www.wixapis.com/site-folders/v2/folders/query
 Method: POST
 Method parameters:
   param name: query | type: QueryV2    
     - name: paging | type: Paging | description: Paging options to limit and skip the number of items (default limit is 1000).  
        - name: limit | type: integer | description: Number of items to load.  | validation: minimum 0, format int32
        - name: offset | type: integer | description: Number of items to skip in the current sort order.  | validation: minimum 0, format int32
        - name: filter | type: object | description: Filter folders by name/id/parentId in the following format: `"filter" : { "name": "my-folder", "id":{"$in":["value1", "value2"]}, "parentId": "value", }`. Examples: - `{"filter": {"name": "my folder"}}` - `{"filter": {"name": {"$startsWith" :"my folder"}}}` - `{"filter": {"name": {"$contains" :"my folder"}}}` - `{"filter": {"id": "d20c988a-5f6f-4b55-aeb1-0dfb7646da38"}}` - `{"filter": {"id":{"$in":["6a26dd24-af0b-474a-813a-c442093483a9", "d5f5f00d-b600-4114-8ff0-e86005c050ce"]}}}` - `{"filter": {"parentId":{"283f4660-8f6f-462b-94a1-160a57338032"}}}` - `{"filter": {"parentId": { "$exists": false }}}` - query root's folders  
        - name: sort | type: array<Sorting> | description: Sort object in the following format: `[{"fieldName":"name","order":"ASC"}]`. Examples: - `{"sort": [{"fieldName":"name","order":"ASC"}]}`  | validation: minItems 0, maxItems 4
           - 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
           - name: origin | type: AddressLocation | description: Origin point for geo-distance sorting on a GEO field results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).  
              - name: latitude | type: number | description: Address latitude.  | validation: format double
              - name: longitude | type: number | description: Address longitude.  | validation: format double
 Return type: QueryFoldersResponse
  - name: folders | type: array<Folder> | description: List of retrieved folders. Maximal number of retrieved folders is 1000.  
     - name: id | type: string | description: Folder GUID.  | read-only: true | validation: format GUID
     - name: name | type: string | description: Folder name.  
     - name: createdDate | type: string | description: Date the folder was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date the folder was last updated.  | read-only: true | validation: format date-time
     - name: siteCount | type: integer | description: Number of sites in the folder.  | read-only: true 
     - name: parentId | type: string | description: Parent folder GUID. When empty, the site is at root level.  
     - name: path | type: array<FolderBasicInfo> | description: Path including all parent folders from root to the current folder, in order. When empty, the site or folder is at root level.  | read-only: true | validation: maxItems 50
        - name: id | type: string | description: Folder GUID.  | read-only: true | validation: format GUID
        - name: name | type: string | description: Folder name.  | read-only: true 
  - name: metadata | type: PagingMetadataV2 | description: Meta data about the returned folders  
     - name: count | type: integer | description: Number of items returned in the response.  | validation: format int32
     - name: offset | type: integer | description: Offset that was requested.  | validation: format int32
     - name: total | type: integer | description: Total number of items that match the query.  | validation: format int32
     - name: tooManyToCount | type: boolean | description: Flag that indicates the server failed to calculate the `total` field.  


```

### Examples

### QueryFolders
```curl
curl -X POST 'https://www.wixapis.com/site-folders/v2/folders/query' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'Authorization: <AUTH>' \
  -H 'wix-account-id: 4eef80de-db78-465c-8f30-96004676c394' \
  -d '{"query":{"filter":{"name":{"$contains":"Folder"}}}}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.sites.siteFolders.queryFolders(options)
 Description: Retrieves a list folders, given the provided paging, sorting and filtering. > **Important**: You can only call this method when authenticated as a Wix user or by using an account level API key.
 Method parameters:
   param name: options | type: QueryFoldersOptions  none  
        - name: query | type: QueryV2 | description: Filtering, sorting and paging for retrieving the folders.  
           - ONE-OF: 
              - name: paging | type: Paging | description: Paging options to limit and skip the number of items (default limit is 1000).  
                 - name: limit | type: integer | description: Number of items to load.  | validation: minimum 0, format int32
                 - name: offset | type: integer | description: Number of items to skip in the current sort order.  | validation: minimum 0, format int32
           - name: filter | type: object | description: Filter folders by name/id/parentId in the following format: `"filter" : { "name": "my-folder", "id":{"$in":["value1", "value2"]}, "parentId": "value", }`. Examples: - `{"filter": {"name": "my folder"}}` - `{"filter": {"name": {"$startsWith" :"my folder"}}}` - `{"filter": {"name": {"$contains" :"my folder"}}}` - `{"filter": {"id": "d20c988a-5f6f-4b55-aeb1-0dfb7646da38"}}` - `{"filter": {"id":{"$in":["6a26dd24-af0b-474a-813a-c442093483a9", "d5f5f00d-b600-4114-8ff0-e86005c050ce"]}}}` - `{"filter": {"parentId":{"283f4660-8f6f-462b-94a1-160a57338032"}}}` - `{"filter": {"parentId": { "$exists": false }}}` - query root's folders  
           - name: sort | type: array<Sorting> | description: Sort object in the following format: `[{"fieldName":"name","order":"ASC"}]`. Examples: - `{"sort": [{"fieldName":"name","order":"ASC"}]}`  | validation: minItems 0, maxItems 4
              - 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
              - name: origin | type: AddressLocation | description: Origin point for geo-distance sorting on a GEO field results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).  
                 - name: latitude | type: number | description: Address latitude.  
                 - name: longitude | type: number | description: Address longitude.  
 Return type: PROMISE<QueryFoldersResponse>
  - name: folders | type: array<Folder> | description: List of retrieved folders. Maximal number of retrieved folders is 1000.  
     - name: _id | type: string | description: Folder GUID.  | read-only: true | validation: format GUID
     - name: name | type: string | description: Folder name.  
     - name: _createdDate | type: Date | description: Date the folder was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date the folder was last updated.  | read-only: true 
     - name: siteCount | type: integer | description: Number of sites in the folder.  | read-only: true 
     - name: parentId | type: string | description: Parent folder GUID. When empty, the site is at root level.  
     - name: path | type: array<FolderBasicInfo> | description: Path including all parent folders from root to the current folder, in order. When empty, the site or folder is at root level.  | read-only: true | validation: maxItems 50
        - name: _id | type: string | description: Folder GUID.  | read-only: true | validation: format GUID
        - name: name | type: string | description: Folder name.  | read-only: true 
  - name: metadata | type: PagingMetadataV2 | description: Meta data about the returned folders  
     - name: count | type: integer | description: Number of items returned in the response.  | validation: format int32
     - name: offset | type: integer | description: Offset that was requested.  | validation: format int32
     - name: total | type: integer | description: Total number of items that match the query.  | validation: format int32
     - name: tooManyToCount | type: boolean | description: Flag that indicates the server failed to calculate the `total` field.  


```

### Examples

### queryFolders
```javascript
import { siteFolders } from '@wix/sites';

async function queryFolders(options) {
  const response = await siteFolders.queryFolders(options);
};
```

### queryFolders (with elevated permissions)
```javascript
import { siteFolders } from '@wix/sites';
import { auth } from '@wix/essentials';

async function myQueryFoldersMethod(options) {
  const elevatedQueryFolders = auth.elevate(siteFolders.queryFolders);
  const response = await elevatedQueryFolders(options);
}
```

### queryFolders (self-managed)
Self-managed 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 { siteFolders } from '@wix/sites';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function queryFolders(options) {
  const response = await myWixClient.siteFolders.queryFolders(options);
};
```

---