# How to run a scheduled job on your app.

URL: https://antideploy.com/blog/how-to-run-a-scheduled-job-on-your-app

A scheduled job is a route that Antideploy calls on a schedule. It wakes your app if it is asleep, so no worker has to stay alive.

## At a glance

- **Standard cron, in UTC**: Five fields, or @daily and friends
- **A plain HTTP call**: A GET or POST to a path on your app
- **Wakes a sleeping app**: So nothing has to stay running
- **On every plan**: Three jobs per app, Free included

Published 7 October 2026. Facts checked 7 October 2026. 3 min read.

## The short answer

To run a scheduled job, write a route in your app that does the work, then ask your connected coding agent to schedule it. Antideploy sends a request to that path on your schedule. It wakes the app if it is asleep, runs the route, and lets the app go back to sleep. You do not need a background worker, and a timer inside your server will not work, because an idle app sleeps.

> **Say this to your coding agent**
>
> Run /api/cron/nightly every day at 3am UTC.

If your agent is not connected yet, paste this first: Set this project up to deploy on Antideploy. Fetch https://antideploy.com/agent.md and follow it.

## What your agent does

### 1. It writes the route

A nightly task is a route. For example, a route that deletes expired sessions.

### 2. It creates the job

A job is a path, a method and a schedule. The method is POST unless you say GET. Five-field cron in UTC, or `@hourly`, `@daily`, `@weekly` and `@monthly`.

### 3. It reads the result

Each job shows its next run and its last, the status of the last run and any error. The console has a Schedules panel for the same thing.

## What the route looks like

Every run carries the header `x-antideploy-cron: 1`. Anyone can send a header, so a route that does real work should also check a secret that only your app knows.

**Express**

```
app.post("/api/cron/nightly", async (req, res) => {
  // anyone can send the cron header, so check a secret of your own for real work
  await deleteExpiredSessions();
  res.sendStatus(200);
});
```

## The rules

- Three jobs per app, on every plan
- Runs are at least five minutes apart
- A run is given up after 60 seconds, so keep each one short
- Schedules are in UTC, so convert from your own time zone
- Ten failures in a row pause the job, and resuming it resets the count
- To change a schedule or a path, remove the job and add it again

## Why not a timer in your server

A library such as `node-cron`, or a `setInterval`, needs the process to be running. Antideploy scales an idle app to zero, so the timer stops with it and never fires. Antideploy flags this before you deploy. Move the work into a route and schedule that route instead.

## Here's where it stops.

A platform that only tells you what it is good at is one you find the edges of in production. These are the ones to know before your first deploy.

### No background workers

Only the web process runs. A queue consumer or a loop inside the app will not stay alive. Use a cron job to call a path on a schedule, or a webhook.

### Apps sleep when idle

On every plan, an app nobody is using goes to sleep and the next visit wakes it. The first request took 2.9 to 13.9 seconds in our measurements, depending on the stack. There are no always-on workers, so use a cron job or a webhook for background work.

## Scheduled job questions, answered.

Anything else? Write to us and a person answers.

[support@antideploy.com](mailto:support@antideploy.com)

### What time zone are schedules in?

UTC. Write the schedule in UTC and convert from your own time zone. For example, 3am in India is 21:30 UTC the day before.

### How often can a job run?

At most every five minutes.

### Does a job wake a sleeping app?

Yes. A run is a request to your app's public address, so the app wakes to serve it. The first request after a quiet spell can take several seconds, well inside the 60 seconds a run is allowed.

### What if my route takes longer than a minute?

The run is given up after 60 seconds. Keep each run short, and do the slow part in smaller steps over several runs.

### How do I stop strangers calling my route?

Check a secret of your own in the route. Anyone can send the cron header.

### Can I run a background worker instead?

Not today. Only the web process runs, and apps sleep when idle. Use a scheduled job, or a webhook.

## More guides, and the platform.

Each platform page covers one part of Antideploy: what it does, where it stops and the questions people ask. [See the whole platform](https://antideploy.com/platform), or [all the guides](https://antideploy.com/blog).

- [How to see logs and know when your app is down](https://antideploy.com/blog/how-to-see-logs-and-know-when-your-app-is-down): Logs, traffic numbers and health on every plan. An email when your app goes down and when it is back.
- [How to add a Postgres database to your app](https://antideploy.com/blog/how-to-add-a-postgres-database-to-your-app): Ask your agent. A Postgres 17 database is created beside your app and DATABASE_URL is set.
- [How to send email from your app](https://antideploy.com/blog/how-to-send-email-from-your-app): Welcome messages and receipts with the Resend package, with no account to open and no DNS to touch.

- [Cron jobs](https://antideploy.com/platform/cron-jobs)
- [Hosting](https://antideploy.com/platform/hosting)
- [Environment variables](https://antideploy.com/platform/environment-variables)
- [Agent API](https://antideploy.com/platform/agent-api)

Facts on this page were checked against the live platform on 7 October 2026.

## Deploy something. Start with one sentence.

Paste one sentence into your coding agent, click Approve once, and get a live link. No card, no trial clock.

To set this up, give your coding agent this sentence:

```text
Set this project up to deploy on Antideploy. Fetch https://antideploy.com/agent.md and follow it.
```
