Cron Jobs

Schedule edge functions to run on a cron schedule. Supports standard 5-field cron expressions, manual triggers, retry logic, and execution logs.

Create a Cron Job

POST /projects/{project_id}/cron

{
  "name": "Daily Report",
  "function_name": "generate-report",
  "schedule": "0 9 * * *",
  "timezone": "Asia/Kolkata",
  "payload": { "type": "daily" },
  "description": "Generate daily analytics report at 9 AM IST",
  "max_retries": 3,
  "timeout_ms": 30000
}

// Response includes next scheduled runs
{
  "id": "uuid",
  "name": "Daily Report",
  "schedule": "0 9 * * *",
  "next_runs": ["2026-03-25T03:30:00Z", "2026-03-26T03:30:00Z", ...],
  "created": true
}

Cron Expression Format

┌───────────── minute (0-59)
│ ┌───────────── hour (0-23)
│ │ ┌───────────── day of month (1-31)
│ │ │ ┌───────────── month (1-12)
│ │ │ │ ┌───────────── day of week (0-6, 0=Sunday)
│ │ │ │ │
* * * * *

Examples:
  */5 * * * *     → Every 5 minutes
  0 * * * *       → Every hour
  0 9 * * *       → Daily at 9 AM
  0 9 * * 1       → Every Monday at 9 AM
  0 0 1 * *       → First day of every month

List Cron Jobs

GET /projects/{project_id}/cron

{
  "jobs": [
    {
      "id": "uuid",
      "name": "Daily Report",
      "function_name": "generate-report",
      "schedule": "0 9 * * *",
      "is_active": true,
      "last_run_at": "2026-03-24T03:30:00Z",
      "last_status": "success",
      "run_count": 45,
      "error_count": 2,
      "next_runs": [...]
    }
  ]
}

Manual Trigger

POST /projects/{project_id}/cron/{job_id}/trigger

// Response
{
  "triggered": true,
  "result": { "status": "success", "result": {...}, "duration_ms": 1200 }
}

Execution Logs

GET /projects/{project_id}/cron/{job_id}/logs

All Endpoints

MethodPathDescription
POST/cronCreate cron job
GET/cronList cron jobs
GET/cron/{id}Get job details
PATCH/cron/{id}Update job
DELETE/cron/{id}Delete job
POST/cron/{id}/triggerManual trigger
GET/cron/{id}/logsExecution logs