# Create Short URL — jo4

> Create a new shortened URL. See the documentation

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

## Description

Create a new shortened URL. [See the documentation](https://jo4.io/docs)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `longUrl` | `string` | Yes | The long URL to shorten |
| `shortUrl` | `string` | No | Custom short URL alias (e.g., my-link). Leave empty for auto-generated. |
| `title` | `string` | No | A title for the short URL |
| `tags` | `string[]` | No | Tags to categorize the URL |
| `expirationTime` | `integer` | No | Unix timestamp (milliseconds) when the URL should expire |
| `passwordProtected` | `boolean` | No | Whether the URL requires a password to access |
| `password` | `string` | No | Password for the URL (required if password protected is enabled) |
| `utmSource` | `string` | No | UTM source parameter to append |
| `utmMedium` | `string` | No | UTM medium parameter to append |
| `utmCampaign` | `string` | No | UTM campaign parameter to append |

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

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: "jo4-create-short-url",
  arguments: {
    longUrl: "Destination URL",
    shortUrl: "Custom Alias",
  },
})
```

**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: "jo4-create-short-url",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    jo4: { authProvisionId: "apn_xxxxxxx" },
    longUrl: "Destination URL",
    shortUrl: "Custom Alias",
  },
})

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": "jo4-create-short-url",
    "configured_props": {
      "jo4": { "authProvisionId": "apn_xxxxxxx" },
      "longUrl": "Destination URL",
      "shortUrl": "Custom Alias"
    }
  }'
```

---

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