---
agentTools:
  projectIndex: https://docs.cancergenomicscloud.org/llms.txt
---

# Create a folder

/files

This call creates a new folder.

Every project on the CGC is represented by a root folder which contains all the files associated with a particular project. You can create nesting folders and subfolders within this root folder by using this API request.

Once you've created a folder, you can [copy](https://docs.cancergenomicscloud.org/docs/copy-a-file-between-folders) or [move](move-a-file-between-folders) files between folders to populate your newly created folder.

To list the contents of the main project folder, first make the API request to [get project details](https://docs.cancergenomicscloud.org/docs/get-project-details) which will return the ID of the main folder (key: `root_folder`). Next, use the [list folder contents](https://docs.cancergenomicscloud.org/docs/list-folder-contents) call and specify this ID.

[block:code]
{
  "codes": [
    {
      "code": "https://cgc-api.sbgenomics.com/v2/files",
      "language": "text",
      "name": "Path"
    }
  ]
}
[/block]

\##Request
\###Example request

[block:code]
{
  "codes": [
    {
      "code": "POST /v2/files HTTP/1.1\nHost: cgc-api.sbgenomics.com\nX-SBG-Auth-Token: 3210a98c1db9318fa9d9273156740f74\nContent-Type: application/json\n",
      "language": "http",
      "name": null
    },
    {
      "code": "curl -X POST -H \"X-SBG-Auth-Token: 3210a98c1db9318fa9d9273156740f74\" -H \"Content-Type: application/json\" -d '{\n    \"name\" : \"my new folder\",\n    \"type\" : \"folder\",\n    \"parent\": \"568e69abe9b0307bc0414164\"\n}",
      "language": "curl",
      "name": "cURL"
    }
  ],
  "sidebar": true
}
[/block]

\###Header Fields

[block:parameters]
{
  "data": {
    "h-0": "Name",
    "h-1": "Description",
    "0-0": " X-SBG-Auth-Token\n*required* ",
    "0-1": "Your CGC [authentication token](https://docs.cancergenomicscloud.org/docs/get-your-authentication-token).",
    "h-2": "",
    "1-0": " Content-Type\n*required* ",
    "1-1": "`application/json`"
  },
  "cols": 2,
  "rows": 2
}
[/block]

\###Request body
In the request body, you should enter the following list of key-value pairs:

[block:parameters]
{
  "data": {
    "h-0": "Name",
    "h-1": "Data type",
    "h-2": "Description",
    "0-0": "`name`\n_required_",
    "0-1": "String",
    "0-2": "The name of the folder. It shouldn't begin with \"__\".",
    "1-0": "`type`\n_required_",
    "1-1": "Enum",
    "1-2": "`folder`",
    "2-0": "`parent`",
    "2-1": "String",
    "2-2": "Specifies the ID of the parent folder for the new folder. \n\nYou should either specify a parent folder or the project name (see [List folder contents](https://docs.cancergenomicscloud.org/docs/list-folder-contents) for instructions on how to find the folder ID).",
    "3-0": "project",
    "3-1": "String",
    "3-2": "Project ID (`username/project_name`). \n\nYou should either specify a project name or the parent folder ID."
  },
  "cols": 3,
  "rows": 4
}
[/block]

\###Example request body

[block:code]
{
  "codes": [
    {
      "code": "{\n  \"name\": \"my new folder\", \n  \"parent\": \"568e69abe9b0307bc0414164\",\n  \"type\": \"FOLDER\"\n}",
      "language": "json"
    }
  ]
}
[/block]

\##Response

[See a list of CGC-specific response codes that may be contained in the body of the response.](https://docs.cancergenomicscloud.org/docs/api-status-codes)

\###Example response body

[block:code]
{
  "codes": [
    {
      "code": "{\n  \"href\": \"https://cgc-api.sbgenomics.com/v2/files/5800c606e4b07ecb1445de83\",\n  \"id\": \"5800c606e4b07ecb1445de83\",\n  \"name\": \"my new folder\",\n  \"parent\": \"568e69abe9b0307bc0414164\",\n  \"type\": \"FOLDER\",\n  \"created_on\": \"2016-10-10T14:06:25Z\",\n  \"modified_on\": \"2016-10-10T14:06:25Z\"\n}",
      "language": "json",
      "name": "Example response body"
    }
  ],
  "sidebar": true
}
[/block]