# cron

Canonical page: https://docs.ovok.com/settings-and-features/features/cron

Lets the project schedule Bots to run on a timer. A Bot with a `cronString` or `cronTiming` element is registered to run on that schedule.

| | |
| --- | --- |
| Type | Project feature |
| Value in `features` | `cron` |
| Change with | `PATCH /v1/projects/me/features` (replaces the whole list) |
| Who can change it | Project admin. Any practitioner can read the list. |
| On for new projects | Yes |
| Needs | [bots](/settings-and-features/features/bots) as well |
| When off | A scheduled Bot saves, but nothing is scheduled. There is no error. |

## What it enables [#what-it-enables]

When a Bot is created or updated, Ovok registers its schedule if the Bot has a `cronString` or a `cronTiming` and the project has `cron`. At each tick the Bot runs as if it had been executed by id, so it needs [bots](/settings-and-features/features/bots) too. For the shape of `cronTiming`, see [Timing](/fhir-elements/complex/timing).

## Turn it on [#turn-it-on]

Add `cron` to the list and send the whole list. Include `bots`, or the schedule will fire and be refused.

```bash
curl --request PATCH \
  --url 'https://api.sandbox.ovok.com/v1/projects/me/features' \
  --header "Authorization: Bearer ${OVOK_TOKEN}" \
  --header 'Content-Type: application/json' \
  --data '{"features":["bots","cron","email","transaction-bundles","websocket-subscriptions"]}'
```

## What happens when it is off [#what-happens-when-it-is-off]

Nothing visible. Saving a Bot with a schedule returns success, and no job is registered, so the Bot never runs on its own. No endpoint tells you that the schedule was ignored.

## Gotchas [#gotchas]

- **The schedule is registered when the Bot is saved, not when it fires.** Turning `cron` on does not schedule Bots you saved earlier. Save each one again to register it.
- **Turning `cron` off does not stop schedules that already exist.** They keep firing while [bots](/settings-and-features/features/bots) is on. To stop a scheduled Bot, remove its schedule and save it, or delete the Bot.
- **`cron` alone runs nothing.** Without `bots`, each tick is refused with `Bots not enabled`.
- **A silent miss is the failure mode.** If a scheduled Bot is not running, check the features list first, then re-save the Bot.
- **Projects created before this was a default can lack it.** Call `GET /v1/projects/me/features` and check.

## Related [#related]

- [bots](/settings-and-features/features/bots)
- [email](/settings-and-features/features/email)
- [Execute a Bot by id](/primitives/execute-bot-by-id)
