Skip to main content
Cron jobs use the vanilla Convex API. Define your crons in confect/crons.ts and the Confect CLI will re-export them into convex/crons.ts.
confect/crons.ts
import { cronJobs } from "convex/server";
import { internal } from "../convex/_generated/api";

const crons = cronJobs();

crons.interval(
  "clear stale sessions",
  { hours: 1 },
  internal.sessions.clearStale,
);

export default crons;
See the Convex cron jobs documentation for the full API.