# Create Time Off Request — BambooHR

> Create a time off request for an employee. Use List Time Off Types to find a valid time off type ID and Get Employees Directory for the employee ID. See the documentation

- Key: `bamboohr-create-time-off-request`
- Type: Action (Write)
- Version: 0.0.1
- App: BambooHR (`bamboohr`) — https://pipedream.com/apps/bamboohr.md
- This page (HTML): https://pipedream.com/apps/bamboohr/actions/create-time-off-request
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/bamboohr/actions/create-time-off-request/create-time-off-request.mjs

## Description

Create a time off request for an employee. Use **List Time Off Types** to find a valid time off type ID and **Get Employees Directory** for the employee ID. [See the documentation](https://documentation.bamboohr.com/reference/create-time-off-request)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `employeeId` | `string` | Yes | The employee ID (digits only), e.g. 100. Run Get Employees Directory to discover IDs. |
| `status` | `string` | Yes | Initial request status. One of approved, denied, declined, requested. |
| `start` | `string` | Yes | Start date in YYYY-MM-DD format. |
| `end` | `string` | Yes | End date in YYYY-MM-DD format. |
| `timeOffTypeId` | `string` | Yes | The time off type ID, e.g. 5. Run List Time Off Types to discover IDs. |
| `amount` | `string` | No | Required unless dates is supplied instead. Total amount of time off for the whole date range, measured in the time off type's own unit — run List Time Off Types to check whether this type is days or hours before choosing a value. For a days type this is a day-fraction (e.g. 1 for one full day, 3 for a 3-day range), NOT hours; for an hours type it's the literal hour count (e.g. 8). A value outside what the date range can hold (e.g. 8 for a 1-day days-type request) is rejected by the API. |
| `previousRequest` | `string` | No | The ID of a prior time off request to supersede, e.g. 12345. Run List Time Off Requests to find a valid ID. Supersedes the prior request: it's cancelled, its approval workflow is removed, and any related notifications are deleted. |
| `notes` | `string` | No | JSON array of note objects, e.g. [{"from":"employee","note":"Vacation"}]. |
| `dates` | `string` | No | Optional per-day breakdown; when supplied, amount is ignored and the sum of these daily amounts is used instead. JSON array of per-day objects, each amount in the time off type's own unit (a days-type request typically uses 1 per full day, not hours) — e.g. [{"ymd":"2026-07-01","amount":1}] for a days-type, or [{"ymd":"2026-07-01","amount":8}] for an hours-type. |

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

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: "bamboohr-create-time-off-request",
  arguments: {
    employeeId: "Employee ID",
    status: "Status",
  },
})
```

**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: "bamboohr-create-time-off-request",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    bamboohr: { authProvisionId: "apn_xxxxxxx" },
    employeeId: "Employee ID",
    status: "Status",
  },
})

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": "bamboohr-create-time-off-request",
    "configured_props": {
      "bamboohr": { "authProvisionId": "apn_xxxxxxx" },
      "employeeId": "Employee ID",
      "status": "Status"
    }
  }'
```

---

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