Download ZIP Archive
Download ZIP Archive
To download all files in a folder or an entire folder structure, you have to create and download a ZIP archive.
Create a ZIP Archive
First, you need to create a ZIP archive containing the files or the folder structure. You can include up to 10,000 file and folder IDs unless you reach the account’s upload limit.
curl -i -X POST "https://api.box.com/2.0/zip_downloads" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-d '{
"download_file_name": "January Financials",
"items": [
{
"type": "file",
"id": "12345"
},
{
"type": "file",
"id": "34325"
},
{
"type": "folder",
"id": "45678"
}
]
}'
The response will look similar to the following:
{
"download_url": "https://dl.boxcloud.com/2.0/zip_downloads/25gvaXcIE4QJlinNiw2oHAQ==ZFs3Q2Xpd7pKBz7OyzXNrUaoW3aJxQRN5znAvyM-KpdEEPdWcQDKU-Dl85Ew/content",
"status_url": "https://api.box.com/2.0/zip_downloads/25gvaXcIE4QJlinNiw2oHAQ==ZFs3Q2Xpd7pKBz7OyzXNrUaoW3aJxQRN5znAvyM-KpdEEPdWcQDKU-Dl85Ew/status",
"expires_at": "2023-02-28T10:23:54Z",
"name_conflicts": []
}
Extract the ZIP download ID
To download the ZIP archive, you need the ZIP download ID. You can find it in the response you got when you created the archive.
Go to status_url
and copy the ID located betweenzip_downloads
and content
:
25gvaXcIE4QJlinNiw2oHAQ==ZFs3Q2Xpd7pKBz7OyzXNrUaoW3aJxQRN5znAvyM-KpdEEPdWcQDKU-Dl85Ew
Download files
Place the download ID in the file location URL as in the sample below to point to the right files.
curl -L GET "https://dl.boxcloud.com/2.0/zip_downloads/29l00nfxDyHOt7RphI9zT_w==nDnZEDjY2S8iEWWCHEEiptFxwoWojjlibZjJ6geuE5xnXENDTPxzgbks_yY=/content" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-o sample_curl.zip
For downloads that take longer, you can monitor the download status using the status endpoint. This allows you to inspect the progress of the download as well as the number of items that might have been skipped.
curl -i -X GET "https://api.box.com/2.0/zip_downloads/29l00nfxDyHOt7RphI9zT_w==nDnZEDjY2S8iEWWCHEEiptFxwoWojjlibZjJ6geuE5xnXENDTPxzgbks_yY=/status" \
-H "authorization: Bearer <ACCESS_TOKEN>"