Box Python SDK


pip install boxsdk


Create a developer token from your app’s configuration page (

You’ll be prompted for it on the command line.

$ from boxsdk import DevelopmentClient
$ client = DevelopmentClient()
>>> Enter developer token: <enter your developer token>
$ me = client.user().get()

GET {'headers': {u'Authorization': u'Bearer ----KkeV',
             u'User-Agent': u'box-python-sdk-1.4.3'},
 'params': None}

{"type":"user","id":"----6009","name":"Jeffrey Meadows","login":"",...}

>>> Jeffrey Meadows

The DevelopmentClient uses Box developer tokens for auth (and will prompt you for a new token upon expiration), and logs API requests and responses, making it really easy to get started learning the SDK and Box API.

Creating an App for Users


If you’d like other users to use your app, you need to set up a way for them to authorize your app and grant it access to their Box account. The auth module contains several classes to help you do that.

The simplest class is the OAuth2 class. To use it, instantiate it with your client_id and client_secret.

Follow the tutorial on GitHub for instructions on how to get an authorized client for a user. Using the store_tokens callback, you may persist the user’s auth and refresh tokens for the next time they use your app. Once they return to your app, you can create an authorized client like so:

from boxsdk import OAuth2, Client

oauth = OAuth2(
client = Client(oauth)

Making requests to Box

Once you have an authorized client, you can use it to make requests to Box on your user’s behalf. The client has several methods to help you get started, many of which return Box objects, which, in turn, have methods that correspond to Box API endpoints.

The module documentation below describes each of these methods and which parameters they require. Some API endpoints do not have corresponding SDK methods; for those, you can use the generic make_request method of the client.

Module Documentation

Indices and tables