Manage Applications

    Create a folder

    Create a 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 -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"
           }
         }'
    .NET
    // Create a new folder in the user's root folder
    var folderParams = new BoxFolderRequest()
    {
        Name = "New folder",
        Parent = new BoxRequestEntity()
        {
            Id = "0"
        }
    };
    BoxFolder folder = client.FoldersManager.CreateAsync(folderParams);
    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))
    Node
    client.folders.create('0', 'New Folder')
        .then(folder => {
            /* folder -> {
                type: 'folder',
                id: '123456',
                sequence_id: '0',
                etag: '0',
                name: 'New Folder',
                created_at: '2012-12-12T10:53:43-08:00',
                modified_at: '2012-12-12T11:15:04-08:00',
                description: '',
                size: 0,
                path_collection: 
                { total_count: 1,
                    entries: 
                    [ { type: 'folder',
                        id: '0',
                        sequence_id: null,
                        etag: null,
                        name: 'All Files' } ] },
                created_by: 
                { type: 'user',
                    id: '22222',
                    name: 'Example User'
                    login: 'user@example.com' },
                modified_by: 
                { type: 'user',
                    id: '22222',
                    name: 'Example User',
                    login: 'user@example.com' },
                owned_by: 
                { type: 'user',
                    id: '22222',
                    name: 'Example User',
                    login: 'user@example.com' },
                shared_link: null,
                parent: 
                { type: 'folder',
                    id: '0',
                    sequence_id: null,
                    etag: null,
                    name: 'All Files' },
                item_status: 'active',
                item_collection: 
                { total_count: 0,
                    entries: [],
                    offset: 0,
                    limit: 100 } }
            */
        });

    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 special names . and .. are reserved names and therefore also prohibited.