Get 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 items in.

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-1000

The maximum number of items to return per page.

stringin queryoptional
JV9IRGZmieiBasejOG9yDCRNgd2ymoZIbjsxbJMjIs3kioVii

The position marker at which to begin the response.

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
1000

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.

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',
    {
        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' } ] }
        */
    });

Response Example

{
  "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"
    }
  ]
}