Quick Start: Push (HTTP)
Chronos sends HTTP requests to your endpoint when a job is due. No long-lived worker process needed.
Prerequisites
Section titled “Prerequisites”- Node.js 20 or later
- A Chronos account (sign up free)
- An API key (create one in the dashboard under Settings → API Keys)
- A publicly reachable HTTPS endpoint (or a tunnel for local dev)
-
Install Express
Terminal window pnpm add expressTerminal window npm install expressTerminal window yarn add express -
Write your handler
server.mjs import express from 'express';const app = express();app.use(express.json());app.post('/hooks/chronos', (req, res) => {const { handler, payload, job_id, attempt } = req.body;if (handler !== 'hello') {console.warn(`Unknown handler: ${handler}`);return res.sendStatus(400);}console.log(`Job ${job_id} running (attempt ${attempt})`);res.sendStatus(200);});app.listen(3000, () => console.log('Listening on :3000'));Return 200 for success, 4xx for permanent failures, 5xx for transient failures you want retried.
-
Start the server
Terminal window node server.mjsYour server is now listening on port 3000.
-
Create a job
In a second terminal, create a one-off job with push delivery:
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": "My first job","handler": "hello","delivery": {"type": "push","http": {"url": "https://your-server.com/hooks/chronos","method": "POST"}}}'Chronos sends an HTTP request to your endpoint. You should see:
Job a8f3e2b1-... running (attempt 1)
What just happened
Section titled “What just happened”- You created a one-off job with push delivery
- Chronos sent an HTTP POST to your endpoint
- Your handler processed the request and returned 200
- Chronos recorded the execution as
completed
If your endpoint had returned 5xx or timed out, Chronos would have retried up to 3 times with exponential backoff.
Make it recurring
Section titled “Make it recurring”Create a schedule with push delivery and your server receives jobs automatically:
curl -X POST https://api.chronos.sh/v1/schedules \ -H "Authorization: Bearer chrns_your_api_key" \ -H "Content-Type: application/json" \ -d '{ "name": "Hello every 10 minutes", "handler": "hello", "interval": { "value": 10, "unit": "minute" }, "delivery": { "type": "push", "http": { "url": "https://your-server.com/hooks/chronos", "method": "POST" } } }'Your running server now receives a new request every 10 minutes. To stop it, archive the schedule:
curl -X POST https://api.chronos.sh/v1/schedules/SCHEDULE_ID/archive \ -H "Authorization: Bearer chrns_your_api_key"Next steps
Section titled “Next steps” Signature Verification Verify that requests actually come from Chronos
Push Delivery Response rules, custom headers, debugging tips
API Reference Full endpoint documentation