> ## Documentation Index
> Fetch the complete documentation index at: https://developer.box.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI

export const SignupCTA = ({children}) => {
  return <div className="flex flex-wrap items-center gap-4 p-5 rounded-lg border border-gray-200 dark:border-gray-700 my-6" style={{
    background: "linear-gradient(135deg, rgba(0, 97, 213, 0.06), rgba(0, 97, 213, 0.02))"
  }}>
      <div className="flex-1 text-sm leading-relaxed text-gray-700 dark:text-gray-300" style={{
    minWidth: "280px"
  }}>
        {children}
      </div>
      <div className="flex flex-col items-center gap-2">
        <a href="https://account.box.com/signup/developer#ty9l3" className="signup-cta-button inline-flex items-center whitespace-nowrap px-5 py-2 text-sm font-semibold text-white no-underline">
          Get started for free
        </a>
        <a href="https://account.box.com/developers/console" className="signup-cta-login text-xs text-gray-500 dark:text-gray-400 no-underline whitespace-nowrap">
          Already have an account? Log in
        </a>
      </div>
    </div>;
};

export const MultiRelatedLinks = ({sections = []}) => {
  if (!sections || sections.length === 0) {
    return null;
  }
  return <div className="space-y-8">
      {sections.map((section, index) => <RelatedLinks key={index} title={section.title} items={section.items} />)}
    </div>;
};

export const RelatedLinks = ({title, items = []}) => {
  const getBadgeClass = badge => {
    if (!badge) return "badge-default";
    const badgeType = badge.toLowerCase().replace(/\s+/g, "-");
    return `badge-${badge === "ガイド" ? "guide" : badgeType}`;
  };
  if (!items || items.length === 0) {
    return null;
  }
  return <div className="my-8">
      {}
      <h3 className="text-sm font-bold uppercase tracking-wider mb-4">{title}</h3>

      {}
      <div className="flex flex-col gap-3">
        {items.map((item, index) => <a key={index} href={item.href} className="py-2 px-3 rounded related_link hover:bg-[#f2f2f2] dark:hover:bg-[#111827] flex items-center gap-3 group no-underline hover:no-underline border-b-0">
            {}
            <span className={`px-2 py-1 rounded-full text-xs font-semibold uppercase tracking-wide flex-shrink-0 ${getBadgeClass(item.badge)}`}>
              {item.badge}
            </span>

            {}
            <span className="text-base">{item.label}</span>
          </a>)}
      </div>
    </div>;
};

export const Link = ({href, children, className, ...props}) => {
  const localizedHref = href;
  return <a href={localizedHref} className={className} {...props}>
      {children}
    </a>;
};

The Box CLI brings Box to your terminal. It works with agentic tools and harnesses, letting you manage content, automate tasks, and integrate Box into scripts, tools, and AI agents.

