# Create Shared Link — Box

> Creates or updates a shared link for a file or folder. Access levels: open, company, or collaborators. A password can only be set when access is open; download permission applies only when access is open or company. A resource can have…

- Key: `box-create-shared-link`
- 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-shared-link
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/box/actions/create-shared-link/create-shared-link.mjs

## Description

Creates or updates a shared link for a file or folder. Access levels: `open`, `company`, or `collaborators`. A password can only be set when access is `open`; download permission applies only when access is `open` or `company`. A resource can have only one shared link at a time. [See the documentation](https://developer.box.com/guides/shared-links/create-or-update/).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `itemType` | `string` | Yes | The type of Box item. Valid values: file or folder. |
| `item` | `string` | Yes | The Box file or folder to share. The available items are filtered by Item Type (e.g. 123456789). Options are loaded from the connected account. |
| `access` | `string` | No | The access level for the shared link. If not set, the enterprise default is used. Valid values: open, company, collaborators. |
| `password` | `string` | No | The password required to access the shared link. Can only be set when access is open. |
| `unsharedAt` | `string` | No | The timestamp at which the shared link will expire. Must be in RFC3339 format, e.g. 2022-07-20T10:53:43-08:00 |
| `canDownload` | `boolean` | No | Whether the shared link allows downloads. Only applicable when access is open or company. |

## 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-shared-link",
  arguments: {
    itemType: "Item Type",
    item: "File or 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-shared-link",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    box: { authProvisionId: "apn_xxxxxxx" },
    itemType: "Item Type",
    item: "File or 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-shared-link",
    "configured_props": {
      "box": { "authProvisionId": "apn_xxxxxxx" },
      "itemType": "Item Type",
      "item": "File or Folder"
    }
  }'
```

---

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