Skip to main content

Schedules

A schedule starts actors or saved tasks automatically: every few minutes, every day, on the weekdays you pick, or once a month. Lantfly starts them on time even when your browser is closed. Find them under Automation → Schedules.

Create a schedule​

  1. Click New schedule.

  2. Give it a Name, for example "Daily collection". A Technical name for the API (lowercase letters, digits and dashes, unique in your account) is made from it; change it under Advanced if you like.

  3. Under What to run, pick A saved task or An actor. You can add an Input override (JSON, optional) under Advanced.

  4. Under When to run, pick how often:

    OptionExample
    Every few minutesEvery 5, 10, 15 or 30 minutes
    Every hourAt minute 15 of every hour
    Every dayAt 08:00, or at several times a day
    Some days of the weekMonday to Friday at 09:00
    Every monthOn day 1, or on the last day of the month
    Advanced (cron)Any cron expression
  5. Pick the time zone. It defaults to your browser's.

  6. Keep Notify me when it cannot start a run on to get a notification if a run is refused (for example when usage runs out).

  7. Click Save.

Below the form, a sentence describes the schedule ("Runs at 08:00 every day…") and lists its next five runs in the chosen time zone.

note

Several times a day can be combined only when they form a grid of hours and minutes (08:00 and 17:00, or 08:00 and 08:30). For 08:00 and 17:30, create two schedules.

The schedule list​

Each schedule shows a readable description of when it runs, its Next run, and its Last run with the status of the run it started. Runs and logs opens the runs that schedule started. Turn on / Turn off pauses a schedule without deleting it.

Cron expressions​

The API takes a five-field cron expression (minute hour day-of-month month day-of-week) or one of @hourly, @daily, @weekly, @monthly. L in the day-of-month field means the last day of the month. Time zones are IANA names such as Asia/Ho_Chi_Minh or Europe/Berlin; older names such as Asia/Saigon are accepted.

ExpressionRuns
*/15 * * * *Every 15 minutes
0 8 * * *Every day at 08:00
0 9 * * 1-5Monday to Friday at 09:00
0 8 L * *The last day of every month at 08:00

Preview the next runs​

GET /api/v3/schedules/preview returns the next fire times of an expression in a time zone, without saving anything. It uses the same cron engine as the scheduler, so it matches the real runs.

Preview a cron expression
curl -s -G "https://lantfly.com/api/v3/schedules/preview" \
-H "Authorization: Bearer $LANTFLY_TOKEN" \
--data-urlencode "cron_expression=0 8 * * 1-5" \
--data-urlencode "timezone=Asia/Ho_Chi_Minh" \
--data-urlencode "count=3"

The answer has cron_expression, timezone and next_runs (UTC timestamps). count is 1 to 10 (default 5). An invalid expression or time zone answers 422.

Create a schedule with the API​

Create a schedule
curl -s -X POST "https://lantfly.com/api/v3/schedules" \
-H "Authorization: Bearer $LANTFLY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "daily-collection",
"title": "Daily collection",
"cron_expression": "0 8 * * *",
"timezone": "Asia/Ho_Chi_Minh",
"is_enabled": true,
"notify_on_failure": true,
"actions": [
{ "type": "RUN_ACTOR_TASK", "task_id": "YOUR_TASK_ID" }
]
}'
FieldMeaning
nameUnique slug in your account
titleDisplay name, up to 120 characters
cron_expression, timezoneWhen it runs
is_enabledWhether it runs
notify_on_failureNotify the account when a fire cannot start its run (default true)
actionsUp to 10 actions: RUN_ACTOR with actor_id, or RUN_ACTOR_TASK with task_id, each with optional input and options

Each schedule returns next_run_at, last_run_at, last_run_id and last_run_status. Other calls:

RequestWhat it does
GET /api/v3/schedulesAll schedules; add page or per_page (up to 100) to page them
GET / PATCH / DELETE /api/v3/schedules/:scheduleRead (with recent runs), change (is_enabled turns it on or off), delete
POST /api/v3/schedules/bulkenable, disable or delete up to 200 schedules
GET /api/v3/runs?schedule_id=…Runs a schedule started

Schedules do not carry webhooks. To be called when scheduled runs end, use an account webhook.