Skip to main content

Box Storage

Load data from Box Storage.

Configure via UI

We can load data from Box using one of two different types of authentication, either a Developer Token or a Client Credential Grant.

1. Developer Token Authentication Mechanism

Developer Tokens are short lived and can be created in the Box Developer Console.

box

2. Client Credential Grant Authentication Mechanism

These credentials can be used to access Box data for a specific user or an entire enterprise and are longer-lived than Developer Tokens. You can use either an Enterprise ID or a User ID to authenticate.

Setting up Box CCG Credentials

  1. Log in to your Box account / Create a Box developer account and navigate to the developer console.
  2. Create a new custom app.
  3. Select "Server Authentication (Client Credentials Grant)" as the authentication method.
  4. Under "App Access Level", select App + Enterprise Access.
  5. We recommend giving your app all permissions, as shown: box
  6. Save your changes and submit the app for authorization.
  7. Open the Box Admin console. As an admin, authorize the app in the Custom Apps Manager.
  8. Once the app is enabled, get your User ID, Enterprise ID, Client ID and Client Secret from app console in developer console.

1. Client Credential Grant Authentication Mechanism using an Enterprise ID

Note that to access files via an Enterprise ID, they need to have been shared with that app. You can share files with an app by its email address, which can be found in the Developer Console under "Service Account Info".

box

2. Client Credential Grant Authentication Mechanism using a User ID

If you are using a User ID, you can access files that have been shared with or created by that user. This will be the user ID of the person who created the app.

box

Configure via API / Client

1. Developer Token Authentication Mechanism

from llama_cloud.types import CloudBoxDataSource

ds = {
'name': '<your-name>',
'source_type': 'BOX',
'component': CloudBoxDataSource(
folder_id='<folder_id>', # Optional
developer_token='<token>', # Developer Tokens are short lived
)
}
data_source = client.data_sources.create_data_source(request=ds)

2. Client Credential Grant Authentication Mechanism

from llama_cloud.types import CloudBoxDataSource

ds = {
'name': '<your-name>',
'source_type': 'BOX',
'component': CloudBoxDataSource(
folder_id='<folder_id>', # Optional
client_id='<client_id>',
client_secret='<client_secret>',
user_id='<user_id>', # Optional, if using enterprise_id
enterprise_id='<enterprise_id>' # Optional, if using user_id
)
}
data_source = client.data_sources.create_data_source(request=ds)