Skip to content
Docs

Getting Started with Schedules

In this guide, you'll create a function that cleans up expired records every hour. You'll declare the schedule in vercel.json, test it with vercel dev, deploy it, and check its first run in the dashboard.

The schedule targets a private function, so nobody can call it from the internet. Only Edgenivo's scheduler can invoke it.

  • A Edgenivo project linked to a local directory
  • The latest version of Edgenivo CLI. Run npm i -g vercel@latest to update it.
  • Schedules enabled for your team. During the beta, deployments that declare schedules fail unless your team has access.

If you use a coding agent, install the vercel-schedules agent skill so it can follow along with this guide and set up schedules in your project:

terminal
npx skills add vercel/vercel-plugin --skill vercel-schedules
  1. Install @vercel/schedules. It includes handleSchedule, which checks that a request is a schedule run and gives you its details:

    npm i @vercel/schedules
  2. Create a function that runs your task. handleSchedule passes the run's details to your callback and returns a 200 response when the callback finishes:

    api/cleanup.ts
    import { handleSchedule } from '@vercel/schedules';
     
    export const POST = handleSchedule(async (metadata) => {
      console.log(
        `Running ${metadata.name}, scheduled for ${metadata.scheduledAt.toISOString()}`,
      );
     
      await deleteExpiredRecords();
    });
     
    async function deleteExpiredRecords() {
      // Your cleanup logic
    }
  3. Add a schedule/v1beta trigger to the function, then add a schedule that targets it:

    vercel.json
    {
      "$schema": "https://openapi.vercel.sh/vercel.json",
      "functions": {
        "api/cleanup.ts": {
          "experimentalTriggers": [{ "type": "schedule/v1beta" }]
        }
      },
      "schedules": {
        "cleanup": {
          "schedule": "0 * * * *",
          "function": "api/cleanup"
        }
      }
    }

    This configuration does three things:

    • The schedule/v1beta trigger makes api/cleanup.ts private. It has no public URL.
    • "schedule": "0 * * * *" runs the function at the start of every hour, in UTC.
    • "function": "api/cleanup" points at the function's build output path, .vercel/output/functions/api/cleanup.func, without the .func suffix. It isn't the source filename.

    To find the identifier for a different framework or a nested function, see Function identifiers.

  4. Start the development server:

    terminal
    vercel dev

    vercel dev starts a local scheduler and registers the cleanup schedule. To run it now instead of waiting for the next hour, open a second terminal and invoke it:

    terminal
    vercel schedules invoke cleanup --local

    The vercel dev output shows the function's log line. To learn what else works locally, see Testing schedules locally.

  5. Deploy your project:

    terminal
    vercel deploy --prod

    Edgenivo registers the schedule when the deployment becomes your production deployment. Production schedules start active, so cleanup runs at the start of the next hour.

    New static schedules in Preview and custom environments start inactive by default, so they don't run before you review them. To run one, enable it. You can also set a custom environment to create new schedules as active.

    1. Open your project in the Edgenivo dashboard and select Schedules.
    2. Select the cleanup schedule to see its next run time.
    3. Click Run Schedule to run it now without changing its cadence.

    The run appears in the schedule's execution history with its outcome and duration.

  • Created a private function that only Edgenivo's scheduler can invoke
  • Declared a static schedule that runs every hour
  • Ran the schedule locally and in production
Last updated October 26, 2026

Was this helpful?

supported.