Documentation Index
Fetch the complete documentation index at: https://docs.azalt.co/llms.txt
Use this file to discover all available pages before exploring further.
Cron Job
Cron Jobs are scheduled automation scripts that execute JavaScript code at regular intervals. They enable organizations to automate data synchronization, calculations, notifications, and integrations with external systems.At a Glance
- JavaScript code runs in a secure sandbox environment
- Configurable schedules: 5m, 10m, 15m, 30m, 1h, 2h, 4h, 6h, 12h, daily, weekly
- Access to organization data, database operations, HTTP client, and email
- Environment variables and encrypted secrets support
- 5-minute maximum execution time
- Manual trigger option for testing
Data Shape
Sandbox Environment
Your JavaScript code runs in an isolated sandbox with access to these APIs:| API | Description |
|---|---|
organization | Current organization data and sites |
db | Database operations (scoped to organization via RLS) |
fetch | HTTP client for external API calls |
email | Send notification emails |
env | Environment variables (CronJobVariables with type “variable”) |
secrets | Encrypted secret values (CronJobVariables with type “secret”) |
console | Logging (captured in execution logs) |
Example Code
Security & Permissions
- Create/Update/Delete: Owner role required
- View/Execute: Any organization member
- Sandbox: Code runs in isolated VM with no file system access
- RLS: Database queries respect row-level security policies
- Secrets: Encrypted at rest using organization’s encryption key
- Timeout: Automatic termination after 5 minutes
Execution Flow
- Scheduler finds jobs where
nextExecutionAt <= nowandisActive = true - Job code is executed in a secure sandbox
- Execution result (success/failure, logs, output) is recorded
nextExecutionAtis calculated based on schedulelastExecutionAtis updated
API Notes
cronJob.list: Returns jobs with execution statistics and variable countscronJob.get: Returns full job details including code and recent executionscronJob.create: Creates new job (starts inactive for safety)cronJob.execute: Manually trigger execution (useful for testing)cronJob.toggle: Enable/disable scheduled execution
Related Concepts
- CronJobVariable - Environment variables and secrets for jobs
- CronJobExecution - Execution history and logs

