Skip to content

Schedules & documents ​

Schedules ​

Run a bot on its own, once or on a repeating schedule.

http
POST /bots/{botId}/schedules
x-lex-client: my-app
Content-Type: application/json

{
  "name": "Monday sales digest",
  "taskInput": "Summarise last week's deals from Gmail and post the top 5.",
  "scheduleType": "cron",
  "scheduleValue": "0 8 * * 1",
  "timezone": "Asia/Jakarta",
  "approvalPolicy": "require",
  "mode": "patih"
}
scheduleTypescheduleValue
onceA date and time, e.g. 2026-11-01T09:00 (in timezone) or with an offset
intervalSeconds between runs, at least 300
cronA cron expression that fires at most every 5 minutes

Other options: timeoutSeconds (30–3600, default 300), maxRetries (0–5), misfirePolicy (run_once or skip for runs missed while paused or down) and approvalPolicy. Nobody is watching a scheduled run, so with deny any action that would need approval is skipped instead of waiting.

GET /schedules, GET /schedules/calendarAll schedules, or upcoming runs for a calendar
PATCH /schedules/{id}, DELETE /schedules/{id}Change or remove
POST /schedules/{id}/pause, /resume, /run-now, /duplicateControl it
GET /scheduled-runs, GET /scheduled-runs/{id}What ran, with the agent run behind each
POST /scheduled-runs/{id}/retryRun a failed one again

Each scheduled run posts its result into the bot's chat.

Documents ​

Bots can write documents (reports, drafts, notes), and people can edit them.

GET /documents, POST /documentsList and create
GET/PATCH/DELETE /documents/{id}Read, edit, delete
GET /documents/{id}/versionsEvery saved version (by a person, a bot or a restore)
POST /documents/{id}/versions/{version}/restoreGo back to a version
POST /documents/{id}/duplicateCopy
GET /documents/{id}/export?format=markdownDownload as Markdown
GET/POST /document-foldersFolders

Documents a bot writes in a chat keep a link to the bot and the run that made them.

Lex by Gavalytics AI