Host agent API
This is the API the host agent (cronbeat run) speaks. It is the API used by the
CLI: stable, and meant for the CLI. You normally never call it yourself; it is documented so security teams can see
exactly what leaves the server. The API for the Kubernetes agent is separate, see Agent API.
- Base URL:
https://api.cronbeat.dev - Authentication:
Authorization: Bearer <apiKey>. The key starts withcb_agent_, belongs to a host agent (Linux server (cron jobs) in the app) and only a hash is stored. A key of a Kubernetes agent answers403on these endpoints, and a host key answers403on the Kubernetes endpoints. - Content type:
application/json. Field names arecamelCase. Unknown request fields are ignored. - Requests have a body limit of 64 KB, and a rate limit per key and per IP address, see Limits.
POST /agent/v1/host/runs
Section titled “POST /agent/v1/host/runs”Reports one event of a run. The CLI sends it twice per run: started, then succeeded or failed.
{ "agentVersion": "0.1.0", "job": { "name": "nightly-backup", "schedule": "0 2 * * *", "timeZone": "Europe/Istanbul", "graceSeconds": 300, "maxRuntimeSeconds": 3600 }, "run": { "id": "3f2b8c1e-5a4d-4e6f-8b7a-1c2d3e4f5a6b", "type": "failed", "durationMs": 1234, "exitCode": 2, "output": "backup failed: disk full\n" }}| Field | Notes |
|---|---|
agentVersion |
Optional, at most 40 characters. Shown on the Agents page. |
job.name |
Required, 1 to 64 characters of A-Za-z0-9._-. With the key it identifies the monitor. |
job.schedule |
Five field cron expression, at most 100 characters. Required only when the monitor does not exist yet; otherwise optional. Macros such as @daily are refused (the CLI converts them). |
job.timeZone |
Optional IANA name, at most 64 characters, default UTC. An unknown name is 400. |
job.graceSeconds |
Optional, 0 to 604800 (7 days), default 300. Used only when the monitor is created. |
job.maxRuntimeSeconds |
Optional, 1 to 86400 (24 hours). Used only when the monitor is created. |
run.id |
Required, a UUID. Every event of a run uses the same id. |
run.type |
Required: started, succeeded or failed. |
run.durationMs |
Optional, 0 or more. Stored for succeeded. |
run.exitCode |
Optional, 0 to 255. |
run.signal |
Optional, 1 to 16 characters of A-Z0-9 (for example SIGKILL). |
run.output |
Optional. Only used for failed. The last 8192 bytes are kept (cut at a character boundary, NUL bytes removed); text that is blank is dropped. |
Response 202:
{"monitorId": "6a1f0c2e-7d3b-4e91-8f40-2b5c9d1e7a33", "created": false, "warnings": []}created is true when this event created the monitor. warnings is a list of texts for the CLI to show (currently
always empty).
Behaviour
Section titled “Behaviour”- Identity. A monitor is identified by the key and
job.name(internallyhost/<agent id>/<name>). Its source ishost_agent, its description isReported by host <server name>. - Definition with every event. The job definition is accepted with every event. A monitor that exists is updated
from it: when
job.scheduleis present, its schedule and time zone (UTCwhen no zone is sent) are replaced, and its name is set tojob.name. Grace period, maximum runtime and description are never changed after creation, so edits made in the app stay. A paused ordownmonitor does not recalculate its expected time. - Events.
startedis a start ping (statusrunning),succeededa success ping with the duration,faileda fail ping. A failure detail is stored:exit code 2,terminated by signal SIGKILL, orexit code 137 (signal SIGKILL)when both are sent, and the output as the body of the ping. - Idempotent. The key
<run.id>:<TYPE>de-duplicates events: sending the same event again has no extra effect. The time of the event is the time CronBeat received it. - An event for a monitor that was deleted creates it again if
job.scheduleis present, otherwise it is400. - Plan limits. A new monitor needs room under the monitor limit; otherwise
403withplan_limit_exceeded. A host agent that is outside the plan after a downgrade also answers403. - Every authenticated request updates the time of the last run reported and the version on the Agents page. There is
no heartbeat and a host agent never gets the status
lost.
POST /agent/v1/host/check
Section titled “POST /agent/v1/host/check”Validates the key and records that the host agent was seen. No body. Used by cronbeat check.
{"name": "prod-db-1", "kind": "host", "version": 1}name is the name of the host agent, version the version of this protocol.
Limits
Section titled “Limits”| Limit | Value | Answer |
|---|---|---|
Body of /agent/v1/host/* |
64 KB | 413 |
Body of /agent/v1/sync (Kubernetes) |
2 MB | 413 |
| Requests per key | 600 per minute | 429 with Retry-After |
| Requests per IP address | 3000 per minute, all keys together | 429 with Retry-After |
run.output |
8192 bytes kept |
The limits apply to all /agent/v1/ endpoints. A request with a missing or made-up key only spends the budget of its IP
address, so guessing keys cannot use up the budget of a real key. The body limit is checked from Content-Length
and, without it, by reading at most one byte more than the limit.
Errors
Section titled “Errors”Error bodies follow RFC 7807 (application/problem+json) and never contain stack traces.
| Code | Meaning |
|---|---|
202 |
The event was accepted (runs). |
200 |
The key is valid (check). |
400 |
Validation failed: a missing or invalid field, an invalid cron expression, an unknown time zone, or no job.schedule for a monitor that does not exist yet. |
401 |
The Authorization header is missing or not Bearer, or the key is unknown or revoked. |
403 |
The key is of the wrong kind; or plan_limit_exceeded: the monitor limit is reached or the host agent is outside the plan. |
413 |
The body is larger than the limit. |
429 |
A rate limit was hit. Retry-After is in seconds. |
The CLI retries started never and succeeded or failed up to 3 times for network errors, 5xx and 429, and never for
other 4xx, see Network behaviour.
Example
Section titled “Example”curl -sS -X POST https://api.cronbeat.dev/agent/v1/host/check \ -H "Authorization: Bearer cb_agent_YOUR_KEY"Do not paste a real key into shell history on shared machines; the CLI reads it from a file or the environment for that reason.

