Swarms
6 endpoints at https://api.kosa8.com, sent with Authorization: Bearer $KOSA8_API_KEY. Generated from the API's own OpenAPI description, which a test holds to the router.
The organization's swarms, newest first, without counters#
/v1/swarmsscope sandboxes:readcurl -s -X GET https://api.kosa8.com/v1/swarms \ -H "Authorization: Bearer $KOSA8_API_KEY"
Checkpoint a sandbox and fork it into a named swarm under one egress policy#
/v1/swarmsscope sandboxes:writeThe checkpoint and the fork are the same calls as POST /v1/sandboxes/{id}/checkpoints and /fork, with the same payment, quota and fork limits. Members are labelled swarm, swarm.member and swarm.parent. If a member's egress policy cannot be applied, every member is deleted (502 egress_failed).
JSON bodynamerequiredstringfrom_sandbox_idrequiredstringcountrequiredintegeregressobjectegress.internetbooleanegress.allowarray of stringegress.denyarray of stringegress.presetsarray of "common" | "npm" | "pypi" | "github" | "go" | "crates" | "rubygems" | "maven" …curl -s -X POST https://api.kosa8.com/v1/swarms \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
A swarm with each running member's egress counters and anomalies#
/v1/swarms/{id}scope sandboxes:read?stats=0 skips the counters. Counters come from the host: packets refused by egress and bytes out since the member last booted. Anomalies found (denied_burst: >= 20 refused; egress_spike: bytes out > 10x the median and > 1 MiB) are kept and written once to the audit log as swarm.anomaly. rare_host needs the hosts each member contacted, which kosa8 Cloud hosts do not report.
Parametersidrequiredpath · stringcurl -s -X GET https://api.kosa8.com/v1/swarms/$SBX \ -H "Authorization: Bearer $KOSA8_API_KEY"
Put every running member to sleep (state kept)#
/v1/swarms/{id}/pausescope sandboxes:writeidrequiredpath · stringcurl -s -X POST https://api.kosa8.com/v1/swarms/$SBX/pause \ -H "Authorization: Bearer $KOSA8_API_KEY"
Wake every sleeping member#
/v1/swarms/{id}/resumescope sandboxes:writeidrequiredpath · stringcurl -s -X POST https://api.kosa8.com/v1/swarms/$SBX/resume \ -H "Authorization: Bearer $KOSA8_API_KEY"
The kill switch: every running member to sleep and the swarm marked killed#
/v1/swarms/{id}/killscope sandboxes:writeWorks while the organization is frozen. A killed swarm's name can be used again.
Parametersidrequiredpath · stringrmquery · "1"curl -s -X POST https://api.kosa8.com/v1/swarms/$SBX/kill \ -H "Authorization: Bearer $KOSA8_API_KEY"