Retrieves details for a folder, including the first 100 entries in the folder.
Passing sort
, direction
, offset
, and limit
parameters in query allows you to manage the
list of returned
folder items.
To fetch more items within the folder, use the Get items in a folder endpoint.
This operation is performed by calling function get_folder_by_id
.
See the endpoint docs at API Reference.
client.folders.get_folder_by_id("0")
- folder_id
str
- 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
thefolder_id
is123
. The root folder of a Box account is always represented by the ID0
. Example: "12345"
- 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
- fields
Optional[List[str]]
- 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. Additionally this field can be used to query any metadata applied to the file by specifying the
metadata
field as well as the scope and key of the template to retrieve, for example?fields=metadata.enterprise_12345.contractTemplate
.
- 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. Additionally this field can be used to query any metadata applied to the file by specifying the
- sort
Optional[GetFolderByIdSort]
- Defines the second attribute by which items are sorted. The folder type affects the way the items are sorted: _ Standard folder: Items are always sorted by their
type
first, with folders listed before files, and files listed before web links. _ Root folder: This parameter is not supported for marker-based pagination on the root folder (the folder with anid
of0
). * Shared folder with parent path to the associated folder visible to the collaborator: Items are always sorted by theirtype
first, with folders listed before files, and files listed before web links.
- Defines the second attribute by which items are sorted. The folder type affects the way the items are sorted: _ Standard folder: Items are always sorted by their
- direction
Optional[GetFolderByIdDirection]
- The direction to sort results in. This can be either in alphabetical ascending (
ASC
) or descending (DESC
) order.
- The direction to sort results in. This can be either in alphabetical ascending (
- offset
Optional[int]
- The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
- limit
Optional[int]
- The maximum number of items to return per page.
- if_none_match
Optional[str]
- Ensures an item is only returned if it has changed. Pass in the item's last observed
etag
value into this header and the endpoint will fail with a304 Not Modified
if the item has not changed since.
- Ensures an item is only returned if it has changed. Pass in the item's last observed
- boxapi
Optional[str]
- The URL, and optional password, for the shared link of this item. This header can be used to access items that have not been explicitly shared with a user. Use the format
shared_link=[link]
or if a password is required then useshared_link=[link]&shared_link_password=[password]
. This header can be used on the file or folder shared, as well as on any files or folders nested within the item.
- The URL, and optional password, for the shared link of this item. This header can be used to access items that have not been explicitly shared with a user. Use the format
- extra_headers
Optional[Dict[str, Optional[str]]]
- Extra headers that will be included in the HTTP request.
This function returns a value of type FolderFull
.
Returns a folder, including the first 100 entries in the folder.
If you used query parameters like
sort
, direction
, offset
, or limit
the folder items list will be affected accordingly.
To fetch more items within the folder, use the Get items in a folder) endpoint.
Not all available fields are returned by default. Use the fields query parameter to explicitly request any specific fields.
Updates a folder. This can be also be used to move the folder, create shared links, update collaborations, and more.
This operation is performed by calling function update_folder_by_id
.
See the endpoint docs at API Reference.
client.folders.update_folder_by_id(
folder_to_update.id, name=updated_name, description="Updated description"
)
- folder_id
str
- 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
thefolder_id
is123
. The root folder of a Box account is always represented by the ID0
. Example: "12345"
- 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
- name
Optional[str]
- The optional new name for this folder.
- description
Optional[str]
- The optional description of this folder
- sync_state
Optional[UpdateFolderByIdSyncState]
- Specifies whether a folder should be synced to a user's device or not. This is used by Box Sync (discontinued) and is not used by Box Drive.
- can_non_owners_invite
Optional[bool]
- Specifies if users who are not the owner of the folder can invite new collaborators to the folder.
- tags
Optional[List[str]]
- The tags for this item. These tags are shown in the Box web app and mobile apps next to an item. To add or remove a tag, retrieve the item's current tags, modify them, and then update this field. There is a limit of 100 tags per item, and 10,000 unique tags per enterprise.
- is_collaboration_restricted_to_enterprise
Optional[bool]
- Specifies if new invites to this folder are restricted to users within the enterprise. This does not affect existing collaborations.
- collections
Optional[List[UpdateFolderByIdCollections]]
- An array of collections to make this folder a member of. Currently we only support the
favorites
collection. To get the ID for a collection, use the [List all collections][1] endpoint. Passing an empty array[]
ornull
will remove the folder from all collections. [1]: e://get-collections
- An array of collections to make this folder a member of. Currently we only support the
- can_non_owners_view_collaborators
Optional[bool]
- Restricts collaborators who are not the owner of this folder from viewing other collaborations on this folder. It also restricts non-owners from inviting new collaborators. When setting this field to
false
, it is required to also setcan_non_owners_invite_collaborators
tofalse
if it has not already been set.
- Restricts collaborators who are not the owner of this folder from viewing other collaborations on this folder. It also restricts non-owners from inviting new collaborators. When setting this field to
- fields
Optional[List[str]]
- 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.
- if_match
Optional[str]
- Ensures this item hasn't recently changed before making changes. Pass in the item's last observed
etag
value into this header and the endpoint will fail with a412 Precondition Failed
if it has changed since.
- Ensures this item hasn't recently changed before making changes. Pass in the item's last observed
- extra_headers
Optional[Dict[str, Optional[str]]]
- Extra headers that will be included in the HTTP request.
This function returns a value of type FolderFull
.
Returns a folder object for the updated folder
Not all available fields are returned by default. Use the fields query parameter to explicitly request any specific fields.
This call will return synchronously. This holds true even when moving folders with a large a large number of items in all of its descendants. For very large folders, this means the call could take minutes or hours to return.
Deletes a folder, either permanently or by moving it to the trash.
This operation is performed by calling function delete_folder_by_id
.
See the endpoint docs at API Reference.
client.folders.delete_folder_by_id(new_folder.id)
- folder_id
str
- 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
thefolder_id
is123
. The root folder of a Box account is always represented by the ID0
. Example: "12345"
- 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
- recursive
Optional[bool]
- Delete a folder that is not empty by recursively deleting the folder and all of its content.
- if_match
Optional[str]
- Ensures this item hasn't recently changed before making changes. Pass in the item's last observed
etag
value into this header and the endpoint will fail with a412 Precondition Failed
if it has changed since.
- Ensures this item hasn't recently changed before making changes. Pass in the item's last observed
- extra_headers
Optional[Dict[str, Optional[str]]]
- Extra headers that will be included in the HTTP request.
This function returns a value of type None
.
Returns an empty response when the folder is successfully deleted or moved to the trash.
Retrieves a page of items in a folder. These items can be files, folders, and web links.
To request more information about the folder itself, like its size, use the Get a folder endpoint instead.
This operation is performed by calling function get_folder_items
.
See the endpoint docs at API Reference.
client.folders.get_folder_items(folder_origin.id)
- folder_id
str
- 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
thefolder_id
is123
. The root folder of a Box account is always represented by the ID0
. Example: "12345"
- 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
- fields
Optional[List[str]]
- 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. Additionally this field can be used to query any metadata applied to the file by specifying the
metadata
field as well as the scope and key of the template to retrieve, for example?fields=metadata.enterprise_12345.contractTemplate
.
- 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. Additionally this field can be used to query any metadata applied to the file by specifying the
- usemarker
Optional[bool]
- Specifies whether to use marker-based pagination instead of offset-based pagination. Only one pagination method can be used at a time. By setting this value to true, the API will return a
marker
field that can be passed as a parameter to this endpoint to get the next page of the response.
- Specifies whether to use marker-based pagination instead of offset-based pagination. Only one pagination method can be used at a time. By setting this value to true, the API will return a
- marker
Optional[str]
- Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires
usemarker
to be set totrue
.
- Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires
- offset
Optional[int]
- The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
- limit
Optional[int]
- The maximum number of items to return per page.
- sort
Optional[GetFolderItemsSort]
- Defines the second attribute by which items are sorted. The folder type affects the way the items are sorted: _ Standard folder: Items are always sorted by their
type
first, with folders listed before files, and files listed before web links. _ Root folder: This parameter is not supported for marker-based pagination on the root folder (the folder with anid
of0
). * Shared folder with parent path to the associated folder visible to the collaborator: Items are always sorted by theirtype
first, with folders listed before files, and files listed before web links.
- Defines the second attribute by which items are sorted. The folder type affects the way the items are sorted: _ Standard folder: Items are always sorted by their
- direction
Optional[GetFolderItemsDirection]
- The direction to sort results in. This can be either in alphabetical ascending (
ASC
) or descending (DESC
) order.
- The direction to sort results in. This can be either in alphabetical ascending (
- boxapi
Optional[str]
- The URL, and optional password, for the shared link of this item. This header can be used to access items that have not been explicitly shared with a user. Use the format
shared_link=[link]
or if a password is required then useshared_link=[link]&shared_link_password=[password]
. This header can be used on the file or folder shared, as well as on any files or folders nested within the item.
- The URL, and optional password, for the shared link of this item. This header can be used to access items that have not been explicitly shared with a user. Use the format
- extra_headers
Optional[Dict[str, Optional[str]]]
- Extra headers that will be included in the HTTP request.
This function returns a value of type Items
.
Returns a collection of files, folders, and web links contained in a folder.
Creates a new empty folder within the specified parent folder.
This operation is performed by calling function create_folder
.
See the endpoint docs at API Reference.
client.folders.create_folder(new_folder_name, CreateFolderParent(id="0"))
- name
str
- The name for the new folder. 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 not allowed either.
- The name for the new folder. There are some restrictions to the file name. Names containing non-printable ASCII characters, forward and backward slashes (
- parent
CreateFolderParent
- The parent folder to create the new folder within.
- sync_state
Optional[CreateFolderSyncState]
- Specifies whether a folder should be synced to a user's device or not. This is used by Box Sync (discontinued) and is not used by Box Drive.
- fields
Optional[List[str]]
- 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.
- extra_headers
Optional[Dict[str, Optional[str]]]
- Extra headers that will be included in the HTTP request.
This function returns a value of type FolderFull
.
Returns a folder object.
Not all available fields are returned by default. Use the fields query parameter to explicitly request any specific fields.
Creates a copy of a folder within a destination folder.
The original folder will not be changed.
This operation is performed by calling function copy_folder
.
See the endpoint docs at API Reference.
client.folders.copy_folder(
folder_origin.id, CopyFolderParent(id="0"), name=copied_folder_name
)
- folder_id
str
- The unique identifier of the folder to copy. 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
thefolder_id
is123
. The root folder with the ID0
can not be copied. Example: "0"
- The unique identifier of the folder to copy. 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
- name
Optional[str]
- An optional new name for the copied folder. 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 not allowed either.
- An optional new name for the copied folder. There are some restrictions to the file name. Names containing non-printable ASCII characters, forward and backward slashes (
- parent
CopyFolderParent
- The destination folder to copy the folder to.
- fields
Optional[List[str]]
- 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.
- extra_headers
Optional[Dict[str, Optional[str]]]
- Extra headers that will be included in the HTTP request.
This function returns a value of type FolderFull
.
Returns a new folder object representing the copied folder.
Not all available fields are returned by default. Use the fields query parameter to explicitly request any specific fields.