# Upsert User — SkillzRun

> Creates or updates a user based on the user email prop. See the documentation

- Key: `skillzrun-upsert-user`
- Type: Action (Write)
- Version: 0.0.2
- App: SkillzRun (`skillzrun`) — https://pipedream.com/apps/skillzrun.md
- This page (HTML): https://pipedream.com/apps/skillzrun/actions/upsert-user
- Hints: destructive · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/skillzrun/actions/upsert-user/upsert-user.mjs

## Description

Creates or updates a user based on the user email prop. [See the documentation](https://api.skillzrun.com/external/api/swagger/static/index.html#/users/post_external_api_users_upsert)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `email` | `string` | Yes | The email of the user. This is required and must be unique. |
| `name` | `string` | Yes | The name of the user |
| `phone` | `string` | No | The phone number of the user |
| `isActive` | `boolean` | No | Whether the user is active |
| `seesAllSubjects` | `boolean` | No | Whether the user sees all offers |
| `ignoreNotOpenLevels` | `boolean` | No | Whether to ignore not open levels |
| `ignoreStopItems` | `boolean` | No | Whether to ignore stop items |
| `noteAboutUser` | `string` | No | Additional information about the user |
| `isDemoMode` | `boolean` | No | Whether the user is in demo mode |
| `aboutMe` | `string` | No | Information about the user |
| `personalLink` | `string` | No | The url of the user's personal link |
| `newPassword` | `string` | No | The password of the user |

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

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: "skillzrun-upsert-user",
  arguments: {
    email: "User Email",
    name: "User Name",
  },
})
```

**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: "skillzrun-upsert-user",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    skillzrun: { authProvisionId: "apn_xxxxxxx" },
    email: "User Email",
    name: "User Name",
  },
})

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": "skillzrun-upsert-user",
    "configured_props": {
      "skillzrun": { "authProvisionId": "apn_xxxxxxx" },
      "email": "User Email",
      "name": "User Name"
    }
  }'
```

---

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