# Create Collaboration — Box

> Adds a collaboration for a user or group on a file or folder, granting them access with a role (editor, viewer, previewer, uploader, previewer uploader, viewer uploader, or co-owner). Item Type must be file or folder. Invite users by email…

- Key: `box-create-collaboration`
- Type: Action (Write)
- Version: 0.0.2
- App: Box (`box`) — https://pipedream.com/apps/box.md
- This page (HTML): https://pipedream.com/apps/box/actions/create-collaboration
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/box/actions/create-collaboration/create-collaboration.mjs

## Description

Adds a collaboration for a user or group on a file or folder, granting them access with a role (editor, viewer, previewer, uploader, previewer uploader, viewer uploader, or co-owner). Item Type must be `file` or `folder`. Invite users by email or user ID; groups must be invited by group ID only. Can View Path applies only to folder collaborations. Use **Delete Collaboration** to revoke access. [See the documentation](https://developer.box.com/reference/post-collaborations/).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `itemType` | `string` | Yes | The type of Box item. Valid values: file or folder. |
| `folderId` | `string` | Yes | The folder to add a collaboration to when Item Type is folder. When Item Type is file, this instead scopes the File dropdown to a parent folder. Use 0 for the root folder. Use the List Folders action to retrieve folder IDs. Options are loaded from the connected account. |
| `fileId` | `string` | No | The file to add a collaboration to (e.g. 123456789). Required when Item Type is file. Use the List Folder Items action to retrieve file IDs. Options are loaded from the connected account. |
| `canViewPath` | `boolean` | No | Whether the collaborator can view the parent path to the folder. Only applicable when Item Type is folder. |
| `accessibleByType` | `string` | Yes | The type of collaborator to invite. Valid values: user or group. Groups must be identified by ID (not email). |
| `identifyBy` | `string` | No | How to identify the user collaborator: by email or by ID. Only applicable when Collaborator Type is user (groups are always identified by ID via Collaborator ID). |
| `login` | `string` | No | The email address of the user to invite (e.g. user@example.com). Required when Collaborator Type is user and Identify By is email. |
| `accessibleById` | `string` | No | The ID of the user or group to invite (e.g. 123456789). Required when Collaborator Type is group, or when Collaborator Type is user and Identify By is id. |
| `role` | `string` | Yes | The level of access granted. Valid values: editor, viewer, previewer, uploader, previewer uploader, viewer uploader, co-owner. |
| `notify` | `boolean` | No | Whether to notify the collaborator via email |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "box",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "box-create-collaboration",
  arguments: {
    itemType: "Item Type",
    folderId: "Folder",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "box-create-collaboration",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    box: { authProvisionId: "apn_xxxxxxx" },
    itemType: "Item Type",
    folderId: "Folder",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "box-create-collaboration",
    "configured_props": {
      "box": { "authProvisionId": "apn_xxxxxxx" },
      "itemType": "Item Type",
      "folderId": "Folder"
    }
  }'
```

---

- App: https://pipedream.com/apps/box.md · All apps: https://pipedream.com/apps
