# Update Link — Short.io

> Update original URL, title or path for existing URL by id. See the documentation.

- Key: `short-update-a-link`
- Type: Action (Write)
- Version: 0.0.3
- App: Short.io (`short`) — https://pipedream.com/apps/short.md
- This page (HTML): https://pipedream.com/apps/short/actions/update-a-link
- Hints: destructive · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/short/actions/update-a-link/update-a-link.mjs

## Description

Update original URL, title or path for existing URL by id. [See the documentation](https://developers.short.io/reference/linksbylinkidpost).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `shortLink` | `string` | Yes | Specify your current short link. Options are loaded from the connected account. |
| `domain` | `string` | Yes | Domain name you added to short.io Options are loaded from the connected account. |
| `originalURL` | `string` | Yes | Link, which you want to shorten. |
| `path` | `string` | No | Optional path part of newly created link. If empty - it will be generated automatically. |
| `title` | `string` | No | Title of created URL to be shown in short.io admin panel. |
| `tags` | `string[]` | No | Specify the tags of your link. |
| `allowDuplicates` | `boolean` | No | Specify whether to allow repeated links to be registered. |
| `expiresAt` | `string` | No | Link expiration date, use yyyy-mm-dd format. If no expiration date is given (default), link will never expire. |
| `expiredURL` | `string` | No | URL to redirect when the link is expired. |
| `iphoneURL` | `string` | No | If users open the URL with iPhone, they will be redirected to this URL. |
| `androidURL` | `string` | No | If users open the URL with Android, they will be redirected to this URL |
| `password` | `string` | No | Requires Personal plan. Password to be asked when user visits a link. This password will not be stored in plain text, we will hash it with salt. |
| `utmSource` | `string` | No | The referrer: (e.g. google, newsletter). |
| `utmMedium` | `string` | No | Marketing medium: (e.g. cpc, banner, email). |
| `utmCampaign` | `string` | No | Product, promo code, or slogan (e.g. spring_sale). |
| `utmTerm` | `string` | No | Identify the paid keywords. |
| `utmContent` | `string` | No | Use to differentiate ads. |
| `cloaking` | `boolean` | No | Specify whether to cloak the link. |
| `redirectType` | `integer` | No | Status for the short link redirect. |

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

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: "short-update-a-link",
  arguments: {
    shortLink: "Link",
    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: "short-update-a-link",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    short: { authProvisionId: "apn_xxxxxxx" },
    shortLink: "Link",
    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": "short-update-a-link",
    "configured_props": {
      "short": { "authProvisionId": "apn_xxxxxxx" },
      "shortLink": "Link",
      "domain": "Domain"
    }
  }'
```

---

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