Skip to main content
POST
/
crons
Create cron
curl --request POST \
  --url https://api.example.com/crons
{
  "cron": "<string>",
  "url": "<string>",
  "name": "<string>",
  "method": "<string>",
  "headers": {},
  "body": {}
}

Request body

cron
string
required
Cron expression defining the schedule (e.g., */5 * * * *). Must be a valid 5-field cron expression.
url
string
required
Webhook URL to call on each execution.
name
string
Optional display name for the cron.
method
string
default:"POST"
HTTP method: GET, POST, or DELETE.
headers
object
default:"{}"
Custom HTTP headers to include in the webhook request.
body
object
default:"{}"
JSON body to send with the webhook request (used with POST).

Response

Returns the created cron object with a 201 status code.
curl -X POST https://app.cronapi.dev/api/v1/crons \
  -H "Authorization: Bearer your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Daily report",
    "cron": "0 9 * * *",
    "url": "https://example.com/report",
    "method": "POST",
    "headers": {"X-Custom": "value"},
    "body": {"notify": true}
  }'
201
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "user_id": "d4e5f6a7-b890-1234-cdef-567890abcdef",
  "name": "Daily report",
  "cron": "0 9 * * *",
  "url": "https://example.com/report",
  "method": "POST",
  "headers": {"X-Custom": "value"},
  "body": {"notify": true},
  "paused": false,
  "last_run_at": null,
  "next_run_at": "2026-04-16T09:00:00.000Z",
  "created_at": "2026-04-15T14:31:00.000Z"
}
400
{
  "error": "Invalid cron expression: unexpected character at position 0"
}