Schedule a recurring request
A cron sends an HTTP request to your endpoint on a schedule. The steps below set up a nightly backup that calls https://api.yourapp.com/backup every day at 03:00 UTC.
Create a cron in the dashboard
-
Open the Cron jobs tab and click New cron job.
-
Enter a Cron job name, such as
Nightly backup, and the URL to call:https://api.yourapp.com/backup. -
Choose the HTTP method. It defaults to
GET. PickPOSTif your endpoint expects a body, then fill in Request Payload (JSON), for example{"type": "full"}. The payload field is hidden forGET. -
If your endpoint needs a key or token, click Add Header under HTTP headers and enter it, for example
X-Api-Keyand its value. -
Set the Cron expression. Pick from Quick presets…, fill in the five fields, or type the whole expression in Full expression. For 03:00 every day, enter
0 3 * * *. The preview below it describes the schedule in plain words. Schedules run in UTC, see Cron schedules. -
Optional settings:
- Request timeout: how long to wait for a response, 1 to 300 seconds (default 30).
- Success assertions: extra checks on 2xx responses, see Success assertions.
- Failure alerting: alert after 1, 2 or 3 consecutive failures. It starts as Disabled. See Set up alerts.
- Callback URL (optional): Delay POSTs the result of each run there, see Callbacks.
-
Leave Enable this cron job ticked and click Create cron job.
The cron first runs at the next time that matches the expression, not when you save it. A cron created at 15:00 UTC with 0 3 * * * first runs at 03:00 UTC the next day.
Test it now
You don’t have to wait for the schedule. Open the cron from the Cron jobs list and click Run now. Delay sends one request straight away, and the result appears under Recent executions a few moments later. Click View all to see every run with its request and response.
Run now doesn’t change the schedule. It only works while the cron is active, and each run counts toward your monthly usage.
If the run fails, see Debug a failed run.
Create a cron with the API
The same cron in one request (get your token from Settings > API token):
curl -X POST https://app.delay.run/api/crons \ -H "Authorization: Bearer $DELAY_TOKEN" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{ "name": "Nightly backup", "url": "https://api.yourapp.com/backup", "method": "POST", "cron_expression": "0 3 * * *", "headers": { "X-Api-Key": "your-endpoint-key" }, "payload": "{\"type\":\"full\"}", "alert_threshold": 2 }'The API’s payload is a string, so a JSON body is written as escaped JSON. The API can’t set success assertions: add them afterwards with Edit. Every field, the response and the errors are on POST /api/crons.
Change, pause or delete a cron
Open the cron from the Cron jobs list. The buttons at the top of its page:
- Edit opens the same form. Save with Update cron job. If you change the expression, the next run is recalculated.
- Pause stops the cron. It keeps its settings and history but doesn’t run. Start turns it back on, and it runs at the next matching time. Runs missed while paused are not made up.
- Delete removes the cron and its execution history, after you confirm in the Delete cron job dialog. This can’t be undone.
You can also pause and resume from the list: use the pause icon on the row, or the More actions menu (Pause or Resume, View, Edit, Delete).
Before you rely on it
- The endpoint must be public. Delay can’t call private or internal addresses such as
localhostor10.x. The URL is checked when the cron runs, not when you save it. - Only 2xx counts as success. Redirects are not followed, so a
301or302is a failure. - Runs can overlap. If a request takes longer than the interval, the next run starts anyway.
- Crons don’t retry. A failed run waits for the next scheduled time.
Details for each: Write endpoints Delay can call and Cron schedules.
Next steps
- Cron schedules: syntax, UTC, timing and a table of common patterns.
- POST /api/crons: every field, with examples in four languages.
- Set up alerts: hear about failures in Slack or Discord.
- Debug a failed run: read a run and fix what broke.