Transfer owned folders

put
https://api.box.com/2.0
/users/:user_id/folders/:folder_id

Move all of the items owned by a user into a new folder in another user’s account.

Only the root folder (0) can be transferred.

Folders can only be moved across users by users with administrative permissions.

This call will be performed synchronously which might lead to a slow response when the source user has a large number of items in all of its folders.

If the destination path has a metadata cascade policy attached to any of the parent folders, a metadata cascade operation will be kicked off asynchronously.

There is currently no way to check for when this operation is finished.

Request

application/json

Path Parameters

stringin pathrequired
0

The unique identifier that represent a folder.

The ID for any folder can be determined by visiting this folder in the web application and copying the ID from the URL. For example, for the url https://*.app.box.com/folder/123 the folder_id is 123.

The root folder of a Box account is always represented by the ID 0.

stringin pathrequired
12345

The ID of the user.

Query Parameters

string arrayin queryoptional
id,type,name

A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response.

Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested.

booleanin queryoptional
true

Determines if users should receive email notification for the action performed.

Request Body

objectin body

The user who the folder will be transferred to

stringin bodyrequired
1232234

The ID of the user who the folder will be transferred to

Response

application/jsonFolder

Returns the information for the newly created destination folder.

You can now try out some of our APIs live, right here in the documentation.
Log In

Request Example

cURL
curl -X PUT https://api.box.com/2.0/users/12345/folders/0 \
     -H "Authorization: Bearer <ACCESS_TOKEN>" \
     -H "Content-Type: application/json" \
     -d '{
       "owned_by": {
         "id": "1232234"
       }
     }'
.NET
var sourceUserId = "33333";
var destinationUserId = "44444";
BoxFolder movedFolder = await client.MoveUserFolderAsync(sourceUserId, destinationUserId);
Java
String sourceUserID = "11111";
String destinationUserID = "22222";
BoxUser sourceUser = new BoxUser(api, sourceUserID);
BoxFolder.Info transferredFolderInfo = sourceUser.transferContent(destinationUserID);
Python
source_user_id = '33333'
destination_user_id = '44444'

user = client.user(source_user_id)
destination_user = client.user(destination_user_id)

folder = user.transfer_content(destination_user)
print('Created new folder "{0}" in the account of user {1}'.format(folder.name, destination_user.id))
Node
var sourceUserID = '33333';
var destinationUserID = '44444';
client.enterprise.transferUserContent(sourceUserID, destinationUserID)
	.then(movedFolder => {
		/* movedFolder -> {
			type: 'folder',
			id: '123456789',
			sequence_id: '1',
			etag: '1',
			name: 'Other User's Files and Folders',
			created_at: '2018-04-23T11:00:07-07:00',
			modified_at: '2018-04-23T11:00:07-07:00',
			description: 'This folder contains files previously owned by Other User, and were transferred to you by your enterprise administrator. If you have any questions, please contact Enterprise Admin (admin@example.com).',
			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: '99999',
				name: 'Enterprise Admin',
				login: 'admin@example.com' },
			modified_by: 
			{ type: 'user',
				id: '99999',
				name: 'Enterprise Admin',
				login: 'admin@example.com' },
			trashed_at: null,
			purged_at: null,
			content_created_at: '2018-04-23T11:00:07-07:00',
			content_modified_at: '2018-04-23T11:00:07-07:00',
			owned_by: 
			{ type: 'user',
				id: '33333',
				name: 'Example User',
				login: 'user@example.com' },
			shared_link: null,
			folder_upload_email: null,
			parent: 
			{ type: 'folder',
				id: '0',
				sequence_id: null,
				etag: null,
				name: 'All Files' },
			item_status: 'active' }
		*/
	});

Response Example

{
  "id": 12345,
  "etag": 1,
  "type": "folder",
  "sequence_id": 3,
  "name": "Contracts",
  "created_at": "2012-12-12T10:53:43-08:00",
  "modified_at": "2012-12-12T10:53:43-08:00",
  "description": "Legal contracts for the new ACME deal",
  "size": 629644,
  "path_collection": {
    "total_count": 1,
    "entries": [
      {
        "id": 12345,
        "etag": 1,
        "type": "folder",
        "sequence_id": 3,
        "name": "Contracts"
      }
    ]
  },
  "created_by": {
    "id": 11446498,
    "type": "user",
    "name": "Aaron Levie",
    "login": "ceo@example.com"
  },
  "modified_by": {
    "id": 11446498,
    "type": "user",
    "name": "Aaron Levie",
    "login": "ceo@example.com"
  },
  "trashed_at": "2012-12-12T10:53:43-08:00",
  "purged_at": "2012-12-12T10:53:43-08:00",
  "content_created_at": "2012-12-12T10:53:43-08:00",
  "content_modified_at": "2012-12-12T10:53:43-08:00",
  "expires_at": "2012-12-12T10:53:43-08:00",
  "owned_by": {
    "id": 11446498,
    "type": "user",
    "name": "Aaron Levie",
    "login": "ceo@example.com"
  },
  "shared_link": {
    "url": "https://www.box.com/s/vspke7y05sb214wjokpk",
    "download_url": "https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg",
    "vanity_url": "https://acme.app.box.com/v/my_url/",
    "access": "open",
    "effective_access": "company",
    "effective_permission": "can_download",
    "unshared_at": "2018-04-13T13:53:23-07:00",
    "is_password_enabled": true,
    "permissions": {
      "can_download": true,
      "can_preview": true
    },
    "download_count": 3,
    "preview_count": 3
  },
  "folder_upload_email": {
    "access": "open",
    "email": "upload.Contracts.asd7asd@u.box.com"
  },
  "parent": {
    "id": 12345,
    "etag": 1,
    "type": "folder",
    "sequence_id": 3,
    "name": "Contracts"
  },
  "item_status": "active",
  "item_collection": {
    "total_count": 5000,
    "limit": 1000,
    "offset": 2000,
    "order": [
      {
        "by": "type",
        "direction": "ASC"
      }
    ],
    "entries": [
      {
        "id": 12345,
        "etag": 1,
        "type": "file",
        "sequence_id": 3,
        "name": "Contract.pdf"
      }
    ]
  },
  "sync_state": "synced",
  "has_collaborations": true,
  "permissions": {
    "can_delete": true,
    "can_download": true,
    "can_invite_collaborator": true,
    "can_rename": true,
    "can_set_share_access": true,
    "can_share": true,
    "can_upload": true
  },
  "tags": [
    "approved"
  ],
  "can_non_owners_invite": true,
  "is_externally_owned": true,
  "is_collaboration_restricted_to_enterprise": true,
  "allowed_shared_link_access_levels": [
    "open"
  ],
  "allowed_invitee_roles": [
    "open"
  ],
  "watermark_info": {
    "is_watermarked": true
  },
  "can_non_owners_view_collaborators": true
}