# Create Shortened Link — TinyURL

> Creates a new shortened link. See the documentation

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

## Description

Creates a new shortened link. [See the documentation]()

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `url` | `string` | Yes | The long URL that will be shortened |
| `domain` | `string` | No | The domain you would like the TinyURL to use. Select from TinyURL free domain tinyurl.com or subscribe and use TinyURL branded domains. |
| `alias` | `string` | No | A short string of characters to use in the TinyURL. If ommitted, one will be randomly generated. When using a branded domain, this has a minimum length of 1 character. |
| `tags` | `string[]` | No | Tags group and categorize TinyURLs together. Paid accounts only |
| `expiresAt` | `string` | No | TinyURL expiration in ISO8601 format. If not set so TinyURL never expires. Example: 2024-10-25 10:11:12. Paid accounts only |
| `description` | `string` | No | The alias description |

## 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": "tinyurl",
      },
    },
  },
)

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: "tinyurl-create-shortened-link",
  arguments: {
    url: "URL",
    domain: "Domain",
  },
})
```

**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: "tinyurl-create-shortened-link",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    tinyurl: { authProvisionId: "apn_xxxxxxx" },
    url: "URL",
    domain: "Domain",
  },
})

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": "tinyurl-create-shortened-link",
    "configured_props": {
      "tinyurl": { "authProvisionId": "apn_xxxxxxx" },
      "url": "URL",
      "domain": "Domain"
    }
  }'
```

---

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