Skip to main content
This tutorial covers two ways to upload content to Box by using the Python SDK: and . For chunked upload, you can use the SDK convenience method or manage the upload session yourself. Learn how each method works and how to combine with conflict handling to upload new files or update existing ones.
The code samples in this tutorial use the .

Prerequisites

  • A Box application with the scope (root_readwrite) enabled
  • Python 3.8 or later installed on your computer
  • The Box Python SDK v10.16.0 or later installed (pip install "boxsdk>=10.16")
  • An authenticated

Direct upload

To upload a file, call the upload_file method. For more information about the direct upload API, see . Run a first. If a file with the same name already exists, the error response includes the conflicting file ID. If you don’t want to override the content of the file with that name, change the name and upload it as a new file. The sample below assumes you want to override the file content, so it uses that ID to upload a :
Python v10
Calling upload_file on a folder creates a new file. Calling upload_file_version on an existing file uploads a new version.

Chunked upload

Use for files that are 20 MB or larger. Every chunked upload works through an : you create a session, , and to finalize the file. You have two options:
  • Convenience method: upload_big_file or upload_big_file_version runs all three steps for you.
  • Manual upload session: create the session, upload each part, and commit it yourself when you need full control.

Convenience method

The SDK uploads the file in parts for you:
  • upload_big_file uploads a new file to a folder.
  • upload_big_file_version uploads a new version of an existing file. Before it uploads each part, it checks whether Box already stores that part from the previous version and skips it if so, so the upload is faster. For details, see .
Run a preflight check first to handle name conflicts before you start the upload. When a file with the same name already exists, upload_chunked_file uses the conflicting file ID to upload a new version with upload_big_file_version:
Python v10
upload_big_file returns the new file. upload_big_file_version returns the updated file, or None when the returns 202 Accepted instead of a file.

Manual upload session

For full control over the upload, manage the session yourself. The upload_file_via_session helper uploads every part and commits the session for a session you pass in:
Python v10
This helper uploads every part, even when most of a new version matches the previous version. To skip unchanged parts, use upload_big_file_version, or with create_file_upload_session_plan_by_url and only upload the parts listed in misses.
Create the session before calling the helper. Run a preflight check first, then use create_file_upload_session for a new file. When a file with the same name already exists, upload_file_manual falls back to create_file_upload_session_for_existing_file to upload a new version:
Python v10

Resources

Last modified on November 12, 2026