Create a Cron Job
Parameters
expressionstring
Valid cron expression that defines the schedule
namestring | null
Optional name for the cron job
timezonestring | null
Optional timezone for evaluating the cron expression (e.g., 'America/New_York')
endpointstring
URL endpoint that will be called when the cron job executes
datarecord | null
Optional JSON data to include in the request body when calling the endpoint
Returns
Returns the created cron job object.
POST/cron
curl -X POST https://api.next-cron.com/cron \
-H "Authorization: Bearer $YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"expression": "0 0 * * *",
"name": "Daily Job",
"endpoint": "https://www.example.com/api/next-cron"
}'
Response
{
"id": "49d10214-f4f1-497a-94b7-c0e597ad3fea",
"expression": "0 0 * * *",
"name": "My Cron Job",
"invocations": 0,
"timezone": "Europe/London",
"status": "Active",
"endpoint": "https://www.example.com/api/next-cron",
"data": null,
"createdAt": "2024-03-19T10:30:00Z",
"nextInvocation": "2024-03-20T00:00:00Z"
}