Webhooks
9 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.
List webhook endpoints#
/v1/webhooksscope admincurl -s -X GET https://api.kosa8.com/v1/webhooks \ -H "Authorization: Bearer $KOSA8_API_KEY"
Add an endpoint; the whsec_ signing secret is shown once#
/v1/webhooksscope adminurlrequiredstringeventsarray of "sandbox.created" | "sandbox.deleted" | "sandbox.slept" | "sandbox.woke" | "sandbox.error" | "sandbox.killed" | "sandbox.oom" | "function.deployed" …descriptionstringcurl -s -X POST https://api.kosa8.com/v1/webhooks \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
Stop sending, including retries#
/v1/webhooks/{id}scope adminidrequiredpath · stringcurl -s -X DELETE https://api.kosa8.com/v1/webhooks/$SBX \ -H "Authorization: Bearer $KOSA8_API_KEY"
Recent deliveries#
/v1/webhooks/{id}/deliveriesscope adminidrequiredpath · stringlimitquery · integercurl -s -X GET https://api.kosa8.com/v1/webhooks/$SBX/deliveries \ -H "Authorization: Bearer $KOSA8_API_KEY"
Send a webhook.test event now#
/v1/webhooks/{id}/testscope adminidrequiredpath · stringcurl -s -X POST https://api.kosa8.com/v1/webhooks/$SBX/test \ -H "Authorization: Bearer $KOSA8_API_KEY"
Record an agent hook decision or session event from a developer's machine (kosa8 hooks install --cloud)#
/v1/agent-hooks/eventsscope sandboxes:writeThe decision was made by kosa8's rules on the machine; the answer may only be stricter (a frozen organization refuses every call). agent.tool_call.blocked (deny or ask) and agent.tool_call.decided are recorded in the audit log and sent to webhooks that subscribe to them.
JSON bodyeventrequiredobjectevent.actionrequired"agent.tool_call.decided" | "agent.tool_call.blocked" | "agent.session.started" | "agent.session.stopped" | "agent.session.ended" | "agent.file.edited"event.harnessrequired"claude-code" | "cursor" | "codex" | "gemini" | "copilot"event.eventstringevent.toolstringevent.effect"allow" | "flag" | "ask" | "deny"event.reasonstringevent.rulesarray of stringevent.subjectstringevent.args_sha256stringevent.sessionstringevent.cwdstringevent.mode"check" | "sandbox"event.sandboxedbooleancurl -s -X POST https://api.kosa8.com/v1/agent-hooks/events \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
The organization's agent hook policy, which `kosa8 hooks install --org` caches and decides with on each machine#
/v1/agent-hooks/policyscope sandboxes:readVersion 0 is the default policy (nothing changed). frozen: the organization is frozen, and every checked call is refused.
Responsescurl -s -X GET https://api.kosa8.com/v1/agent-hooks/policy \ -H "Authorization: Bearer $KOSA8_API_KEY"
Replace the organization's agent hook policy#
/v1/agent-hooks/policyscope adminrules: [{id, effect: deny|ask|flag, tool, match, reason}] with tool and match regular expressions (RE2: no lookaround or backreferences) on the tool name and on the call's command, path or URL; disabled_rules turns built-in K8- rules off; fail: closed|open when a machine has no usable copy. Machines pick a change up within ttl_seconds.
JSON bodyfail"closed" | "open"ttl_secondsintegermax_stale_secondsintegerdisabled_rulesarray of stringrulesarray of objectcurl -s -X PUT https://api.kosa8.com/v1/agent-hooks/policy \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
Record agent hook decisions forwarded from a machine's audit log (kosa8 hooks install --org --forward-audit)#
/v1/agent-hooks/auditscope sandboxes:writebatch is the JSON of the forwarded entries (chain, seq, time, action, hash, event), signed with the machine's audit key (Ed25519 over "kosa8.hooks.forward/v1\n" + batch). Each entry is recorded once per chain and seq, and reaches the SIEM export with the rest of the audit log. Metadata only: never file contents or command output.
JSON bodybatchrequiredstringkeyobjectsigstringcurl -s -X POST https://api.kosa8.com/v1/agent-hooks/audit \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json