Skip to main content
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 and list all files in the root folder

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. App Details
Developer tokens expire one hour after you generate them.
We prepared an example invoice document for you to upload. Create a root folder for your project, download the file , and save it in the folder.
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_gen import BoxClient, BoxDeveloperTokenAuth, UploadFileAttributes, UploadFileAttributesParentField
import json

auth = BoxDeveloperTokenAuth(token="YOUR_DEVELOPER_TOKEN")
client = BoxClient(auth=auth)
For production codebase, always store your credentials in a .env file and add .env to your .gitignore.
Then call the upload API as follows.
with open("demo-invoice-20tax-2.pdf", "rb") as file_content_stream:
    uploaded_file = client.uploads.upload_file(
        UploadFileAttributes(
            name="demo-invoice-20tax-2.pdf",
            parent=UploadFileAttributesParentField(id="0"),
        ),
        file_content_stream,
    )

items = client.folders.get_folder_items("0")
print(json.dumps(items.to_dict(), indent=2))
The get_folder_items command lists all files in the root folder. Execute the script to upload the file and list all files.
Congratulations! You’ve uploaded your first file to Box and listed all files in the root folder.

Use cases

Unsure if your use case is a good fit for Box Platform? You’re in the right place if:
  • Content is in the center of your use case
  • Your process involves moving content from one place to another
  • Your workflow can abide by waterfall permissions
  • Your process involves administrative tasks that can be automated
Some common customer solutions include:
  • Marketing asset management
  • Secure document vaults
  • Wealth management portals
  • Automatic folder creation based on user provisioning
  • Adding relevant metadata using machine learning
  • Claim reviews with built-in approval/rejection flows
  • Event monitoring for security and auditing

What’s next

Explore the following resources:
Last modified on June 26, 2026