# Box

To use the Box integration in StackAI, add the Box node to your workflow. You can then select from a wide range of actions to interact with your Box account, such as uploading files, managing folders, sharing documents, and handling metadata. Each action can be configured with specific inputs and settings to match your automation needs.

***

## Establishing a Connection to Box

### Box OAuth2

Selecting the Box OAuth2 allows you to connect directly to your Box user account using StackAI's OAuth app. Sign in to Box and your Box connection will be automatically established.

### Box JSON Web Token

JWT (JSON Web Token) is a secure way for our platform to talk directly to your Box account without requiring a specific person to stay logged in. This type of connection connects directly to a Box service account unique to your organization. To set up this type of connection, visit the [Box Developer Console](https://app.box.com/developers/console).

Select **New App** in the top right corner, then name your app and select JWT.

<figure><img src="https://3697023207-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFSlso1Kjob5CLDrh0dVn%2Fuploads%2FDYzjO9E5ukKdzcRCYNQQ%2FScreenshot%202026-01-14%20at%205.12.27%E2%80%AFPM.png?alt=media&#x26;token=844a938f-b041-4f62-8f1a-d91dc15f22a2" alt=""><figcaption></figcaption></figure>

Under Configuration, make sure you have the following:

* Read all files
* Write all files

If you plan to impersonate a user, additionally add the following scopes:

* App + Enterprise Access
* Make API calls using the as-user header

Then **Generate a Public/Private Keypair**.

Once your new app is configured, save your changes.

Go to the Authorization tab and click **Review and Submit.** Once your app is reviewed, it should be ready to use in StackAI.

#### Establishing a Connection

Under the Configuration tab of your App, go to App Settings and **Download as JSON**. This file will contain everything you need to create a connection.&#x20;

Inside StackAI, create a new connection by selecting **+ New Connection**. Go to Box -> Box (JWT) and fill in the fields with the data in your .json file.

<figure><img src="https://3697023207-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFSlso1Kjob5CLDrh0dVn%2Fuploads%2FEUzKDBMK6yMpn2p6vkrT%2FScreenshot%202026-01-14%20at%206.09.30%E2%80%AFPM.png?alt=media&#x26;token=e617996d-07ae-443f-8b8a-129b331c571f" alt=""><figcaption></figcaption></figure>

***

## Most Commonly Used Actions in Box

Below are the most frequently used Box actions in StackAI, along with their input, configuration, and output details:

***

### 1. Upload File

**Description:** Uploads a file to a specified folder in your Box account.

**Inputs:**

* **file** (Required): The file object or path to upload.
* **parent\_folder\_id** (Required): The ID of the destination folder in Box.
* **name** (Optional): The name for the uploaded file.

**Configurations:**

* **connection\_id** (Required): Your Box connection for authentication.

**Outputs:**

* **id**: The unique ID of the uploaded file.
* **name**: The name of the uploaded file.
* **created\_at**: Timestamp of file creation.
* **modified\_at**: Timestamp of last modification.
* **size**: File size in bytes.

**Example:**

```json
{
  "file": "{doc-0}",
  "parent_folder_id": "123456789",
  "name": "report.pdf"
}
```

***

### 2. Download File

**Description:** Downloads a file from Box using its file ID.

**Inputs:**

* **file\_id** (Required): The ID of the file to download.

**Configurations:**

* **connection\_id** (Required): Your Box connection for authentication.

**Outputs:**

* **file\_content**: The binary content of the downloaded file.

**Example:**

```json
{
  "file_id": "987654321"
}
```

***

### 3. Create Folder

**Description:** Creates a new folder in a specified parent folder.

**Inputs:**

* **name** (Required): The name of the new folder.
* **parent\_folder\_id** (Required): The ID of the parent folder.

**Configurations:**

* **connection\_id** (Required): Your Box connection for authentication.

**Outputs:**

* **id**: The unique ID of the new folder.
* **name**: The name of the new folder.

**Example:**

```json
{
  "name": "Project Files",
  "parent_folder_id": "123456789"
}
```

***

### 4. List Folder Items

**Description:** Lists all items (files and folders) within a specified folder.

**Inputs:**

* **folder\_id** (Required): The ID of the folder to list items from.

**Configurations:**

* **connection\_id** (Required): Your Box connection for authentication.

**Outputs:**

* **entries**: Array of items (files/folders) in the folder.
* **total\_count**: Total number of items.

**Example:**

```json
{
  "folder_id": "123456789"
}
```

***

### 5. Share File or Folder (Get Shared Link)

**Description:** Generates a shared link for a file or folder.

**Inputs:**

* **file\_id** or **folder\_id** (Required): The ID of the file or folder to share.
* **access** (Optional): Access level (e.g., "open", "company", "collaborators").

**Configurations:**

* **connection\_id** (Required): Your Box connection for authentication.

**Outputs:**

* **shared\_link**: The generated URL for sharing.

**Example:**

```json
{
  "file_id": "987654321",
  "access": "open"
}
```
