# Create Employee — Personio

> Creates a new employee. See the documentation

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

## Description

Creates a new employee. [See the documentation](https://developer.personio.de/reference/post_company-employees)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `email` | `string` | Yes | The e-mail field is required for the employee creation. Updating of this field is not currently supported. |
| `firstName` | `string` | Yes | The first name of the employee. |
| `lastName` | `string` | Yes | The last name of the employee. |
| `gender` | `string` | No | The gender of the employee. |
| `position` | `string` | No | The position of the employee. E.g. developer. |
| `subcompany` | `string` | No | The subcompany employee belongs to. Should be predefined in Personio. Otherwise will be ignored with showing meta error in the response. |
| `department` | `string` | No | The department employee belongs to. Should be predefined in Personio. Otherwise will be ignored with showing meta error in the response. |
| `office` | `string` | No | The office employee belongs to. Should be predefined in Personio. Otherwise will be ignored with showing meta error in the response. |
| `hireDate` | `string` | No | Employee hire date. Format: "yyyy-mm-dd". If status is not provided, it will be set to active if the hire date is in the past, or to onboarding if it's in the future. |
| `weeklyWorkingHours` | `integer` | No | All hours usually worked, including regular overtime. |
| `status` | `string` | No | Status of the employee. Overrides the status determined based on the value of hire_date. |
| `supervisorId` | `string` | No | Employee ID of the Supervisor to be assigned. It needs to belong to a current existing employee, otherwise an error will be returned. If not present, no supervisor will be assigned. Options are loaded from the connected account. |
| `customAttributes` | `object` | No | Additional attributes to the employee. |

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

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

---

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