Skip to main content
POST
Create schedule
Every time the schedule fires, the agent receives message as if a user had sent it. The schedule is active as soon as it is created. cron_expression uses standard five-field cron syntax, evaluated in timezone. See Cron expressions for the format and examples. To test the schedule without waiting for the next cron time, call Trigger Schedule Now.

Authorizations

x-api-key
string
header
required

Lyzr API key. Required on every endpoint except Trigger Webhook.

Body

application/json
user_id
string
required

User ID the agent runs on behalf of. Used to scope the agent's session and memory.

Example:

"user@example.com"

agent_id
string
required

ID of the agent to run.

Example:

"66e9b0f2a1c3d4e5f6a7b8c9"

cron_expression
string
required

Five-field cron expression: minute hour day month day_of_week. Day-of-week follows standard cron numbering (0 or 7 = Sunday, 1 = Monday, ..., 6 = Saturday).

Example:

"0 9 * * 1-5"

message
string
default:""

Message sent to the agent on every run.

Example:

"Summarize yesterday's support tickets and flag anything urgent."

timezone
string
default:UTC

IANA timezone the cron expression is evaluated in.

Example:

"Asia/Kolkata"

max_retries
integer
default:3

Number of retry attempts if a run fails (0-5).

Required range: 0 <= x <= 5
retry_delay
integer
default:60

Seconds to wait between retry attempts (10-3600).

Required range: 10 <= x <= 3600

Response

Schedule created.

id
string
required

Unique schedule ID.

Example:

"66f1c2a9e4b0a1b2c3d4e5f6"

user_id
string
required
Example:

"user@example.com"

agent_id
string
required
Example:

"66e9b0f2a1c3d4e5f6a7b8c9"

message
string
required
Example:

"Summarize yesterday's support tickets and flag anything urgent."

cron_expression
string
required
Example:

"0 9 * * 1-5"

timezone
string
required
Example:

"Asia/Kolkata"

created_at
string<date-time>
required
max_retries
integer
default:3
retry_delay
integer
default:60
is_active
boolean
default:true

false when the schedule is paused.

updated_at
string<date-time> | null
next_run_time
string<date-time> | null

When the schedule will next fire. null while paused.

last_run_at
string<date-time> | null
last_run_success
boolean | null

Outcome of the most recent run. null if the schedule has never run.