Caution
box-typescript-sdk-gen is deprecated and no longer maintained. Do not use it for new projects.
Use box-node-sdk v10+ instead: npm install box-node-sdk.
To migrate existing code, see the migration guide.
As of September 17, 2025, Box Next Generation SDKs are no longer supported as separate artifacts. Your existing code will continue to work without changes, but you won't receive new features, updates, bug fixes, or security patches.
In keeping with industry best practices, we are consolidating the Box Next Generation SDKs and Box core SDKs into a single package. This makes migration easier and allows you to seamlessly add new capabilities to existing applications. Two consolidated versions are available in box-node-sdk:
- Version 4 (combined-sdk branch): Contains both
box-node-sdkandsdk-genpackages for gradual migration. - Version 10 (main branch): The latest major release containing only
sdk-gen.
For more details, see our SDK versioning strategy document.
This library provides access to the Box Platform API from TypeScript or JavaScript, in Node.js and in the browser.
- Deprecation notice
- Box TypeScript SDK Gen
- Table of contents
- Installing
- Getting Started
- Documentation
- Browser Support
- Upgrades
- Integration Tests
- Questions, Bugs, and Feature Requests?
- Copyright and License
Caution
This package is deprecated. For new projects, install box-node-sdk instead: npm install box-node-sdk.
npm install box-typescript-sdk-genIf you use yarn, please do this instead:
yarn add box-typescript-sdk-genThis is autogenerated Box SDK version.
The full API of this library is listed in api.md, with code samples for each manager in docs/.
To get started with the SDK, get a Developer Token from the Configuration page of your app in the Box Developer Console. You can use this token to make test calls for your own Box account.
The SDK provides an DeveloperTokenAuth class, which allows you to authenticate using your Developer Token.
Use instance of DeveloperTokenAuth to initialize Client object.
Using Client object you can access managers, which allow you to perform some operations on your Box account.
The example below demonstrates how to authenticate with Developer Token and print names of all items inside a root folder.
const { BoxClient, BoxDeveloperTokenAuth } = require('box-typescript-sdk-gen');
async function main(token) {
let auth = new BoxDeveloperTokenAuth({ token });
let client = new BoxClient({ auth });
let entries = (await client.folders.getFolderItems('0')).entries;
entries.forEach((entry) => console.log(entry));
}
main('INSERT YOUR DEVELOPER TOKEN HERE');In order to use in browser make sure you include the lib/bundle.js file and then you can access the classes like so:
const { BoxClient, BoxDeveloperTokenAuth } = window['box-typescript-sdk-gen'];See example.html for an example website using this SDK.
To run the example locally:
- Start the local server by running
npx serve -p 3000in the project directory. - Make sure
http://localhost:3000is allowlisted in CORS Domains of your application. - Head over to
http://localhost:3000/example.html. - Provide a fresh Developer Token to the dialog window that shows up upon running the example.
- Make sure that you get an alert message that includes your user name.
- api.md: every manager and method on
BoxClient, with signatures and return types. - docs/: code samples for each manager, plus guides for authentication, configuration, and the client.
- Box API Reference: the underlying REST API.
For box-node-sdk, the maintained replacement for this package, see its README and docs.
This SDK works in modern browsers that support ES6+ features. It seamlessly integrates with frontend frameworks like ReactJS, Angular, and NextJS. Check out our example below:
Upgrading from our legacy SDKs to the new generation SDKs is a straightforward process. See our migration guide and changelog for more information.
To run integration tests locally you will need a Custom App created in the Box Developer
Console with Server Authentication (with JWT) selected as authentication method.
Once created you can edit properties of the application:
- In section
App Access LevelselectApp + Enterprise Access. You can enable allApplication Scopes. - In section
Advanced FeaturesenableMake API calls using the as-user headerandGenerate user access tokens.
Now select Authorization and submit application to be reviewed by account admin.
- Select
Configurationtab and in the bottom in the sectionApp Settingsdownload your app configuration settings as JSON. - Encode configuration file to Base64, e.g. using command:
base64 -i path_to_json_file - Set environment variable:
JWT_CONFIG_BASE_64with base64 encoded jwt configuration file - Set environment variable:
BOX_FILE_REQUEST_IDwith ID of file request already created in the user account,BOX_EXTERNAL_USER_EMAILwith email of free external user which not belongs to any enterprise. - Set environment variable:
WORKFLOW_FOLDER_IDwith the ID of the Relay workflow that deletes the file that triggered the workflow. The workflow should have a manual start to be able to start it from the API. - Set environment variable:
APP_ITEM_ASSOCIATION_FILE_IDto the ID of the file with associated app item andAPP_ITEM_ASSOCIATION_FOLDER_IDto the ID of the folder with associated app item. - Set environment variable:
APP_ITEM_SHARED_LINKto the shared link associated with app item. - Set environment variable:
SLACK_AUTOMATION_USER_IDto the ID of the user responsible for the Slack automation,SLACK_ORG_IDto the ID of the Slack organization andSLACK_PARTNER_ITEM_IDto the ID of the Slack partner item.
Need to contact us directly? Browse the issues tickets! Or, if that doesn't work, file a new one and we will get back to you. If you have general questions about the Box API, you can post to the Box Developer Forum.
Copyright 2023 Box, Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
