Vercel Schedules is now in public beta on all plans. Run tasks on a recurring cadence or at a single point in time, in production, preview, or custom environments.
Schedules in vercel.json
can target a private Vercel Function, an HTTP path, or a Vercel Queue topic, and schedules created at runtime target a Queue topic. Any schedule can be enabled, disabled, or run on demand without redeploying.
Define a static schedule:
{ "schedules": { "cleanup": { "schedule": "0 * * * *", "function": "api/cleanup.ts", "timezone": "America/New_York" } }, "functions": { "api/cleanup.ts": { "experimentalTriggers": [{ "type": "schedule/v1beta" }] } } }
An hourly static schedule in vercel.json, targeting a private Vercel Function
Adding a schedule/v1beta
trigger makes the function private. It has no public URL and only the Vercel schedule infrastructure can invoke it.
Handle the dispatch:
import { handleSchedule } from '@vercel/schedules';
export const POST = handleSchedule(async (metadata) => { console.log(`Running ${metadata.name} at ${metadata.scheduledAt}`); await deleteExpiredRecords(); });
Handling the schedule dispatch with handleSchedule from @vercel/schedules
Create a schedule at runtime:
import { Schedules } from '@vercel/schedules';
await Schedules.create({ name: 'daily-digest',…