Add the power of the Box AI API to your custom apps at Content Cloud Summit on May 15

Learn more and register!

Building Commands and Help Feature

Guides CLI Use Box CLI with OAuth 2.0 Building Commands and Help Feature
Edit this page

Building Commands and Help Feature

A full list of CLI commands and usage information can be found in the GitHub repository.

Only Service Accounts and Admins are able to use some commands. If your user is not authorized with the necessary scopes or you configured your CLI to obtain a default token for another user, calls may fail. Add -v or --verbose to your command for verbose error logging.

If you do not see a command for an endpoint you need, you can build a custom request.

Use repository documentation in conjunction with reference documentation to see information the help command does not provide. This includes restrictions, token permission requirements, fields, etc.

First: Reset browser storage

Now that you've imported the Box API credentials into the CLI you should take a moment to remove these credentials from your browser's storage.

Removing your API credentials from the browser storage ensures that no other script can read your Client ID or Client Secret

Creating a folder with help

Every CLI command begins with box. Add the option --help to any command for help building it. For example, executing box --help will bring you to a list of all possible object commands. Options are discussed more in step 4.

Help

Then, for example, use the folder object and execute the command box folders --help. This provides a list of all eligible actions for this object.

Help

Discover the required arguments for creating a folder: box folders:create --help

Help

Execute the command box folders:create 0 "My CLI Folder" and note the folder ID returned in the response.

The root level of the folder tree, the All Files page, is always represented by folder ID 0.

Log into your Box account. Can you see this folder in your folder tree?

If you set up the Box CLI using JWT authentication, you will not see the folder in your Box account. The folder will live in the service account of the application that was created after application approval.

Summary

  • You used the help feature to create a folder