How to Setup Cron Jobs on Vercel

Cron jobs are time-based scheduling tools used to automate repetitive tasks. By using a specific syntax called a cron expression, you can define the frequency and timing of each task. This helps improve efficiency and ensures that important processes are performed consistently.

Vercel supports cron jobs for Serverless and Edge Functions. This guide will show you how to create your first cron job. Alternatively, you can start from a template.

Create a cron job

The following steps will demonstrate how to create a cron job on Vercel that executes every day at 5 am UTC.

Create a function

First, create a Serverless or Edge Function for your project. The function will be called every time the cron job is triggered.

Create or update your vercel.json file

Go to your vercel.json file and add the following code:

vercel.json
{
"crons": [
{
"path": "/api/cron",
"schedule": "0 5 * * *"
}
]
}
A Vercel cron job that runs every day at 5 am UTC.
  • The path must start with /
  • The schedule property must be a string that represents a cron expression. In this example, the job is scheduled to execute every day at 5:00 am UTC

Deploy your project

Once your project is deployed on Vercel, our build process will create the cron job. Cron jobs are invoked only for production deployments. Preview deployments are ignored. You can also deploy to your production domain via Git.

Your cron job is now active and will call the /api/cron path every day at 5:00 am UTC. Learn more about cron jobs.

Alternative cron providers

If you prefer using a different provider for cron jobs, the following services pair well with Vercel:

Couldn't find the guide you need?