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

# Schedule Templates

> Save a set of schedule items as a reusable template, then apply it to another day.

A **schedule template** is a reusable snapshot of one or more [schedule items](/endpoints/schedule) — their times, notes, locations, attachments, reminders, travel details and visibility. Applying a template recreates those items on another day of the same tour, which is how a repeating show-day running order is set up once and reused.

Template IDs are integers.

All endpoints require the standard [authentication](/authentication) headers.

<Note>
  **Templates are per user.** Every endpoint on this page sees only the templates belonging to the authenticated Daysync user — never another member's, even for a tour or organization administrator. A template's tour is fixed when it is saved, and it can only ever be applied to a day of that tour.
</Note>

***

## List templates

```text theme={null}
GET /v1/tours/{tourId}/schedule-templates
```

Returns the authenticated user's templates for a tour, newest first.

**Scope:** `schedule.read`

**Path parameters**

| Name     | Type          | Description                       |
| -------- | ------------- | --------------------------------- |
| `tourId` | string (UUID) | The tour whose templates to list. |

**Example**

```bash theme={null}
curl "$BASE/v1/tours/2f1c…/schedule-templates" \
  -H "x-api-key: $KEY" -H "x-api-secret: $SECRET" -H "Authorization: Bearer $TOKEN"
```

**Response `data`** — array of templates:

```json theme={null}
{
  "status": true,
  "message": "Templates retrieved successfully",
  "data": [
    {
      "id": 214,
      "template_name": "Standard show day",
      "tour_id": "2f1c…",
      "org_id": "9a4b…",
      "created_by": "…",
      "item_templates_count": 6
    }
  ]
}
```

| Field                  | Type          | Description                                                  |
| ---------------------- | ------------- | ------------------------------------------------------------ |
| `id`                   | integer       | Template ID — pass to every other endpoint on this page.     |
| `template_name`        | string        | Template name. Unique among your own templates in this tour. |
| `tour_id`              | string (UUID) | The tour this template belongs to.                           |
| `org_id`               | string (UUID) | The organization.                                            |
| `created_by`           | string (UUID) | Owner — always the authenticated user.                       |
| `item_templates_count` | integer       | How many items the template holds.                           |

<Note>
  The organization is resolved from the tour in the path — you do not supply an `org_id`.
</Note>

***

## Read a template's items

```text theme={null}
GET /v1/schedule-templates/{templateId}/items
```

