Create Folder

Create Folder

To create a folder in Box you will need to provide our API with a name for the new folder, as well as the id of the parent folder that you would like to create the new folder within.

cURL
curl -i -X POST "https://api.box.com/2.0/folders" \
     -H "Authorization: Bearer <ACCESS_TOKEN>" \
     -H "Content-Type: application/json" \
     -d '{
       "name": "New Folder",
       "parent": {
         "id": "0"
       }
     }'
Java
BoxFolder parentFolder = new BoxFolder(api, "id");
BoxFolder.Info childFolderInfo = parentFolder.createFolder("Child Folder Name");
Python
subfolder = client.folder('0').create_subfolder('My Stuff')
print('Created subfolder with ID {0}'.format(subfolder.id))
iOS
client.folders.create(name: "New Folder", parentId: "22222") { (result: Result<Folder, BoxSDKError>) in
    guard case let .success(folder) = result else {
        print("Error creating folder")
        return
    }

    print("Created folder \"\(folder.name)\" inside of folder \"\(folder.parent.name)\"")
}

Name restrictions

There are some restrictions to the file name. Names containing non-printable ASCII characters, forward and backward slashes (/, \), as well as names with trailing spaces are prohibited.

Additionally, the names . and .. are reserved names and therefore also prohibited.