Skip to main content

Documentation Index

Fetch the complete documentation index at: https://developer.box.com/llms.txt

Use this file to discover all available pages before exploring further.

Box is a cloud-based, intelligent content management and file sharing platform for storing, accessing, and collaborating on content from anywhere.

Sign up for a free account

Confirm your email address to activate your developer account.

Upload a file to Box

The Upload file endpoint allows you to upload a single file to Box through the upload domain https://upload.box.com/api/2.0/files/content.
The maximum file size is 50MB. For larger files, use the .
A pre-built application is created for you to get started. Create a developer token to authenticate your requests. Go to the Developer Console > your pre-built application and find the App Details section. Locate the Developer Token field, select Generate Developer Token, and copy it.
Developer tokens expire one hour after you generate them.
We prepared an example invoice document for you to upload. Download it and save it as invoice.pdf.
Create and activate a Python virtual environment.
python3 -m venv .venv
source .venv/bin/activate
Install the Box Python SDK by running the following command using .
pip install "boxsdk>=10"
Make sure you use the most up-to-date version number of the Python SDK. Refer to the .
Obtain a client with your developer token:
from box_sdk import BoxClient, BoxDeveloperTokenAuth

auth = BoxDeveloperTokenAuth(token="YOUR_DEVELOPER_TOKEN")
client = BoxClient(auth=auth)
Never commit .env files to version control. Add .env to your .gitignore.
Then call the upload API as follows.
client.uploads.upload_file(
    UploadFileAttributes(
        name="invoice.pdf", parent=UploadFileAttributesParentField(id="0")
    ),
    file_content_stream,
)
Execute the script to upload the file.

List files in a folder

Now let’s list all files in the root folder.
Run the following command to list all files in the root folder.
client.folders.get_folder_items("0")
Congratulations! 🎉 You’ve uploaded your first file to Box and listed all files in the root folder.

What’s next

Explore the following resources: