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

# Scheduler API

> Run agents and HTTP requests on a cron schedule.

The Scheduler API runs work automatically at set times. It has two resource groups:

| Group | What it does |
| - | - |
| [Schedules](/enterprise/api/scheduler/schedules/create) | Send a fixed message to an agent on a cron schedule, with automatic retries. |
| [HTTP Schedules](/enterprise/api/scheduler/http-schedules/create) | Call any URL (GET, POST, PUT, PATCH, or DELETE) on a cron schedule. |

To run an agent when an external system sends it an event, rather than on a timer, use the [Webhooks API](/enterprise/api/webhooks/introduction).

## Base URL

```text theme={null}
https://scheduler.studio.lyzr.ai
```

<Note>
  Collection endpoints end in a trailing slash, for example `/schedules/` and `/schedules/pause-bulk/`. Include it exactly as shown. Requests without it are redirected, and most HTTP clients drop the body and headers when they follow the redirect.
</Note>

## Authentication

Every endpoint requires your Lyzr API key in the `x-api-key` header. Schedules are scoped to the key that created them, so list endpoints only return your own schedules.

```bash theme={null}
curl https://scheduler.studio.lyzr.ai/schedules/ \
  -H "x-api-key: YOUR_API_KEY"
```

A missing or invalid key returns `403`:

```json theme={null}
{ "detail": "API key missing" }
```

## Cron expressions

Schedules and HTTP schedules use standard five-field cron expressions, evaluated in the schedule's `timezone` (default `UTC`).

```text theme={null}
┌───────── minute (0-59)
│ ┌─────── hour (0-23)
│ │ ┌───── day of month (1-31)
│ │ │ ┌─── month (1-12)
│ │ │ │ ┌─ day of week (0-6, where 0 and 7 are Sunday)
│ │ │ │ │
* * * * *
```

| Expression | Runs |
| - | - |
| `0 9 * * *` | Every day at 09:00 |
| `0 9 * * 1-5` | Weekdays at 09:00 |
| `*/15 * * * *` | Every 15 minutes |
| `0 0 1 * *` | Midnight on the first day of each month |

Set `timezone` to an IANA name such as `Asia/Kolkata` or `America/New_York` so runs follow local time.

## Retries

Failed runs are retried automatically. `max_retries` sets the number of retries (0-5, default 3) and `retry_delay` sets the wait between them in seconds (10-3600, default 60). Every attempt is recorded in the execution logs with its `attempt` number.

## Typical flow

To run an agent every morning:

1. Create the schedule with [Create Schedule](/enterprise/api/scheduler/schedules/create).
2. Confirm it works without waiting for the cron by calling [Trigger Schedule Now](/enterprise/api/scheduler/schedules/trigger).
3. Check the result with [Get Execution Logs](/enterprise/api/scheduler/schedules/logs). Each run includes a `session_id` you can use with the [Sessions API](/enterprise/api/sessions/list).

## Errors

| Status | Meaning |
| - | - |
| `403` | The `x-api-key` header is missing or invalid. |
| `404` | No schedule with that ID exists for your API key. |
| `422` | The request failed validation. The `detail` array lists each invalid field. |
