CronHub API
Tous les endpoints marqués avec un cadenas nécessitent un header Authorization: Bearer <api-key>
1. Créez une organisation: POST /api/orgs
2. Générez une clé API: POST /api/orgs/:slug/api-keys
3. Enregistrez vos crons: POST /api/crons/register avec la clé
4. Envoyez des heartbeats: POST /api/crons/:id/heartbeat
/api/orgs
Create an organization.
curl -X POST http://localhost:4000/api/orgs -H 'Content-Type: application/json' -d '{"name":"Mon Org","slug":"mon-org"}'
/api/orgs/:slug/api-keys
Create an API key for an organization (required for authenticated endpoints).
curl -X POST http://localhost:4000/api/orgs/mon-org/api-keys -H 'Content-Type: application/json' -d '{"name":"production"}'
/api/crons/register
Register crons for a service. Crons are linked to the API key's organization.
curl -X POST http://localhost:4000/api/crons/register -H 'Authorization: Bearer ch_xxx' -H 'Content-Type: application/json' -d '{"product":"MonProduit","service":"mon-service","crons":[{"name":"daily-cleanup","schedule":"0 2 * * *"}]}'
/api/crons/:id/start
Signal execution start. Checks dependencies (blocks if a dependency is not completed).
curl -X POST http://localhost:4000/api/crons/ID/start -H 'Authorization: Bearer ch_xxx'
/api/crons/:id/heartbeat
Record a heartbeat. Automatically detects anomalies (3x average duration) and drift.
curl -X POST http://localhost:4000/api/crons/ID/heartbeat -H 'Authorization: Bearer ch_xxx' -H 'Content-Type: application/json' -d '{"status":"success","duration_ms":1234}'
/api/crons
List organization crons. Filters: product, service, search, project_id.
curl http://localhost:4000/api/crons -H 'Authorization: Bearer ch_xxx'
/api/crons/:id
Details with stats, SLA, anomalies, dependencies, and next runs.
curl http://localhost:4000/api/crons/ID -H 'Authorization: Bearer ch_xxx'
/api/crons/:id/dependencies
Add a dependency (cron A must finish before cron B).
curl -X POST http://localhost:4000/api/crons/ID/dependencies -H 'Authorization: Bearer ch_xxx' -H 'Content-Type: application/json' -d '{"depends_on_id":"OTHER_ID"}'
/api/maintenance
Create a maintenance window. Alerts are suspended during this period.
curl -X POST http://localhost:4000/api/maintenance -H 'Authorization: Bearer ch_xxx' -H 'Content-Type: application/json' -d '{"name":"Deploy v2","starts_at":"2026-02-17T02:00:00Z","ends_at":"2026-02-17T03:00:00Z"}'
/api/orgs/:slug/invite
Invite a member by email.
curl -X POST http://localhost:4000/api/orgs/mon-org/invite -H 'Authorization: Bearer ch_xxx' -H 'Content-Type: application/json' -d '{"email":"dev@example.com","role":"member"}'
/api/ping/:id
Simplified ping (no auth). Ideal for simple scripts. Uses cron ID directly.
curl -X POST http://localhost:4000/api/ping/CRON_ID
/api/start/:id
Signal execution start (no auth).
curl -X POST http://localhost:4000/api/start/CRON_ID
/api/fail/:id
Signal a failure (no auth).
curl -X POST http://localhost:4000/api/fail/CRON_ID