Returns the items a template holds — what [Apply a template](#apply-a-template) would create.

**Scope:** `schedule.read`

**Path parameters**

| Name         | Type    | Description   |
| ------------ | ------- | ------------- |
| `templateId` | integer | The template. |

**Response `data`** — array of template items:

```json theme={null}
{
  "id": 5510,
  "scheduled_template_id": 214,
  "name": "Soundcheck",
  "notes": "FOH ready 15 min before",
  "start_time": "14:00:00",
  "end_time": "15:00:00",
  "start_time_type_id": 1,
  "end_time_type_id": 1,
  "allDay": false,
  "formatted_address": "123 Main St",
  "location_coordinates": { "lat": -33.86, "lng": 151.21 },
  "timezone_start": "Australia/Sydney",
  "timezone_end": "Australia/Sydney",
  "item_type_id": 3,
  "item_color_id": 4,
  "status_type": 1,
  "is_everyone": true,
  "is_admin_only": false,
  "attachments": [ { "id": 88, "name": "Stage plot", "link": "https://…", "file_name": "plot.pdf" } ],
  "reminders": [ { "id": 31, "duration": 30, "reminder_type_id": 1, "description": "30 min before" } ],
  "travelbreaks": [ { "id": 12, "name": "Coffee", "duration": 15 } ],
  "visibilities": [ { "id": 7, "user_id": "…", "tour_invite_id": null } ],
  "tag_ids": [ 1340 ]
}
```

ID-valued fields use the same lookups as schedule items — see [Reference Data](/endpoints/reference) and [Field Reference](/field-reference).

***

## Save a template

```text theme={null}
POST /v1/schedule-templates
```

Snapshots existing schedule items into a new template.

**Scope:** `schedule.write`

**Body**

| Field               | Type            | Required | Description                                                                                                                               |
| ------------------- | --------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `templateName`      | string          | Yes      | Template name, 1–255 characters. Must be unique among your own templates in this tour.                                                    |
| `itemIds`           | array\<integer> | Yes      | Schedule item IDs to snapshot, from [`GET /v1/tours/{tourId}/days/{dayId}/schedule`](/endpoints/schedule#list-schedule-items). 1–500 IDs. |
| `includeNotes`      | boolean         | No       | Copy each item's notes. Defaults to `true`.                                                                                               |
| `includeVisibility` | boolean         | No       | Copy each item's visibility audience. Defaults to `true`.                                                                                 |
| `includeAttachment` | boolean         | No       | Copy each item's attachments. Defaults to `true`.                                                                                         |

<Warning>
  **The template's tour is derived from `itemIds` — there is no `tourId` in the path or body.** Every ID must belong to the **same** tour, and that tour becomes the only one the template can be applied to. A list spanning two tours is rejected with `400 VALIDATION_ERROR`.

  You must also be able to see every item you name: an item restricted away from you returns `404`.
</Warning>

**Example**

```bash theme={null}
curl -X POST "$BASE/v1/schedule-templates" \
  -H "x-api-key: $KEY" -H "x-api-secret: $SECRET" -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "templateName": "Standard show day", "itemIds": [9021, 9022, 9023] }'
```

**Response `data`:** `{ "id": 214 }` — the new template's ID.

***

## Rename a template

```text theme={null}
PUT /v1/schedule-templates/{templateId}
```

**Scope:** `schedule.write`

**Body**

| Field          | Type   | Required | Description                 |
| -------------- | ------ | -------- | --------------------------- |
| `templateName` | string | Yes      | New name, 1–255 characters. |

<Note>
  Renaming is the **only** edit this endpoint performs — a template's items are fixed when it is saved. To change the items, save a new template.
</Note>

**Response `data`:** `{ "id": 214 }`.

***

## Delete a template

```text theme={null}
DELETE /v1/schedule-templates/{templateId}
```

Soft-deletes the template and its items. Schedule items previously created **from** the template are not affected.

**Scope:** `schedule.write`

**Response `data`:** none (status + message only).

***

## Restore a deleted template

```text theme={null}
POST /v1/schedule-templates/{templateId}/restore
```

Restores a soft-deleted template, with its items.

**Scope:** `schedule.write`

**Response `data`:** none. A template that is not deleted returns `400`.

***

## Apply a template

```text theme={null}
POST /v1/schedule-templates/{templateId}/apply
```

Creates the template's items on a tour day.

**Scope:** `schedule.write`

**Body**

| Field   | Type                 | Required | Description                                                      |
| ------- | -------------------- | -------- | ---------------------------------------------------------------- |
| `dayId` | integer              | Yes      | The day to apply to. Must belong to the **template's own tour**. |
| `mode`  | `MERGE` \| `REPLACE` | No       | Defaults to `MERGE`.                                             |

| Mode      | Effect                                                                                                                                          |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `MERGE`   | Adds the template's items alongside whatever is already on the day.                                                                             |
| `REPLACE` | **Soft-deletes the day's existing items that you can see** first, then applies the template. Items restricted away from you are left untouched. |

<Warning>
  `REPLACE` deletes before it creates. Both modes are reversible with [Undo an apply](#undo-an-apply), but that only removes the items this template created — it does not bring back what `REPLACE` deleted. Prefer `MERGE` unless you specifically want the day cleared.
</Warning>

**Example**

```bash theme={null}
curl -X POST "$BASE/v1/schedule-templates/214/apply" \
  -H "x-api-key: $KEY" -H "x-api-secret: $SECRET" -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "dayId": 1844, "mode": "MERGE" }'
```

**Response `data`:** `{ "ids": [9101, 9102, 9103] }` — the created schedule item IDs, in template order.

A `dayId` that is not on the template's tour returns `400`. You must still be a member of that tour: a `403` means you no longer are.

***

## Undo an apply

```text theme={null}
POST /v1/schedule-templates/{templateId}/undo-apply
```

Soft-deletes the items this template created on a day.

**Scope:** `schedule.write`

**Body**

| Field   | Type    | Required | Description                                                     |
| ------- | ------- | -------- | --------------------------------------------------------------- |
| `dayId` | integer | Yes      | The day whose items from this template application are removed. |

Only items stamped with this template ID are touched, and only ones you can see. Items you created by hand, or from a different template, are left alone.

**Response `data`:** none.

***

See also: [Schedule](/endpoints/schedule), [Tours](/endpoints/tours), [Reference Data](/endpoints/reference).
