# Connect Account — LinkupAPI for LinkedIn

> Authenticate a LinkedIn account and obtain a persistent account_id to reuse across all other actions. Connect with either a login token or email + password. If a checkpoint/challenge is required, follow up with Verify Code. See the…

- Key: `linkupapi-connect-account`
- Type: Action (Write)
- Version: 0.0.2
- App: LinkupAPI for LinkedIn (`linkupapi`) — https://pipedream.com/apps/linkupapi.md
- This page (HTML): https://pipedream.com/apps/linkupapi/actions/connect-account
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/linkupapi/actions/connect-account/connect-account.mjs

## Description

Authenticate a LinkedIn account and obtain a persistent `account_id` to reuse across all other actions. Connect with either a login token or email + password. If a checkpoint/challenge is required, follow up with **Verify Code**. [See the documentation](https://docs.linkupapi.com/api-reference/v2/accounts/login)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `loginToken` | `string` | No | LinkedIn authentication token/cookie for direct, token-based connection. Alternative to Email + Password that skips the 2FA step. Provide this, or both Email and Password. |
| `email` | `string` | No | Account email address. Required (with Password) for credential-based login when no Login Token is provided. |
| `password` | `string` | No | Account password. Required (with Email) for credential-based login when no Login Token is provided. |
| `country` | `string` | No | Country code for proxy selection (e.g. US, UK, FR). Defaults to FR server-side. |
| `accountName` | `string` | No | Display name for the account. Defaults to the email address. |
| `challengeType` | `string` | No | Type of 2FA challenge to use if the account has two-factor authentication enabled. code_challenge: receive a verification code (email/SMS/authenticator) to submit via Verify Code. app_challenge: approve the login from the LinkedIn mobile app, then call Verify Code with only the account ID. |

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

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: "linkupapi-connect-account",
  arguments: {
    loginToken: "Login Token",
    email: "Email",
  },
})
```

**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: "linkupapi-connect-account",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    linkupapi: { authProvisionId: "apn_xxxxxxx" },
    loginToken: "Login Token",
    email: "Email",
  },
})

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": "linkupapi-connect-account",
    "configured_props": {
      "linkupapi": { "authProvisionId": "apn_xxxxxxx" },
      "loginToken": "Login Token",
      "email": "Email"
    }
  }'
```

---

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