> ## Documentation Index
> Fetch the complete documentation index at: https://vlyai-1c28d863.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Scheduled functions

> Cron-style or delayed one-shot execution. Use for nightly cleanups, reminder emails, periodic data sync.

Schedule a Convex function to run later — once after a delay, or recurring on a cron schedule. See [Convex scheduled functions](/convex/scheduled-functions) for the full reference; this page is the orientation.

## Two patterns

<CardGroup cols={2}>
  <Card title="One-shot delayed" icon="alarm-clock">
    `ctx.scheduler.runAfter(60_000, api.foo.bar, args)` — runs once, after 60 seconds.
  </Card>

  <Card title="Recurring (cron)" icon="repeat">
    `crons.cron("0 0 * * *", api.foo.dailyCleanup, args)` — runs daily at midnight UTC.
  </Card>
</CardGroup>

## Common uses

<CardGroup cols={2}>
  <Card title="Reminder emails" icon="mail">
    "Send a reminder 24 hours before the booking" — schedule from the booking creation mutation.
  </Card>

  <Card title="Cleanup jobs" icon="trash">
    Delete soft-deleted rows after 30 days; clear old presence records hourly.
  </Card>

  <Card title="Nightly reports" icon="chart-bar">
    Aggregate yesterday's data into a `dailyMetrics` table for fast dashboard queries.
  </Card>

  <Card title="Renewals" icon="repeat">
    "Mark subscription as 'renewing' 24 hours before period end."
  </Card>
</CardGroup>

## Tips

<Tip>
  **For complex workflows, use [Inngest](/integrations/inngest) or [Trigger.dev](/integrations/trigger-dev).** Scheduled functions are great for simple one-shots; orchestrators are better for multi-step jobs with retries.
</Tip>

<Tip>
  **All cron schedules are UTC.** If you want "midnight in user's timezone", store the timezone on the user and pick a daily action that processes per-user.
</Tip>

## Related

<CardGroup cols={3}>
  <Card title="Convex scheduled functions" icon="clock" href="/convex/scheduled-functions">
    Full reference.
  </Card>

  <Card title="Background jobs" icon="cog" href="/features/data/background-jobs">
    For longer / chunked work.
  </Card>

  <Card title="Inngest" icon="cog" href="/integrations/inngest">
    For complex workflows.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.