# Create User — Clerk

> Creates a new user. Your user management settings determine how you should setup your user model. See the documentation

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

## Description

Creates a new user. Your user management settings determine how you should setup your user model. [See the documentation](https://clerk.com/docs/reference/backend-api/tag/Users#operation/CreateUser)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `externalId` | `string` | No | The ID of the user as used in your external systems or your previous authentication solution. Must be unique across your instance. |
| `firstName` | `string` | No | The first name to assign to the user. |
| `lastName` | `string` | No | The last name to assign to the user. |
| `emailAddress` | `string[]` | Yes | Email addresses to add to the user. Must be unique across your instance. The first email address will be set as the user's primary email address. |
| `phoneNumber` | `string[]` | No | Phone numbers to add to the user. Must be unique across your instance. The first phone number will be set as user's primary phone number. |
| `web3Wallet` | `string[]` | No | Web3 wallets to add to the user. Must be unique across your instance. The first wallet will be set as the user's primary wallet. |
| `username` | `string` | No | The username to give to the user. It must be unique across your instance. |
| `password` | `string` | Yes | The plaintext password to give to the user. Must be at least 8 characters long, and can not be in any list of hacked passwords. |
| `passwordDigest` | `string` | No | In case you already have the password digests and not the passswords, you can use them for the newly created user via this property. The digests should be generated with one of the supported algorithms. The hashing algorithm can be specified using the Password Hasher property. |
| `passwordHasher` | `string` | No | The hashing algorithm that was used to generate the password digest. The algorithms that Clerk supports at the moment are bcrypt, bcrypt_sha256_django, md5, pbkdf2_sha256, pbkdf2_sha256_django, phpass, scrypt_firebase and 2 argon2 variants, argon2i and argon2id. Each of the above expects the incoming digest to be of a particular format. See the documentation for further information. |
| `skipPasswordChecks` | `boolean` | No | When set to true all password checks are skipped. It is recommended to use this method only when migrating plaintext passwords to Clerk. Upon migration the user base should be prompted to pick stronger password. |
| `skipPasswordRequirement` | `boolean` | No | When set to true, password is not required anymore when creating the user and can be omitted. This is useful when you are trying to create a user that doesn't have a password, in an instance that is using passwords. Please note that you cannot use this flag if password is the only way for a user to sign into your instance. |
| `totpSecret` | `string` | No | In case TOTP is configured on the instance, you can provide the secret to enable it on the newly created user without the need to reset it. |
| `backupCodes` | `string[]` | No | If Backup Codes are configured on the instance, you can provide them to enable it on the newly created user without the need to reset them. You must provide the backup codes in plain format or the corresponding bcrypt digest. |
| `publicMetadata` | `object` | No | Metadata saved on the user, that is visible to both your Frontend and Backend APIs. |
| `privateMetadata` | `object` | No | Metadata saved on the user, that is only visible to your Backend API. |
| `unsafeMetadata` | `object` | No | Metadata saved on the user, that can be updated from both the Frontend and Backend APIs. Note: Since this data can be modified from the frontend, it is not guaranteed to be safe. |
| `createdAt` | `string` | No | A custom date/time denoting when the user signed up to the application, specified in RFC3339 format (e.g. 2012-10-20T07:15:20.902Z). |

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

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: "clerk-create-user",
  arguments: {
    externalId: "External Id",
    firstName: "First 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: "clerk-create-user",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    clerk: { authProvisionId: "apn_xxxxxxx" },
    externalId: "External Id",
    firstName: "First 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": "clerk-create-user",
    "configured_props": {
      "clerk": { "authProvisionId": "apn_xxxxxxx" },
      "externalId": "External Id",
      "firstName": "First Name"
    }
  }'
```

---

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