Skip to content

POST /api/crons

Create a recurring HTTP cron job. The job fires on the given cron expression and is immediately active unless you pass is_active: false.

Endpoint

POST /api/crons

Authentication

Pass your API token as a Bearer token. Generate one from Settings → API.

Authorization: Bearer YOUR_API_TOKEN

Request body

{
"name": "Health Check",
"url": "https://api.yourapp.com/health",
"method": "GET",
"cron_expression": "*/5 * * * *",
"timeout_seconds": 30,
"alert_threshold": 3
}

Parameters

FieldTypeRequiredDescription
namestringYesDisplay name for the cron job
urlstringYesThe URL to send the HTTP request to
cron_expressionstringYesStandard 5-field cron expression (e.g. */5 * * * *)
methodstringNoHTTP method: GET, POST, PUT, PATCH, DELETE. Defaults to POST
headersobjectNoKey-value pairs sent as request headers
payloadstringNoRaw string body sent with the request
timeout_secondsintegerNoRequest timeout in seconds (1–300). Defaults to 30
alert_thresholdintegerNoConsecutive failures before an alert fires: 1, 2, or 3
is_activebooleanNoWhether the cron starts active. Defaults to true

Response

201 Created

{
"id": 42,
"name": "Health Check",
"cron_expression": "*/5 * * * *",
"next_run_at": "2026-02-27T14:15:00+00:00",
"is_active": true
}
FieldTypeDescription
idintegerID of the created cron job
namestringDisplay name
cron_expressionstringThe cron expression
next_run_atstring | nullISO 8601 timestamp of the next scheduled run
is_activebooleanWhether the cron is currently active

Error responses

401 Unauthorized — missing or invalid token

{ "error": "Missing authorization token" }

422 Unprocessable Entity — validation error

{
"message": "A cron expression is required.",
"errors": {
"cron_expression": ["A cron expression is required."]
}
}

Examples

Simple health check

Ping your health endpoint every minute:

Terminal window
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": "* * * * *",
"alert_threshold": 3
}'

Nightly data sync

POST to a sync endpoint every night at 2 AM with a custom header:

Terminal window
curl -X POST https://app.recurohq.com/api/crons \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Nightly Sync",
"url": "https://warehouse.internal/sync",
"method": "POST",
"cron_expression": "0 2 * * *",
"headers": { "X-Sync-Source": "recuro" },
"timeout_seconds": 120
}'

Create inactive (paused) cron

Terminal window
curl -X POST https://app.recurohq.com/api/crons \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Weekly Report",
"url": "https://reports.internal/generate",
"cron_expression": "0 8 * * 1",
"is_active": false
}'