Creating a Cron Schedule
This guide walks you through creating a cron schedule — a recurring HTTP request that fires on a cron expression.
Via the dashboard
- Navigate to Crons in the sidebar
- Click New Cron
- Fill in the form:
- Name: A descriptive name (e.g., “API Health Check”)
- URL: The endpoint to call (e.g.,
https://api.yourapp.com/health) - Method: GET, POST, PUT, PATCH, or DELETE
- Cron Expression: A standard 5-field expression (e.g.,
*/5 * * * *for every 5 minutes)
- Optionally configure:
- Headers: Key-value pairs sent with the request
- Payload: Raw string body (for POST/PUT/PATCH)
- Callback URL: A URL to receive a POST after each execution
- Timeout: 1-300 seconds (default: 30)
- Alert Threshold: 1, 2, or 3 consecutive failures before alerting
- Success Assertions: Conditions the response must satisfy
- Active: Whether the cron starts firing immediately
- Click Create
The cron starts firing on the next scheduled time.
Via the API
curl
curl -X POST https://app.recurohq.com/api/crons \ -H "Authorization: Bearer YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "API Health Check", "url": "https://api.yourapp.com/health", "method": "GET", "cron_expression": "*/5 * * * *", "timeout_seconds": 30, "alert_threshold": 3, "success_assertions": [ { "type": "status_code_equals", "value": "200" }, { "type": "response_time_under_ms", "value": "5000" } ] }'PHP
$response = Http::withToken('YOUR_API_TOKEN') ->post('https://app.recurohq.com/api/crons', [ 'name' => 'API Health Check', 'url' => 'https://api.yourapp.com/health', 'method' => 'GET', 'cron_expression' => '*/5 * * * *', 'timeout_seconds' => 30, 'alert_threshold' => 3, 'success_assertions' => [ ['type' => 'status_code_equals', 'value' => '200'], ['type' => 'response_time_under_ms', 'value' => '5000'], ], ]);
$cron = $response->json();echo "Created cron {$cron['id']}, next run at {$cron['next_run_at']}";Node.js
const response = await fetch('https://app.recurohq.com/api/crons', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_TOKEN', 'Content-Type': 'application/json', }, body: JSON.stringify({ name: 'API Health Check', url: 'https://api.yourapp.com/health', method: 'GET', cron_expression: '*/5 * * * *', timeout_seconds: 30, alert_threshold: 3, success_assertions: [ { type: 'status_code_equals', value: '200' }, { type: 'response_time_under_ms', value: '5000' }, ], }),});
const cron = await response.json();console.log(`Created cron ${cron.id}, next run at ${cron.next_run_at}`);Python
import requests
response = requests.post( 'https://app.recurohq.com/api/crons', headers={'Authorization': 'Bearer YOUR_API_TOKEN'}, json={ 'name': 'API Health Check', 'url': 'https://api.yourapp.com/health', 'method': 'GET', 'cron_expression': '*/5 * * * *', 'timeout_seconds': 30, 'alert_threshold': 3, 'success_assertions': [ {'type': 'status_code_equals', 'value': '200'}, {'type': 'response_time_under_ms', 'value': '5000'}, ], },)
cron = response.json()print(f"Created cron {cron['id']}, next run at {cron['next_run_at']}")See the full API reference for all parameters and response details.
Choosing the right cron expression
| Goal | Expression |
|---|---|
| Every minute | * * * * * |
| Every 5 minutes | */5 * * * * |
| Every hour at minute 0 | 0 * * * * |
| Daily at midnight | 0 0 * * * |
| Daily at 9 AM | 0 9 * * * |
| Weekdays at 9 AM | 0 9 * * 1-5 |
| Every Monday at midnight | 0 0 * * 1 |
| First day of the month at midnight | 0 0 1 * * |
| Every 15 minutes during business hours | */15 9-17 * * 1-5 |
Setting up assertions
Assertions verify that your endpoint’s response meets your expectations. If any assertion fails, the execution is marked as failed.
Example: Check that your health endpoint returns 200 with a body containing “ok” in under 5 seconds:
{ "success_assertions": [ { "type": "status_code_equals", "value": "200" }, { "type": "body_contains", "value": "ok" }, { "type": "response_time_under_ms", "value": "5000" } ]}See Cron Schedules > Success assertions for all assertion types.
Configuring headers and payload
Custom headers
Add authentication or custom headers:
{ "headers": { "Authorization": "Bearer your-endpoint-token", "X-Source": "recuro", "Content-Type": "application/json" }}Request body
The payload field is a raw string. For JSON payloads, serialize as a JSON string:
{ "payload": "{\"action\":\"sync\",\"source\":\"recuro\"}"}Next steps
- Create a Cron Job (API) — Full API reference
- Cron Expression Patterns — Common patterns and pitfalls
- Setting Up Alerts — Get notified on failures