{
  "openapi": "3.1.0",
  "info": {
    "title": "Kaze agent API",
    "version": "1",
    "description": "Every tool the Kaze MCP server offers, as an HTTPS POST. Send an agent key as a bearer token. No tool can approve work or mark it done; a person does that in Kaze."
  },
  "servers": [
    {
      "url": "https://tame-goldfinch-206.eu-west-1.convex.site",
      "description": "Your Kaze API address"
    }
  ],
  "tags": [
    {
      "name": "read",
      "description": "Read items and sprints"
    },
    {
      "name": "write",
      "description": "Create and update items"
    },
    {
      "name": "plan",
      "description": "Plan sprints"
    },
    {
      "name": "telemetry",
      "description": "Report agent runs"
    },
    {
      "name": "test",
      "description": "Record test results"
    },
    {
      "name": "deploy",
      "description": "Record deployments"
    },
    {
      "name": "inbox",
      "description": "Send items to the inbox"
    },
    {
      "name": "webhooks",
      "description": "Events sent to Kaze by other tools"
    }
  ],
  "paths": {
    "/api/v1/get_team": {
      "post": {
        "operationId": "get_team",
        "summary": "Call first.",
        "description": "Call first. What this team works on and its notes for agents, the hard rules you must follow, what done means here, how often to pick up work, statuses, item types, estimating and KazeQL tips.\n\nNeeds the `read` scope (read items and sprints).",
        "tags": [
          "read"
        ],
        "security": [
          {
            "agentKey": [
              "read"
            ]
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/list_items": {
      "post": {
        "operationId": "list_items",
        "summary": "List open items.",
        "description": "List open items. queued: true gives the agent queue: work a person has handed to agents, oldest first. Take work from there. Filter by sprint, status category or 'mine' (claimed by or queued for this key).\n\nNeeds the `read` scope (read items and sprints).",
        "tags": [
          "read"
        ],
        "security": [
          {
            "agentKey": [
              "read"
            ]
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sprint": {
                    "type": "string",
                    "enum": [
                      "active",
                      "backlog"
                    ]
                  },
                  "category": {
                    "type": "string",
                    "enum": [
                      "todo",
                      "doing",
                      "review",
                      "validate"
                    ]
                  },
                  "mine": {
                    "type": "boolean"
                  },
                  "queued": {
                    "type": "boolean"
                  },
                  "limit": {
                    "default": 50,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/get_item": {
      "post": {
        "operationId": "get_item",
        "summary": "Full item: description, criteria, guardrails, links and comments.",
        "description": "Full item: description, criteria, guardrails, links and comments. `code` gives the branch name, commit prefix, pull request title and description to use, whether a repository (GitHub, GitLab or Bitbucket) is connected, and the pull requests and commits already linked with their checks and reviews.\n\nNeeds the `read` scope (read items and sprints).",
        "tags": [
          "read"
        ],
        "security": [
          {
            "agentKey": [
              "read"
            ]
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
                  }
                },
                "required": [
                  "key"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/list_sprints": {
      "post": {
        "operationId": "list_sprints",
        "summary": "Active and planned sprints.",
        "description": "Active and planned sprints.\n\nNeeds the `read` scope (read items and sprints).",
        "tags": [
          "read"
        ],
        "security": [
          {
            "agentKey": [
              "read"
            ]
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sprint_health": {
      "post": {
        "operationId": "sprint_health",
        "summary": "Progress, remaining effort and blockers for the active sprint.",
        "description": "Progress, remaining effort and blockers for the active sprint.\n\nNeeds the `read` scope (read items and sprints).",
        "tags": [
          "read"
        ],
        "security": [
          {
            "agentKey": [
              "read"
            ]
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/query": {
      "post": {
        "operationId": "query",
        "summary": "Find items with KazeQL.",
        "description": "Find items with KazeQL. field:value pairs; a space means AND, plus OR, NOT or -, and brackets. Values: word, \"two words\", (a,b) for any of, 1..5 for a range, >5. Dates: 2026-03-31, -7d, this-week, @now, @start-of(this-month). People: @me, @user(name), none. History: was:status=in-progress, changed:target-date after:-14d since:@baseline(\"name\"). End with sort:priority-desc. Fields: id, key, type, project, title, status, category, resolution, assignee, assignee-kind, accountable, reporter, sponsor, team, priority, label, sprint, release, target-date, forecast-date, start-date, created, updated, resolved, started, risk, review, cost, time-logged, outcome, spec, verification, parent, child-of, epic, blocks, blocked-by, linked, duplicates, has, estimate, cf.<your-field>. Example: assignee-kind:agent review:waiting sort:risk-desc. Every query is logged.\n\nNeeds the `read` scope (read items and sprints).",
        "tags": [
          "read"
        ],
        "security": [
          {
            "agentKey": [
              "read"
            ]
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kazeql": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "limit": {
                    "default": 50,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  },
                  "cursor": {
                    "default": 0,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000
                  }
                },
                "required": [
                  "kazeql"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/explain": {
      "post": {
        "operationId": "explain",
        "summary": "Say what a KazeQL query means, and give its tree, without running it.",
        "description": "Say what a KazeQL query means, and give its tree, without running it.\n\nNeeds the `read` scope (read items and sprints).",
        "tags": [
          "read"
        ],
        "security": [
          {
            "agentKey": [
              "read"
            ]
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kazeql": {
                    "type": "string",
                    "maxLength": 1000
                  }
                },
                "required": [
                  "kazeql"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/validate": {
      "post": {
        "operationId": "validate",
        "summary": "Check a KazeQL query.",
        "description": "Check a KazeQL query. Returns the problem, where it is, and a suggested fix.\n\nNeeds the `read` scope (read items and sprints).",
        "tags": [
          "read"
        ],
        "security": [
          {
            "agentKey": [
              "read"
            ]
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kazeql": {
                    "type": "string",
                    "maxLength": 1000
                  }
                },
                "required": [
                  "kazeql"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/get_rubric": {
      "post": {
        "operationId": "get_rubric",
        "summary": "The rules a spec is checked against.",
        "description": "The rules a spec is checked against. Check yourself against them before you create or claim an item.\n\nNeeds the `read` scope (read items and sprints).",
        "tags": [
          "read"
        ],
        "security": [
          {
            "agentKey": [
              "read"
            ]
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/lint_spec": {
      "post": {
        "operationId": "lint_spec",
        "summary": "Check one item against the rubric.",
        "description": "Check one item against the rubric. Anything marked block stops an agent from claiming it.\n\nNeeds the `read` scope (read items and sprints).",
        "tags": [
          "read"
        ],
        "security": [
          {
            "agentKey": [
              "read"
            ]
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
                  }
                },
                "required": [
                  "key"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/create_item": {
      "post": {
        "operationId": "create_item",
        "summary": "Create an item.",
        "description": "Create an item. Build an epic first, then its stories, bugs and tasks with parent set to the epic's key. Stories and bugs need testable acceptance criteria. Use the team's context from get_team. Nothing you create is queued for agents until a person queues it.\n\nNeeds the `write` scope (create and update items).",
        "tags": [
          "write"
        ],
        "security": [
          {
            "agentKey": [
              "write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "initiative",
                      "epic",
                      "story",
                      "task",
                      "bug",
                      "spike",
                      "debt",
                      "impediment",
                      "subtask"
                    ]
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 20000
                  },
                  "parent": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
                  },
                  "priority": {
                    "type": "string",
                    "enum": [
                      "urgent",
                      "high",
                      "medium",
                      "low"
                    ]
                  },
                  "acceptance": {
                    "maxItems": 30,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500
                    }
                  },
                  "estimate": {
                    "type": "string",
                    "maxLength": 10
                  },
                  "execution": {
                    "type": "string",
                    "enum": [
                      "agent",
                      "pair",
                      "human"
                    ]
                  },
                  "labels": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    }
                  },
                  "nonGoals": {
                    "type": "string",
                    "maxLength": 5000
                  },
                  "verification": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "steps": {
                    "type": "string",
                    "maxLength": 10000
                  },
                  "guardrails": {
                    "type": "string",
                    "maxLength": 5000
                  },
                  "references": {
                    "type": "string",
                    "maxLength": 5000
                  },
                  "outcome": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "successMeasure": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "userStory": {
                    "type": "object",
                    "properties": {
                      "role": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "want": {
                        "type": "string",
                        "maxLength": 500
                      },
                      "value": {
                        "type": "string",
                        "maxLength": 500
                      }
                    },
                    "required": [
                      "role",
                      "want",
                      "value"
                    ],
                    "additionalProperties": false
                  },
                  "skill": {
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9-]{0,60}@\\d{1,4}\\.\\d{1,4}\\.\\d{1,4}$"
                  }
                },
                "required": [
                  "type",
                  "title"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/update_item": {
      "post": {
        "operationId": "update_item",
        "summary": "Change an item that has not reached a person yet: title, description, priority, estimate, labels, parent, scope, verification, guardrails, references, user story, or an epic's outcome and success measure.",
        "description": "Change an item that has not reached a person yet: title, description, priority, estimate, labels, parent, scope, verification, guardrails, references, user story, or an epic's outcome and success measure. Once work has started only the agent holding it can edit it.\n\nNeeds the `write` scope (create and update items).",
        "tags": [
          "write"
        ],
        "security": [
          {
            "agentKey": [
              "write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 20000
                  },
                  "priority": {
                    "type": "string",
                    "enum": [
                      "urgent",
                      "high",
                      "medium",
                      "low"
                    ]
                  },
                  "estimate": {
                    "type": "string",
                    "maxLength": 10
                  },
                  "labels": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    }
                  },
                  "parent": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
                  },
                  "nonGoals": {
                    "type": "string",
                    "maxLength": 5000
                  },
                  "verification": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "steps": {
                    "type": "string",
                    "maxLength": 10000
                  },
                  "guardrails": {
                    "type": "string",
                    "maxLength": 5000
                  },
                  "references": {
                    "type": "string",
                    "maxLength": 5000
                  },
                  "outcome": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "successMeasure": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "userStory": {
                    "type": "object",
                    "properties": {
                      "role": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "want": {
                        "type": "string",
                        "maxLength": 500
                      },
                      "value": {
                        "type": "string",
                        "maxLength": 500
                      }
                    },
                    "required": [
                      "role",
                      "want",
                      "value"
                    ],
                    "additionalProperties": false
                  },
                  "skill": {
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9-]{0,60}@\\d{1,4}\\.\\d{1,4}\\.\\d{1,4}$"
                  }
                },
                "required": [
                  "key"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/add_criteria": {
      "post": {
        "operationId": "add_criteria",
        "summary": "Add acceptance criteria to an item that has not started.",
        "description": "Add acceptance criteria to an item that has not started.\n\nNeeds the `write` scope (create and update items).",
        "tags": [
          "write"
        ],
        "security": [
          {
            "agentKey": [
              "write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
                  },
                  "criteria": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500
                    }
                  },
                  "skill": {
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9-]{0,60}@\\d{1,4}\\.\\d{1,4}\\.\\d{1,4}$"
                  }
                },
                "required": [
                  "key",
                  "criteria"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/claim_item": {
      "post": {
        "operationId": "claim_item",
        "summary": "Start work on an item from the agent queue (list_items with queued: true).",
        "description": "Start work on an item from the agent queue (list_items with queued: true). Only queued items can be started. Fails unless the item is ready and safe to run. Gives you a lease: call update_progress at least hourly to keep it. Returns `code`: name your branch, commits and pull request exactly as it says, so Kaze links them.\n\nNeeds the `write` scope (create and update items).",
        "tags": [
          "write"
        ],
        "security": [
          {
            "agentKey": [
              "write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
                  },
                  "driver": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "model": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "skills": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-z0-9][a-z0-9-]{0,60}@\\d{1,4}\\.\\d{1,4}\\.\\d{1,4}$"
                    }
                  }
                },
                "required": [
                  "key",
                  "driver"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/submit_item": {
      "post": {
        "operationId": "submit_item",
        "summary": "Hand work over for review or human validation.",
        "description": "Hand work over for review or human validation.\n\nNeeds the `write` scope (create and update items).",
        "tags": [
          "write"
        ],
        "security": [
          {
            "agentKey": [
              "write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
                  },
                  "to": {
                    "type": "string",
                    "enum": [
                      "review",
                      "validate"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 2000
                  }
                },
                "required": [
                  "key",
                  "to"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/check_criteria": {
      "post": {
        "operationId": "check_criteria",
        "summary": "Set which acceptance criteria are met, by 0-based index.",
        "description": "Set which acceptance criteria are met, by 0-based index.\n\nNeeds the `write` scope (create and update items).",
        "tags": [
          "write"
        ],
        "security": [
          {
            "agentKey": [
              "write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
                  },
                  "met": {
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 100
                    }
                  }
                },
                "required": [
                  "key",
                  "met"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ask_question": {
      "post": {
        "operationId": "ask_question",
        "summary": "Ask the people on this team, inside Kaze.",
        "description": "Ask the people on this team, inside Kaze. Use it whenever you lack access (kind: access, for example 'I do not have access to the Salesforce UAT org. Please give the integration user access.'), a decision (kind: decision) or information (kind: detail). The item shows it at the top until a person answers, and you wait.\n\nNeeds the `write` scope (create and update items).",
        "tags": [
          "write"
        ],
        "security": [
          {
            "agentKey": [
              "write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
                  },
                  "question": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "access",
                      "decision",
                      "detail"
                    ]
                  }
                },
                "required": [
                  "key",
                  "question"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/add_comment": {
      "post": {
        "operationId": "add_comment",
        "summary": "Comment on an item.",
        "description": "Comment on an item.\n\nNeeds the `write` scope (create and update items).",
        "tags": [
          "write"
        ],
        "security": [
          {
            "agentKey": [
              "write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 5000
                  }
                },
                "required": [
                  "key",
                  "text"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/link_pr": {
      "post": {
        "operationId": "link_pr",
        "summary": "Attach a pull request (a merge request on GitLab) to an item.",
        "description": "Attach a pull request (a merge request on GitLab) to an item. Only needed when the repository is not connected to Kaze, or the pull request does not carry the item key. Harmless to call twice.\n\nNeeds the `write` scope (create and update items).",
        "tags": [
          "write"
        ],
        "security": [
          {
            "agentKey": [
              "write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 500,
                    "pattern": "^https:\\/\\/"
                  },
                  "number": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "key",
                  "url",
                  "number"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/plan_sprint": {
      "post": {
        "operationId": "plan_sprint",
        "summary": "Move ready items into a planned or active sprint.",
        "description": "Move ready items into a planned or active sprint.\n\nNeeds the `plan` scope (plan sprints).",
        "tags": [
          "plan"
        ],
        "security": [
          {
            "agentKey": [
              "plan"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sprint": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "keys": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
                    }
                  }
                },
                "required": [
                  "sprint",
                  "keys"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/log_run": {
      "post": {
        "operationId": "log_run",
        "summary": "Report one agent run.",
        "description": "Report one agent run. Send costUsd only if your tool reports a real figure; otherwise Kaze uses the team's price for the model. Call once per agent or sub-agent. Name the exact model, and say what the run achieved.\n\nNeeds the `telemetry` scope (report agent runs).",
        "tags": [
          "telemetry"
        ],
        "security": [
          {
            "agentKey": [
              "telemetry"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
                  },
                  "driver": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "model": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "outcome": {
                    "type": "string",
                    "enum": [
                      "done",
                      "partial",
                      "failed"
                    ]
                  },
                  "summary": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000
                  },
                  "skills": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-z0-9][a-z0-9-]{0,60}@\\d{1,4}\\.\\d{1,4}\\.\\d{1,4}$"
                    }
                  },
                  "filesChanged": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000
                  },
                  "linesAdded": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000
                  },
                  "linesRemoved": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000
                  },
                  "testsPassed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000
                  },
                  "testsFailed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "orchestrator",
                      "planner",
                      "coder",
                      "test_runner",
                      "reviewer",
                      "other"
                    ]
                  },
                  "inputTokens": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000
                  },
                  "outputTokens": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000
                  },
                  "cachedTokens": {
                    "default": 0,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000
                  },
                  "durationMs": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000
                  },
                  "costUsd": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100000
                  }
                },
                "required": [
                  "key",
                  "driver",
                  "model",
                  "outcome",
                  "summary",
                  "role",
                  "inputTokens",
                  "outputTokens",
                  "durationMs"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/update_progress": {
      "post": {
        "operationId": "update_progress",
        "summary": "Say what you are doing now.",
        "description": "Say what you are doing now. Call at least every 20 minutes while working, or the session shows as stale. Send the whole plan each time.\n\nNeeds the `write` scope (create and update items).",
        "tags": [
          "write"
        ],
        "security": [
          {
            "agentKey": [
              "write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
                  },
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "plan": {
                    "maxItems": 30,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "text": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "pending",
                            "doing",
                            "done",
                            "dropped"
                          ]
                        }
                      },
                      "required": [
                        "text",
                        "status"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "model": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  }
                },
                "required": [
                  "key",
                  "note"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/record_test": {
      "post": {
        "operationId": "record_test",
        "summary": "Record a test you ran against one acceptance criterion (0-based) or the whole item.",
        "description": "Record a test you ran against one acceptance criterion (0-based) or the whole item. This is evidence, not sign-off: a person still checks each criterion.\n\nNeeds the `test` scope (record test results).",
        "tags": [
          "test"
        ],
        "security": [
          {
            "agentKey": [
              "test"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
                  },
                  "criterion": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "result": {
                    "type": "string",
                    "enum": [
                      "pass",
                      "fail",
                      "blocked",
                      "skipped"
                    ]
                  },
                  "how": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "environment": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "build": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "evidence": {
                    "type": "string",
                    "maxLength": 500,
                    "pattern": "^https:\\/\\/"
                  }
                },
                "required": [
                  "key",
                  "result",
                  "how"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/import_test_results": {
      "post": {
        "operationId": "import_test_results",
        "summary": "Record the totals of an automated test run for an item.",
        "description": "Record the totals of an automated test run for an item.\n\nNeeds the `test` scope (record test results).",
        "tags": [
          "test"
        ],
        "security": [
          {
            "agentKey": [
              "test"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
                  },
                  "suite": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "passed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000
                  },
                  "failed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000
                  },
                  "skipped": {
                    "default": 0,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000
                  },
                  "failures": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 300
                    }
                  },
                  "environment": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "build": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "evidence": {
                    "type": "string",
                    "maxLength": 500,
                    "pattern": "^https:\\/\\/"
                  },
                  "durationMs": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000
                  }
                },
                "required": [
                  "key",
                  "suite",
                  "passed",
                  "failed"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/record_deployment": {
      "post": {
        "operationId": "record_deployment",
        "summary": "Record a deployment to any environment, for example uat or production.",
        "description": "Record a deployment to any environment, for example uat or production. A successful one ticks the team's matching done step (see get_team doneMeans) on each item in keys, and production deployments are used to measure delivery.\n\nNeeds the `deploy` scope (record deployments).",
        "tags": [
          "deploy"
        ],
        "security": [
          {
            "agentKey": [
              "deploy"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "ok": {
                    "type": "boolean"
                  },
                  "unplanned": {
                    "default": false,
                    "type": "boolean"
                  },
                  "environment": {
                    "default": "production",
                    "type": "string",
                    "maxLength": 60
                  },
                  "committedAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  },
                  "recoveredAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  },
                  "keys": {
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
                    }
                  }
                },
                "required": [
                  "version",
                  "ok"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/add_to_inbox": {
      "post": {
        "operationId": "add_to_inbox",
        "summary": "Send a request or finding to the team inbox.",
        "description": "Send a request or finding to the team inbox.\n\nNeeds the `inbox` scope (send items to the inbox).",
        "tags": [
          "inbox"
        ],
        "security": [
          {
            "agentKey": [
              "inbox"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "body": {
                    "type": "string",
                    "maxLength": 20000
                  }
                },
                "required": [
                  "title"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The body is JSON. It may include `warning`, which you should act on.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid for this tool. `issues` says which field and why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInput"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this tool needs, or the item is in another team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No item, sprint or tool with that name in the key's team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: for example, someone else holds the item's lease.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request is valid but breaks a rule: for example, the item is not ready to claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/junit": {
      "post": {
        "operationId": "junit",
        "summary": "Post a JUnit XML report from CI.",
        "description": "Tests are matched to items by the item key in the test name, or all to `key`. Needs the `test` scope. Up to 2 MB.",
        "tags": [
          "test"
        ],
        "security": [
          {
            "agentKey": [
              "test"
            ]
          }
        ],
        "parameters": [
          {
            "name": "suite",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 120,
              "default": "CI"
            },
            "description": "Name of the test suite."
          },
          {
            "name": "build",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Build or version number."
          },
          {
            "name": "environment",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Where the tests ran, for example staging."
          },
          {
            "name": "key",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z][A-Za-z0-9]{1,9}-\\d{1,9}$"
            },
            "description": "Record every test against this one item."
          },
          {
            "name": "evidence",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "description": "Link to the CI run."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/xml": {
              "schema": {
                "type": "string"
              }
            },
            "text/xml": {
              "schema": {
                "type": "string"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tests": {
                      "type": "integer"
                    },
                    "items": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "unmatched": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Not a JUnit report, no test cases, or more than 100 items.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or the key is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/in/{connection}": {
      "post": {
        "operationId": "inbound",
        "summary": "Receive a webhook from GitHub, GitLab, Bitbucket or another tool.",
        "description": "Each connection in Team settings, Connections has its own address. Kaze checks the signature or token for that kind of connection, and lists every delivery under the connection with what it did.",
        "tags": [
          "webhooks"
        ],
        "security": [],
        "parameters": [
          {
            "name": "connection",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The connection's id, from its address."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Used."
          },
          "202": {
            "description": "Received but not used. The delivery log says why."
          },
          "401": {
            "description": "The signature or token did not match.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such connection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "agentKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "kz_ followed by 64 hex characters",
        "description": "Create one in Kaze, Settings, Agent keys. Each key has scopes and belongs to one team."
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "pattern": "^[\\w-]{8,100}$"
        },
        "description": "Send the same value to retry safely: Kaze does the work once and returns the same answer."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          }
        }
      },
      "InvalidInput": {
        "type": "object",
        "required": [
          "error",
          "issues"
        ],
        "properties": {
          "error": {
            "type": "string",
            "const": "Invalid input"
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 10
          }
        }
      }
    }
  }
}