Box Developer Documentation

Join BoxWorks 2024 to discover what's possible with content and AI!

Register now!

Move Folder

Move Folder

To move a folder, update the ID of its parent folder.

cURL
curl -i -X PUT "https://api.box.com/2.0/folders/4353455" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -H "content-type: application/json" \
     -d '{
       "name": "New folder name",
       "parent": {
         "id": "123"
       }
     }'
Node
var folderID = '11111';
var destinationFolderID = '22222';
client.folders.move(folderID, destinationfolderID)
    .then(folder => {
       /* folder -> {
            type: 'folder',
            id: '11111',
            sequence_id: '1',
            etag: '1',
            name: 'Pictures from 2017',
            created_at: '2012-12-12T10:53:43-08:00',
            modified_at: '2012-12-12T11:15:04-08:00',
            description: 'Some pictures I took',
            size: 629644,
            path_collection: 
            { total_count: 1,
                entries: 
                [ { type: 'folder',
                    id: '0',
                    sequence_id: null,
                    etag: null,
                    name: 'All Files' },
                  { type: 'folder',
                    id: '22222',
                    sequence_id: '3',
                    etag: '3',
                    name: 'Archives' } ] },
            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: '22222',
                sequence_id: '3',
                etag: '3',
                name: 'Archives' },
            item_status: 'active',
            item_collection: 
            { total_count: 1,
                entries: 
                [ { type: 'file',
                    id: '33333',
                    sequence_id: '3',
                    etag: '3',
                    sha1: '134b65991ed521fcfe4724b7d814ab8ded5185dc',
                    name: 'tigers.jpeg' } ],
                offset: 0,
                limit: 100 } }
        */
    });

Operation details

This call will return synchronously. This holds true even for folder moves when the folder contains a large number of items in all of its descendants. For very large folders, this means the call could take minutes or hours to complete and some parts of the tree are locked during moves.

When moving a folder, part of the file tree will be locked, mainly the source folder and all of its descendants, as well as the destination folder.

For the duration of the move you cannot perform other move, copy, delete, or restore operation on any of the locked folders.

Moving a subfolder to a private folder

When you attempt to move a collaborated subfolder to a private one, you will get the cannot_make_collaborated_subfolder_private error. In such a case, specify the ID of the user that folder belongs to setting the owned_by.id parameter in the request:

cURL
curl -i -X PUT "https://api.box.com/2.0/folders/4353455" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -H "content-type: application/json" \
     -d '{
       "name": "New folder name",
       "parent": {
         "id": "123"
       }
        "owned_by": {
         "id": "123456"
       }
     }'