> Documentation index for AI agents: https://docs.pagerduty.com/llms.txt

# Create a rotation

`POST https://api.pagerduty.com/v3/schedules/{id}/rotations`

<!-- theme: info -->

> **Important note:** Shift-based schedules use the V3 API and are not compatible with V2 automations. **To create automations for Shift-Based Schedules, you need to:**
>
> 1. **Update your automations** to use the V3 API for all new shift-based schedules
> 2. **Keep the V2 endpoint** for your existing schedules
>
> An upgrade tool for existing schedules is coming soon; your legacy schedules will keep working in the meantime. [Learn more](https://support.pagerduty.com/main/docs/shift-based-schedules-api-upgrade-examples).

Create a new empty rotation for a schedule. After creating a rotation,
add events to define the on-call pattern.

**Note:** Rotations have no configuration of their own — all scheduling
logic (recurrence, assignment strategy, members) is specified on events.
The request body must be empty or `{}`.

## Authorization

- **api_key** (apiKey) — `Authorization` header. The API Key with format `Token token=<API_KEY>`

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | The ID of the schedule. |

## Request body (`application/json`)

Type: object

## Response 201

Rotation created successfully

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `rotation` | object | yes | A rotation within a schedule. All scheduling logic (recurrence, assignment strategy, members) is defined on the rotation's events. |
| `rotation.id` | string | yes |  |
| `rotation.type` | string | yes | One of: `schedule_rotation`. |
| `rotation.events` | array of object |  | Events in this rotation. |
| `rotation.events[].id` | string | yes |  |
| `rotation.events[].type` | string | yes | One of: `schedule_event`. |
| `rotation.events[].name` | string | yes | Display name for this event. |
| `rotation.events[].start_time` | object | yes | A time-of-day value with an explicit time zone. Used for event `start_time` and `end_time` to define the recurring window of coverage (e.g., 9 AM–5 PM every Monday in New York). |
| `rotation.events[].start_time.date_time` | string (date-time) | yes | The date and time. |
| `rotation.events[].start_time.time_zone` | string | yes | IANA timezone identifier. |
| `rotation.events[].end_time` | object | yes | A time-of-day value with an explicit time zone. Used for event `start_time` and `end_time` to define the recurring window of coverage (e.g., 9 AM–5 PM every Monday in New York). Same fields as `rotation.events[].start_time` above. |
| `rotation.events[].effective_since` | string (date-time) | yes | When this event starts producing shifts (UTC) |
| `rotation.events[].effective_until` | string \| null (date-time) |  | When this event stops producing shifts (UTC). Null means indefinite. |
| `rotation.events[].recurrence` | array of string | yes | RFC 5545 recurrence rules defining the repeating pattern. This must be an array containing: <br> - Exactly one <b>RRULE</b> <br>- Zero or more <b>EXDATE</b> <br>- Zero or more <b>RDATE</b>. |
| `rotation.events[].assignment_strategy` | object | yes | Defines how users are assigned on-call within an event's time window. - `rotating_member_assignment_strategy`: users rotate in sequence. `shifts_per_member` controls how many consecutive shift periods each member covers before rotating. - `every_member_assignment_strategy`: all listed members are on-call simultaneously for every occurrence. |
| `rotation.events[].assignment_strategy.type` | string | yes | One of: `rotating_member_assignment_strategy`, `every_member_assignment_strategy`. |
| `rotation.events[].assignment_strategy.shifts_per_member` | integer |  | Required for `rotating_member_assignment_strategy`. Number of consecutive shift occurrences each member covers before the next member takes over. Must be omitted (or null) for `every_member_assignment_strategy`. **UI editor constraint:** When `recurrence` uses `FREQ=WEEKLY`, `shifts_per_member` must be evenly divisible by the number of days listed in the RRULE `BYDAY` parameter. Events that violate this are fully functional via the API but cannot be loaded in the web schedule editor. Minimum: 1. |
| `rotation.events[].assignment_strategy.members` | array of object | yes | Min items: 1. Max items: 60. |
| `rotation.events[].assignment_strategy.members[].type` | string | yes | `user_member` — a specific user is assigned. `empty_member` — the slot is intentionally unassigned. One of: `user_member`, `empty_member`. |
| `rotation.events[].assignment_strategy.members[].user_id` | string |  | The ID of the user. Required when type is `user_member`. |
| `rotation.events[].self` | string (uri) |  |  |
| `rotation.events[].html_url` | string (uri) |  |  |
| `rotation.self` | string (uri) |  |  |
| `rotation.html_url` | string (uri) |  |  |

## Response 400

Bad Request — The request contains invalid parameters or data

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object | yes |  |
| `error.message` | string | yes |  |
| `error.code` | integer | yes |  |
| `error.errors` | object |  | Map of field path to list of validation messages for that field. Field paths use dot notation prefixed by the resource type (e.g. `event.effective_since`, `rotation.events`). |

Example: default

```json
{
  "error": {
    "message": "Invalid Request",
    "code": 2001,
    "errors": {
      "event.effective_since": [
        "Date cannot be more than 12 months in the future"
      ]
    }
  }
}
```

## Response 401

Caller did not supply credentials or did not provide the correct credentials.
If you are using an API key, it may be invalid or your Authorization header may be malformed.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Response 403

Caller is not authorized to view the requested resource.
While your authentication is valid, the authenticated user or token does not have permission to perform this action.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Response 404

The requested resource was not found.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Response 500

Internal Server Error the PagerDuty server experienced an error.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Developer Agreement

Your access to and use of the PagerDuty Developer Services is governed by the [PagerDuty Developer Agreement](https://docs.pagerduty.com/developer/pagerduty-developer-agreement).
