Cron API
Create, list, and delete cron jobs directly on the OpenClaw gateway. Cron jobs run recurring tasks on your agent using the gateway’s built-in scheduler.These endpoints manage cron jobs on the gateway itself via
POST /tools/invoke. For application-level scheduled tasks stored in the database, see the scheduled tasks API.Cron is enabled by default on all new instances. The provisioning template sets a maximum of 2 concurrent runs and 24-hour session retention. You can adjust these limits using the config API.
List cron jobs
Response
Job object
| Field | Type | Description |
|---|---|---|
id | string | Job identifier |
name | string | Job display name |
enabled | boolean | Whether the job is active |
schedule | object | Schedule configuration. Contains kind (every for interval-based) and timing fields like everyMs (interval in milliseconds) or expr (cron expression). |
payload | object | Job payload sent to the agent when the job runs |
lastRun | string | null | ISO 8601 timestamp of the last execution |
nextRun | string | null | ISO 8601 timestamp of the next scheduled execution |
Response fields
| Field | Type | Description |
|---|---|---|
jobs | array | List of cron job objects |
total | number | Total number of jobs |
source | string | Data source — gateway on success, gateway-error when the gateway is unreachable |
Gateway errors
When the gateway is unreachable, the endpoint returns HTTP200 with an empty job list and the error detail:
Example
Create a cron job
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Job name |
schedule | object | Yes | Schedule configuration. Use { "kind": "every", "everyMs": 3600000 } for interval-based schedules, or { "kind": "cron", "expr": "0 9 * * *" } for cron expressions. |
payload | object | Yes | Job payload sent to the agent on each run |
enabled | boolean | No | Whether the job starts active. Defaults to true. |
Example request
Response
Errors
| Code | Description |
|---|---|
| 400 | name, schedule, and payload required — one or more required fields are missing |
| 401 | Unauthorized — no valid session |
| 502 | Gateway error — the gateway rejected the request or is unreachable |
Example
Delete a cron job
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
jobId | string | Yes | ID of the job to delete |
Response
Errors
| Code | Description |
|---|---|
| 400 | jobId required — the jobId query parameter is missing |
| 401 | Unauthorized — no valid session |
| 502 | Gateway error — the gateway rejected the request or is unreachable |