Skip to content

One-Off Jobs

Use a one-off job when you need something to happen once at a specific time, not on a recurring cadence.

  • Delayed action: send a follow-up email in 2 hours
  • Scheduled event: expire a trial on a specific date
  • Deferred work: process an upload after a 30-second buffer
  • Immediate background task: offload work from the request path

If the task recurs, use a schedule instead.

Omit both delay and scheduled_for. The job runs as soon as possible:

Terminal window
curl -X POST https://api.chronos.sh/v1/jobs \
-H "Authorization: Bearer chrns_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "Process upload",
"handler": "process-upload",
"payload": { "fileId": "file_abc123" }
}'

Prevent duplicate jobs with idempotency_key:

Terminal window
curl -X POST https://api.chronos.sh/v1/jobs \
-H "Authorization: Bearer chrns_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "Charge invoice inv_789",
"handler": "charge-invoice",
"delay": { "value": 1, "unit": "hour" },
"idempotency_key": "charge-inv_789",
"payload": { "invoiceId": "inv_789" }
}'

If a job with the same idempotency_key already exists on your account, the API returns 409 with code idempotency_key_conflict instead of creating a duplicate.

Use this when the trigger for job creation might fire multiple times (webhook retries, user double-clicks, distributed systems with at-least-once delivery).

The key is scoped to your account and persists for the lifetime of the job. Max 255 characters.

One-off jobs support the same delivery configuration as schedules:

Terminal window
curl -X POST https://api.chronos.sh/v1/jobs \
-H "Authorization: Bearer chrns_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "Send webhook notification",
"handler": "notify",
"delay": { "value": 5, "unit": "minute" },
"delivery": {
"type": "push",
"http": {
"url": "https://your-app.com/hooks/chronos",
"method": "POST"
}
},
"payload": { "event": "subscription.created", "data": { "id": "sub_123" } }
}'

If delivery is omitted, pull is the default. Your worker picks it up.

Override defaults per job:

{
"name": "Critical charge",
"handler": "charge-invoice",
"delay": { "value": 1, "unit": "hour" },
"timeout": 60,
"max_retries": 5,
"payload": { "invoiceId": "inv_789" }
}
FieldDefaultDescription
timeout30Seconds before execution is considered timed out
max_retries3Number of retry attempts on failure. 0 = no retries.

Filter the job list to show only one-off jobs (those without a parent schedule):

Terminal window
curl "https://api.chronos.sh/v1/jobs?schedule_id=null" \
-H "Authorization: Bearer chrns_your_api_key"

The literal string "null" filters for jobs where schedule_id is null.