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

# Schedules API: Run Hosted Agents on a Cron

> Create, update, pause, and run cron schedules for hosted agents with the OneCLI API. Each run sends a prompt to the agent.

A schedule runs a prompt on a hosted agent at the times a cron expression sets. Each run lands as a turn in your direct thread with the agent, so reports show up where you created the schedule.

Use these endpoints to automate recurring work such as daily reports or nightly checks. To control which services a scheduled run can reach, see [Agent access](https://onecli.sh/docs/guides/agent-access.md).

## Related guides

* [Agent access: grant credentials to agents](https://onecli.sh/docs/guides/agent-access.md)
* [Rules: control what agents can do](https://onecli.sh/docs/guides/rules.md)

## Endpoints

| Endpoint | Method and path | What it does |
| - | - | - |
| [List an agent's schedules](https://onecli.sh/docs/api-reference/schedules/list-an-agents-schedules.md) | `GET /agents/{agentId}/crons` | List every cron schedule on a hosted agent, with its prompt, cron expression, and next run time. |
| [Create a schedule](https://onecli.sh/docs/api-reference/schedules/create-a-schedule.md) | `POST /agents/{agentId}/crons` | Create a cron schedule that sends a prompt to a hosted agent on a recurring basis, such as a daily report or nightly check. |
| [Update, pause, or resume a schedule](https://onecli.sh/docs/api-reference/schedules/update-pause-or-resume-a-schedule.md) | `PATCH /agents/{agentId}/crons/{cronId}` | Change a schedule's prompt or cron expression, or pause and resume it without deleting it. |
| [Delete a schedule](https://onecli.sh/docs/api-reference/schedules/delete-a-schedule.md) | `DELETE /agents/{agentId}/crons/{cronId}` | Permanently delete a cron schedule from a hosted agent. |
| [Run a schedule now](https://onecli.sh/docs/api-reference/schedules/run-a-schedule-now.md) | `POST /agents/{agentId}/crons/{cronId}/run` | Trigger a schedule immediately instead of waiting for its next cron time. |

## Next steps

* [API overview](https://onecli.sh/docs/api-reference.md): base URLs, authentication, and pagination
* [Errors](https://onecli.sh/docs/api-reference/errors.md): status codes and the error format
* [Editions](https://onecli.sh/docs/api-reference/editions.md): which endpoints each edition serves


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.