SC-14 — what the pre-deploy drain hook polls: local and fleet run COUNTS, the oldest local run's start, whether the drain is complete, and the maintenance / draining flags. Counts only — no workspace, project, task or title.
GET
/api/operator/v1/drain
const url = 'https://example.com/api/operator/v1/drain';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://example.com/api/operator/v1/drainSC-14 — what the pre-deploy drain hook polls: local and fleet run COUNTS, the oldest local run’s start, whether the drain is complete, and the maintenance / draining flags. Counts only — no workspace, project, task or title.
Responses
Section titled “Responses”OK
Media typeapplication/json
SC-14 — what a deploy hook polls. COUNTS ONLY: no workspace, project, task or title, so an operator token learns nothing about tenants from it.
object
active_fleet_runs
required
Open fleet assignments (assigned/claimed/running); they live on their
runners and survive a hub restart, so they do not gate drain_complete.
integer format: int64
active_local_runs
required
Hub-local agent runs still in flight (their containers die with this process).
integer format: int64
drain_complete
required
active_local_runs == 0.
boolean
draining
required
This process is in its shutdown drain.
boolean
maintenance
required
The instance is in a maintenance window.
boolean
maintenance_origin
oldest_started_at
The oldest started_at among the hub-local active runs.
string | null format: date-time
Example
{ "maintenance_origin": "deploy_hook"}