Skip to content
This repository was archived by the owner on Nov 6, 2026. It is now read-only.
boxPublic archive

About

No description, website, or topics provided.

Resources

Contributing

Stars

6 stars

Watchers

5 watching

Forks

Repository files navigation

“box-dev-logo”

Deprecation notice

Caution

box-java-sdk-gen is deprecated and no longer maintained. Do not use it for new projects.

Use box-java-sdk v10+ instead: com.box:box-java-sdk from Maven Central. 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-java-sdk:

  • Version 5 (combined-sdk branch): Contains both com.box.sdk and com.box.sdkgen packages for gradual migration.
  • Version 10 (main branch): The latest major release containing only com.box.sdkgen.

For more details, see our SDK versioning strategy document.

Box Java SDK Gen

Project Status build Maven Central Version Platform Coverage

This library provides access to the Box Platform API from Java.

Table of contents

Installing

Caution

This package is deprecated. For new projects, install box-java-sdk instead: com.box:box-java-sdk from Maven Central.

To generate a .jar file download the source code and run the following command:

./gradlew build

.jar file will be generated in the build/libs directory.

The SDK is also available on Maven Central Repository. To include the SDK in your project, add the following dependency to your pom.xml file:

<dependency>
    <groupId>com.box</groupId>
    <artifactId>box-java-sdk-gen</artifactId>
    <version>VERSION</version>
</dependency>

To include the SDK in your project using Gradle, add the following dependency to your build.gradle file:

implementation 'com.box:box-java-sdk-gen:VERSION'

Where VERSION is the version of the SDK you want to use. You can find the latest version in the Maven Central Repository.

Getting Started

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 BoxDeveloperTokenAuth class, which allows you to authenticate using your Developer Token. Use instance of BoxDeveloperTokenAuth to initialize BoxClient object. Using BoxClient 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.

BoxDeveloperTokenAuth auth = new BoxDeveloperTokenAuth("DEVELOPER_TOKEN");
BoxClient client = new BoxClient(auth);
client.folders.getFolderItems("0").getEntries().forEach(item -> {
   System.out.println(item.toString());
});

Documentation

For box-java-sdk, the maintained replacement for this package, see its README and docs.

Upgrades

The SDK is updated regularly to include new features, enhancements, and bug fixes. If you are upgrading from our legacy SDKs to this new generation SDKs is a straightforward process. Checkout the migration guide and changelog for more information.

Integration Tests

Running integration tests locally

Create Platform Application

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 Level select App + Enterprise Access. You can enable all Application Scopes.
  • In section Advanced Features enable Make API calls using the as-user header and Generate user access tokens.

Now select Authorization and submit application to be reviewed by account admin.

Export configuration

  1. Select Configuration tab and in the bottom in the section App Settings download your app configuration settings as JSON.
  2. Encode configuration file to Base64, e.g. using command: base64 -i path_to_json_file
  3. Set environment variable: JWT_CONFIG_BASE_64 with base64 encoded jwt configuration file
  4. Set environment variable: BOX_FILE_REQUEST_ID with ID of file request already created in the user account, BOX_EXTERNAL_USER_EMAIL with email of free external user which not belongs to any enterprise.
  5. Set environment variable: WORKFLOW_FOLDER_ID with 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.
  6. Set environment variable: APP_ITEM_ASSOCIATION_FILE_ID to the ID of the file with associated app item and APP_ITEM_ASSOCIATION_FOLDER_ID to the ID of the folder with associated app item.
  7. Set environment variable: APP_ITEM_SHARED_LINK to the shared link associated with app item.
  8. Set environment variable: SLACK_AUTOMATION_USER_ID to the ID of the user responsible for the Slack automation, SLACK_ORG_ID to the ID of the Slack organization and SLACK_PARTNER_ITEM_ID to the ID of the Slack partner item.

Start integration tests

To run integration tests locally, you can use the following command:

./gradlew test --stacktrace

3rd Party Libraries & Licenses

The Java SDK Gen uses third-party libraries that are required for usage. Their licenses are listed below:

  1. jackson-annotations v2.17.2 Maven: com.fasterxml.jackson.core:jackson-annotations:2.17.2 Licence: Apache 2.0
  2. jackson-core v2.17.2 Maven: com.fasterxml.jackson.core:jackson-core:2.17.2 Licence: Apache 2.0
  3. jackson-databind v2.17.2 Maven: com.fasterxml.jackson.core:jackson-databind:2.17.2 Licence: Apache 2.0
  4. okhttp v4.12.0 Maven: com.squareup.okhttp3:okhttp:4.12.0 Licence: Apache 2.0
  5. okio v3.5.0 Maven: com.squareup.okio:okio:3.5.0 Licence: Apache 2.0
  6. jose4j v0.9.6 Maven: org.bitbucket.b_c:jose4j:0.9.6 Licence: Apache 2.0
  7. bcprov-jdk18on v1.78.1 Maven: org.bouncycastle:bcprov-jdk18on:1.78.1 Licence: MIT
  8. bcpkix-jdk18on v1.78.1 Maven: org.bouncycastle:bcpkix-jdk18on:1.78.1 Licence: MIT

The following libraries are required for running tests:

  1. junit-jupiter-api v5.10.0 Maven: org.junit.jupiter:junit-jupiter-api:5.10.0 Licence: EPL 2.0
  2. junit-jupiter-engine v5.10.0 Maven: org.junit.jupiter:junit-jupiter-engine:5.10.0 Licence: EPL 2.0

Questions, Bugs, and Feature Requests?

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 and License

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.

About

No description, website, or topics provided.

Resources

Contributing

Stars

6 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages