> 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

# CreateFolder

# Package: sites

# Namespace: SiteFoldersServiceV2

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

## Introduction

Creates a folder.
> **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: createFolder
 Description: Creates a folder. > **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
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  folder.name
 Method parameters: 
   param name: folder | type: Folder    
        - name: name | type: string | description: Folder name. | required: true 
        - name: parentId | type: string | description: Parent folder GUID. When empty, the site is at root level.  
 Return type: CreateFolderResponse
  - name: folder | type: Folder | description: Folder data.  
     - 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 

 Possible Errors:
   HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: duplicate_folder_name | Description: There's already a folder with this name.


```

### Examples

### CreateFolder
```curl
curl -X POST 'https://www.wixapis.com/site-folders/v2/folders' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'Authorization: <AUTH>' \
  -H 'wix-account-id: 4339fba7-b533-4d10-a91b-822d825f29a5' \
  -d '{ "folder": {"name": "My Folder", "parentId": "root"}}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.sites.siteFolders.createFolder(options)
 Description: Creates a folder. > **Important**: You can only call this method when authenticated as a Wix user or by using an account level API key.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  options.folder.name
 Method parameters: 
   param name: options | type: CreateFolderOptions  none  
        - name: folder | type: Folder | description: Folder object to create.  
           - name: name | type: string | description: Folder name. | required: true 
           - name: parentId | type: string | description: Parent folder GUID. When empty, the site is at root level.  
 Return type: PROMISE<Folder>
  - 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 

 Possible Errors:
   HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: duplicate_folder_name | Description: There's already a folder with this name.


```

### Examples

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

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

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

async function myCreateFolderMethod(options) {
  const elevatedCreateFolder = auth.elevate(siteFolders.createFolder);
  const response = await elevatedCreateFolder(options);
}
```

### createFolder (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 createFolder(options) {
  const response = await myWixClient.siteFolders.createFolder(options);
};
```

---