<!-- https://developers.silktide.com/v1/governance/report-schedules/list-report-schedules | Governance / Report schedules -->

# List report schedules

`GET /v1/report-schedules`

Returns every report schedule the API key's user can see, with no paging.

Each schedule lists the users and roles it emails as `assigneesIds`, but not the other email addresses it sends to. For those, and for who may see and admin a schedule, use [Get a report schedule](https://developers.silktide.com/v1/governance/report-schedules/get-report-schedule.md), which returns the same users and roles as `subscribers.assigneeIds`.

`assigneesIds` and `creatorAssigneeId` are [assignee](https://developers.silktide.com/v1/platform/assignees.md) ids. The snapshots a schedule has made are in [List reports](https://developers.silktide.com/v1/governance/reports/list-reports.md), with its `reportScheduleId`.

A schedule with a non-null `skipped` did not run when it was last due, and says why. It needs nothing from you: it runs again by itself once the reason has gone.

## Response

Status `200`.

- `reportSchedules` (list of objects, required): Every report schedule the API key's user can see.
  - `reportScheduleId` (integer, required, at least 1): The report schedule.
  - `name` (string, required, at least 1 characters): Its name. The snapshots it makes are named from their template, not from this.
  - `reportTemplateId` (string, required, 1 to 16 characters): The report template each snapshot is built from.
  - `context` (object or map of any JSON or empty list, required): What it covers, in the shape its `contextTypeId` takes: `{"websiteId": 3, "sectionId": 0}` for one website, `{"criteria": {...}}` for several. `[]` when it has none.
    - `websiteId` (integer, required, at least 1): The website.
    - `sectionId` (integer, required): One of its sections. `0` for the whole website.
  - `emailSubject` (string, required, up to 255 characters): The subject of the email subscribers get. Empty for the default, the snapshot's name followed by "is ready".
  - `emailMessage` (string, required, up to 4096 characters): Text at the top of the email subscribers get. Can be empty.
  - `scheduleInterval` (string, required): The unit of how often it runs. One of: `day`, `week`, `month`, `year`.
  - `schedulePeriod` (integer, required, 1 to 90): How many `scheduleInterval`s apart runs are. `week` and `2` runs every two weeks.
  - `scheduleFromDate` (integer, required): When the schedule counts from. Each run falls a whole number of periods after it.
  - `durationInterval` (string, required): The unit of how far back each snapshot looks. One of: `day`, `week`, `month`, `year`.
  - `durationPeriod` (integer, required, 1 to 90): How many `durationInterval`s back each snapshot looks, from when it runs.
  - `created` (integer, required): When it was created.
  - `lastRun` (integer, required): When it last made a snapshot. `0` if never.
  - `nextDue` (integer, required): When it next runs. In the past when a run is waiting to be picked up.
  - `creatorAssigneeId` (string, required): The assignee who created it: a user (`u:`), an API key (`a:`), or `system` for those Silktide made itself.
  - `skipped` (object, required, can be null): Null, or why its last due run made no snapshot and sent no email. It runs again by itself once the reason has gone.
    - `at` (integer, required): When the run was due.
    - `reason` (string, required): Why it was skipped, as a stable id: `no-platform-access` when the account has no active plan.
    - `message` (string, required, can be null): The reason, in the API user's language. Null for a reason without one.
  - `assigneesIds` (list of strings, required): Users and roles emailed when it runs, as assignee ids. Note the spelling: `assigneesIds`, with an s.

## Errors

| Status | Type | When |
| --- | --- | --- |
| 403 | `EditionNotAvailable` | The account does not have Silktide 4. Reports, report schedules and report templates are Silktide 4's, so an account with only Silktide 5 cannot use them. |
| 401 | `NotLoggedIn` | No API key was sent, or it is not a key for this region. |
| 429 | `TooManyRequests` | Too many requests to this path in five seconds. Retry after the number of seconds in the `Retry-After` header, which `properties.retryAfter` repeats. |
| 503 | - | Silktide is busy. Retry after the number of seconds in the `Retry-After` header. |

## Access

- Permission: any user of the account
- Plan feature: none
- Edition: Silktide 4 only
- Cost: free
- Stability: stable, since 1.0.0

## Example: A monthly broken links report

```bash
curl "https://api.eu.silktide.com/v1/report-schedules" \
  -H "Authorization: silktide token=$SILKTIDE_API_KEY"
```

Response:

```json
{
  "reportSchedules": [
    {
      "reportScheduleId": 1,
      "name": "Broken links report for Wine Barrel",
      "reportTemplateId": "broken-links",
      "context": {
        "websiteId": 3,
        "sectionId": 0
      },
      "emailSubject": "Monthly broken links",
      "emailMessage": "Fix these first.",
      "scheduleInterval": "month",
      "schedulePeriod": 1,
      "scheduleFromDate": 1793577600,
      "durationInterval": "day",
      "durationPeriod": 30,
      "created": 1793520000,
      "lastRun": 1796169600,
      "nextDue": 1798761600,
      "creatorAssigneeId": "u:eu-12",
      "assigneesIds": [
        "u:eu-12",
        "g:4"
      ],
      "skipped": null
    }
  ]
}
```
