DaytonaDocs

Scheduling Functions

Run a function on a cron cadence with an optional fixed payload.

A schedule runs a function automatically on a recurring cadence. You attach a cron schedule to a function with a 5-field cron expression (evaluated in UTC) and an optional fixed payload; on every tick Daytona invokes the function's current version with that payload. Each firing produces an ordinary invocation you can inspect through the invocation log or by polling GET /invocations/:id. Schedules are ideal for periodic work — nightly ETL, health polls, digest emails — where you want the platform to do the calling on a clock.

Creating a schedule

Create a schedule with the SDK or the REST API. The cron expression has five fields — minute, hour, day-of-month, month, day-of-week — and is interpreted in UTC. The payload is forwarded verbatim to the handler on each fire, exactly like a manual invocation.

Python
from rlp import Daytona
 
daytona = Daytona()
 
# Run every day at 02:00 UTC with a fixed payload.
sched = daytona.fn.schedule("nightly-etl", "0 2 * * *", {"mode": "full"})
print(sched["id"], sched["next_run_at"])
TypeScript
import { Daytona } from '@rlp/sdk'
 
const daytona = new Daytona()
 
const sched = await daytona.fn.schedule('nightly-etl', '0 2 * * *', { mode: 'full' })
console.log(sched.id, sched.next_run_at)
cURL
curl -X POST https://api.rl.trydaytona.com/fns/nightly-etl/schedules \
  -H "Authorization: Bearer $RLP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "cron": "0 2 * * *", "payload": { "mode": "full" } }'

The response includes the schedule's id, whether it's enabled, and the computed next_run_at. A schedule with an unparseable cron expression is rejected with 400.

Listing and deleting schedules

A function can have multiple schedules. List them to see each one's cron expression, payload, enabled state, and next and last run times; delete one by id when you no longer need it.

cURL
curl https://api.rl.trydaytona.com/fns/nightly-etl/schedules \
  -H "Authorization: Bearer $RLP_API_KEY"
cURL
curl -X DELETE https://api.rl.trydaytona.com/fns/nightly-etl/schedules/$SCHEDULE_ID \
  -H "Authorization: Bearer $RLP_API_KEY"

Inspecting scheduled runs

Each fire is an async invocation, so you inspect it the same way you inspect a spawned one — through the function's invocation log, or by polling GET /invocations/:id. Because scheduled invocations run asynchronously, the 256 KiB retrievable-result limit for async results applies: return a reference to any large output rather than the output itself.

Note: Cron schedules always run against the function's current version. Redeploying rolls scheduled runs forward to the new version automatically — there's nothing to re-point.

For the full request and response shapes, see the Functions API reference.

On this page