# Schedules

Run any function on a schedule — syncs, reports, reminders and cleanups — or start it by hand from the console.

Any function can run on its own. For jobs that shouldn't answer HTTP requests — nightly imports, weekly reports, reminder emails, cleanups — create a function with **HTTP off**, then give it a schedule.

```js
import { table } from 'wisp';

export async function handler(req) {
  const since = req.body?.since ?? new Date(Date.now() - 86_400_000).toISOString();
  const orders = await fetchOrdersSince(since);
  for (const o of orders) await table('orders').put(o.id, o);
  return { imported: orders.length };
}
```

Or ask the assistant: "every weekday at 8am, fetch yesterday's orders from Shopify and save the totals".

## Set a schedule

Open the function's **Settings** and describe the schedule in plain words — "every 15 minutes", "every Monday at 9am Berlin time". Wisp turns it into a cron expression in your timezone; you can also enter one directly.

```text
*/15 * * * *    every 15 minutes
0 9 * * 1       Mondays at 09:00
0 8 * * 1-5     weekdays at 08:00
```

Things to know:

- **Schedules run the published version.** Publish after you add or change one.
- The shortest interval is 5 minutes.
- Scheduled runs see `req.caller.kind === "schedule"`. Each run can send a fixed query string and JSON input.
- Pause a schedule without deleting it by turning it off.
- The return value is saved as the run's result in the [log](/logs-and-live-debugging).
- Every run uses [Run credits](/plans-and-credits#run-credits), like a request.

## Run by hand

Open the function and press **Run** (or **Test** for HTTP functions). Choose the draft or the live version and pass input as JSON. From the CLI: `wisp invoke <function> -d '{"since":"2026-01-01"}'`. From code: [`functions.<name>(input)`](/api/sdk-functions).
