# Create a CodeQR Link — CodeQR

> Creates a short link in CodeQR using the CodeQR API. See the documentation

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

## Description

Creates a short link in CodeQR using the CodeQR API. [See the documentation](https://codeqr.mintlify.app/api-reference/endpoint/create-a-link)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `url` | `string` | Yes | The destination URL of the short link. |
| `key` | `string` | No | The short link slug. If not provided, a random 7-character slug will be generated. |
| `domain` | `string` | No | The domain of the short link. If not provided, the default workspace domain will be used. |
| `externalId` | `string` | No | This is the ID of the link in your database. Must be prefixed with ext_. |
| `password` | `string` | No | The password required to access the destination URL. |
| `flexible` | `boolean` | No | Whether this is a flexible link with dynamic destination setting. |
| `title` | `string` | No | The title displayed on the short link page. |
| `description` | `string` | No | A description displayed on the short link page. |
| `image` | `string` | No | URL of the image displayed on the short link page. |
| `video` | `string` | No | URL of the video displayed on the short link page. |
| `proxy` | `boolean` | No | Enable proxy settings. |
| `rewrite` | `boolean` | No | Enable link rewriting. |
| `ios` | `string` | No | The iOS destination URL for device-specific redirection. |
| `android` | `string` | No | The Android destination URL for device-specific redirection. |
| `doIndex` | `boolean` | No | Enable indexing of the short link. |
| `comments` | `string` | No | Comments or notes about the short link. |
| `expiresAt` | `string` | No | The date and time when the short link will expire (ISO 8601). E.g. 2025-06-13T05:31:56Z |
| `expiredUrl` | `string` | No | The URL to redirect to when the short link has expired. |
| `geo` | `object` | No | Mapping of country codes to destination URLs (JSON format). |
| `publicStats` | `boolean` | No | Whether the short link's stats are publicly accessible. |

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

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: "codeqr-create-link",
  arguments: {
    url: "URL",
    key: "Key",
  },
})
```

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

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": "codeqr-create-link",
    "configured_props": {
      "codeqr": { "authProvisionId": "apn_xxxxxxx" },
      "url": "URL",
      "key": "Key"
    }
  }'
```

---

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