Scopes are limited to files and folders, AI, and Sign when [logging in as a Box user](#log-in-as-box-user). If you need additional scopes, [use a Box platform app](#use-a-box-platform-app) instead.

<SignupCTA>
  Install the Box CLI and connect to your account in minutes. A free developer account is all you need to get started.
</SignupCTA>

## Quickstart

### Step 1: Install the CLI

The CLI can be installed as a Node package on any platform,
including Linux, Windows, and macOS. For this to work, you need to have
[Node.js](https://nodejs.org/) installed.

```bash theme={null}
npm install --global @box/cli
```

### Step 2: Authenticate the CLI

In your terminal, run:

```bash theme={null}
box login
```

<a id="log-in-as-box-user" style={{scrollMarginTop: "6rem"}} />

##### 1. Log in as a Box user (OAuth)

The fastest way to get started. Uses a preconfigured Box application that only supports file and folder operations, AI, and Sign.

Select the **Grant Access to Box** button which appears in the browser.

After authentication completes successfully, you are ready to run commands.

<a id="use-a-box-platform-app" style={{scrollMarginTop: "6rem"}} />

##### 2. Use a Box platform app

This option requires additional setup but allows you to configure scopes and permissions.

1. Go to your [Developer Console][devconsole] and select or create an application.
2. In the application’s **Configuration** section:
   * Make sure it uses **Standard OAuth 2.0**.
   * Set the **Redirect URI** to `http://localhost:3000/callback`.
   * Select your desired <Link href="/guides/api-calls/permissions-and-errors/scopes">scopes</Link>.
   * Copy your **Client ID** and **Client Secret**.
3. At the top of the page, click **Save Changes**.
4. Return to the terminal window and enter the **Client ID** and **Client Secret** when prompted.
5. Select the **Grant Access to Box** button which appears in the browser.

After authentication completes successfully, you are ready to run commands.

<Info>
  Use `box login --platform-app` to skip the prompt for the Client ID and Client Secret.
</Info>

##### 3. Headless environment (no browser)

If you are on a remote server or any machine without a browser, use the `--code` flag for manual code entry. See <Link href="/guides/cli/headless-login">Headless Login</Link> for step-by-step instructions.

```bash theme={null}
box login --code
```

### Step 3: Run your first command

To confirm the configuration was successful, enter:

```bash theme={null}
box users:get me
```

If authentication was successful, the CLI returns information about your Box user account.

```json theme={null}
Type: user
ID: '0123456789'
Name: Aaron Levie
Login: example@box.com
Created At: '2020-01-01T09:45:01-07:00'
Modified At: '2021-03-01T09:30:05-07:00'
Language: en
Timezone: America/Los_Angeles
Space Amount: 999999999999999
Space Used: 6291500
Max Upload Size: 16106127360
Status: active
Job Title: ''
Phone: ''
Address: example+user@box.com
Avatar URL: ''
Notification Email: []
```

## Getting help

Every CLI command begins with `box`. Add `--help` to any
command for assistance. Run `box --help` to display all available top-level commands.

A full list of commands and usage information is available in the
[GitHub repository][github].

Supported callback ports are: `3000`, `3001`, `4000`, `5000`, and `8080`. Change with `--port`.

## Alternative methods to interact with the Box API

* To use the <Link href="/guides/authentication/jwt">server authentication</Link> method, check our <Link href="/guides/cli/cli-with-jwt-authentication/jwt-cli">CLI with JWT</Link> guide.
* To use the <Link href="/guides/authentication/client-credentials">CCG authentication</Link> method, check our [Box configure][ccg-page] guide.

## Additional information

More information about the Box CLI is available in the following pages.

* Review all [commands][commands].
* Review [token cache][cache] settings.
* Review [autocomplete][ac] settings.
* To perform bulk actions using CLI commands, check our [CLI bulk commands][bulk] guide.

[cache]: https://github.com/box/boxcli/blob/master/docs/configure.md#box-configureenvironmentsupdate-name

[ac]: https://github.com/box/boxcli/blob/master/docs/autocomplete.md

[commands]: https://github.com/box/boxcli#command-topics

[github]: https://github.com/box/boxcli#command-topics-1

[devconsole]: https://cloud.app.box.com/developers/console

<Info>
  API requests made through Box first-party applications are not chargeable. Requests made by custom applications using the Box API are chargeable.
</Info>

## Advanced

The GitHub page contains additional guides that might be of interest to an
advanced CLI user.

* [Set up autocomplete][cli-autocomplete].
* [Configure another app][cli-add-config].
* [Switch accounts][cli-switch].
* [Token cache][cache].

[cli]: https://github.com/box/boxcli

[cli-autocomplete]: https://github.com/box/boxcli/blob/main/docs/autocomplete.md

[cli-switch]: https://github.com/box/boxcli/blob/main/docs/configure.md#box-configureenvironmentsswitch-user-userid

[cli-add-config]: https://github.com/box/boxcli/blob/main/docs/configure.md#box-configureenvironmentsadd-path

[cache]: https://github.com/box/boxcli/blob/main/docs/configure.md#box-configureenvironmentsupdate-name

[scripts]: https://github.com/box/boxcli/tree/main/examples

[ccg-page]: https://github.com/box/boxcli/tree/main/docs/configure.md#box-configureenvironmentsadd-path

[bulk]: https://github.com/box/boxcli/blob/main/docs/Bulk%20actions/README.md
