Setu Recipes: reusable workflows across every app.Browse templates

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

TypeScript
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

ScopeWhy it is requested
root_readonlyRead files and folders in your Box account
root_readwriteCreate, 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

InputTypeDescription
namestringRequiredFolder name, 1 to 255 characters, no slashes
parent_idstringRequiredId of the parent folder; 0 is the root
TypeScript
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

InputTypeDescription
file_idstringRequiredFile id
TypeScript
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

InputTypeDescription
file_idstringRequiredFile id
TypeScript
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

InputTypeDescription
folder_idstringRequiredFolder id; 0 is the root folder
limitintegerOptionalMaximum items to return, up to 1000
offsetintegerOptionalIndex of the first item to return
TypeScript
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

InputTypeDescription
file_idstringRequiredFile id
parent_idstringRequiredId of the destination folder
TypeScript
await setu.execute({
  userId: "user_1",
  action: "box.move_file",
  input: {
    "file_id": "<file_id>",
    "parent_id": "<parent_id>"
  },
});
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

InputTypeDescription
file_idstringRequiredFile id
namestringOptionalNew file name
descriptionstringOptionalNew description, up to 256 characters
TypeScript
await setu.execute({
  userId: "user_1",
  action: "box.update_file",
  input: {
    "file_id": "<file_id>"
  },
});