> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Create Scheduled Shift

> Creates a scheduled shift by providing draft shift details such as job ID, team member assignment, and start and end times.

`square.createScheduledShift` creates a scheduled shift by providing draft shift details such as job ID, team member assignment, and start and end times.

## Example

```ts automations/square-create-scheduled-shift.automation.ts theme={null}
import { automation, onDashboardRun } from "automate.ax"
import { square } from "automate.ax/square"

export default automation("Create Square Scheduled Shift", () => {
  onDashboardRun({ title: "Create Square Scheduled Shift" })

  square.createScheduledShift({
    idempotencyKey: "HIDSNG5KS478L",
    scheduledShift: {
      draftShiftDetails: {
        teamMemberId: "ormj0jJJZ5OZIzxrZYJI",
        locationId: "PAA1RJZZKXBFG",
        jobId: "FzbJAtt9qEWncK1BWgVCxQ6M",
        startAt: "2019-01-25T03:11:00-05:00",
        endAt: "2019-01-25T13:11:00-05:00",
        notes: "Dont forget to prep the vegetables",
        isDeleted: false,
      },
    },
  })
})
```

## Inputs

Every input accepts a compatible signal. It requires `TIMECARDS_WRITE`.

| Field            | Type                    | Required | Default | Description                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | ----------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `idempotencyKey` | `string`                | No       | —       | A unique identifier for the `CreateScheduledShift` request, used to ensure the [idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) of the operation.                                                                                                                                                                                                       |
| `scheduledShift` | `Square.ScheduledShift` | Yes      | —       | The scheduled shift with `draft_shift_details`. If needed, call ListLocations to get location IDs, ListJobs to get job IDs, and SearchTeamMembers to get team member IDs and current job assignments. The `start_at` and `end_at` timestamps must be provided in the time zone + offset of the shift location specified in `location_id`. Example for Pacific Standard Time: 2024-10-31T12:30:00-08:00 |

Use the official [CreateScheduledShift reference](https://developer.squareup.com/reference/square/labor-api/create-scheduled-shift) for provider field semantics and limits.

## Output

Returns the official `Square.CreateScheduledShiftResponse` response as a codec-safe object. Square integer money amounts remain `bigint` values.
