Skip to content

Agent API (Kubernetes)

This is the API the Kubernetes agent speaks. You normally never call it yourself; it is documented so security teams can see exactly what leaves the cluster. The cronbeat command for Linux servers uses a different API, see Host agent API.

  • Base URL: https://api.cronbeat.dev
  • Authentication: Authorization: Bearer <apiKey>, where the key starts with cb_agent_. Keys are created in the app under Agents (kind Kubernetes cluster) and only a hash is stored. A key of a Linux host agent answers 403 on these endpoints.
  • Content type: application/json. Field names are camelCase.
  • The cluster name registered with the key is authoritative; the clusterName in a request body is informational.
Code Meaning
200 sync succeeded, the body has the monitors and warnings.
202 events accepted.
204 heartbeat accepted, no body.
400 Validation failed, or an unknown event type.
401 Authorization header missing, not Bearer, key unknown or revoked.
403 The key belongs to a host agent.
413 The body is larger than the limit (2 MB for sync, 64 KB for the other endpoints).
429 More than 600 requests per minute with this key, or 3000 per minute from this IP address. Retry-After gives the seconds to wait.

Error bodies follow RFC 7807 (application/problem+json) and never contain stack traces.

Sent on start and every 5 minutes with the full list of CronJobs.

{
"clusterName": "prod-eu",
"agentVersion": "0.4.0",
"cronJobs": [
{
"namespace": "default",
"name": "my-backup-job",
"uid": "5b2f0c1e-8d7a-4c53-9a1e-0d3f6a7b8c9d",
"schedule": "0 2 * * *",
"timeZone": "Europe/Istanbul",
"suspend": false,
"graceSeconds": 900,
"maxRuntimeSeconds": 7200,
"concurrencyPolicy": "Forbid",
"startingDeadlineSeconds": 120,
"lastScheduleTime": "2026-10-08T02:00:00Z",
"lastSuccessfulTime": "2026-10-07T02:03:10Z",
"activeJobs": 1
}
]
}
Field Notes
cronJobs Required, at most 5000 entries.
namespace, name, schedule Required. Text fields are limited to 253 characters.
timeZone Optional (omitted when the CronJob has none; CronBeat then uses UTC).
suspend true pauses the monitor, false resumes it.
graceSeconds Optional, 1 to 604800 (7 days). Sets the grace period of the monitor. Omitted when not configured: the monitor keeps its current value (600 seconds for a new one). A value outside the limits is ignored and a warning is returned, the sync still succeeds.
maxRuntimeSeconds Optional, 1 to 86400 (24 hours). Same rules as graceSeconds.
concurrencyPolicy Optional: Allow, Forbid or Replace.
startingDeadlineSeconds Optional, the startingDeadlineSeconds of the CronJob.
lastScheduleTime, lastSuccessfulTime Optional, RFC 3339 UTC. A value that is not a time is ignored.
activeJobs Optional, how many Jobs of the CronJob were running.

The last five fields are only used to explain a missed run. They are stored with the time of the sync, and are never used for a run that was due before that sync.

Response 200:

{
"monitors": [{"namespace": "default", "name": "my-backup-job"}],
"warnings": []
}

Behaviour:

  • A monitor is created or updated for each CronJob (identified by cluster, namespace and name), with a cron schedule and a default grace period of 600 seconds.
  • CronJobs missing from the list are not deleted; their monitors are paused.
  • warnings lists things such as Monitor limit reached, <namespace>/<name> is not monitored (plan limit) or Unsupported schedule for <namespace>/<name>.

One request per Job event. Response 202 with an empty body.

{
"clusterName": "prod-eu",
"namespace": "default",
"cronJobName": "my-backup-job",
"jobUid": "9a4e6c10-3b7d-4e0f-b2a8-1c5d7e9f0a2b",
"type": "job_failed",
"occurredAt": "2026-10-03T02:00:12Z",
"durationMs": 53000,
"reason": "OOMKilled",
"message": "container backup terminated: OOMKilled (exit code 137)"
}
Field Notes
type job_started, job_succeeded or job_failed. Anything else is 400.
jobUid, namespace, cronJobName Required.
occurredAt ISO 8601 timestamp in UTC.
durationMs Optional, sent for finished Jobs.
reason Optional, at most 253 characters.
message Optional, at most 2000 characters.

The event becomes a ping: job_started is a start, job_succeeded a success and job_failed a fail. The pair jobUid + type is the idempotency key, so sending the same event twice has no extra effect. An event for a CronJob CronBeat does not know yet is accepted and ignored.

Sent every 60 seconds. Response 204.

{"clusterName": "prod-eu", "agentVersion": "0.2.3", "cronJobCount": 12}

CronBeat records the time of the heartbeat. If none arrives for 3 minutes the agent is lost.