Integrations / Box
Box
Cloud content management: browse, search, organise and share files and folders.
8 actions
OAuth 2
3 read4 write1 destructive
Calls api.box.com
Connect
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "box" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();Permissions requested
| Scope | Why it is requested |
|---|---|
root_readonly | Read files and folders in your Box account |
root_readwrite | Create, change, share and delete files and folders in your Box account |
Actions
Create folderwritebox.create_folderCreate a new folder inside a parent folder (use parent id 0 for the root). Names must be unique within the parent.
Needs scope: root_readwrite
| Input | Type | Description | |
|---|---|---|---|
name | string | Required | Folder name, 1 to 255 characters, no slashes |
parent_id | string | Required | Id of the parent folder; 0 is the root |
await setu.execute({
userId: "user_1",
action: "box.create_folder",
input: {
"name": "<name>",
"parent_id": "<parent_id>"
},
});Delete filedestructivebox.delete_fileDelete a file by id. It moves to the Box trash where it can usually be restored until the trash is emptied.
Needs scope: root_readwrite
| Input | Type | Description | |
|---|---|---|---|
file_id | string | Required | File id |
await setu.execute({
userId: "user_1",
action: "box.delete_file",
input: {
"file_id": "<file_id>"
},
confirm: true,
});Get file detailsreadbox.get_fileGet details of one file by id: name, size, description, extension and version.
Needs scope: root_readonly
| Input | Type | Description | |
|---|---|---|---|
file_id | string | Required | File id |
await setu.execute({
userId: "user_1",
action: "box.get_file",
input: {
"file_id": "<file_id>"
},
});List folder itemsreadbox.list_folder_itemsList the files and folders inside a Box folder. Use folder id 0 for the root folder. Returns names, ids and types.
Needs scope: root_readonly
| Input | Type | Description | |
|---|---|---|---|
folder_id | string | Required | Folder id; 0 is the root folder |
limit | integer | Optional | Maximum items to return, up to 1000 |
offset | integer | Optional | Index of the first item to return |
await setu.execute({
userId: "user_1",
action: "box.list_folder_items",
input: {
"folder_id": "<folder_id>"
},
});Move filewritebox.move_fileMove a file into another folder by id. Use folder id 0 for the root.
Needs scope: root_readwrite
| Input | Type | Description | |
|---|---|---|---|
file_id | string | Required | File id |
parent_id | string | Required | Id of the destination folder |
await setu.execute({
userId: "user_1",
action: "box.move_file",
input: {
"file_id": "<file_id>",
"parent_id": "<parent_id>"
},
});Search Boxreadbox.searchSearch files, folders and web links in Box by text. Can limit by type, file extension or ancestor folders. Returns names, ids and types.
Needs scope: root_readonly
| Input | Type | Description | |
|---|---|---|---|
query | string | Required | Search text |
type | string | Optional | Only this kind of item |
file_extensions | string | Optional | Comma-separated extensions without dots, e.g. pdf,png |
ancestor_folder_ids | string | Optional | Comma-separated folder ids to search inside |
limit | integer | Optional | Maximum results, up to 200 |
await setu.execute({
userId: "user_1",
action: "box.search",
input: {
"query": "<query>"
},
});Rename or describe filewritebox.update_fileChange a file's name or description. Does not move it; use move_file for that.
Needs scope: root_readwrite
| Input | Type | Description | |
|---|---|---|---|
file_id | string | Required | File id |
name | string | Optional | New file name |
description | string | Optional | New description, up to 256 characters |
await setu.execute({
userId: "user_1",
action: "box.update_file",
input: {
"file_id": "<file_id>"
},
});