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 installed (pip install "boxsdk~=10")
  • 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 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 upload_big_file method uploads the file in parts automatically. Run a preflight check first so that you can handle name conflicts before you start the upload. When a file with the same name already exists, upload_chunked_file creates a session for the existing file and uploads a new version with the upload_file_via_session helper shown in the next section.
Python v10

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
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 June 10, 2026