# preview_cron_schedule

Source: https://modulify.ai/docs/api/scheduled-jobs/preview-cron-schedule

Works out the next 5 times a schedule would fire, without saving anything.

- Title: Preview when a schedule would fire
- Scope: `config:read`
- Access: Read only
- Endpoint: `POST /v1/preview_cron_schedule`

The same validation runs as on `create_site_cron` and `update_site_cron`, including the 5 minutes minimum between runs, so an invalid schedule comes back with the reason instead of a list of times. The tool tells the client to always reach for it before writing a schedule you described in words. Times are UTC.

A schedule takes a `Kind` and only the fields that kind uses. `hourly` needs `Minute`, `daily` needs `Hour` and `Minute`, `weekly` needs `DaysOfWeek`, `Hour` and `Minute`, `monthly` needs `DayOfMonth`, `Hour` and `Minute`, and `cron` needs `Expression`. See [Scheduled jobs](https://modulify.ai/docs/automations/scheduled-jobs#choose-a-schedule).

## Request

Call it with a `POST` to `https://api.modulify.ai/v1/preview_cron_schedule`, sending the inputs below as a JSON object. The token needs the `config:read` scope.

It only reads and changes nothing, so retrying it is safe.

```bash
curl -X POST https://api.modulify.ai/v1/preview_cron_schedule \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"projectId":"PROJECT_ID","schedule":{}}'
```

Over MCP, the same method is the [preview_cron_schedule tool](https://modulify.ai/docs/mcp/scheduled-jobs/preview-cron-schedule).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site the schedule is for. Your token's access is checked against it. |
| `schedule` | object | Yes | When it runs, in UTC. Its fields are `Kind` (`hourly`, `daily`, `weekly`, `monthly` or `cron`), `Minute` (0 to 59), `Hour` (0 to 23), `DaysOfWeek` (a list of integers from 0 to 6, Sunday is 0), `DayOfMonth` (1 to 31) and `Expression` (a five field cron expression, used only when `Kind` is `cron`). Fill only the fields the `Kind` uses. |

## Response

Every call answers with the [JSON envelope](https://modulify.ai/docs/api/requests-and-responses#the-response) of `success`, `message`, `data`, `code` and `version`. `data` holds the result described above, and on a method that returns a total, `count` carries it. The [response headers](https://modulify.ai/docs/api/requests-and-responses#headers-on-every-method-call) carry the call's `X-Request-Id` and what is left of your per-minute budget in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. [Errors](https://modulify.ai/docs/api/errors) explains every status code a call can answer with.