Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: Klaxon Stacks 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.
Auth: `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.
Agents: 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
tags:
- name: Stacks
paths:
/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
tags:
- Stacks
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
tags:
- Stacks
/stacks/{idOrName}:
delete:
operationId: deleteStack
summary: Delete a stack (it is removed from the account, with its members, routes and…
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
tags:
- Stacks
/stacks/{idOrName}/status:
get:
operationId: stackStatus
summary: What changed since the last check (coalesced net-diff; advances the cursor…
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
tags:
- Stacks
/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
tags:
- Stacks
delete:
operationId: unwatchMember
summary: 'Stop watching a tool (structured why: reason_code menu, swap target, alert…'
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 }'
tags:
- Stacks
/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
tags:
- Stacks
/stacks/{idOrName}/routes:
get:
operationId: listRoutes
summary: The stack's delivery channels, targets masked, each with the state the stack…
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
tags:
- Stacks
post:
operationId: addRoute
summary: Add a delivery channel to a stack (webhook targets are SSRF-checked; 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
tags:
- Stacks
/stacks/{idOrName}/export/cyclonedx:
get:
operationId: exportCyclonedx
summary: A stack's tool list in CycloneDX shape (names, roles and plans; no versions or…
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
tags:
- Stacks
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.
The 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.
Answer 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.
tags:
- Stacks
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: A zk_ API key. The needed scope is listed per operation as x-required-scope.