Box Python Generated SDK
The `box-sdk-gen` library is the official Box Python SDK, designed for rapid API updates and comprehensive coverage of the Box API. However, as of September 17, 2025, this standalone package will no longer receive updates, bug fixes, or new features. Its functionalities have been consolidated into the `boxsdk` package (version 10.0.0 and higher), which now contains the `box_sdk_gen` module. Users are strongly advised to migrate to `boxsdk>=10` for continued support and access to the latest features. The current version is 1.17.0, and the consolidated `boxsdk` maintains a regular release cadence for minor/patch versions every 2-3 months.
Warnings
- breaking The standalone `box-sdk-gen` package is deprecated as of September 17, 2025. It will no longer receive new features, updates, bug fixes, or security patches. All future development is consolidated into the `boxsdk` package (version 10.0.0 and higher).
- gotcha When upgrading to `boxsdk` v10+, significant interface changes may be present, especially for older `boxsdk` users. While `box_sdk_gen` retains its internal structure, the overarching `boxsdk` client instantiation and some method signatures may have been updated.
- gotcha Using a Developer Token is suitable only for testing and development. These tokens are short-lived and cannot be refreshed, making them unsuitable for production applications.
- gotcha Specific authentication classes (e.g., for JWT, CCG) are located in submodules like `box_sdk_gen.jwt_auth` or `box_sdk_gen.ccg_auth`, not directly under `box_sdk_gen`.
Install
-
pip install box-sdk-gen -
pip install boxsdk>=10 -
pip install "boxsdk[jwt]>=10"
Imports
- BoxClient
from box_sdk_gen import BoxClient
- BoxDeveloperTokenAuth
from box_sdk_gen import BoxDeveloperTokenAuth
- BoxJWTAuth
from box_sdk_gen.jwt_auth import BoxJWTAuth
- CCGConfig
from box_sdk_gen.ccg_auth import CCGConfig
Quickstart
import os
from box_sdk_gen import BoxClient, BoxDeveloperTokenAuth
# It's recommended to set your developer token as an environment variable
# For testing, you can replace os.environ.get with your actual token string
DEVELOPER_TOKEN = os.environ.get('BOX_DEVELOPER_TOKEN', 'YOUR_DEVELOPER_TOKEN')
if not DEVELOPER_TOKEN or DEVELOPER_TOKEN == 'YOUR_DEVELOPER_TOKEN':
print("Please set the BOX_DEVELOPER_TOKEN environment variable or replace the placeholder.")
else:
try:
auth = BoxDeveloperTokenAuth(token=DEVELOPER_TOKEN)
client = BoxClient(auth=auth)
# Get information about the current user
me = client.users.get_user_me()
print(f"Hello, I'm {me.name} (ID: {me.id}) - Login: {me.login}")
# List items in the root folder (ID '0')
print("\nItems in your root folder:")
root_folder_items = client.folders.get_folder_items('0').entries
if root_folder_items:
for item in root_folder_items:
print(f" - {item.type.value.capitalize()}: {item.name} (ID: {item.id})")
else:
print(" No items found in the root folder.")
except Exception as e:
print(f"An error occurred: {e}")
print("Please ensure your developer token is valid and has the necessary permissions.")