{"openapi":"3.1.0","info":{"title":"Klaxon API","version":"0.1.0","description":"Register the tools a project depends on; hear about verified, published catalog changes with old→new values, a verification date, and an evidence link.\n\nAuth: `Authorization: Bearer zk_...` — keys are issued from /watch/account and carry scopes (`status:read`, `stacks:manage`; `report:read` is retired, accepted on old keys only). Acknowledging an alert as wrong or as a plan mismatch needs `stacks:manage`. The Stack Report endpoints need no key.\n\nAgents: the MCP server at /watch/mcp exposes the same behavior as tools (stateless JSON-RPC: initialize, tools/list, tools/call) and is the richer surface; REST is the stable path for scripts and CI.","contact":{"name":"Zaira Labs","url":"https://zairalabs.ai"}},"servers":[{"url":"https://app.zairalabs.ai/watch/api/v1"}],"webhooks":{"alert":{"post":{"operationId":"alertWebhook","summary":"An alert, digest, update or test posted to a generic webhook route","description":"Headers: `webhook-id` (the delivery id, repeated on every retry), `webhook-timestamp` (unix seconds) and `webhook-signature` (`v1,` and the base64 HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{body}`). `X-Zaira-Timestamp` and `X-Zaira-Signature` (`v1=` and the hex HMAC-SHA256 of `{timestamp}.{body}`) come beside them.\n\nThe secret is `whsec_` and base64 (Standard Webhooks); the signing key is the decoded part. To verify, check `webhook-signature` against the raw body with the id and timestamp from the headers, and reject an old timestamp.\n\nAnswer 2xx. Anything else, or no answer in 10 seconds, is retried after 5, 25 and 125 minutes, six attempts in all.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"delivery_id":{"type":"string","description":"Stable per delivery; the same on every retry, and the same value as the webhook-id header."},"kind":{"type":"string","enum":["critical","digest","correction","test","weekly_digest"],"description":"What this post is. An update to an earlier alert has kind correction and an `update` object."},"stack":{"type":"string"},"generated_at":{"type":"string","format":"date-time"},"stack_autonomy":{"type":"object","description":"{ mode, effective, note }: how involved the stack's owner wants to be."},"update":{"type":"object","description":"Updates only: { kind (updated | revised), note, of_sequence, tool, field, earlier_value, current_value, earlier_from, changed_on }."},"alerts":{"type":"array","description":"OSV-shaped; `id` is the catalog change id (KX-{sequence}-{field}), not the delivery.","items":{"type":"object","properties":{"id":{"type":"string"},"modified":{"type":"string"},"published":{"type":"string"},"summary":{"type":"string"},"details":{"type":"string"},"severity":{"type":"array","description":"[{ type: zaira, score: minor | notable | critical }]"},"database_specific":{"type":"object","description":"field, old_value, new_value, verified_at, evidence, and the stack-specific meaning, why and todo."}}}}}}}}},"responses":{"2XX":{"description":"Received."}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"A zk_ API key. The needed scope is listed per operation as x-required-scope."}}},"paths":{"/report":{"get":{"operationId":"getStackReport","summary":"Stack Report: verified facts + change replay for a set of tools (no key)","parameters":[{"name":"slugs","in":"query","schema":{"type":"string"},"description":"Comma-separated catalog slugs (max 200)"},{"name":"names","in":"query","schema":{"type":"string"},"description":"Comma-separated tool names; unresolved in-scope names are reported, never silently dropped"}],"responses":{"200":{"description":"The report: per-tool facts with per-field watchability, the coalesced change replay, and unresolved names.","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}}}},"post":{"operationId":"postStackReport","summary":"Stack Report from a JSON body (slugs, names, manifest_text, repo_url)","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"slugs":{"type":"array","items":{"type":"string"}},"names":{"type":"array","items":{"type":"string"}},"manifest_text":{"type":"string"},"repo_url":{"type":"string"}}}}}},"responses":{"200":{"description":"The report (same shape as GET)."},"400":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}}}}},"/typeahead":{"get":{"operationId":"typeahead","summary":"Tool-picker typeahead over the catalog (no key)","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":2,"maxLength":60}}],"responses":{"200":{"description":"Up to 8 matches: slug, name, category."}}}},"/catalog":{"get":{"operationId":"catalog","summary":"The whole catalog for pickers: slug, name, category (no key; edge-cached 1h)","responses":{"200":{"description":"{ tools: [...] }"}}}},"/request-tool":{"post":{"operationId":"requestTool","summary":"Ask for coverage of a tool the catalog lacks (no key; sanitized; feeds the demand queue)","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}}}}},"responses":{"200":{"description":"{ ok, queued } or, when the catalog already covers the name, { ok, covered, message }"},"400":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}}}}},"/scopes":{"get":{"operationId":"scopes","summary":"Machine-readable scope catalog (no key)","responses":{"200":{"description":"{ scopes: { 'status:read': ..., 'stacks:manage': ..., 'report:read': ... (retired) } }"}}}},"/stacks":{"get":{"operationId":"listStacks","summary":"List this account's stacks with members and context","security":[{"bearerAuth":[]}],"x-required-scope":"status:read","responses":{"200":{"description":"{ stacks: [{ id, name, repo, cursor, context, members }] }. A stack-restricted key sees only its own stack."},"401":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}},"403":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}}}},"post":{"operationId":"registerStack","summary":"Register or update a stack (same behavior as the klaxon_register MCP tool)","security":[{"bearerAuth":[]}],"x-required-scope":"stacks:manage","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":120},"slugs":{"type":"array","items":{"type":"string"},"maxItems":200},"names":{"type":"array","items":{"type":"string"},"maxItems":200},"manifest_text":{"type":"string","description":"Contents of .zaira/stack.yml (schema: /watch/schema/stack.json)"},"repo":{"type":"string"},"repo_url":{"type":"string"},"context":{"type":"object","description":"The seven personalization enums; any subset"},"tools":{"type":"array","description":"Per-tool facts ({ name, plan?, role?, hosted_on? }) the human has stated; alerts condition on them","items":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":100},"plan":{"type":"string","enum":["free","paid","enterprise"]},"role":{"type":"string","maxLength":80},"hosted_on":{"type":"string","maxLength":100}}},"maxItems":200},"detail":{"type":"boolean","description":"Return the full receipt (twin and queue explanations, suggested pairings) instead of the compact one that leads with the ask and the counts"}}}}}},"responses":{"200":{"description":"{ ok, result, stack: { id, name } }: the registration receipt (the ask first, then counts: resolved, queued for coverage, out of scope, suggested — every submitted name accounted for; detail=true for the full form) and the stack it landed on, for the routes and context calls. A refusal is a problem answer: 400 a manifest that did not validate or nothing to watch, 403 a stack-restricted key naming another stack, 429 the day's registration budget."},"400":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}},"401":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}},"403":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}},"429":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}}}}},"/stacks/{idOrName}":{"delete":{"operationId":"deleteStack","summary":"Delete a stack (it is removed from the account, with its members, routes and scoped keys)","security":[{"bearerAuth":[]}],"x-required-scope":"stacks:manage","parameters":[{"name":"idOrName","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ ok, deleted }"},"404":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}}}}},"/stacks/{idOrName}/status":{"get":{"operationId":"stackStatus","summary":"What changed since the last check (coalesced net-diff; advances the cursor unless peek is true)","security":[{"bearerAuth":[]}],"x-required-scope":"status:read","parameters":[{"name":"idOrName","in":"path","required":true,"schema":{"type":"string"}},{"name":"peek","in":"query","schema":{"type":"boolean"},"description":"Read without advancing the cursor (true, 1 or yes; false, 0 or no advance it; any other value is refused with 400)"}],"responses":{"200":{"description":"{ ok, result }: the Markdown-KV status text an agent relays (first check = an explicitly framed BASELINE). A refusal is a problem answer, never { ok: true } (since 2026-10-08): 404 unknown stack, 409 several stacks and none named."},"400":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}},"404":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}},"409":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}}}}},"/stacks/{idOrName}/members/{slug}":{"patch":{"operationId":"setMemberLevel","summary":"Mute/unmute a tool or set its severity floor","security":[{"bearerAuth":[]}],"x-required-scope":"stacks:manage","parameters":[{"name":"idOrName","in":"path","required":true,"schema":{"type":"string"}},{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"mute":{"type":"boolean"},"severity_floor":{"type":"string","enum":["minor","notable","critical"]}}}}}},"responses":{"200":{"description":"{ ok, result }"},"400":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}}}},"delete":{"operationId":"unwatchMember","summary":"Stop watching a tool (structured why: reason_code menu, swap target, alert linkage; free-text reason minimized before storage)","security":[{"bearerAuth":[]}],"x-required-scope":"stacks:manage","parameters":[{"name":"idOrName","in":"path","required":true,"schema":{"type":"string"}},{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":200},"reason_code":{"type":"string","enum":["pricing_changed","works_better_with","missing_capability","maintenance_security","team_preference","consolidating_vendors","compliance","project_changed"],"description":"Why, from the human, in our vocabulary"},"replaced_by":{"type":"string","maxLength":100,"description":"What replaced it (any tool name; unresolved names join the request queue)"},"because_of_alert":{"type":"boolean","description":"True only when the human confirms a Klaxon alert drove the change"}}}}}},"responses":{"200":{"description":"{ ok, result }"}}}},"/stacks/{idOrName}/context":{"patch":{"operationId":"setContext","summary":"Set the personalization answers (enum-only; anything else is rejected and named)","security":[{"bearerAuth":[]}],"x-required-scope":"stacks:manage","parameters":[{"name":"idOrName","in":"path","required":true,"schema":{"type":"string"},"description":"The stack's id or its name"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","description":"Any subset of ctx_stage, ctx_audience, ctx_user_scale, ctx_deployment, ctx_build_type, ctx_team_size, ctx_compliance, ctx_agent_operated, ctx_autonomy (agent_handles | agent_tells | human_decides; how involved the human wants to be on this stack)"}}}},"responses":{"200":{"description":"{ ok, set, rejected }"},"400":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}},"404":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}}}}},"/account":{"get":{"operationId":"account","summary":"This account's plan, masked sign-in address, email switches and limits (read-only)","security":[{"bearerAuth":[]}],"x-required-scope":"status:read","responses":{"200":{"description":"{ plan, email (masked), email_switches: { criticals, digest }, limits: { alerted_tools_per_stack, alerted_tools_per_account, register_calls_per_day, member_writes_per_day, channels, digest_days }, note }"},"401":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}}}}},"/stacks/{idOrName}/routes":{"get":{"operationId":"listRoutes","summary":"The stack's delivery channels, targets masked, each with the state the stack page shows (read-only)","security":[{"bearerAuth":[]}],"x-required-scope":"status:read","parameters":[{"name":"idOrName","in":"path","required":true,"schema":{"type":"string"},"description":"The stack's id or its name"}],"responses":{"200":{"description":"{ routes: [{ id, channel, target (masked), min_severity, state: { kind: not_on_plan | waiting | declined | expired | no_sends | retrying | dead | sending, attempts?, at? } }], account_email: on | off }"},"404":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}}}},"post":{"operationId":"addRoute","summary":"Add a delivery channel to a stack (webhook targets are SSRF-checked; channels are tier-gated). An email channel is a notify-only recipient scoped to the stack: the address gets a confirmation link and receives nothing until it says yes (202); the account's own sign-in address is confirmed at once (200). min_severity applies to webhook-class channels.","security":[{"bearerAuth":[]}],"x-required-scope":"stacks:manage","parameters":[{"name":"idOrName","in":"path","required":true,"schema":{"type":"string"},"description":"The stack's id or its name"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["channel","target"],"properties":{"channel":{"type":"string","enum":["email","webhook","slack","discord"]},"target":{"type":"string"},"secret":{"type":"string","description":"Signing secret for a generic webhook. Left out, a whsec_ secret is generated and returned in this response, so it will be in the agent's transcript. Either form signs the posts (see the alert webhook)."},"min_severity":{"type":"string","enum":["minor","notable","critical"],"default":"critical"}}}}}},"responses":{"200":{"description":"{ ok } (webhook without a secret: { ok, secret }; email: { ok, confirmed: true })"},"202":{"description":"email: { ok, confirmed: false, pending_confirmation }"},"400":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}},"403":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}},"429":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}}}}},"/stacks/{idOrName}/export/cyclonedx":{"get":{"operationId":"exportCyclonedx","summary":"A stack's tool list in CycloneDX shape (names, roles and plans; no versions or package identifiers)","security":[{"bearerAuth":[]}],"x-required-scope":"status:read","parameters":[{"name":"idOrName","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"A CycloneDX 1.5 JSON BOM."},"404":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}}}}},"/bug-report":{"post":{"operationId":"fileBugReport","summary":"File a bug report (identity from the key; description sanitized like every ingress field)","security":[{"bearerAuth":[]}],"x-required-scope":"status:read","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["description"],"properties":{"description":{"type":"string","maxLength":2000},"page":{"type":"string","maxLength":200}}}}}},"responses":{"200":{"description":"{ ok, stripped }"},"400":{"description":"Errors are RFC 9457 problem documents (application/problem+json) with a machine-readable `type`, a human `title`/`detail`, and a `recovery` array of concrete next steps. 429 responses additionally carry a reserved `payment_options` slot.","content":{"application/problem+json":{"schema":{"type":"object"}}}}}}}}}