List items in folder

get
https://api.box.com/2.0
/folders/:folder_id/items

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, please use the Get a folder endpoint instead.

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.

Query Parameters

stringin queryoptional
ASC

The direction to sort results in. This can be either in alphabetical ascending (ASC) or descending (DESC) order.

Value is one of ASC,DESC

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.

integer / int64in queryoptional
10001000

The maximum number of items to return per page.

stringin queryoptional
JV9IRGZmieiBasejOG9yDCRNgd2ymoZIbjsxbJMjIs3kioVii

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 to true.

integer / int64in queryoptional
10000

The offset of the item at which to begin the response.

stringin queryoptional
id

Defines the second attribute by which items are sorted.

Items are always sorted by their type first, with folders listed before files, and files listed before web links.

This parameter is not supported for marker-based pagination on the root folder (the folder with an ID of 0).

Value is one of id,name,date,size

booleanin queryoptional
true

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.

Response

application/jsonItems

Returns a collection of files, folders, and web links contained in a folder.

application/jsonClient error

Returned when the access token provided in the Authorization header is not recognized or not provided.

application/jsonClient error

Returned if the folder is not found, or the user does not have access to the folder.

application/jsonClient error

Returned if the folder_id is not in a recognized format.

application/jsonClient error

An unexpected client error.

get
List items in folder
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
curl -X GET https://api.box.com/2.0/folders/0/items \
     -H 'Authorization: Bearer <ACCESS_TOKEN>'
.NET
BoxCollection<BoxItem> folderItems = await client.FoldersManager.GetFolderItemsAsync("11111", 100);
Java
BoxFolder folder = new BoxFolder(api, "id");
for (BoxItem.Info itemInfo : folder) {
    if (itemInfo instanceof BoxFile.Info) {
        BoxFile.Info fileInfo = (BoxFile.Info) itemInfo;
        // Do something with the file.
    } else if (itemInfo instanceof BoxFolder.Info) {
        BoxFolder.Info folderInfo = (BoxFolder.Info) itemInfo;
        // Do something with the folder.
    }
}
Python
items = client.folder(folder_id='22222').get_items()
for item in items:
    print('{0} {1} is named "{2}"'.format(item.type.capitalize(), item.id, item.name))
Node
client.folders.getItems(
    '12345',
    {
        usemarker: 'false',
        fields: 'name',
        offset: 0,
        limit: 25
    })
    .then(items => {
        /* items -> {
            total_count: 2,
            entries: 
            [ { type: 'folder',
                id: '11111',
                sequence_id: '1',
                etag: '1',
                name: 'Personal Documents' },
                { type: 'file',
                id: '22222',
                sequence_id: '0',
                etag: '0',
                name: 'Q2 Strategy.pptx' } ],
            offset: 0,
            limit: 25,
            order: 
            [ { by: 'type', direction: 'ASC' },
                { by: 'name', direction: 'ASC' } ] }
        */
    });
iOS
let folderItems = client.folders.listItems(folderId: "22222", sort: .name, direction: .ascending) { results in
    switch results {
    case let .success(iterator):
        for i in 1 ... 10 {
            iterator.next { result in
                switch result {
                case let .success(item):
                    switch item {
                    case let .file(file):
                        print("File \(file.name) (ID: \(file.id)) is in the folder")
                    case let .folder(folder):
                        print("Subfolder \(folder.name) (ID: \(folder.id)) is in the folder")
                    case let .webLink(webLink):
                        print("Web link \(webLink.name) (ID: \(webLink.id)) is in the folder")
                    }
                case let .failure(error):
                    print(error)
                }
            }
        }
    case let .failure(error):
        print(error)
    }
}