{
  "openapi": "3.1.0",
  "info": {
    "title": "AtmanID API",
    "version": "1.42.0",
    "description": "Identity & Access Management REST API. All endpoints require Bearer token authentication via an API key. Existing tenants mint keys on the API Keys page after sign-in. Errors follow a machine-first envelope: { error: { code, message, request_id, details? } }.\n\n## Trace correlation\n\nEvery response carries three correlation headers:\n- `X-Request-Id` — internal AtmanID correlator, format `req_<26-char-ULID>` (the same value is recorded on the matching audit records).\n- `X-Trace-Id` — W3C-compliant 32-hex trace-id.\n- `traceparent` — full W3C Trace Context v00 string for OpenTelemetry collector chaining.\n\nSend a `traceparent` header on your request and AtmanID will honour it (your distributed trace extends through us). Omit it and AtmanID derives a stable trace-id from the request_id (deterministic SHA-256). For support tickets, the X-Trace-Id (or X-Request-Id) is the fastest correlator.",
    "contact": {
      "name": "AtmanID Support",
      "email": "hello@atmanid.com"
    }
  },
  "servers": [
    {
      "url": "{base_url}/api/v1",
      "description": "Your AtmanID instance — replace {base_url} with your tenant URL",
      "variables": {
        "base_url": {
          "default": "https://your-tenant.atmanid.com",
          "description": "The base URL of your AtmanID instance. Replace with the URL you sign in at — e.g. https://acme.atmanid.com."
        }
      }
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Applications",
      "description": "Registered app connectors."
    },
    {
      "name": "Users",
      "description": "Human identities in the tenant."
    },
    {
      "name": "Access Requests",
      "description": "Access grant workflow."
    },
    {
      "name": "Entitlements",
      "description": "Fine-grained permissions."
    },
    {
      "name": "Bundles",
      "description": "Entitlement groupings."
    },
    {
      "name": "SoD",
      "description": "Segregation of Duties violations."
    },
    {
      "name": "JML",
      "description": "Joiner-Mover-Leaver lifecycle."
    },
    {
      "name": "Webhooks",
      "description": "Outbound event subscriptions."
    },
    {
      "name": "Audit",
      "description": "Audit log queries."
    },
    {
      "name": "GitHub",
      "description": "GitHub connector endpoints."
    },
    {
      "name": "MCP Authorization",
      "description": "Decisions on agents' MCP tool calls, for the API gateway that enforces them."
    },
    {
      "name": "Confirmations",
      "description": "Changes that loosen a control and wait for a person's MFA confirmation (ADR-API-006)."
    },
    {
      "name": "Agent Policies",
      "description": "The intent policies that allow, deny or hold agents' MCP calls."
    },
    {
      "name": "MCP Servers",
      "description": "MCP servers and whether the gateway enforces or only logs their policy."
    },
    {
      "name": "Certifications",
      "description": "Access certification campaigns: launch, review items, decisions and evidence."
    },
    {
      "name": "Workflows",
      "description": "Approval workflow template definitions — the code-first GitOps surface."
    }
  ],
  "paths": {
    "/mcp/local-servers/report": {
      "post": {
        "summary": "Report the local MCP servers a device's desktop clients launch (atmanid-mcp-scan)",
        "description": "What `atmanid-mcp-scan` found on one device: every MCP server its client configs (Claude Desktop, Claude Code, Cursor, Windsurf, VS Code) declare — the command and its arguments with secret-looking values masked, or the URL — and whether the config launches the AtmanID shim in front of it. Each distinct server (by a fingerprint AtmanID recomputes; a mismatch is ignored and counted) becomes an MCP server in governance state discovered, and each device + client + config file a sighting. Nothing is granted or callable from a report; a discovered server is approved like any other. Audit: MCP_LOCAL_SERVER_DISCOVERED for each new server.",
        "tags": [
          "MCP Authorization"
        ],
        "operationId": "reportLocalMcpServers",
        "security": [
          {
            "bearerAuth": [
              "mcp:report"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "schema_version": {
                    "type": "number",
                    "const": 1
                  },
                  "device": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200,
                        "description": "The device's hostname."
                      },
                      "os_user": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "platform": {
                        "type": "string",
                        "enum": [
                          "darwin",
                          "win32",
                          "linux"
                        ]
                      }
                    },
                    "required": [
                      "name"
                    ]
                  },
                  "scanned_at": {
                    "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))$"
                  },
                  "name_prefix": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "servers": {
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "client": {
                          "type": "string",
                          "enum": [
                            "claude-desktop",
                            "claude-code",
                            "cursor",
                            "vscode",
                            "windsurf",
                            "other"
                          ],
                          "description": "The client whose config declared the server."
                        },
                        "config_path": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000,
                          "description": "The config file it was read from (home directory shown as ~)."
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200,
                          "description": "The server's key in that config."
                        },
                        "transport": {
                          "type": "string",
                          "enum": [
                            "stdio",
                            "http"
                          ],
                          "description": "stdio: a local process the client spawns. http: a URL."
                        },
                        "command": {
                          "description": "stdio: the command the client runs.",
                          "type": "string",
                          "maxLength": 1000
                        },
                        "args": {
                          "description": "stdio: its arguments, secret-looking values masked.",
                          "maxItems": 64,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "maxLength": 1000
                          }
                        },
                        "url": {
                          "description": "http: the server URL.",
                          "type": "string",
                          "maxLength": 2000
                        },
                        "env_keys": {
                          "description": "Names of environment variables the config sets for it; never values.",
                          "maxItems": 64,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "maxLength": 100
                          }
                        },
                        "wrapped": {
                          "type": "boolean",
                          "description": "The config launches the AtmanID shim (atmanid-mcp-stdio) in front of the server."
                        },
                        "fingerprint": {
                          "type": "string",
                          "pattern": "^v1:[0-9a-f]{64}$",
                          "description": "v1:<sha256> over the canonical command + args, or the URL. AtmanID recomputes it."
                        }
                      },
                      "required": [
                        "client",
                        "config_path",
                        "name",
                        "transport",
                        "wrapped",
                        "fingerprint"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "schema_version",
                  "device",
                  "servers"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "What the report added or refreshed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "servers_new": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "Servers registered as discovered by this report."
                    },
                    "servers_seen": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "Servers already known, now seen again."
                    },
                    "sightings": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "Device + client + config places recorded, new or refreshed."
                    },
                    "unwrapped": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "Sightings where the server runs without the AtmanID shim."
                    },
                    "mismatched": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "Servers whose reported fingerprint did not match AtmanID's recomputation (ignored)."
                    }
                  },
                  "required": [
                    "servers_new",
                    "servers_seen",
                    "sightings",
                    "unwrapped",
                    "mismatched"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/mcp/authorize": {
      "post": {
        "summary": "Decide one MCP tool call, or authenticate an agent (for your API gateway)",
        "description": "Send the agent's credential (its Authorization and DPoP headers, and the method and URL of its request) and the tool call's arguments. AtmanID authenticates the agent and applies the same checks as its own gateway: server governance, tool scope, rate limits, payload inspection and Intent policy. The answer is allow, deny or hold, always with HTTP 200. Under a server in shadow mode the answer is allow with would_deny set (a server in DIRECT mode is decided as enforce). A hold waits for a person: poll hold.poll, and once it is approved send the same call again. Every decision is recorded in the MCP gateway events with your caller.gateway and the decision_id. The agent token must belong to this API key's tenant. Authenticate only (mode: \"authenticate\", no tool or arguments): for an MCP message that carries no tool call (initialize, ping, tools/list, notifications, the GET event stream, DELETE). The answer is allow when the agent's token, and its DPoP proof when the token is bound, is valid for this server and the server may be called; deny otherwise (never hold). No tool policy is applied, handling is null, an allow is not recorded and a deny is. A body without mode is a tool call, as before.",
        "tags": [
          "MCP Authorization"
        ],
        "operationId": "authorizeMcpCall",
        "security": [
          {
            "bearerAuth": [
              "mcp:authorize"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/McpAuthorizeRequest"
                  },
                  {
                    "$ref": "#/components/schemas/McpAuthenticateRequest"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The decision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpAuthorizeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "No decision could be made (a lookup is unavailable). Deny the call and retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/mcp/ext-authz/{path}": {
      "post": {
        "summary": "Envoy ext_authz: decide the MCP tool call Envoy is checking",
        "description": "Envoy ext_authz HTTP service. Point http_service at this path as path_prefix; Envoy sends the agent's method, path, Authorization and DPoP headers and (with_request_body) its body. The agent's path must end in /{server_id}/tools/{tool}, or in /{server_id}/mcp for a standard MCP server: then the body is a JSON-RPC message, a tools/call is decided as that tool, initialize, ping, tools/list and notifications are allowed for an agent whose credential is valid for the server, and any other method is refused as invalid (tools only). Any HTTP method is accepted (Envoy checks with the agent's own). 200 allows the call; every other answer is 403 with x-atmanid-decision: deny (and x-atmanid-reason), hold (x-atmanid-hold-id, x-atmanid-hold-poll), unavailable, or invalid. Configure failure_mode_allow: false. The same decision and audit trail as POST /mcp/authorize.",
        "tags": [
          "MCP Authorization"
        ],
        "operationId": "mcpExtAuthz",
        "security": [
          {
            "extAuthzApiKey": [
              "mcp:authorize"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "path",
            "schema": {
              "type": "string",
              "description": "The agent's path, e.g. mcp/github/tools/create_pull_request, or mcp/github/mcp for a standard MCP server."
            },
            "required": true,
            "description": "The agent's path, e.g. mcp/github/tools/create_pull_request, or mcp/github/mcp for a standard MCP server."
          },
          {
            "in": "header",
            "name": "x-atmanid-origin",
            "schema": {
              "type": "string",
              "format": "uri",
              "description": "Your gateway's public origin (https://gw.example.com); with the path, the URL the agent's DPoP proof is bound to."
            },
            "required": true,
            "description": "Your gateway's public origin (https://gw.example.com); with the path, the URL the agent's DPoP proof is bound to."
          },
          {
            "in": "header",
            "name": "x-atmanid-gateway",
            "schema": {
              "description": "Your gateway's name, recorded on the decision. Default: envoy.",
              "type": "string",
              "maxLength": 200
            },
            "description": "Your gateway's name, recorded on the decision. Default: envoy."
          },
          {
            "in": "header",
            "name": "dpop",
            "schema": {
              "description": "The agent's DPoP proof (add dpop to allowed_headers). Its Authorization header is forwarded by Envoy as is.",
              "type": "string"
            },
            "description": "The agent's DPoP proof (add dpop to allowed_headers). Its Authorization header is forwarded by Envoy as is."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "The tool call's body, as the agent sent it (a JSON-RPC message for a /mcp path)."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Allow. Headers: x-atmanid-decision: allow, x-atmanid-decision-id, and under shadow x-atmanid-would-deny."
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: x-atmanid-decision is deny, hold, unavailable or invalid. (A missing or invalid API key is 401; Envoy refuses the call either way.)"
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/mcp/authorize/holds/{id}": {
      "get": {
        "summary": "Status of a held MCP tool call",
        "description": "pending: waiting for a person. approved: send the same call to POST /mcp/authorize again — it is allowed once, while the approval is valid. rejected / expired: the call stays denied. used: the approval was already used.",
        "tags": [
          "MCP Authorization"
        ],
        "operationId": "getMcpAuthorizeHold",
        "security": [
          {
            "bearerAuth": [
              "mcp:authorize"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "description": "hold.id from the decision (e.g. hitl-eval-…)."
            },
            "required": true,
            "description": "hold.id from the decision (e.g. hitl-eval-…)."
          }
        ],
        "responses": {
          "200": {
            "description": "The hold's status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpAuthorizeHoldStatus"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/mcp/authorize/decisions/{decisionId}/outcome": {
      "post": {
        "summary": "Report how an allowed MCP tool call went",
        "description": "After POST /mcp/authorize answered allow and your gateway forwarded the call, send the MCP server's status and the latency, with what your gateway's inspection found in the response and how many personal-data values it redacted. They land on the decision's gateway event, so the audit trail shows the call's outcome as it does for calls AtmanID forwards itself. Once per decision; 404 when the decision is not this tenant's, was not an allow, or already has an outcome.",
        "tags": [
          "MCP Authorization"
        ],
        "operationId": "reportMcpAuthorizeOutcome",
        "security": [
          {
            "bearerAuth": [
              "mcp:authorize"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "decisionId",
            "schema": {
              "type": "string",
              "description": "decision_id from the allow answer."
            },
            "required": true,
            "description": "decision_id from the allow answer."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/McpAuthorizeOutcome"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Recorded."
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/mcp/authorize/holds/{id}/decision": {
      "post": {
        "summary": "Approve or deny a held MCP tool call",
        "description": "Decide a call POST /mcp/authorize answered with hold, as the person who owns this API key. They must hold the agent-oversight permission (AGENT_HITL_OVERSIGHT) when the call is made. approve releases the call once: the agent's gateway sends the same call again while the approval is valid (approval_expires_at). deny keeps it denied. Recorded exactly as a decision in the console (AGENT_HITL_DECIDED or AGENT_HITL_OVERRIDE, channel api, with the API key id). The owner must be an active person. Only an open hold: 409 ALREADY_DECIDED when it was decided or used (also when another API decision landed first), 409 HOLD_EXPIRED once its deadline passed.\n\nNew in 1.42.0: an optional `category`, the reason for a decision that goes against AtmanID's suggestion (approving a HIGH or CRITICAL hold, or denying a MEDIUM or LOW one), with the values the console offers; the audit record carries it as `new_state.override_category`, as a console decision does, and an unknown value is 400 VALIDATION_ERROR naming the field. Nothing changes for a request without it, and nothing is refused today. In a later version, announced with its date before it takes effect, a decision on a HIGH or CRITICAL hold will require `note`, and a decision against the suggestion will require `category`. To be ready now, send `note` with every decision and `category` with every approve: gateway holds are created at HIGH risk. Until then the audit record of a decision without them carries `new_state.reason_rule` (mode `api_key_exempt`) naming what was missing, so you can find the calls to change.",
        "tags": [
          "MCP Authorization"
        ],
        "operationId": "decideMcpAuthorizeHold",
        "security": [
          {
            "bearerAuth": [
              "mcp:decide"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "description": "hold.id from the decision (e.g. hitl-eval-…)."
            },
            "required": true,
            "description": "hold.id from the decision (e.g. hitl-eval-…)."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/McpHoldDecision"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The decision was recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpHoldDecisionResult"
                }
              }
            }
          },
          "202": {
            "description": "Waiting for a person's MFA confirmation (ADR-API-006): the call loosens a control. Until the tenant turns enforcement on, the call is applied and only recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfirmationAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "RBAC_DENIED — the key lacks the scope, its owner is not an active person in this organisation, or the owner may not make this decision. The owner needs the agent-oversight permission (AGENT_HITL_OVERSIGHT).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "ALREADY_DECIDED — the hold was already decided or used (an approval whose window lapsed included). HOLD_EXPIRED — it passed its deadline undecided and counts as denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "SERVICE_DEGRADED — the owner's permission cannot be checked right now; nothing was decided. Retry after Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/access-requests/{id}/decision": {
      "post": {
        "summary": "Approve or reject the current stage of an access request",
        "description": "Vote on the current approval stage as the person who owns this API key — the same decision the console makes. The owner must be an approver of this stage (assigned, or through an active delegation); the console's administrator override is not available by API. Every console check applies: the request is PENDING, no self-approval (requester or beneficiary, counting linked accounts), one vote per person per stage, a different person per stage, reachability attestation, and on the final stage the SoD re-check (409 with details.conflicts and details.safe_alternative) and the blast-radius intercept (202, not decided). A stage with a quorum stays PENDING until it is met. The owner must be an active person. Audit: APPROVAL_STAGE_APPROVED / APPROVAL_STAGE_REJECTED with channel api, the API key id and the request id of this call.",
        "tags": [
          "Access Requests"
        ],
        "operationId": "decideAccessRequest",
        "security": [
          {
            "bearerAuth": [
              "decide:access_requests"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
              "description": "Access request UUID."
            },
            "required": true,
            "description": "Access request UUID."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccessRequestDecision"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The vote was recorded; request_status says where the request now stands.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccessRequestDecisionResult"
                }
              }
            }
          },
          "202": {
            "description": "Nothing was decided yet. With `intercepted`: the blast-radius check stopped it and the request stays PENDING for review in the console. With `confirmation`: approving access whose highest-risk entitlement (on the request, in its cart, or in the requested role) is HIGH or CRITICAL waits for a person's MFA confirmation (ADR-API-006).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/AccessRequestDecisionIntercepted"
                    },
                    {
                      "$ref": "#/components/schemas/ConfirmationAccepted"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION_ERROR — the body is invalid (a REJECT needs comments or decision_reason).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "RBAC_DENIED — the key lacks the scope, its owner is not an active person in this organisation, or the owner may not make this decision. The owner must be an approver of the current stage, and not the requester or the person it is for.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "INVALID_STATE — an approver of an earlier stage chose an end date that has already passed: approving would grant access that is already expired, so nothing is decided; reject the request instead. CONFLICT — the request is no longer PENDING, the stage was decided concurrently, the owner already voted on this stage, or the final-stage SoD re-check blocks (details.sod_blocked, details.conflicts, details.safe_alternative). When the tenant enforces it, also when the SoD re-check could not run: message \"SoD check failed, needs review\", details.sod_check_failed true, details.sod_blocked true, details.conflicts empty — the request stays PENDING; try again later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "ATTESTATION_REQUIRED — send attested: true to approve an entitlement whose reach is unknown (details.attestation_required_ids). PERSON_DEPARTED — the person the request is for has left; the request was cancelled (details.cancelled).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/agent-policies": {
      "get": {
        "summary": "List agent intent policies",
        "tags": [
          "Agent Policies"
        ],
        "operationId": "listAgentPolicies",
        "description": "The intent policies the gateway evaluates for agents' MCP calls. agent_id returns the policies that apply to that agent: its own and the global ones.",
        "security": [
          {
            "bearerAuth": [
              "read:agent_policies"
            ]
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "description": "Page number, 1-indexed.",
              "example": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number, 1-indexed."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "description": "Results per page. Max 100.",
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Results per page. Max 100."
          },
          {
            "in": "query",
            "name": "agent_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "DRAFT",
                "ARCHIVED"
              ]
            }
          },
          {
            "in": "query",
            "name": "action",
            "schema": {
              "type": "string",
              "enum": [
                "ALLOW",
                "DENY",
                "REQUIRE_HITL"
              ]
            }
          },
          {
            "in": "query",
            "name": "sort_by",
            "schema": {
              "type": "string",
              "enum": [
                "priority",
                "name",
                "created_at",
                "updated_at"
              ]
            }
          },
          {
            "in": "query",
            "name": "sort_dir",
            "schema": {
              "default": "asc",
              "description": "Sort direction.",
              "example": "asc",
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentPolicyListResponse"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_PARAM — status or action is not one of its values.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "RBAC_DENIED — the key lacks the scope, or its owner does not hold AGENT_INTENT_POLICY_VIEW.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create an agent intent policy",
        "tags": [
          "Agent Policies"
        ],
        "operationId": "createAgentPolicy",
        "description": "A new policy is DRAFT unless status says otherwise; an ACTIVE policy applies to the next call. Test it first with POST /agent-policies/simulate. Audit: AGENT_POLICY_CREATED (triggered_via api_key, with the API key id).",
        "security": [
          {
            "bearerAuth": [
              "write:agent_policies"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentPolicyCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The stored policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentPolicy"
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION_ERROR — the body is invalid, or the approver is not an active person in this organisation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "RBAC_DENIED — the key lacks the scope, or its owner does not hold AGENT_INTENT_POLICY_MANAGE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "CONFLICT — a policy with this name already exists.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/agent-policies/{id}": {
      "get": {
        "summary": "Get an agent intent policy",
        "tags": [
          "Agent Policies"
        ],
        "operationId": "getAgentPolicy",
        "security": [
          {
            "bearerAuth": [
              "read:agent_policies"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "description": "Policy id (aip-…)."
            },
            "required": true,
            "description": "Policy id (aip-…)."
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentPolicy"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "RBAC_DENIED — the key lacks the scope, or its owner does not hold AGENT_INTENT_POLICY_VIEW.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Update an agent intent policy",
        "tags": [
          "Agent Policies"
        ],
        "operationId": "updateAgentPolicy",
        "description": "Only the fields sent change. status ARCHIVED retires the policy. Audit: AGENT_POLICY_UPDATED with the changed fields.",
        "security": [
          {
            "bearerAuth": [
              "write:agent_policies"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "description": "Policy id (aip-…)."
            },
            "required": true,
            "description": "Policy id (aip-…)."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentPolicyUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentPolicy"
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION_ERROR — the body is invalid, empty or has an unknown property, or the approver is not an active person in this organisation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "RBAC_DENIED — the key lacks the scope, or its owner does not hold AGENT_INTENT_POLICY_MANAGE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/agent-policies/simulate": {
      "post": {
        "summary": "Test what the policies decide for one call",
        "tags": [
          "Agent Policies"
        ],
        "operationId": "simulateAgentPolicy",
        "description": "Read-only: what the ACTIVE policies say for this agent, intent and resource (and sample arguments), what enforcement would return right now, and the per-policy trace. Writes nothing.",
        "security": [
          {
            "bearerAuth": [
              "read:agent_policies"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentPolicySimulationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentPolicySimulation"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "RBAC_DENIED — the key lacks the scope, or its owner does not hold AGENT_INTENT_SIMULATE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/mcp/servers": {
      "get": {
        "summary": "List MCP servers and their enforcement modes",
        "tags": [
          "MCP Servers"
        ],
        "operationId": "listMcpServers",
        "security": [
          {
            "bearerAuth": [
              "read:mcp_servers"
            ]
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "description": "Page number, 1-indexed.",
              "example": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number, 1-indexed."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "description": "Results per page. Max 100.",
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Results per page. Max 100."
          },
          {
            "in": "query",
            "name": "gateway_mode",
            "schema": {
              "type": "string",
              "enum": [
                "DIRECT",
                "SHADOW",
                "ENFORCE"
              ]
            }
          },
          {
            "in": "query",
            "name": "intent_mode",
            "schema": {
              "type": "string",
              "enum": [
                "OFF",
                "SHADOW",
                "ENFORCE"
              ]
            }
          },
          {
            "in": "query",
            "name": "governance_status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "sort_by",
            "schema": {
              "type": "string",
              "enum": [
                "name",
                "registered_at",
                "updated_at"
              ]
            }
          },
          {
            "in": "query",
            "name": "sort_dir",
            "schema": {
              "default": "asc",
              "description": "Sort direction.",
              "example": "asc",
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpServerListResponse"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_PARAM — gateway_mode or intent_mode is not one of its values.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "RBAC_DENIED — the key lacks the scope, or its owner does not hold MCP_TOOL_BINDING_VIEW.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/mcp/servers/{id}": {
      "get": {
        "summary": "Get an MCP server",
        "tags": [
          "MCP Servers"
        ],
        "operationId": "getMcpServer",
        "security": [
          {
            "bearerAuth": [
              "read:mcp_servers"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "description": "MCP server id."
            },
            "required": true,
            "description": "MCP server id."
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpServer"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "RBAC_DENIED — the key lacks the scope, or its owner does not hold MCP_TOOL_BINDING_VIEW.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/mcp/servers/{id}/mode-preview": {
      "get": {
        "summary": "Preview what moving a server to ENFORCE would deny",
        "tags": [
          "MCP Servers"
        ],
        "operationId": "previewMcpServerMode",
        "description": "From the last 7 days of this server's gateway events: how many calls each mode would have denied (would_deny_*) or did deny (deny_*), the tools most affected, and — for intent — the tools agents may call that no binding covers (denied under ENFORCE even with no traffic yet). Read this before PATCH /mcp/servers/{id}/mode.",
        "security": [
          {
            "bearerAuth": [
              "read:mcp_servers"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "description": "MCP server id."
            },
            "required": true,
            "description": "MCP server id."
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpServerModePreview"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "RBAC_DENIED — the key lacks the scope, or its owner does not hold MCP_TOOL_BINDING_VIEW.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/mcp/servers/{id}/mode": {
      "patch": {
        "summary": "Switch a server between shadow and enforce",
        "tags": [
          "MCP Servers"
        ],
        "operationId": "setMcpServerMode",
        "description": "Sets the gateway mode (SHADOW or ENFORCE) and/or the intent mode (OFF, SHADOW or ENFORCE), both in one transaction. Moving into ENFORCE stamps gateway_promoted_at. changed lists what moved. Every call is audited, a repeat included (AGENT_MCP_GATEWAY_MODE_UPDATED / AGENT_MCP_INTENT_MODE_UPDATED with the prior and new values and the API key id — the console's records); a failed audit write is a 500 and the call is safe to repeat. Lowering either mode (ENFORCE → SHADOW, or intent towards OFF) can answer 202: it waits for the key owner's MFA confirmation (ADR-API-006).",
        "security": [
          {
            "bearerAuth": [
              "write:mcp_servers"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "description": "MCP server id."
            },
            "required": true,
            "description": "MCP server id."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/McpServerModeChange"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpServerModes"
                }
              }
            }
          },
          "202": {
            "description": "Waiting for a person's MFA confirmation (ADR-API-006): the call loosens a control. Until the tenant turns enforcement on, the call is applied and only recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfirmationAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "RBAC_DENIED — the key lacks the scope, or its owner does not hold AGENT_MCP_MANAGE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/certifications/campaigns": {
      "get": {
        "summary": "List certification campaigns",
        "tags": [
          "Certifications"
        ],
        "operationId": "listCertificationCampaigns",
        "description": "Newest first by default. status takes one value or several, comma-separated. An owner who is a reviewer rather than a campaign administrator sees only the campaigns they review in, and only their own items. [Test] campaigns are never listed.",
        "security": [
          {
            "bearerAuth": [
              "read:certifications"
            ]
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "description": "Page number, 1-indexed.",
              "example": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number, 1-indexed."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "description": "Results per page. Max 100.",
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Results per page. Max 100."
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "description": "ACTIVE, DRAFT, CLOSED, CANCELLED, COMPLETED — comma-separated.",
              "type": "string"
            },
            "description": "ACTIVE, DRAFT, CLOSED, CANCELLED, COMPLETED — comma-separated."
          },
          {
            "in": "query",
            "name": "sort_by",
            "schema": {
              "type": "string",
              "enum": [
                "created_at",
                "deadline",
                "name",
                "progress",
                "urgency"
              ]
            }
          },
          {
            "in": "query",
            "name": "sort_dir",
            "schema": {
              "default": "asc",
              "description": "Sort direction.",
              "example": "asc",
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CertificationCampaignListResponse"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_PARAM — a status or sort_by outside its values.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "RBAC_DENIED — the key lacks the scope, its owner does not hold CERT_VIEW or is not an active person in this organisation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Launch a certification campaign",
        "tags": [
          "Certifications"
        ],
        "operationId": "launchCertificationCampaign",
        "description": "The console's launch: the type, deadline (required unless save_as_draft) and scope are checked, the items are queued for their reviewers and narrowed by the scoping options (min_risk, exclude_recently_certified_days, granted_before_days, scope_criteria / scope_query, incremental_only), multi-stage routing and waves are saved, and the reviewers are notified. save_as_draft stores it without queuing. Audit: CERT_CAMPAIGN_CREATED or CERT_CAMPAIGN_SAVED_AS_DRAFT, and CERT_CAMPAIGN_LAUNCHED_VIA_API with the API key.",
        "security": [
          {
            "bearerAuth": [
              "write:certifications"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CertificationCampaignCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Launched (or saved as a draft).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CertificationCampaignLaunched"
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION_ERROR — the body, the campaign type, a missing deadline, or a scope that is not the right kind for the type in this tenant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "RBAC_DENIED — the key lacks the scope, its owner does not hold CERT_LAUNCH or is not an active person in this organisation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/certifications/campaigns/{id}": {
      "get": {
        "summary": "Get a certification campaign",
        "tags": [
          "Certifications"
        ],
        "operationId": "getCertificationCampaign",
        "description": "The campaign with its item counts by status (released items: a later wave counts once released). An owner who is a reviewer rather than a campaign administrator sees only the campaigns they review in, and only their own items.",
        "security": [
          {
            "bearerAuth": [
              "read:certifications"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
              "description": "Campaign UUID."
            },
            "required": true,
            "description": "Campaign UUID."
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CertificationCampaign"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "RBAC_DENIED — the key lacks the scope, its owner does not hold CERT_VIEW or is not an active person in this organisation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/certifications/campaigns/{id}/reviews": {
      "get": {
        "summary": "List a campaign's review items",
        "tags": [
          "Certifications"
        ],
        "operationId": "listCertificationReviews",
        "description": "Every subject type, newest first; items of a later wave appear once released. An owner who is a reviewer rather than a campaign administrator sees only the campaigns they review in, and only their own items.",
        "security": [
          {
            "bearerAuth": [
              "read:certifications"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
              "description": "Campaign UUID."
            },
            "required": true,
            "description": "Campaign UUID."
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "description": "Page number, 1-indexed.",
              "example": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number, 1-indexed."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "description": "Results per page. Max 100.",
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Results per page. Max 100."
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "PENDING",
                "CERTIFIED",
                "REVOKED",
                "ESCALATED"
              ]
            }
          },
          {
            "in": "query",
            "name": "reviewer_id",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CertificationReviewListResponse"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_PARAM — status or reviewer_id is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "RBAC_DENIED — the key lacks the scope, its owner does not hold CERT_VIEW or is not an active person in this organisation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/certifications/campaigns/{id}/evidence": {
      "get": {
        "summary": "Export a campaign's evidence (CSV)",
        "tags": [
          "Certifications"
        ],
        "operationId": "exportCertificationEvidence",
        "description": "The console's campaign export: reviewer, subject, application, entitlement, risk, decision, when, how long, delegations and escalation notes, one row per reviewed item — an app entitlement, platform role, NHI, agent tool grant, MCP server or API scope (Application, email and department are blank where they do not apply; an NHI item names the NHI). Audited as CERT_CAMPAIGN_EXPORTED before the file is sent; if the audit row cannot be written, no file is sent (500).",
        "security": [
          {
            "bearerAuth": [
              "read:certifications"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
              "description": "Campaign UUID."
            },
            "required": true,
            "description": "Campaign UUID."
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "ALL",
                "PENDING",
                "CERTIFIED",
                "REVOKED",
                "ESCALATED"
              ]
            }
          },
          {
            "in": "query",
            "name": "reviewer_id",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "text/csv attachment.",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_PARAM — status or reviewer_id is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "RBAC_DENIED — the key lacks the scope, its owner does not hold CERT_CAMPAIGN_EXPORT or is not an active person in this organisation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/certifications/reviews/{id}/decision": {
      "post": {
        "summary": "Certify, revoke or escalate a review item",
        "tags": [
          "Certifications"
        ],
        "operationId": "decideCertificationReview",
        "description": "The console's decision, as the key's owner. The subject is the item's own (never the body's). The owner decides an item assigned to them; deciding someone else's item is an override (CERT_REVIEW_ANY) and needs a written note of at least 20 characters. The tenant may require a note for some decisions; nobody certifies their own access; a cancelled campaign takes no decisions; REVOKE only for a subject one decision can remove. Audit: ACCESS_CERTIFIED / ACCESS_REVOKED (or the role, agent-grant and MCP-server equivalents) with the decision trace, and CERT_REVIEW_DECIDED_VIA_API with the API key.",
        "security": [
          {
            "bearerAuth": [
              "decide:certifications"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
              "description": "Review item UUID."
            },
            "required": true,
            "description": "Review item UUID."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CertificationReviewDecision"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CertificationReviewDecisionResult"
                }
              }
            }
          },
          "202": {
            "description": "Not decided: the blast-radius check intercepted this REVOKE for review in the console. The item stays PENDING.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CertificationReviewDecisionIntercepted"
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION_ERROR — the body, or a REVOKE no single decision can carry out.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "RBAC_DENIED — the key lacks the scope, its owner does not hold CERT_REVIEW or is not an active person in this organisation. SELF_CERTIFICATION_FORBIDDEN — the owner's own access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "CAMPAIGN_CANCELLED — the campaign was cancelled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "JUSTIFICATION_REQUIRED — this decision needs a note (the tenant's policy, or an override needs 20 characters). UNPROCESSABLE — an ESCALATE with nobody to escalate to.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/mcp/decisions": {
      "get": {
        "summary": "Export the MCP gateway decision log",
        "tags": [
          "MCP Authorization"
        ],
        "operationId": "listMcpDecisions",
        "description": "Every decision the gateway made on an agent's tool call — its own and those made for your gateway through /mcp/authorize — in a window of at most 31 days (since and until required), newest first. decision: allow, deny, hold (held for a person's approval under enforce: recorded with status 202), would_deny (shadow) or bypass. No payloads, only the flags inspection raised; events of [Test] agents are left out. For a SIEM, page through a fixed window, then move it forward.",
        "security": [
          {
            "bearerAuth": [
              "read:mcp_decisions"
            ]
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "description": "Page number, 1-indexed.",
              "example": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number, 1-indexed."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "description": "Results per page. Max 100.",
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Results per page. Max 100."
          },
          {
            "in": "query",
            "name": "since",
            "schema": {
              "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
              "description": "Start of the window (inclusive), ISO 8601."
            },
            "required": true,
            "description": "Start of the window (inclusive), ISO 8601."
          },
          {
            "in": "query",
            "name": "until",
            "schema": {
              "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
              "description": "End of the window (exclusive), at most 31 days after since. Keep since and until fixed while you page: new decisions then cannot shift the pages."
            },
            "required": true,
            "description": "End of the window (exclusive), at most 31 days after since. Keep since and until fixed while you page: new decisions then cannot shift the pages."
          },
          {
            "in": "query",
            "name": "decision",
            "schema": {
              "description": "hold: a call held for a person's approval (enforce). deny: every other refusal.",
              "type": "string",
              "enum": [
                "allow",
                "deny",
                "hold",
                "would_deny",
                "bypass"
              ]
            },
            "description": "hold: a call held for a person's approval (enforce). deny: every other refusal."
          },
          {
            "in": "query",
            "name": "agent_id",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "server_id",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "tool",
            "schema": {
              "description": "Exact tool name.",
              "type": "string",
              "maxLength": 200
            },
            "description": "Exact tool name."
          },
          {
            "in": "query",
            "name": "deny_reason",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "in": "query",
            "name": "caller_gateway",
            "schema": {
              "description": "Decisions made for your own gateway (POST /mcp/authorize caller.gateway).",
              "type": "string",
              "maxLength": 200
            },
            "description": "Decisions made for your own gateway (POST /mcp/authorize caller.gateway)."
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpDecisionListResponse"
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION_ERROR — a parameter is invalid. INVALID_PARAM — until is not after since, or the window is longer than 31 days.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "RBAC_DENIED — the key lacks the scope, or its owner is not an active person with access to the MCP Gateway events.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/confirmations/{id}": {
      "get": {
        "summary": "Read a change that waits for a person's confirmation",
        "description": "A call that loosens a control — moving an MCP server towards SHADOW or OFF, approving a HIGH or CRITICAL held call, approving access whose highest-risk entitlement (on the request, in its cart, or in the requested role) is HIGH or CRITICAL — answers 202 with a confirmation when its tenant enforces confirmations. This reads it: pending, rejected, or confirmed with `result` (the status and body the original call would have returned; a non-2xx status means the change was refused when it was applied, e.g. the hold was decided meanwhile). The key needs the scope the original call needed; otherwise 404.",
        "tags": [
          "Confirmations"
        ],
        "operationId": "getConfirmation",
        "security": [
          {
            "bearerAuth": [
              "write:mcp_servers"
            ]
          },
          {
            "bearerAuth": [
              "mcp:decide"
            ]
          },
          {
            "bearerAuth": [
              "decide:access_requests"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
              "description": "confirmation.id from the 202."
            },
            "required": true,
            "description": "confirmation.id from the 202."
          }
        ],
        "responses": {
          "200": {
            "description": "The confirmation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfirmationRead"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "CONFIRMATION_EXPIRED — nobody confirmed it within 15 minutes; nothing was changed. Make the call again to raise a new one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/apps": {
      "get": {
        "summary": "List connected applications",
        "tags": [
          "Applications"
        ],
        "operationId": "listApps",
        "security": [
          {
            "bearerAuth": [
              "read:apps"
            ]
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "description": "Page number, 1-indexed.",
              "example": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number, 1-indexed."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "description": "Results per page. Max 100.",
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Results per page. Max 100."
          },
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "sync_status",
            "schema": {
              "type": "string",
              "enum": [
                "healthy",
                "warning",
                "error",
                "unknown"
              ]
            }
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "sort_by",
            "schema": {
              "default": "name",
              "type": "string",
              "enum": [
                "name",
                "type",
                "sync_status",
                "created_at"
              ]
            }
          },
          {
            "in": "query",
            "name": "sort_dir",
            "schema": {
              "default": "asc",
              "description": "Sort direction.",
              "example": "asc",
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            },
            "description": "Sort direction."
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated applications.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/users": {
      "get": {
        "summary": "List human identities",
        "tags": [
          "Users"
        ],
        "operationId": "listUsers",
        "security": [
          {
            "bearerAuth": [
              "read:users"
            ]
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "description": "Page number, 1-indexed.",
              "example": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number, 1-indexed."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "description": "Results per page. Max 100.",
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Results per page. Max 100."
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "SUSPENDED",
                "EXPIRED",
                "DEPROVISIONED"
              ]
            }
          },
          {
            "in": "query",
            "name": "department",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "identity_type",
            "schema": {
              "type": "string",
              "enum": [
                "employee",
                "contractor",
                "vendor",
                "partner"
              ]
            }
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "sort_by",
            "schema": {
              "default": "name",
              "type": "string",
              "enum": [
                "name",
                "created_at",
                "last_login_at"
              ]
            }
          },
          {
            "in": "query",
            "name": "sort_dir",
            "schema": {
              "default": "asc",
              "description": "Sort direction.",
              "example": "asc",
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            },
            "description": "Sort direction."
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated users.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/users/{id}": {
      "get": {
        "summary": "Get a user by ID",
        "tags": [
          "Users"
        ],
        "operationId": "getUser",
        "security": [
          {
            "bearerAuth": [
              "read:users"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "description": "User UUID.",
              "$ref": "#/components/schemas/Uuid"
            },
            "required": true,
            "description": "User UUID."
          }
        ],
        "responses": {
          "200": {
            "description": "User detail.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/users/{id}/entitlements": {
      "get": {
        "summary": "List entitlements held by a user",
        "tags": [
          "Users",
          "Entitlements"
        ],
        "operationId": "listUserEntitlements",
        "security": [
          {
            "bearerAuth": [
              "read:users",
              "read:entitlements"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "description": "User UUID.",
              "$ref": "#/components/schemas/Uuid"
            },
            "required": true,
            "description": "User UUID."
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "description": "Page number, 1-indexed.",
              "example": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number, 1-indexed."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "description": "Results per page. Max 100.",
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Results per page. Max 100."
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "REVOKED",
                "EXPIRED"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserEntitlementListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/users/{id}/access-snapshot": {
      "get": {
        "summary": "Compute the effective access state for a subject at a point in time",
        "description": "Returns the entitlements held by a user (or NHI) at the specified moment, plus a tamper-evidence breadcrumb that pins the result to the audit-log sequence number covered. Three replay modes are picked automatically: LIVE (now), RECENT_REPLAY (≤7d ago), SNAPSHOT_FORWARD (>7d ago).",
        "tags": [
          "Users",
          "Time-Travel"
        ],
        "operationId": "getUserAccessSnapshot",
        "security": [
          {
            "bearerAuth": [
              "read:users"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "description": "User or NHI UUID.",
              "$ref": "#/components/schemas/Uuid"
            },
            "required": true,
            "description": "User or NHI UUID."
          },
          {
            "in": "query",
            "name": "at",
            "schema": {
              "description": "ISO 8601 timestamp; defaults to now.",
              "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))$"
            },
            "description": "ISO 8601 timestamp; defaults to now."
          },
          {
            "in": "query",
            "name": "subject_type",
            "schema": {
              "default": "user",
              "description": "Whether the subject is a human user or non-human identity.",
              "type": "string",
              "enum": [
                "user",
                "nhi"
              ]
            },
            "description": "Whether the subject is a human user or non-human identity."
          }
        ],
        "responses": {
          "200": {
            "description": "Effective access state at the queried timestamp.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccessSnapshotResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/entitlements": {
      "get": {
        "summary": "List entitlements across all applications",
        "tags": [
          "Entitlements"
        ],
        "operationId": "listEntitlements",
        "security": [
          {
            "bearerAuth": [
              "read:entitlements"
            ]
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "description": "Page number, 1-indexed.",
              "example": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number, 1-indexed."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "description": "Results per page. Max 100.",
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Results per page. Max 100."
          },
          {
            "in": "query",
            "name": "application_id",
            "schema": {
              "$ref": "#/components/schemas/Uuid"
            }
          },
          {
            "in": "query",
            "name": "risk_level",
            "schema": {
              "type": "string",
              "enum": [
                "low",
                "medium",
                "high"
              ]
            }
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EntitlementListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/entitlements/{id}": {
      "get": {
        "summary": "Get an entitlement by ID",
        "tags": [
          "Entitlements"
        ],
        "operationId": "getEntitlement",
        "security": [
          {
            "bearerAuth": [
              "read:entitlements"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "description": "Entitlement UUID.",
              "$ref": "#/components/schemas/Uuid"
            },
            "required": true,
            "description": "Entitlement UUID."
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Entitlement"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/access-requests": {
      "get": {
        "summary": "List access requests",
        "tags": [
          "Access Requests"
        ],
        "operationId": "listAccessRequests",
        "security": [
          {
            "bearerAuth": [
              "read:access_requests"
            ]
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "description": "Page number, 1-indexed.",
              "example": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number, 1-indexed."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "description": "Results per page. Max 100.",
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Results per page. Max 100."
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "PENDING",
                "APPROVED",
                "DENIED",
                "PROVISIONED",
                "EXPIRED",
                "REVOKED"
              ]
            }
          },
          {
            "in": "query",
            "name": "target_user_id",
            "schema": {
              "$ref": "#/components/schemas/Uuid"
            }
          },
          {
            "in": "query",
            "name": "requester_id",
            "schema": {
              "$ref": "#/components/schemas/Uuid"
            }
          },
          {
            "in": "query",
            "name": "source",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccessRequestListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create an access request",
        "description": "Submit a new access request for one or more entitlements. Request enters PENDING until approved or denied.",
        "tags": [
          "Access Requests"
        ],
        "operationId": "createAccessRequest",
        "security": [
          {
            "bearerAuth": [
              "write:access_requests"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccessRequestCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Access request created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccessRequest"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Duplicate request already pending for this target + entitlement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "No request is created. The target person has left the organisation: `PERSON_DEPARTED` (Inactive, Expired, Terminated or an unknown status) or `USER_DEPROVISIONED` (Deprovisioned), both carrying `details.target_status`. Or an approval stage has nobody eligible to decide it: `NO_ELIGIBLE_APPROVER`, with `details.stages`. A request for several entitlements submits the items that can be decided and lists the others in `no_approver_items` (201); when none can be, it answers this 422 with `details.no_approver_items`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/access-requests/{id}": {
      "get": {
        "summary": "Get an access request by ID",
        "tags": [
          "Access Requests"
        ],
        "operationId": "getAccessRequest",
        "security": [
          {
            "bearerAuth": [
              "read:access_requests"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "description": "Access request UUID.",
              "$ref": "#/components/schemas/Uuid"
            },
            "required": true,
            "description": "Access request UUID."
          }
        ],
        "responses": {
          "200": {
            "description": "Access request detail with its approval chain — who each stage was assigned to and who decided it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccessRequestDetail"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/jml/joiner": {
      "post": {
        "summary": "Onboard a new user (joiner event)",
        "description": "Creates the user (PRE_HIRE when start_date is in the future, else ACTIVE) or reactivates a deprovisioned one, and records a joiner event with status `pending`. This call grants no access and provisions no accounts: the event stays `pending` until an administrator runs the joiner workflow for the person in AtmanID, which grants birthright access, provisions accounts and sets the event to `completed`, `partial` or `failed` (visible through GET /jml/status/{idempotency_key}). Idempotent — repeat calls with the same idempotency_key return the cached result.",
        "tags": [
          "JML"
        ],
        "operationId": "jmlJoiner",
        "security": [
          {
            "bearerAuth": [
              "write:jml"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JmlJoinerBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Joiner processed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JmlResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "USER_ALREADY_EXISTS — a user with this email is already active or pre-hire, or was just created by a concurrent request. CONFLICT — the person left and cannot be rehired by a joiner now: `details.reason` is `emergency_termination` (an administrator terminated them in an emergency — Terminate now — and it is not yet reconciled with HR; an ordinary leaver an administrator ran does not block the rehire), `leaver_steps_pending` or `revocation_tickets_open` (retry when their departure finishes), `not_reinstatable` (an external whose end date has passed) or `not_deprovisioned`. Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/jml/leaver": {
      "post": {
        "summary": "Offboard a user (leaver event)",
        "description": "Sets the termination date and records a leaver event with status `pending`. On the termination date (daily run at 12:00 UTC) AtmanID runs the full leaver workflow: connected-app accounts are deprovisioned through their connectors, disconnected apps get revocation tickets, sessions and tokens are revoked, and owned agents are deactivated. An administrator can run the leaver earlier from AtmanID. Either run sets this event to `completed`, `partial` or `failed` with account and ticket counts (visible through GET /jml/status/{idempotency_key}). Idempotent on idempotency_key.",
        "tags": [
          "JML"
        ],
        "operationId": "jmlLeaver",
        "security": [
          {
            "bearerAuth": [
              "write:jml"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JmlLeaverBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JmlResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/jml/mover": {
      "post": {
        "summary": "Process a user role/department change (mover event)",
        "description": "Updates department and title (and the manager, through the governed manager-change rules) immediately and records a mover event with status `pending`. Access is not reviewed or provisioned by this call: the event stays `pending` until an administrator runs the mover workflow for the person in AtmanID, which sets it to `completed` or `partial` (visible through GET /jml/status/{idempotency_key}). Idempotent on idempotency_key.",
        "tags": [
          "JML"
        ],
        "operationId": "jmlMover",
        "security": [
          {
            "bearerAuth": [
              "write:jml"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JmlMoverBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JmlResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/agents": {
      "get": {
        "summary": "List non-human identities in the tenant",
        "description": "Paginated list of agents. Our GitHub Action consumer uses this to compute a diff plan against its YAML manifest.",
        "tags": [
          "Agents"
        ],
        "operationId": "listAgents",
        "security": [
          {
            "bearerAuth": [
              "read:nhi"
            ]
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "description": "Page number, 1-indexed.",
              "example": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number, 1-indexed."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "description": "Results per page. Max 100.",
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Results per page. Max 100."
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "PENDING_REVIEW",
                "DEPROVISIONED",
                "SUSPENDED"
              ]
            }
          },
          {
            "in": "query",
            "name": "environment",
            "schema": {
              "type": "string",
              "enum": [
                "Production",
                "Staging",
                "Development",
                "Testing"
              ]
            }
          },
          {
            "in": "query",
            "name": "name_prefix",
            "schema": {
              "description": "Case-insensitive prefix match on agent name.",
              "type": "string"
            },
            "description": "Case-insensitive prefix match on agent name."
          },
          {
            "in": "query",
            "name": "managed_by",
            "schema": {
              "description": "Cont. 128 — filter to agents tagged with `managed-by:<value>`. The GitOps boundary for multi-workflow tenants.",
              "type": "string"
            },
            "description": "Cont. 128 — filter to agents tagged with `managed-by:<value>`. The GitOps boundary for multi-workflow tenants."
          },
          {
            "in": "query",
            "name": "include_deleted",
            "schema": {
              "description": "Set true to include soft-deleted agents.",
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "description": "Set true to include soft-deleted agents."
          },
          {
            "in": "query",
            "name": "sort_by",
            "schema": {
              "default": "name",
              "type": "string",
              "enum": [
                "name",
                "registered_at"
              ]
            }
          },
          {
            "in": "query",
            "name": "sort_dir",
            "schema": {
              "default": "asc",
              "description": "Sort direction.",
              "example": "asc",
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            },
            "description": "Sort direction."
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated agent list.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Register a non-human identity (agent / service account)",
        "description": "Idempotent on idempotency_key. Created in PENDING_REVIEW status; an administrator must approve before full policy enforcement applies. Pairs with POST /jml/joiner (which handles human identities).",
        "tags": [
          "Agents"
        ],
        "operationId": "registerAgent",
        "security": [
          {
            "bearerAuth": [
              "write:nhi"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentCreateBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cached idempotent replay (the same idempotency_key and body seen within 24h).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRegisterResult"
                }
              }
            }
          },
          "201": {
            "description": "Agent registered. Status is PENDING_REVIEW.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRegisterResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Agent name already exists in this tenant, or the tenant's agent quota is reached; or IDEMPOTENCY_IN_PROGRESS — a request with this idempotency_key is still being processed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "IDEMPOTENCY_KEY_REUSED — this idempotency_key was already used within 24h for a different request body; nothing was done.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/agents/{id}": {
      "patch": {
        "summary": "Update mutable fields on a non-human identity (mover semantics)",
        "description": "Partial update. Mutable fields: framework, model, owner_team, owner_email, environment, vendor, purpose. Immutable: id, name, type. Idempotent on idempotency_key (24h window).",
        "tags": [
          "Agents"
        ],
        "operationId": "updateAgent",
        "security": [
          {
            "bearerAuth": [
              "write:nhi"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "description": "Agent identifier (e.g. agt-v1-7a2c8d9f).",
              "$ref": "#/components/schemas/Uuid"
            },
            "required": true,
            "description": "Agent identifier (e.g. agt-v1-7a2c8d9f)."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentPatchBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent updated (or no-op if every field already matches), or a cached idempotent replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentPatchResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Agent not found in tenant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Agent is DEPROVISIONED; cannot mover a leaver. Or IDEMPOTENCY_IN_PROGRESS — a request with this idempotency_key is still being processed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "IDEMPOTENCY_KEY_REUSED — this idempotency_key was already used within 24h for a different request body; nothing was done.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/agents/{id}/deactivate": {
      "post": {
        "summary": "Deactivate a non-human identity (leaver semantics)",
        "description": "Decommission and soft-delete: status → DEPROVISIONED (permanent), deleted_at = NOW(), and everything the agent holds is revoked in the same transaction — MCP tokens, sessions, MCP access grants, API keys, JIT sessions, its delegation nodes and agent-to-agent grants. Never hard-deletes. Idempotent on idempotency_key (24h window).",
        "tags": [
          "Agents"
        ],
        "operationId": "deactivateAgent",
        "security": [
          {
            "bearerAuth": [
              "write:nhi"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "description": "Agent identifier (e.g. agt-v1-7a2c8d9f).",
              "$ref": "#/components/schemas/Uuid"
            },
            "required": true,
            "description": "Agent identifier (e.g. agt-v1-7a2c8d9f)."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentDeactivateBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent deactivated (or already DEPROVISIONED — idempotent no-op), or a cached idempotent replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentDeactivateResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Agent not found in tenant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "IDEMPOTENCY_IN_PROGRESS — a request with this idempotency_key is still being processed; retry once it has finished.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "IDEMPOTENCY_KEY_REUSED — this idempotency_key was already used within 24h for a different request body; nothing was done.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/jml/status/{idempotency_key}": {
      "get": {
        "summary": "Look up a JML event result by idempotency key",
        "description": "Useful after a 500/network error — check whether the original call landed before retrying. `status` is the event's current state: `pending` until the matching JML workflow has run (the leaver runs automatically on the termination date; joiner and mover run when an administrator starts them), then `completed`, `partial` or `failed`, with account and ticket counts.",
        "tags": [
          "JML"
        ],
        "operationId": "getJmlStatus",
        "security": [
          {
            "bearerAuth": [
              "write:jml"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "idempotency_key",
            "schema": {
              "type": "string",
              "description": "Idempotency key originally sent on the JML call."
            },
            "required": true,
            "description": "Idempotency key originally sent on the JML call."
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JmlStatus"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sod-violations": {
      "get": {
        "summary": "List SoD violations",
        "tags": [
          "SoD"
        ],
        "operationId": "listSodViolations",
        "security": [
          {
            "bearerAuth": [
              "read:sod_violations"
            ]
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "description": "Page number, 1-indexed.",
              "example": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number, 1-indexed."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "description": "Results per page. Max 100.",
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Results per page. Max 100."
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "ACKNOWLEDGED",
                "EXCEPTED",
                "RESOLVED"
              ]
            }
          },
          {
            "in": "query",
            "name": "severity",
            "schema": {
              "type": "string",
              "enum": [
                "low",
                "medium",
                "high",
                "critical"
              ]
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "schema": {
              "$ref": "#/components/schemas/Uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SodViolationListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/identities": {
      "get": {
        "summary": "List non-human identity records",
        "description": "Returns non-human identities (service accounts, bots, agents) from the NHI registry. Despite the path name this endpoint does NOT return human identities — use /users for those.",
        "tags": [
          "Users"
        ],
        "operationId": "listIdentities",
        "security": [
          {
            "bearerAuth": [
              "read:nhi"
            ]
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "description": "Page number, 1-indexed.",
              "example": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number, 1-indexed."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "description": "Results per page. Max 100.",
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Results per page. Max 100."
          },
          {
            "in": "query",
            "name": "source",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "linked",
            "schema": {
              "description": "true = only linked, false = orphans.",
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "description": "true = only linked, false = orphans."
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IdentityListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/bundles": {
      "get": {
        "summary": "List access bundles",
        "tags": [
          "Bundles"
        ],
        "operationId": "listBundles",
        "security": [
          {
            "bearerAuth": [
              "read:access_requests"
            ]
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "description": "Page number, 1-indexed.",
              "example": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number, 1-indexed."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "description": "Results per page. Max 100.",
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Results per page. Max 100."
          },
          {
            "in": "query",
            "name": "is_active",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "in": "query",
            "name": "category",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BundleListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create an access bundle",
        "tags": [
          "Bundles"
        ],
        "operationId": "createBundle",
        "security": [
          {
            "bearerAuth": [
              "write:access_requests"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BundleCreateBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Bundle created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Bundle"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Bundle name already exists in this tenant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/bundles/{id}": {
      "get": {
        "summary": "Get a bundle by ID",
        "tags": [
          "Bundles"
        ],
        "operationId": "getBundle",
        "security": [
          {
            "bearerAuth": [
              "read:access_requests"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "description": "Bundle UUID.",
              "$ref": "#/components/schemas/Uuid"
            },
            "required": true,
            "description": "Bundle UUID."
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Bundle"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Update a bundle",
        "description": "The `items` of a bundle that grants without approval (`approval_required: false`), or whose approvals go to a chosen approver (`approval_override_user_id` set), cannot be changed through the API: the call returns 403. An administrator changes them in the console. A key edits only the bundles its owner owns, unless the owner may edit any bundle (BUNDLE_EDIT_ANY — identity_admin, tenant_owner, super_admin); otherwise 403.",
        "tags": [
          "Bundles"
        ],
        "operationId": "updateBundle",
        "security": [
          {
            "bearerAuth": [
              "write:access_requests"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "description": "Bundle UUID.",
              "$ref": "#/components/schemas/Uuid"
            },
            "required": true,
            "description": "Bundle UUID."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BundleUpdateBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bundle updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Bundle"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Soft-delete a bundle",
        "tags": [
          "Bundles"
        ],
        "operationId": "deleteBundle",
        "security": [
          {
            "bearerAuth": [
              "write:access_requests"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "description": "Bundle UUID.",
              "$ref": "#/components/schemas/Uuid"
            },
            "required": true,
            "description": "Bundle UUID."
          }
        ],
        "responses": {
          "204": {
            "description": "Bundle soft-deleted."
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/audit": {
      "get": {
        "summary": "Query the audit log",
        "description": "Returns audit records for the calling key's tenant, newest first by default.\n\nEach record names its actor (`actor_name`, `actor_email`, `actor_name_source`: `snapshot` | \n`lookup` | `redacted`), the API key that made the call (`api_key_id`) and the request it \nbelongs to (`request_id`, the same value returned in the `X-Request-Id` header). Records \nredacted for an erasure request show `actor_name = \"[REDACTED]\"`.\n\nFor AI-assisted actions, `actor_type`, `delegated_by`, `confirmation_method` and \n`agent_session_id` show whether a person confirmed the action or an agent ran it under a \nstanding authorisation or as a workflow step (`new_state.invocation`: the workflow, the step, who confirmed it). **Caveat:** records written before 2026-08-26 carry \n`confirmation_method = \"proposal_card\"` on both paths, so for those records it does not \ndistinguish them (and workflow steps before 2026-10-28 carry it too).\n\nFilters: `action_type`, `resource_type`, `actor_name` (prefix match), `actor_email` \n(case-insensitive exact match), `actor_type`, `agent_nhi_id`, `since`, `until`. \nSort with `sort_by` (`created_at` | `action_type` | `target_resource_type`) and `sort_dir`.",
        "tags": [
          "Audit"
        ],
        "operationId": "listAuditEvents",
        "security": [
          {
            "bearerAuth": [
              "read:audit_logs"
            ]
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "description": "Page number, 1-indexed.",
              "example": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number, 1-indexed."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "description": "Results per page. Max 100.",
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Results per page. Max 100."
          },
          {
            "in": "query",
            "name": "action_type",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "resource_type",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "actor_name",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "actor_email",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "actor_type",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "agent_nhi_id",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          },
          {
            "in": "query",
            "name": "sort_by",
            "schema": {
              "type": "string",
              "enum": [
                "created_at",
                "action_type",
                "target_resource_type"
              ]
            }
          },
          {
            "in": "query",
            "name": "sort_dir",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "in": "query",
            "name": "since",
            "schema": {
              "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))$"
            }
          },
          {
            "in": "query",
            "name": "until",
            "schema": {
              "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))$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditEventListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "summary": "List webhook subscriptions",
        "tags": [
          "Webhooks"
        ],
        "operationId": "listWebhooks",
        "security": [
          {
            "bearerAuth": [
              "read:webhooks"
            ]
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "description": "Page number, 1-indexed.",
              "example": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number, 1-indexed."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "description": "Results per page. Max 100.",
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Results per page. Max 100."
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "paused",
                "failed"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a webhook subscription",
        "description": "Returns the signing_secret ONCE in the create response — subsequent reads redact it. An event that is not sent yet is refused with 400 EVENT_NOT_AVAILABLE (details.events) when the tenant enforces it, and otherwise saved with a `warnings` entry naming it.",
        "tags": [
          "Webhooks"
        ],
        "operationId": "createWebhook",
        "security": [
          {
            "bearerAuth": [
              "write:webhooks"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookCreateBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Webhook created — signing_secret populated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSubscription"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/webhooks/{id}": {
      "get": {
        "summary": "Get a webhook subscription",
        "tags": [
          "Webhooks"
        ],
        "operationId": "getWebhook",
        "security": [
          {
            "bearerAuth": [
              "read:webhooks"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "description": "Webhook UUID.",
              "$ref": "#/components/schemas/Uuid"
            },
            "required": true,
            "description": "Webhook UUID."
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSubscription"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Update a webhook subscription",
        "description": "The same rules as create: a standard-tier key may subscribe only to governance events (403 RBAC_DENIED lists the forbidden ones), the url must be a public endpoint (400 INVALID_PARAM), and an event this update adds that is not sent yet is refused (400 EVENT_NOT_AVAILABLE) or saved with a `warnings` entry; one the subscription already holds is left as it is.",
        "tags": [
          "Webhooks"
        ],
        "operationId": "updateWebhook",
        "security": [
          {
            "bearerAuth": [
              "write:webhooks"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "description": "Webhook UUID.",
              "$ref": "#/components/schemas/Uuid"
            },
            "required": true,
            "description": "Webhook UUID."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookUpdateBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSubscription"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete a webhook subscription",
        "tags": [
          "Webhooks"
        ],
        "operationId": "deleteWebhook",
        "security": [
          {
            "bearerAuth": [
              "write:webhooks"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "description": "Webhook UUID.",
              "$ref": "#/components/schemas/Uuid"
            },
            "required": true,
            "description": "Webhook UUID."
          }
        ],
        "responses": {
          "204": {
            "description": "Webhook deleted."
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/webhooks/{id}/test": {
      "post": {
        "summary": "Send a test delivery to a webhook",
        "description": "Fires a synthetic event to the webhook URL. Result reports HTTP status + response body snippet.",
        "tags": [
          "Webhooks"
        ],
        "operationId": "testWebhook",
        "security": [
          {
            "bearerAuth": [
              "write:webhooks"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "description": "Webhook UUID.",
              "$ref": "#/components/schemas/Uuid"
            },
            "required": true,
            "description": "Webhook UUID."
          }
        ],
        "responses": {
          "200": {
            "description": "Test delivery result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookTestResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/github/overview": {
      "get": {
        "summary": "GitHub org NHI footprint summary",
        "description": "Uses a short-lived PAT passed via query to poll GitHub's API and count workflows, deploy keys, and apps. Read-only — nothing is persisted.",
        "tags": [
          "GitHub"
        ],
        "operationId": "githubOverview",
        "security": [
          {
            "bearerAuth": [
              "read:apps"
            ]
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "org",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "access_token",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Org NHI footprint summary.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GithubOverview"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/github/discover": {
      "post": {
        "summary": "Discover GitHub NHIs and register them",
        "tags": [
          "GitHub"
        ],
        "operationId": "githubDiscover",
        "security": [
          {
            "bearerAuth": [
              "write:nhi"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GithubDiscoverBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Discovery complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GithubDiscoverResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/reachability/preview": {
      "post": {
        "summary": "Preview the blast radius of an entitlement",
        "description": "Returns the resolved confidence tier, transitive paths to terminal data classes, and a cached summary for an entitlement. Body is XOR — supply EITHER `{ access_request_id }` (server resolves application + entitlement) OR `{ application_id, entitlement_name|entitlement_id }` (explicit). Confidence tiers: `high` (cached summary present while transitive paths exist, catastrophic/high blast radius), `medium` (medium tier), `low` (low tier, OR edges present without a cached summary that has live paths), `none` (no edges declared — caller should require attestation), `unknown` (entitlement not resolvable, e.g. legacy access request without entitlement_id).",
        "tags": [
          "Reachability"
        ],
        "operationId": "reachabilityPreview",
        "security": [
          {
            "bearerAuth": [
              "read:reachability"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ReachabilityPreviewByRequest"
                  },
                  {
                    "$ref": "#/components/schemas/ReachabilityPreviewByEntitlement"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reachability preview for the resolved entitlement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReachabilityPreviewResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/workflow-templates": {
      "get": {
        "summary": "List approval workflow templates for the tenant",
        "description": "Paginated list of approval workflow templates. The companion GitHub Action atmanid/workflow-sync uses this to compute a diff plan against its YAML manifest set.",
        "tags": [
          "Workflows"
        ],
        "operationId": "listWorkflowTemplates",
        "security": [
          {
            "bearerAuth": [
              "read:workflows"
            ]
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "description": "Page number, 1-indexed.",
              "example": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number, 1-indexed."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "description": "Results per page. Max 100.",
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Results per page. Max 100."
          },
          {
            "in": "query",
            "name": "name_prefix",
            "schema": {
              "description": "Case-insensitive prefix match on metadata.name.",
              "type": "string"
            },
            "description": "Case-insensitive prefix match on metadata.name."
          },
          {
            "in": "query",
            "name": "managed_by",
            "schema": {
              "description": "Filter to templates tagged with metadata.managed_by — the GitOps boundary for multi-workflow tenants.",
              "type": "string"
            },
            "description": "Filter to templates tagged with metadata.managed_by — the GitOps boundary for multi-workflow tenants."
          },
          {
            "in": "query",
            "name": "sort_by",
            "schema": {
              "default": "name",
              "type": "string",
              "enum": [
                "name",
                "created_at",
                "updated_at"
              ]
            }
          },
          {
            "in": "query",
            "name": "sort_dir",
            "schema": {
              "default": "asc",
              "description": "Sort direction.",
              "example": "asc",
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            },
            "description": "Sort direction."
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated workflow template list.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowTemplateListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Apply a workflow template manifest (kubectl-style upsert)",
        "description": "Idempotent on metadata.name within the tenant. If a template with the same name exists, UPDATE its content + return 200 + { created: false }. Otherwise CREATE + return 201 + { created: true }. Body accepts JSON (Content-Type: application/json) or YAML (Content-Type: application/yaml).",
        "tags": [
          "Workflows"
        ],
        "operationId": "applyWorkflowTemplate",
        "security": [
          {
            "bearerAuth": [
              "write:workflows"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "ApprovalWorkflowTemplateManifest — apiVersion/kind/metadata/spec block."
              }
            },
            "application/yaml": {
              "schema": {
                "type": "string",
                "description": "Same manifest, YAML-serialised."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing template updated to match manifest.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowTemplateUpdated"
                }
              }
            }
          },
          "201": {
            "description": "New template created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowTemplateCreated"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/workflow-templates/{id}": {
      "get": {
        "summary": "Read a single workflow template by id OR by metadata.name",
        "description": "Path param accepts either a UUID (lookup by id) or a kubectl-style name matching the metadata.name regex (lookup by name within the caller's tenant).",
        "tags": [
          "Workflows"
        ],
        "operationId": "getWorkflowTemplate",
        "security": [
          {
            "bearerAuth": [
              "read:workflows"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "description": "Template UUID or metadata.name."
            },
            "required": true,
            "description": "Template UUID or metadata.name."
          }
        ],
        "responses": {
          "200": {
            "description": "Workflow template detail with full manifest.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowTemplateDetail"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete a workflow template by id OR by metadata.name",
        "description": "Permanently removes the template. (V1 — soft-delete may be added in V2.) Audit event WORKFLOW_TEMPLATE_DELETED_VIA_API is written.",
        "tags": [
          "Workflows"
        ],
        "operationId": "deleteWorkflowTemplate",
        "security": [
          {
            "bearerAuth": [
              "write:workflows"
            ]
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "description": "Template UUID or metadata.name."
            },
            "required": true,
            "description": "Template UUID or metadata.name."
          }
        ],
        "responses": {
          "204": {
            "description": "Template deleted."
          },
          "400": {
            "description": "Bad request — validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but API key lacks required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded for this API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "McpAuthorizeRequest": {
        "type": "object",
        "properties": {
          "ver": {
            "type": "number",
            "const": 1
          },
          "server_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "The MCP server, as registered in AtmanID."
          },
          "tool": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "The tool being called."
          },
          "arguments": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "The tool call's arguments, as the agent sent them. Inspection and Intent policy read them."
          },
          "agent_credential": {
            "type": "object",
            "properties": {
              "authorization": {
                "type": "string",
                "minLength": 1,
                "maxLength": 8192,
                "description": "The agent's Authorization header (Bearer or DPoP)."
              },
              "dpop": {
                "description": "The agent's DPoP proof header, when it sent one.",
                "type": "string",
                "minLength": 1,
                "maxLength": 8192
              },
              "htm": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16,
                "description": "The method of the request the agent made (the proof is bound to it)."
              },
              "htu": {
                "type": "string",
                "maxLength": 2048,
                "format": "uri",
                "description": "The URL of the request the agent made (the proof is bound to it)."
              },
              "workload": {
                "description": "The agent's Workload-Identity-Token header (its workload's signed identity, ADR-AGENT-MCP-006), or null (or an empty string) when the agent sent none. Omit the field when your gateway does not forward that header: the call is then not checked for its workload, rather than counted as an agent that sent none. The result is recorded on the decision in Events, not returned in this response. Since 1.35.0.",
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 65536
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "authorization",
              "htm",
              "htu"
            ],
            "additionalProperties": false
          },
          "caller": {
            "type": "object",
            "properties": {
              "gateway": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200,
                "description": "Your gateway's name; recorded on the decision."
              },
              "request_id": {
                "type": "string",
                "maxLength": 200
              }
            },
            "required": [
              "gateway"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "ver",
          "server_id",
          "tool",
          "arguments",
          "agent_credential",
          "caller"
        ],
        "additionalProperties": false
      },
      "McpAuthenticateRequest": {
        "type": "object",
        "properties": {
          "ver": {
            "type": "number",
            "const": 1
          },
          "mode": {
            "type": "string",
            "const": "authenticate",
            "description": "Authenticate only: allow when the agent's token (and its DPoP proof, when the token is bound) is valid for this server and the server may be called; deny otherwise. No tool policy is applied; an allow is not recorded, a deny is."
          },
          "server_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "The MCP server, as registered in AtmanID."
          },
          "agent_credential": {
            "type": "object",
            "properties": {
              "authorization": {
                "type": "string",
                "minLength": 1,
                "maxLength": 8192,
                "description": "The agent's Authorization header (Bearer or DPoP)."
              },
              "dpop": {
                "description": "The agent's DPoP proof header, when it sent one.",
                "type": "string",
                "minLength": 1,
                "maxLength": 8192
              },
              "htm": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16,
                "description": "The method of the request the agent made (the proof is bound to it)."
              },
              "htu": {
                "type": "string",
                "maxLength": 2048,
                "format": "uri",
                "description": "The URL of the request the agent made (the proof is bound to it)."
              },
              "workload": {
                "description": "The agent's Workload-Identity-Token header (its workload's signed identity, ADR-AGENT-MCP-006), or null (or an empty string) when the agent sent none. Omit the field when your gateway does not forward that header: the call is then not checked for its workload, rather than counted as an agent that sent none. The result is recorded on the decision in Events, not returned in this response. Since 1.35.0.",
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 65536
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "authorization",
              "htm",
              "htu"
            ],
            "additionalProperties": false
          },
          "caller": {
            "type": "object",
            "properties": {
              "gateway": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200,
                "description": "Your gateway's name; recorded on the decision."
              },
              "request_id": {
                "type": "string",
                "maxLength": 200
              }
            },
            "required": [
              "gateway"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "ver",
          "mode",
          "server_id",
          "agent_credential",
          "caller"
        ],
        "additionalProperties": false
      },
      "McpAuthorizeOutcome": {
        "type": "object",
        "properties": {
          "ver": {
            "type": "number",
            "const": 1
          },
          "status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599,
            "description": "The HTTP status the MCP server answered with (for a JSON-RPC answer: 200, 400 for an isError result, 500 for an error)."
          },
          "latency_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3600000,
            "description": "From forwarding the call to its answer."
          },
          "flags": {
            "description": "What your gateway's inspection found in the response, by AtmanID's flag names (e.g. PII_SSN); only known names are kept.",
            "maxItems": 32,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 64
            }
          },
          "response_redactions": {
            "description": "How many personal-data values your gateway replaced in the response.",
            "type": "integer",
            "minimum": 0,
            "maximum": 100000
          }
        },
        "required": [
          "ver",
          "status",
          "latency_ms"
        ],
        "additionalProperties": false
      },
      "McpHoldDecision": {
        "type": "object",
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "approve",
              "deny"
            ],
            "description": "approve releases the held call once, while the approval is valid; deny keeps it denied."
          },
          "note": {
            "description": "Why — the written reason, recorded with the decision in the audit trail. The console requires one for a HIGH or CRITICAL hold.",
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          },
          "category": {
            "description": "Why the decision goes against AtmanID's suggestion (approving a HIGH or CRITICAL hold, or denying a MEDIUM or LOW one): the reasons the console asks for in that case. policy_exception — a documented exception to policy; urgent_request — business urgency; manual_verification — the approver verified the call is safe; agent_error — the risk assessment is wrong for this call. Recorded as the decision's override category, also when sent with a decision that is not an override. Optional.",
            "type": "string",
            "enum": [
              "policy_exception",
              "urgent_request",
              "manual_verification",
              "agent_error"
            ]
          }
        },
        "required": [
          "decision"
        ],
        "additionalProperties": false
      },
      "AccessRequestDecision": {
        "type": "object",
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "APPROVE",
              "REJECT"
            ]
          },
          "comments": {
            "type": "string",
            "maxLength": 2000
          },
          "decision_reason": {
            "type": "string",
            "maxLength": 1000
          },
          "expires_at": {
            "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "attested": {
            "type": "boolean"
          },
          "accept_safe_alternative": {
            "type": "boolean"
          }
        },
        "required": [
          "decision"
        ],
        "description": "decision APPROVE or REJECT (a reject needs comments or decision_reason). expires_at (≤ 1 year ahead) sets when the granted access ends, at any stage: the grant ends at the earliest date any approver chose. An earlier stage's date never lengthens what the request asked for; only the approval that completes the request may set a later one. attested: you approve without blast-radius visibility (required when the tenant asks for it and the entitlement's reach is unknown — otherwise 422 ATTESTATION_REQUIRED). accept_safe_alternative: take the time-boxed grant offered when the final-stage SoD re-check blocks."
      },
      "AgentPolicyCreate": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 3,
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "maxLength": 1000
          },
          "agent_id": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "pattern": "^[\\w\\-]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "intent_pattern": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[\\w\\-:.*]+$"
          },
          "resource_pattern": {
            "default": "*",
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "action": {
            "type": "string",
            "enum": [
              "ALLOW",
              "DENY",
              "REQUIRE_HITL"
            ]
          },
          "risk_threshold": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "LOW",
                  "MEDIUM",
                  "HIGH",
                  "CRITICAL"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "approver": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 254,
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "priority": {
            "default": 100,
            "type": "integer",
            "minimum": 1,
            "maximum": 9999
          },
          "status": {
            "default": "DRAFT",
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT",
              "ARCHIVED"
            ]
          },
          "conditions": {
            "anyOf": [
              {
                "maxItems": 10,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200,
                      "pattern": "^(?:[A-Za-z0-9_$-]+|\\*)(?:(?:\\.(?:[A-Za-z0-9_$-]+|\\*))|\\[(?:\\d+|\\*)\\])*$"
                    },
                    "op": {
                      "type": "string",
                      "enum": [
                        "eq",
                        "neq",
                        "in",
                        "not_in",
                        "gt",
                        "gte",
                        "lt",
                        "lte",
                        "matches",
                        "not_matches",
                        "exists",
                        "absent",
                        "email_domain_in",
                        "email_domain_not_in",
                        "sql_writes",
                        "sql_touches",
                        "budget_exceeds"
                      ]
                    },
                    "value": {}
                  },
                  "required": [
                    "path",
                    "op"
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "redact_args": {
            "anyOf": [
              {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200,
                  "pattern": "^(?:[A-Za-z0-9_$-]+|\\*)(?:(?:\\.(?:[A-Za-z0-9_$-]+|\\*))|\\[(?:\\d+|\\*)\\])*$"
                }
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "name",
          "intent_pattern",
          "action"
        ]
      },
      "AgentPolicyUpdate": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 3,
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "maxLength": 1000
          },
          "agent_id": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64,
                "pattern": "^[\\w\\-]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "intent_pattern": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[\\w\\-:.*]+$"
          },
          "resource_pattern": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "action": {
            "type": "string",
            "enum": [
              "ALLOW",
              "DENY",
              "REQUIRE_HITL"
            ]
          },
          "risk_threshold": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "LOW",
                  "MEDIUM",
                  "HIGH",
                  "CRITICAL"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "approver": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 254,
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "priority": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9999
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT",
              "ARCHIVED"
            ]
          },
          "conditions": {
            "anyOf": [
              {
                "maxItems": 10,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200,
                      "pattern": "^(?:[A-Za-z0-9_$-]+|\\*)(?:(?:\\.(?:[A-Za-z0-9_$-]+|\\*))|\\[(?:\\d+|\\*)\\])*$"
                    },
                    "op": {
                      "type": "string",
                      "enum": [
                        "eq",
                        "neq",
                        "in",
                        "not_in",
                        "gt",
                        "gte",
                        "lt",
                        "lte",
                        "matches",
                        "not_matches",
                        "exists",
                        "absent",
                        "email_domain_in",
                        "email_domain_not_in",
                        "sql_writes",
                        "sql_touches",
                        "budget_exceeds"
                      ]
                    },
                    "value": {}
                  },
                  "required": [
                    "path",
                    "op"
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "redact_args": {
            "anyOf": [
              {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200,
                  "pattern": "^(?:[A-Za-z0-9_$-]+|\\*)(?:(?:\\.(?:[A-Za-z0-9_$-]+|\\*))|\\[(?:\\d+|\\*)\\])*$"
                }
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false,
        "description": "At least one field; no other properties (the id is in the path)."
      },
      "AgentPolicySimulationRequest": {
        "type": "object",
        "properties": {
          "agent_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[\\w\\-]+$"
          },
          "intent": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[\\w\\-:.*]+$"
          },
          "resource": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "arguments": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "agent_id",
          "intent",
          "resource"
        ]
      },
      "McpServerModeChange": {
        "type": "object",
        "properties": {
          "gateway_mode": {
            "description": "SHADOW logs what the gateway would deny; ENFORCE denies it.",
            "type": "string",
            "enum": [
              "SHADOW",
              "ENFORCE"
            ]
          },
          "intent_mode": {
            "description": "Intent policy: off, logged only, or enforced.",
            "type": "string",
            "enum": [
              "OFF",
              "SHADOW",
              "ENFORCE"
            ]
          }
        },
        "additionalProperties": false,
        "description": "At least one. DIRECT (no gateway checks) cannot be set by API."
      },
      "CertificationCampaignCreate": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 3,
            "maxLength": 200
          },
          "deadline": {
            "type": "string"
          },
          "campaign_type": {
            "type": "string",
            "enum": [
              "manager_certification",
              "app_owner_certification",
              "role_owner_certification",
              "entitlement_owner_certification",
              "sponsor_certification",
              "nhi_owner_certification",
              "agent_access_certification",
              "mcp_server_certification"
            ]
          },
          "scope_ref": {
            "type": "string"
          },
          "scope_filter": {
            "type": "string"
          },
          "is_scheduled": {
            "type": "boolean"
          },
          "scheduled_cron": {
            "type": "string"
          },
          "delegation_allowed": {
            "type": "boolean"
          },
          "non_response_action": {
            "type": "string",
            "enum": [
              "ESCALATE",
              "AUTO_REVOKE",
              "AUTO_CERTIFY"
            ]
          },
          "non_response_days": {
            "type": "integer",
            "minimum": 0,
            "maximum": 365
          },
          "escalation_target_user_id": {
            "type": "string"
          },
          "filterType": {
            "type": "string"
          },
          "filterValue": {
            "type": "string"
          },
          "save_as_draft": {
            "type": "boolean"
          },
          "wave_size": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          },
          "wave_interval_days": {
            "type": "integer",
            "minimum": 1,
            "maximum": 90
          },
          "min_risk": {
            "type": "string",
            "enum": [
              "LOW",
              "MEDIUM",
              "HIGH",
              "CRITICAL"
            ]
          },
          "exclude_recently_certified_days": {
            "type": "integer",
            "minimum": 0,
            "maximum": 365
          },
          "granted_before_days": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3650
          },
          "stages": {
            "minItems": 2,
            "maxItems": 4,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "reviewer_kind": {
                  "type": "string",
                  "enum": [
                    "manager",
                    "app_owner",
                    "role_owner",
                    "entitlement_owner",
                    "specific_user"
                  ]
                },
                "reviewer_ref": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "reviewer_kind"
              ]
            }
          },
          "scope_criteria": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "attribute": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80
                },
                "operator": {
                  "type": "string",
                  "enum": [
                    "eq",
                    "neq",
                    "contains",
                    "in",
                    "is_set",
                    "is_not_set"
                  ]
                },
                "value": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 200
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "attribute",
                "operator"
              ]
            }
          },
          "incremental_only": {
            "type": "boolean"
          },
          "scope_query": {
            "$ref": "#/components/schemas/__schema0"
          }
        },
        "required": [
          "name"
        ]
      },
      "CertificationReviewDecision": {
        "type": "object",
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "CERTIFY",
              "REVOKE",
              "ESCALATE"
            ],
            "description": "CERTIFY keeps the access, REVOKE removes it (where one decision can), ESCALATE hands it on."
          },
          "note": {
            "description": "Why. Required when the tenant asks for a justification on this decision, and (at least 20 characters) when deciding an item assigned to someone else.",
            "type": "string",
            "maxLength": 500
          },
          "started_at": {
            "description": "When the reviewer opened the item (ms since epoch): recorded as the review duration.",
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "decision"
        ],
        "additionalProperties": false
      },
      "Uuid": {
        "type": "string",
        "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
        "format": "uuid",
        "description": "RFC 4122 UUID (any version). Case-insensitive on input; output lowercase.",
        "example": "3f6c2a9e-7b41-4d2e-9c58-1a0e6b7d4f23"
      },
      "AccessRequestCreate": {
        "type": "object",
        "properties": {
          "target_user_id": {
            "description": "User who will receive the access.",
            "$ref": "#/components/schemas/Uuid"
          },
          "entitlement_ids": {
            "minItems": 1,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Uuid"
            },
            "description": "One or more entitlement IDs to request."
          },
          "justification": {
            "type": "string",
            "minLength": 1,
            "description": "Business reason for the access request — audit-visible.",
            "example": "Q4 sales reporting rollout — needs Salesforce reports view access."
          },
          "source": {
            "description": "Originating system tag for audit context.",
            "example": "hris-workday",
            "type": "string"
          }
        },
        "required": [
          "target_user_id",
          "entitlement_ids",
          "justification"
        ]
      },
      "JmlJoinerBody": {
        "type": "object",
        "properties": {
          "idempotency_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "first_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "last_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "department": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "identity_type": {
            "default": "employee",
            "type": "string",
            "enum": [
              "employee",
              "contractor",
              "vendor",
              "partner"
            ]
          },
          "manager_email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "start_date": {
            "type": "string",
            "format": "date",
            "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])))$"
          }
        },
        "required": [
          "idempotency_key",
          "email",
          "first_name",
          "last_name"
        ]
      },
      "JmlLeaverBody": {
        "type": "object",
        "properties": {
          "idempotency_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "user_id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "termination_date": {
            "type": "string",
            "format": "date",
            "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])))$"
          },
          "reason": {
            "type": "string"
          }
        },
        "required": [
          "idempotency_key"
        ]
      },
      "JmlMoverBody": {
        "type": "object",
        "properties": {
          "idempotency_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "user_id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "new_department": {
            "type": "string"
          },
          "new_title": {
            "type": "string"
          },
          "new_manager_email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "effective_date": {
            "type": "string",
            "format": "date",
            "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])))$"
          }
        },
        "required": [
          "idempotency_key"
        ]
      },
      "AgentCreateBody": {
        "type": "object",
        "properties": {
          "idempotency_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Client-generated key used to de-duplicate retries. The same key with the same body within 24h returns the cached response (HTTP 200, `cached: true`); the same key with a different body is refused 422 `IDEMPOTENCY_KEY_REUSED`, and while a request with the key is still running another gets 409 `IDEMPOTENCY_IN_PROGRESS`.",
            "example": "gha-jml-sync-2026-04-29-abc123"
          },
          "name": {
            "type": "string",
            "minLength": 2,
            "maxLength": 200,
            "description": "Human-readable identifier for the agent. Must be unique within the tenant.",
            "example": "stripe-webhook-listener"
          },
          "type": {
            "type": "string",
            "minLength": 2,
            "maxLength": 100,
            "description": "Identity type, e.g. \"External AI Tool\", \"Service Account\", \"Internal AI Tool\".",
            "example": "External AI Tool"
          },
          "framework": {
            "example": "openai-assistants-v2",
            "type": "string",
            "maxLength": 100
          },
          "model": {
            "example": "gpt-4o",
            "type": "string",
            "maxLength": 100
          },
          "owner_team": {
            "type": "string",
            "minLength": 2,
            "maxLength": 100,
            "description": "Team that owns this agent. Required for governance.",
            "example": "payments"
          },
          "owner_email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
            "description": "Contact email for the owner team.",
            "example": "payments-eng@example.com"
          },
          "environment": {
            "default": "Production",
            "type": "string",
            "enum": [
              "Production",
              "Staging",
              "Development",
              "Testing"
            ]
          },
          "vendor": {
            "example": "openai",
            "type": "string",
            "maxLength": 100
          },
          "purpose": {
            "description": "Free-text description of what the agent does. Surfaces to certifiers and auditors.",
            "type": "string",
            "maxLength": 1000
          },
          "managed_by": {
            "description": "Cont. 128 — ownership tag. When set, the agent is tagged with `managed-by:<value>` and the GET /agents endpoint can filter by this value to scope downstream operations to only the workflow that owns the row. Strongly recommended for any GitOps-style consumer to prevent cross-workflow blast radius.",
            "example": "gha-jml-sync@v1.1",
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        },
        "required": [
          "idempotency_key",
          "name",
          "type",
          "owner_team",
          "owner_email"
        ]
      },
      "AgentPatchBody": {
        "type": "object",
        "properties": {
          "idempotency_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Client-generated key used to de-duplicate retries. The same key with the same body within 24h returns the cached response (HTTP 200, `cached: true`); the same key with a different body is refused 422 `IDEMPOTENCY_KEY_REUSED`, and while a request with the key is still running another gets 409 `IDEMPOTENCY_IN_PROGRESS`."
          },
          "framework": {
            "type": "string",
            "maxLength": 100
          },
          "model": {
            "type": "string",
            "maxLength": 100
          },
          "owner_team": {
            "type": "string",
            "minLength": 2,
            "maxLength": 100
          },
          "owner_email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "environment": {
            "type": "string",
            "enum": [
              "Production",
              "Staging",
              "Development",
              "Testing"
            ]
          },
          "vendor": {
            "type": "string",
            "maxLength": 100
          },
          "purpose": {
            "type": "string",
            "maxLength": 1000
          }
        },
        "required": [
          "idempotency_key"
        ],
        "description": "Mover semantics — partial update of mutable agent fields. name + type are immutable."
      },
      "AgentDeactivateBody": {
        "type": "object",
        "properties": {
          "idempotency_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Client-generated key used to de-duplicate retries. The same key with the same body within 24h returns the cached response (HTTP 200, `cached: true`); the same key with a different body is refused 422 `IDEMPOTENCY_KEY_REUSED`, and while a request with the key is still running another gets 409 `IDEMPOTENCY_IN_PROGRESS`."
          },
          "reason": {
            "description": "Optional human-readable reason for deactivation. Surfaces in audit trail for compliance.",
            "type": "string",
            "maxLength": 500
          }
        },
        "required": [
          "idempotency_key"
        ]
      },
      "BundleCreateBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "items": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "entitlement_id": {
                  "$ref": "#/components/schemas/Uuid"
                }
              },
              "required": [
                "entitlement_id"
              ]
            }
          },
          "is_active": {
            "default": true,
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "items"
        ]
      },
      "BundleUpdateBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "items": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "entitlement_id": {
                  "$ref": "#/components/schemas/Uuid"
                }
              },
              "required": [
                "entitlement_id"
              ]
            }
          },
          "is_active": {
            "default": true,
            "type": "boolean"
          }
        }
      },
      "WebhookCreateBody": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "minItems": 1,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEvent"
            }
          },
          "description": {
            "type": "string"
          }
        },
        "required": [
          "url",
          "events"
        ]
      },
      "WebhookEvent": {
        "type": "string",
        "enum": [
          "USER_CREATED",
          "USER_DEPROVISIONED",
          "JOINER_PROVISIONED",
          "MOVER_UPDATED",
          "LEAVER_DEPROVISIONED",
          "IDENTITY_SUSPENDED",
          "IDENTITY_REACTIVATED",
          "CONTRACTOR_EXPIRING",
          "CONTRACTOR_EXPIRED",
          "ACCESS_REQUESTED",
          "ACCESS_APPROVED",
          "ACCESS_REVOKED",
          "ACCESS_REQUEST_REJECTED",
          "ACCESS_REQUEST_EXPIRED",
          "ENTITLEMENT_GRANTED",
          "ENTITLEMENT_REVOKED_DIRECT",
          "SOD_VIOLATION",
          "SOD_VIOLATION_RESOLVED",
          "RISK_SCORE_CHANGED",
          "HIGH_RISK_AGENT_DETECTED",
          "CERT_CAMPAIGN_STARTED",
          "CERT_COMPLETED",
          "CERT_AUTO_REVOKED",
          "CERT_AUTO_CERTIFIED",
          "CERT_ESCALATED",
          "NHI_REGISTERED",
          "NHI_SECRET_EXPIRING",
          "AGENT_DELEGATION_CREATED",
          "AGENT_DELEGATION_REVOKED",
          "MFA_ENROLLED",
          "WEBHOOK_TEST",
          "WEBHOOK_SUBSCRIPTION_SUSPENDED",
          "AUDIT_CHAIN_VERIFIED",
          "AUDIT_CHAIN_BROKEN"
        ],
        "description": "Standard-tier keys may subscribe only to the governance events (403 RBAC_DENIED lists the others)."
      },
      "WebhookUpdateBody": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "minItems": 1,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEvent"
            }
          },
          "description": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused"
            ]
          }
        }
      },
      "GithubDiscoverBody": {
        "type": "object",
        "properties": {
          "org": {
            "type": "string",
            "minLength": 1,
            "example": "acme-inc"
          },
          "access_token": {
            "type": "string",
            "minLength": 1,
            "description": "GitHub PAT with read:org scope. Stored encrypted if persist=true."
          },
          "persist": {
            "default": true,
            "description": "When true, discovered NHIs are registered in AtmanID (created or updated).",
            "type": "boolean"
          }
        },
        "required": [
          "org",
          "access_token"
        ]
      },
      "ReachabilityPreviewByRequest": {
        "type": "object",
        "properties": {
          "access_request_id": {
            "$ref": "#/components/schemas/Uuid"
          }
        },
        "required": [
          "access_request_id"
        ]
      },
      "ReachabilityPreviewByEntitlement": {
        "type": "object",
        "properties": {
          "application_id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "entitlement_name": {
            "type": "string"
          },
          "entitlement_id": {
            "$ref": "#/components/schemas/Uuid"
          }
        },
        "required": [
          "application_id"
        ]
      },
      "__schema0": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "attribute": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "operator": {
                "type": "string",
                "enum": [
                  "eq",
                  "neq",
                  "contains",
                  "in",
                  "is_set",
                  "is_not_set"
                ]
              },
              "value": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 200
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "attribute",
              "operator"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "group"
              },
              "match": {
                "type": "string",
                "enum": [
                  "all",
                  "any"
                ]
              },
              "children": {
                "minItems": 1,
                "maxItems": 10,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/__schema0"
                }
              }
            },
            "required": [
              "type",
              "match",
              "children"
            ]
          }
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "$ref": "#/components/schemas/ErrorCode"
              },
              "message": {
                "type": "string",
                "description": "Human-readable sentence safe to surface in a UI toast. Wording may change between releases — do NOT pattern-match on this field.",
                "example": "Too many requests for this API key"
              },
              "request_id": {
                "type": "string",
                "description": "Correlation ID. The same value is recorded on the matching audit records and in our logs for the request. Include it in support tickets.",
                "example": "req_01HXYZABC123"
              },
              "details": {
                "description": "Optional structured context specific to the error code. Schema is per-code and documented alongside each code. Consumers MAY read; MUST tolerate absence.",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              }
            },
            "required": [
              "code",
              "message",
              "request_id"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false,
        "description": "Standard error envelope used across all v1 endpoints.",
        "example": {
          "error": {
            "code": "RATE_LIMIT_EXCEEDED",
            "message": "Too many requests for this API key",
            "request_id": "req_01HXYZABC123",
            "details": {
              "retry_after_ms": 3200
            }
          }
        }
      },
      "ErrorCode": {
        "type": "string",
        "enum": [
          "VALIDATION_FAILED",
          "INVALID_JSON",
          "UNAUTHORIZED",
          "FORBIDDEN",
          "NOT_FOUND",
          "METHOD_NOT_ALLOWED",
          "CONFLICT",
          "UNPROCESSABLE",
          "RATE_LIMIT_EXCEEDED",
          "INTERNAL_ERROR",
          "DB_UNAVAILABLE",
          "DEPENDENCY_UNAVAILABLE",
          "PERSON_DEPARTED",
          "USER_DEPROVISIONED",
          "IDEMPOTENCY_KEY_REUSED",
          "IDEMPOTENCY_IN_PROGRESS",
          "NO_ELIGIBLE_APPROVER",
          "ALREADY_DECIDED",
          "HOLD_EXPIRED",
          "RBAC_DENIED",
          "VALIDATION_ERROR",
          "INVALID_ID",
          "ATTESTATION_REQUIRED",
          "SERVICE_DEGRADED",
          "INVALID_PARAM",
          "JUSTIFICATION_REQUIRED",
          "SELF_CERTIFICATION_FORBIDDEN",
          "CAMPAIGN_CANCELLED",
          "CONFIRMATION_EXPIRED",
          "EVENT_NOT_AVAILABLE"
        ],
        "description": "Stable machine identifier. Primary contract — never changes meaning. Additive only; new codes may appear in future releases. Consumers should switch on this field rather than parsing `message`.",
        "example": "RATE_LIMIT_EXCEEDED"
      },
      "McpAuthorizeResponse": {
        "type": "object",
        "properties": {
          "ver": {
            "type": "number",
            "const": 1
          },
          "decision": {
            "type": "string",
            "enum": [
              "allow",
              "deny",
              "hold"
            ]
          },
          "decision_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
            "description": "Recorded on every audit event of this decision."
          },
          "reason": {
            "description": "Why the call is denied (a gateway deny reason code); null otherwise.",
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "type": [
              "string",
              "null"
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "enforce",
              "shadow"
            ],
            "description": "The server's gateway mode (DIRECT is decided as enforce). Under shadow the answer is allow, with would_deny set."
          },
          "would_deny": {
            "description": "Under shadow: the reason the call would have been denied.",
            "type": [
              "string",
              "null"
            ]
          },
          "hold": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/McpAuthorizeHold"
              },
              {
                "type": "null"
              }
            ],
            "description": "Set when the call waits for a person. Poll it; once approved, send the SAME call again to get allow."
          },
          "retry_after_seconds": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "flags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "What inspection found in the arguments (e.g. PII_SSN)."
          },
          "handling": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/McpCallHandling"
              },
              {
                "type": "null"
              }
            ],
            "description": "How to handle the call and its response; null when the agent was not authenticated for the server."
          }
        },
        "required": [
          "ver",
          "decision",
          "decision_id",
          "reason",
          "message",
          "mode",
          "would_deny",
          "hold",
          "retry_after_seconds",
          "flags",
          "handling"
        ],
        "additionalProperties": false
      },
      "McpAuthorizeHold": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,100}$"
          },
          "poll": {
            "type": "string",
            "description": "GET this path (same API key) for the hold's status."
          }
        },
        "required": [
          "id",
          "poll"
        ],
        "additionalProperties": false
      },
      "McpCallHandling": {
        "type": "object",
        "properties": {
          "redact": {
            "type": "object",
            "properties": {
              "count": {
                "type": "boolean",
                "description": "Count personal data in the response (the server's owner marked it as handling personal data)."
              },
              "enforce": {
                "type": "boolean",
                "description": "Replace it in the response too (the tenant enforces redaction)."
              }
            },
            "required": [
              "count",
              "enforce"
            ],
            "additionalProperties": false
          },
          "offline_fail_open": {
            "type": "boolean",
            "description": "A later call AtmanID cannot decide may be forwarded undecided: the tenant allows it and this server is below HIGH risk. False: refuse it."
          }
        },
        "required": [
          "redact",
          "offline_fail_open"
        ],
        "additionalProperties": false
      },
      "McpAuthorizeHoldStatus": {
        "type": "object",
        "properties": {
          "ver": {
            "type": "number",
            "const": 1
          },
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,100}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "rejected",
              "expired",
              "used"
            ],
            "description": "approved: send the same call again — it is allowed once. used: that approval was already used."
          }
        },
        "required": [
          "ver",
          "id",
          "status"
        ],
        "additionalProperties": false
      },
      "McpHoldDecisionResult": {
        "type": "object",
        "properties": {
          "ver": {
            "type": "number",
            "const": 1
          },
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,100}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "approved",
              "rejected"
            ]
          },
          "decided_by": {
            "type": "string",
            "description": "The API key's owner, who made the decision."
          },
          "decided_at": {
            "type": "string",
            "description": "ISO 8601."
          },
          "approval_expires_at": {
            "description": "An approval is valid until then (the tenant's window); null for a deny.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "ver",
          "id",
          "status",
          "decided_by",
          "decided_at",
          "approval_expires_at"
        ],
        "additionalProperties": false
      },
      "ConfirmationAccepted": {
        "type": "object",
        "properties": {
          "confirmation": {
            "$ref": "#/components/schemas/Confirmation"
          }
        },
        "required": [
          "confirmation"
        ],
        "additionalProperties": false,
        "description": "Nothing was changed yet. The key's owner (or, for a decision, another person allowed to make it) must confirm it with MFA in the console within 15 minutes; poll GET /confirmations/{id} for the outcome. A retry of the same call while it waits returns the same confirmation."
      },
      "Confirmation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "confirmed",
              "rejected",
              "expired"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "mcp_server_mode",
              "gateway_hold_approve",
              "access_request_approve"
            ],
            "description": "What waits."
          },
          "resource_id": {
            "type": "string",
            "description": "The server, hold or access request the call named."
          },
          "expires_at": {
            "type": "string",
            "description": "ISO 8601. Unconfirmed by then, the change is dropped (CONFIRMATION_EXPIRED)."
          },
          "confirm_path": {
            "type": "string",
            "description": "Where a person confirms it in the console, relative to the app origin."
          }
        },
        "required": [
          "id",
          "status",
          "action",
          "resource_id",
          "expires_at",
          "confirm_path"
        ],
        "additionalProperties": false
      },
      "AccessRequestDecisionResult": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "decision": {
            "type": "string",
            "enum": [
              "APPROVE",
              "REJECT"
            ]
          },
          "outcome": {
            "type": "string",
            "description": "What the decision did, in words."
          },
          "request_status": {
            "type": "string",
            "enum": [
              "PENDING",
              "APPROVED",
              "REJECTED"
            ],
            "description": "PENDING: the stage still needs votes, or the request moved to its next stage."
          },
          "current_stage": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "total_stages": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "quorum": {
            "type": "object",
            "properties": {
              "approved": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "required": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "met": {
                "type": "boolean"
              },
              "understaffed": {
                "type": "boolean"
              }
            },
            "required": [
              "approved",
              "required",
              "met"
            ],
            "additionalProperties": false
          },
          "rejection_quorum": {
            "type": "object",
            "properties": {
              "rejected": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "required": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "met": {
                "type": "boolean"
              }
            },
            "required": [
              "rejected",
              "required",
              "met"
            ],
            "additionalProperties": false
          },
          "sod_warnings": {
            "description": "Warn-level SoD conflicts the final approval went ahead with.",
            "type": "array",
            "items": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            }
          }
        },
        "required": [
          "ok",
          "decision",
          "outcome",
          "request_status",
          "current_stage",
          "total_stages"
        ],
        "additionalProperties": false
      },
      "AccessRequestDecisionIntercepted": {
        "type": "object",
        "properties": {
          "intercepted": {
            "type": "boolean",
            "const": true
          },
          "message": {
            "type": "string"
          },
          "blast_radius_score": {
            "type": "number"
          },
          "disposition": {
            "type": "string"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "intercepted",
          "message",
          "blast_radius_score",
          "disposition",
          "reasons"
        ],
        "additionalProperties": false
      },
      "AgentPolicyListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentPolicy"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total number of records across all pages.",
            "example": 142
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "example": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "example": 25
          },
          "total_pages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Math.max(1, Math.ceil(total / limit)). Always at least 1, so an empty result set reports 1 page, not 0.",
            "example": 6
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "AgentPolicy": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "aip-mh3k2x9"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "agent_id": {
            "description": "The agent it applies to; null applies to every agent.",
            "type": [
              "string",
              "null"
            ]
          },
          "intent_pattern": {
            "type": "string",
            "description": "The intent it matches (wildcards *), e.g. github:create_*."
          },
          "resource_pattern": {
            "type": "string"
          },
          "action": {
            "type": "string",
            "enum": [
              "ALLOW",
              "DENY",
              "REQUIRE_HITL"
            ]
          },
          "risk_threshold": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "LOW",
                  "MEDIUM",
                  "HIGH",
                  "CRITICAL"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "approver": {
            "description": "Who decides this policy's holds; null = the agent-oversight roles.",
            "type": [
              "string",
              "null"
            ]
          },
          "priority": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Lower is evaluated first."
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT",
              "ARCHIVED"
            ]
          },
          "conditions": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "Argument conditions, all of which must hold."
          },
          "redact_args": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "created_by": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_triggered": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "agent_id",
          "intent_pattern",
          "resource_pattern",
          "action",
          "risk_threshold",
          "approver",
          "priority",
          "status",
          "conditions",
          "redact_args",
          "created_by",
          "created_at",
          "updated_at",
          "last_triggered"
        ],
        "additionalProperties": false
      },
      "AgentPolicySimulation": {
        "type": "object",
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "ALLOW",
              "DENY",
              "REQUIRE_HITL"
            ],
            "description": "What the policies say (policy only)."
          },
          "reason": {
            "type": "string"
          },
          "enforced_decision": {
            "type": "string",
            "enum": [
              "ALLOW",
              "DENY",
              "REQUIRE_HITL"
            ],
            "description": "What enforcement would return right now, an active JIT session included."
          },
          "jit_coverage": {
            "type": "object",
            "properties": {
              "session": {
                "anyOf": [
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "would_satisfy": {
                "type": "boolean"
              },
              "note": {
                "type": "string"
              }
            },
            "required": [
              "session",
              "would_satisfy",
              "note"
            ],
            "additionalProperties": false
          },
          "matched_policy": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          },
          "deny_wins": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "strictest_decision": {
                    "type": "string",
                    "enum": [
                      "ALLOW",
                      "DENY",
                      "REQUIRE_HITL"
                    ]
                  },
                  "strictest_policy_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "applies": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "strictest_decision",
                  "strictest_policy_id",
                  "applies"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "policies_evaluated": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "trace": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "matched": {
                  "type": "boolean"
                },
                "reason": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name",
                "matched",
                "reason"
              ],
              "additionalProperties": false
            }
          },
          "simulated_at": {
            "type": "string"
          }
        },
        "required": [
          "decision",
          "reason",
          "enforced_decision",
          "jit_coverage",
          "matched_policy",
          "deny_wins",
          "policies_evaluated",
          "trace",
          "simulated_at"
        ],
        "additionalProperties": false
      },
      "McpServerListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/McpServer"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total number of records across all pages.",
            "example": 142
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "example": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "example": 25
          },
          "total_pages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Math.max(1, Math.ceil(total / limit)). Always at least 1, so an empty result set reports 1 page, not 0.",
            "example": 6
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "McpServer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "risk_level": {
            "type": [
              "string",
              "null"
            ]
          },
          "owner_team": {
            "type": [
              "string",
              "null"
            ]
          },
          "transport": {
            "type": [
              "string",
              "null"
            ]
          },
          "governance_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "gateway_mode": {
            "type": "string",
            "enum": [
              "DIRECT",
              "SHADOW",
              "ENFORCE"
            ],
            "description": "SHADOW logs what the gateway would deny; ENFORCE denies it."
          },
          "gateway_promoted_at": {
            "description": "When the server was last moved into ENFORCE.",
            "type": [
              "string",
              "null"
            ]
          },
          "intent_mode": {
            "type": "string",
            "enum": [
              "OFF",
              "SHADOW",
              "ENFORCE"
            ],
            "description": "Intent policy: off, logged only, or enforced."
          },
          "registered_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "status",
          "risk_level",
          "owner_team",
          "transport",
          "governance_status",
          "gateway_mode",
          "gateway_promoted_at",
          "intent_mode",
          "registered_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "McpServerModePreview": {
        "type": "object",
        "properties": {
          "server_id": {
            "type": "string"
          },
          "window_days": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "gateway": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string"
              },
              "totals": {
                "type": "object",
                "properties": {
                  "would_deny_insufficient_scope": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "would_deny_rate_limit_agent_global": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "would_deny_rate_limit_agent_server": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "would_deny_inspection_flagged": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "deny_insufficient_scope": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "deny_rate_limit_agent_global": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "deny_rate_limit_agent_server": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "deny_inspection_flagged": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "total_gateway_events": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "would_deny_insufficient_scope",
                  "would_deny_rate_limit_agent_global",
                  "would_deny_rate_limit_agent_server",
                  "would_deny_inspection_flagged",
                  "deny_insufficient_scope",
                  "deny_rate_limit_agent_global",
                  "deny_rate_limit_agent_server",
                  "deny_inspection_flagged",
                  "total_gateway_events"
                ],
                "additionalProperties": false
              },
              "top_tools": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "tool_name": {
                      "type": "string"
                    },
                    "count": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "tool_name",
                    "count"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "mode",
              "totals",
              "top_tools"
            ],
            "additionalProperties": false
          },
          "intent": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string"
              },
              "totals": {
                "type": "object",
                "properties": {
                  "would_deny_intent_deny": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "would_deny_intent_hitl_timeout": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "would_deny_intent_hitl_rejected": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "would_deny_intent_lookup_failed": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "deny_intent_deny": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "deny_intent_hitl_timeout": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "deny_intent_hitl_rejected": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "deny_intent_lookup_failed": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "total_intent_events": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "would_deny_intent_deny",
                  "would_deny_intent_hitl_timeout",
                  "would_deny_intent_hitl_rejected",
                  "would_deny_intent_lookup_failed",
                  "deny_intent_deny",
                  "deny_intent_hitl_timeout",
                  "deny_intent_hitl_rejected",
                  "deny_intent_lookup_failed",
                  "total_intent_events"
                ],
                "additionalProperties": false
              },
              "top_tools": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "tool_name": {
                      "type": "string"
                    },
                    "count": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "tool_name",
                    "count"
                  ],
                  "additionalProperties": false
                }
              },
              "coverage": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {},
                "description": "Tools agents may call that no intent binding covers: under ENFORCE they are denied by default, with or without traffic."
              }
            },
            "required": [
              "mode",
              "totals",
              "top_tools",
              "coverage"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "server_id",
          "window_days",
          "gateway",
          "intent"
        ],
        "additionalProperties": false
      },
      "McpServerModes": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "gateway_mode": {
            "type": "string"
          },
          "gateway_promoted_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "intent_mode": {
            "type": "string"
          },
          "changed": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "gateway_mode",
                "intent_mode"
              ]
            },
            "description": "What this call changed; empty when both were already as asked."
          }
        },
        "required": [
          "id",
          "name",
          "gateway_mode",
          "gateway_promoted_at",
          "intent_mode",
          "changed"
        ],
        "additionalProperties": false
      },
      "CertificationCampaignListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CertificationCampaignSummary"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total number of records across all pages.",
            "example": 142
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "example": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "example": 25
          },
          "total_pages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Math.max(1, Math.ceil(total / limit)). Always at least 1, so an empty result set reports 1 page, not 0.",
            "example": 6
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "CertificationCampaignSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT",
              "CLOSED",
              "CANCELLED",
              "COMPLETED"
            ]
          },
          "campaign_type": {
            "type": "string"
          },
          "scope_ref": {
            "type": [
              "string",
              "null"
            ]
          },
          "deadline": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "created_by_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "total_reviews": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "completed_reviews": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "escalated_reviews": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "progress": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Percent of items decided."
          }
        },
        "required": [
          "id",
          "name",
          "status",
          "campaign_type",
          "scope_ref",
          "deadline",
          "created_at",
          "created_by_name",
          "total_reviews",
          "completed_reviews",
          "escalated_reviews",
          "progress"
        ],
        "additionalProperties": false
      },
      "CertificationCampaignLaunched": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT"
            ]
          },
          "campaign_type": {
            "type": "string"
          },
          "reviews_queued": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "reviews_skipped_no_reviewer": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Owner-reviewed items left out because nobody can review them."
          },
          "wave_count": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "status",
          "campaign_type",
          "reviews_queued",
          "reviews_skipped_no_reviewer",
          "wave_count"
        ],
        "additionalProperties": false
      },
      "CertificationCampaign": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT",
              "CLOSED",
              "CANCELLED",
              "COMPLETED"
            ]
          },
          "campaign_type": {
            "type": "string"
          },
          "scope_ref": {
            "type": [
              "string",
              "null"
            ]
          },
          "deadline": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "non_response_action": {
            "type": "string",
            "enum": [
              "ESCALATE",
              "AUTO_REVOKE",
              "AUTO_CERTIFY"
            ]
          },
          "non_response_days": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "delegation_allowed": {
            "type": "boolean"
          },
          "is_scheduled": {
            "type": "boolean"
          },
          "launch_trigger": {
            "type": "string"
          },
          "wave_size": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "wave_count": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "total_reviews": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "pending_reviews": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "certified_reviews": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "revoked_reviews": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "escalated_reviews": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "name",
          "status",
          "campaign_type",
          "scope_ref",
          "deadline",
          "created_at",
          "updated_at",
          "non_response_action",
          "non_response_days",
          "delegation_allowed",
          "is_scheduled",
          "launch_trigger",
          "wave_size",
          "wave_count",
          "total_reviews",
          "pending_reviews",
          "certified_reviews",
          "revoked_reviews",
          "escalated_reviews"
        ],
        "additionalProperties": false
      },
      "CertificationReviewListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CertificationReviewItem"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total number of records across all pages.",
            "example": 142
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "example": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "example": 25
          },
          "total_pages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Math.max(1, Math.ceil(total / limit)). Always at least 1, so an empty result set reports 1 page, not 0.",
            "example": 6
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "CertificationReviewItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CERTIFIED",
              "REVOKED",
              "ESCALATED"
            ]
          },
          "subject_type": {
            "type": "string",
            "description": "user_entitlement, user_role, api_scope_grant, nhi_owner, agent_tool_grant or mcp_server."
          },
          "subject_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "subject_user_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "subject_user_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "entitlement_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "application_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "risk_level": {
            "type": [
              "string",
              "null"
            ]
          },
          "reviewer_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "reviewer_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "reviewer_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "reviewed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "escalation_note": {
            "type": [
              "string",
              "null"
            ]
          },
          "overridden": {
            "type": "boolean"
          },
          "remediation_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "stage": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "created_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "status",
          "subject_type",
          "subject_id",
          "subject_user_id",
          "subject_user_name",
          "entitlement_name",
          "application_name",
          "risk_level",
          "reviewer_id",
          "reviewer_name",
          "reviewer_email",
          "reviewed_at",
          "note",
          "escalation_note",
          "overridden",
          "remediation_status",
          "stage",
          "created_at"
        ],
        "additionalProperties": false
      },
      "CertificationReviewDecisionResult": {
        "type": "object",
        "properties": {
          "decided": {
            "type": "boolean",
            "const": true
          },
          "success": {
            "type": "boolean",
            "const": true
          },
          "retire_requested": {
            "description": "REVOKE of an MCP server item: retirement was requested from its administrator.",
            "type": "boolean"
          },
          "revocation_ticket_id": {
            "description": "REVOKE: the ticket that removes the access, when one was opened.",
            "type": [
              "string",
              "null"
            ]
          },
          "escalated_to_id": {
            "type": "string"
          },
          "escalated_to_name": {
            "type": "string"
          }
        },
        "required": [
          "decided",
          "success"
        ],
        "additionalProperties": false
      },
      "CertificationReviewDecisionIntercepted": {
        "type": "object",
        "properties": {
          "decided": {
            "type": "boolean",
            "const": false
          },
          "intercepted": {
            "type": "boolean",
            "const": true
          },
          "message": {
            "type": "string"
          },
          "blast_radius_score": {
            "type": "number"
          },
          "disposition": {
            "type": "string"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "decided",
          "intercepted",
          "message",
          "blast_radius_score",
          "disposition",
          "reasons"
        ],
        "additionalProperties": false
      },
      "McpDecisionListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/McpDecisionRecord"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total number of records across all pages.",
            "example": 142
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "example": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "example": 25
          },
          "total_pages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Math.max(1, Math.ceil(total / limit)). Always at least 1, so an empty result set reports 1 page, not 0.",
            "example": 6
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "McpDecisionRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "decision_id": {
            "description": "The decision_id /mcp/authorize answered with, when made for your gateway.",
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "agent_id": {
            "type": "string"
          },
          "agent_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "server_id": {
            "type": "string"
          },
          "tool": {
            "type": "string"
          },
          "decision": {
            "type": "string",
            "enum": [
              "allow",
              "deny",
              "hold",
              "would_deny",
              "bypass"
            ]
          },
          "deny_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "intent_policy_id": {
            "description": "The intent policy that denied or held the call.",
            "type": [
              "string",
              "null"
            ]
          },
          "flags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "response_status": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "latency_ms": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "response_redactions": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "caller_gateway": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "decision_id",
          "created_at",
          "agent_id",
          "agent_name",
          "server_id",
          "tool",
          "decision",
          "deny_reason",
          "intent_policy_id",
          "flags",
          "response_status",
          "latency_ms",
          "response_redactions",
          "caller_gateway"
        ],
        "additionalProperties": false
      },
      "ConfirmationRead": {
        "type": "object",
        "properties": {
          "confirmation": {
            "$ref": "#/components/schemas/Confirmation"
          },
          "result": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "body": {}
                },
                "required": [
                  "status",
                  "body"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "Once confirmed: what applying the change returned. null while pending or when rejected."
          }
        },
        "required": [
          "confirmation",
          "result"
        ],
        "additionalProperties": false
      },
      "AppListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppListItem"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total number of records across all pages.",
            "example": 142
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "example": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "example": 25
          },
          "total_pages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Math.max(1, Math.ceil(total / limit)). Always at least 1, so an empty result set reports 1 page, not 0.",
            "example": 6
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "AppListItem": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "sync_status": {
            "type": "string",
            "enum": [
              "healthy",
              "warning",
              "error",
              "unknown"
            ]
          },
          "created_at": {
            "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))$"
          }
        },
        "required": [
          "id",
          "name",
          "type",
          "sync_status",
          "created_at"
        ],
        "additionalProperties": false
      },
      "UserListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/User"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total number of records across all pages.",
            "example": 142
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "example": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "example": 25
          },
          "total_pages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Math.max(1, Math.ceil(total / limit)). Always at least 1, so an empty result set reports 1 page, not 0.",
            "example": 6
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "User": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
            "example": "alice@example.com"
          },
          "first_name": {
            "type": "string",
            "example": "Alice"
          },
          "last_name": {
            "type": "string",
            "example": "Chen"
          },
          "full_name": {
            "type": "string",
            "example": "Alice Chen"
          },
          "department": {
            "example": "Engineering",
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "example": "Senior Engineer",
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "SUSPENDED",
              "EXPIRED",
              "DEPROVISIONED"
            ]
          },
          "identity_type": {
            "type": "string",
            "enum": [
              "employee",
              "contractor",
              "vendor",
              "partner"
            ]
          },
          "role": {
            "description": "Highest platform role the user holds.",
            "type": [
              "string",
              "null"
            ]
          },
          "entitlement_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "app_account_count": {
            "description": "Number of the person's active application accounts (GET /users/{id} only).",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "manager_id": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_login_at": {
            "anyOf": [
              {
                "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))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "expiry_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "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))$"
          }
        },
        "required": [
          "id",
          "email",
          "first_name",
          "last_name",
          "full_name",
          "department",
          "title",
          "status",
          "identity_type",
          "role",
          "entitlement_count",
          "last_login_at",
          "created_at"
        ],
        "additionalProperties": false,
        "description": "Human identity in the tenant."
      },
      "UserEntitlementListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Entitlement"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total number of records across all pages.",
            "example": 142
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "example": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "example": 25
          },
          "total_pages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Math.max(1, Math.ceil(total / limit)). Always at least 1, so an empty result set reports 1 page, not 0.",
            "example": 6
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "Entitlement": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "name": {
            "type": "string",
            "example": "sales-admin"
          },
          "type": {
            "description": "role | permission | group | etc.",
            "type": [
              "string",
              "null"
            ]
          },
          "risk_level": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "low",
                  "medium",
                  "high"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "application_id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "application_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "holder_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Number of active accounts currently holding this entitlement."
          },
          "created_at": {
            "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))$"
          }
        },
        "required": [
          "id",
          "name",
          "type",
          "risk_level",
          "description",
          "application_id",
          "application_name",
          "holder_count",
          "created_at"
        ],
        "additionalProperties": false,
        "description": "Fine-grained permission attached to an application."
      },
      "AccessSnapshotResponse": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "LIVE",
              "RECENT_REPLAY",
              "SNAPSHOT_FORWARD"
            ]
          },
          "queriedAt": {
            "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))$"
          },
          "state": {
            "$ref": "#/components/schemas/AccessSnapshotState"
          },
          "audit_seq_at_result": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "has_chain_gap": {
            "type": "boolean"
          },
          "chain_gap_seqs": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            }
          }
        },
        "required": [
          "mode",
          "queriedAt",
          "state",
          "audit_seq_at_result",
          "has_chain_gap"
        ],
        "additionalProperties": false
      },
      "AccessSnapshotState": {
        "type": "object",
        "properties": {
          "subject_id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "subject_type": {
            "type": "string",
            "enum": [
              "user",
              "nhi"
            ]
          },
          "computed_at": {
            "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))$"
          },
          "entitlements": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "user_entitlement_id": {
                  "$ref": "#/components/schemas/Uuid"
                },
                "entitlement_id": {
                  "$ref": "#/components/schemas/Uuid"
                },
                "entitlement_name": {
                  "type": "string"
                },
                "application_id": {
                  "$ref": "#/components/schemas/Uuid"
                },
                "application_name": {
                  "type": "string"
                },
                "risk_level": {
                  "type": "string"
                },
                "granted_at": {
                  "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))$"
                },
                "status": {
                  "type": "string"
                }
              },
              "required": [
                "user_entitlement_id",
                "entitlement_id",
                "entitlement_name",
                "application_id",
                "application_name",
                "risk_level",
                "granted_at",
                "status"
              ],
              "additionalProperties": false
            }
          },
          "counters": {
            "type": "object",
            "properties": {
              "active_count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "critical_count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "high_count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "medium_count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "low_count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "active_count",
              "critical_count",
              "high_count",
              "medium_count",
              "low_count"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "subject_id",
          "subject_type",
          "computed_at",
          "entitlements",
          "counters"
        ],
        "additionalProperties": false
      },
      "EntitlementListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Entitlement"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total number of records across all pages.",
            "example": 142
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "example": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "example": 25
          },
          "total_pages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Math.max(1, Math.ceil(total / limit)). Always at least 1, so an empty result set reports 1 page, not 0.",
            "example": 6
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "AccessRequestListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccessRequest"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total number of records across all pages.",
            "example": 142
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "example": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "example": 25
          },
          "total_pages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Math.max(1, Math.ceil(total / limit)). Always at least 1, so an empty result set reports 1 page, not 0.",
            "example": 6
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "AccessRequest": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "APPROVED",
              "DENIED",
              "PROVISIONED",
              "EXPIRED",
              "REVOKED"
            ]
          },
          "justification": {
            "type": [
              "string",
              "null"
            ]
          },
          "cart_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccessRequestCartItem"
            }
          },
          "source": {
            "description": "web | api | hris | scim | agent — which upstream originated the request.",
            "type": [
              "string",
              "null"
            ]
          },
          "requested_by_system": {
            "example": "hris-workday",
            "type": [
              "string",
              "null"
            ]
          },
          "requester": {
            "$ref": "#/components/schemas/UserRef"
          },
          "target_user": {
            "$ref": "#/components/schemas/UserRef"
          },
          "created_at": {
            "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))$"
          },
          "resolved_at": {
            "anyOf": [
              {
                "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))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "status",
          "justification",
          "cart_items",
          "source",
          "requested_by_system",
          "requester",
          "target_user",
          "created_at",
          "resolved_at"
        ],
        "additionalProperties": false,
        "description": "Single access-grant workflow instance."
      },
      "AccessRequestCartItem": {
        "type": "object",
        "properties": {
          "entitlement_id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "entitlement_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "application_name": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "entitlement_id",
          "entitlement_name",
          "application_name"
        ],
        "additionalProperties": false
      },
      "UserRef": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "email": {
            "anyOf": [
              {
                "type": "string",
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "full_name": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "email",
          "full_name"
        ],
        "additionalProperties": false,
        "description": "Minimal user reference (embedded inside larger resources)."
      },
      "AccessRequestDetail": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "status": {
            "type": "string",
            "description": "PENDING, APPROVED, DENIED, PROVISIONED, EXPIRED, REVOKED, CANCELLED, or BATCH_SUBMITTED for a cart split into one request per item (see items)."
          },
          "justification": {
            "type": [
              "string",
              "null"
            ]
          },
          "requested_by_system": {
            "example": "hris-workday",
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": "string",
            "description": "ui, api, hris, scim or agent — which upstream originated the request."
          },
          "cart_items": {
            "type": "array",
            "items": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            },
            "description": "The requested items, as submitted."
          },
          "created_at": {
            "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))$"
          },
          "resolved_at": {
            "anyOf": [
              {
                "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))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "requester": {
            "$ref": "#/components/schemas/AccessRequestDetailPerson"
          },
          "target_user": {
            "$ref": "#/components/schemas/AccessRequestDetailPerson"
          },
          "approval_chain": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalChainItem"
            },
            "description": "Approval rows in stage order. Within a stage: a PENDING row first while the stage is open, then the row that decided (most recent first), then rows closed without deciding."
          },
          "items": {
            "description": "BATCH_SUBMITTED only: one child request per item.",
            "type": "array",
            "items": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            }
          },
          "total_items": {
            "description": "BATCH_SUBMITTED only.",
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "status",
          "justification",
          "requested_by_system",
          "source",
          "cart_items",
          "created_at",
          "resolved_at",
          "requester",
          "target_user",
          "approval_chain"
        ],
        "additionalProperties": false,
        "description": "Single access-grant workflow instance, with its approval chain."
      },
      "AccessRequestDetailPerson": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "anyOf": [
              {
                "type": "string",
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "department": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "email",
          "department"
        ],
        "additionalProperties": false
      },
      "ApprovalChainItem": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "stage_number": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "status": {
            "type": "string",
            "description": "PENDING, APPROVED, REJECTED, or SUPERSEDED / CANCELLED for a row closed without deciding."
          },
          "approver_id": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Who the stage was assigned to."
          },
          "approver_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "approver_email": {
            "anyOf": [
              {
                "type": "string",
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "acted_at": {
            "anyOf": [
              {
                "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))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "comments": {
            "description": "The decider's note. Null when a policy decided (its internal note is not exposed).",
            "type": [
              "string",
              "null"
            ]
          },
          "decided_by": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UserRef"
              },
              {
                "type": "null"
              }
            ],
            "description": "The person who decided: the approver, their delegate, or an admin overriding. Null when a policy decided, or before a decision. Added in 1.30.0."
          },
          "decided_by_policy": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "sla_auto_rejected",
                  "sla_auto_approved",
                  "sla_closed_unreached"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Set when a policy decided instead of a person: the stage reached its deadline (auto-rejected or auto-approved), or a later stage was closed because an earlier one was auto-rejected. Added in 1.30.0."
          },
          "admin_override": {
            "type": "boolean",
            "description": "An administrator decided on the approver's behalf. Added in 1.30.0."
          }
        },
        "required": [
          "id",
          "stage_number",
          "status",
          "approver_id",
          "approver_name",
          "approver_email",
          "acted_at",
          "comments",
          "decided_by",
          "decided_by_policy",
          "admin_override"
        ],
        "additionalProperties": false,
        "description": "One approval row of an access request, with who decided it."
      },
      "JmlResult": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "cached": {
            "type": "boolean",
            "description": "True when this is an idempotent replay of a previous request."
          },
          "idempotency_key": {
            "type": "string",
            "description": "Client-generated key used to de-duplicate retries. Echoes input."
          },
          "identity_event_id": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "user_id": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "processed",
              "queued",
              "noop",
              "error"
            ]
          },
          "message": {
            "type": [
              "string",
              "null"
            ]
          },
          "warnings": {
            "description": "Joiner and mover (1.19.0): parts of the request that were not applied. A manager who has left or matches no current user is not set — the joiner creates the person with no manager, the mover leaves the manager unchanged — and an audit row (JML_MANAGER_DEPARTED_SKIPPED / JML_MANAGER_NOT_FOUND_SKIPPED) records it. Empty when everything applied; absent on an idempotent replay.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JmlWarning"
            }
          }
        },
        "required": [
          "ok",
          "cached",
          "idempotency_key",
          "identity_event_id",
          "user_id",
          "status",
          "message"
        ],
        "additionalProperties": false,
        "description": "Outcome of a JML (joiner/mover/leaver) invocation."
      },
      "JmlWarning": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "PERSON_DEPARTED",
              "NOT_FOUND"
            ],
            "description": "`PERSON_DEPARTED`: the named manager has left the organization (terminated, deprovisioned or access ended). `NOT_FOUND`: the address matches no current user. Same codes as the error enum; switch on this field."
          },
          "field": {
            "type": "string",
            "enum": [
              "manager_email",
              "new_manager_email"
            ]
          },
          "message": {
            "type": "string",
            "description": "Human-readable sentence; wording may change between releases."
          }
        },
        "required": [
          "code",
          "field",
          "message"
        ],
        "additionalProperties": false,
        "description": "Part of the request was not applied; the rest was."
      },
      "AgentListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentSummary"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total number of records across all pages.",
            "example": 142
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "example": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "example": 25
          },
          "total_pages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Math.max(1, Math.ceil(total / limit)). Always at least 1, so an empty result set reports 1 page, not 0.",
            "example": 6
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "AgentSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "agt-v1-7a2c8d9f"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "framework": {
            "type": [
              "string",
              "null"
            ]
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "owner_team": {
            "type": [
              "string",
              "null"
            ]
          },
          "owner_email": {
            "anyOf": [
              {
                "type": "string",
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "owner_id": {
            "description": "UUID of the human owner, resolved from owner_email at registration. NULL = no resolvable human owner (external / team-alias) — an accountability gap.",
            "type": [
              "string",
              "null"
            ]
          },
          "owner_user_name": {
            "description": "Display name of the resolved human owner (first + last), or NULL when owner_id is NULL.",
            "type": [
              "string",
              "null"
            ]
          },
          "owner_group_id": {
            "description": "UUID of the managing team (approver_group), or NULL when no team manages this agent.",
            "type": [
              "string",
              "null"
            ]
          },
          "owner_group_name": {
            "description": "Name of the managing team, or NULL when owner_group_id is NULL.",
            "type": [
              "string",
              "null"
            ]
          },
          "environment": {
            "type": [
              "string",
              "null"
            ]
          },
          "vendor": {
            "type": [
              "string",
              "null"
            ]
          },
          "purpose": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "example": "ACTIVE"
          },
          "registered_at": {
            "anyOf": [
              {
                "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))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "deleted_at": {
            "anyOf": [
              {
                "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))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "managed_by": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "type",
          "status"
        ],
        "additionalProperties": false,
        "description": "Compact agent shape for list endpoints. Used by GitOps consumers to compute diff plans."
      },
      "AgentRegisterResult": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "cached": {
            "description": "True when the response is an idempotent replay of a previous call within the 24h window.",
            "type": "boolean"
          },
          "idempotency_key": {
            "type": "string"
          },
          "agent_id": {
            "type": "string",
            "description": "Stable identifier for the new agent. Use as targetResourceId on subsequent audit lookups.",
            "example": "agt-v1-7a2c8d9f"
          },
          "status": {
            "type": "string",
            "description": "Initial status — always \"PENDING_REVIEW\" for fresh registrations.",
            "example": "PENDING_REVIEW"
          },
          "name": {
            "type": "string"
          },
          "advisory": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          },
          "next_step": {
            "type": "string"
          },
          "original_processed_at": {
            "description": "Only present on cached replays — the timestamp of the original successful registration.",
            "type": "string"
          }
        },
        "required": [
          "ok",
          "agent_id",
          "status"
        ],
        "additionalProperties": false,
        "description": "Outcome of an agent (NHI) registration via /api/v1/agents."
      },
      "AgentPatchResult": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "cached": {
            "type": "boolean"
          },
          "idempotency_key": {
            "type": "string"
          },
          "agent_id": {
            "type": "string"
          },
          "updated_fields": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "message": {
            "type": "string"
          },
          "original_processed_at": {
            "type": "string"
          }
        },
        "required": [
          "ok",
          "agent_id",
          "updated_fields"
        ],
        "additionalProperties": false
      },
      "AgentDeactivateResult": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "cached": {
            "type": "boolean"
          },
          "idempotency_key": {
            "type": "string"
          },
          "agent_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "const": "DEPROVISIONED"
          },
          "deactivated_at": {
            "anyOf": [
              {
                "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))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "message": {
            "type": "string"
          },
          "original_processed_at": {
            "type": "string"
          }
        },
        "required": [
          "ok",
          "agent_id",
          "status"
        ],
        "additionalProperties": false
      },
      "JmlStatus": {
        "type": "object",
        "properties": {
          "idempotency_key": {
            "type": "string"
          },
          "identity_event_id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "event_type": {
            "type": "string",
            "enum": [
              "joiner",
              "mover",
              "leaver"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "in_progress",
              "pending_approval",
              "completed",
              "partial",
              "failed"
            ],
            "description": "`pending` until the matching JML workflow has run, then `completed`, `partial` or `failed`. `in_progress` and `pending_approval` are states of the workflow's own events."
          },
          "hris_system": {
            "type": [
              "string",
              "null"
            ]
          },
          "effective_date": {
            "description": "The HR effective date, as an ISO 8601 timestamp at midnight UTC (for example 2026-10-21T00:00:00.000Z).",
            "type": [
              "string",
              "null"
            ]
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "queued_at": {
            "type": "string"
          },
          "result": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "user_id": {
                    "$ref": "#/components/schemas/Uuid"
                  },
                  "email": {
                    "type": "string"
                  },
                  "full_name": {
                    "type": "string"
                  },
                  "user_status": {
                    "type": "string"
                  },
                  "accounts_provisioned": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "accounts_deprovisioned": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "tickets_created": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "user_id",
                  "email",
                  "full_name",
                  "user_status",
                  "accounts_provisioned",
                  "accounts_deprovisioned",
                  "tickets_created"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "Set when `status` is `completed`; null otherwise (a `partial` or `failed` run reports its `errors`)."
          },
          "errors": {
            "description": "Per-application errors of a `partial` or `failed` run (since 1.22.0; runs finished before it carry none); absent when there were none.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JmlStatusError"
            }
          }
        },
        "required": [
          "idempotency_key",
          "identity_event_id",
          "event_type",
          "status",
          "hris_system",
          "effective_date",
          "completed_at",
          "queued_at",
          "result"
        ],
        "additionalProperties": false,
        "description": "A JML event's current state, looked up by the idempotency key it was sent with."
      },
      "JmlStatusError": {
        "type": "object",
        "properties": {
          "app_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "app_name": {
            "description": "Null for a joiner run, whose errors name the application by id only.",
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "description": "What went wrong in that application, as a fixed label (for example \"Timed out\"). Since 1.22.0 never the connector's own error text; the detail is in AtmanID's logs.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "app_id",
          "app_name",
          "message"
        ],
        "additionalProperties": false
      },
      "SodViolationListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SodViolation"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total number of records across all pages.",
            "example": 142
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "example": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "example": 25
          },
          "total_pages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Math.max(1, Math.ceil(total / limit)). Always at least 1, so an empty result set reports 1 page, not 0.",
            "example": 6
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "SodViolation": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "ACKNOWLEDGED",
              "EXCEPTED",
              "RESOLVED"
            ]
          },
          "detected_at": {
            "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))$"
          },
          "resolved_at": {
            "anyOf": [
              {
                "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))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "user": {
            "$ref": "#/components/schemas/UserRef"
          },
          "rule": {
            "$ref": "#/components/schemas/SodRuleRef"
          },
          "conflicting_entitlements": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EntitlementRef"
            }
          }
        },
        "required": [
          "id",
          "status",
          "detected_at",
          "resolved_at",
          "user",
          "rule",
          "conflicting_entitlements"
        ],
        "additionalProperties": false,
        "description": "Segregation-of-Duties rule violation."
      },
      "SodRuleRef": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "name": {
            "type": "string"
          },
          "severity": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high",
              "critical"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "severity"
        ],
        "additionalProperties": false
      },
      "EntitlementRef": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "name": {
            "type": "string",
            "example": "sales-admin"
          },
          "application_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "risk_level": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "low",
                  "medium",
                  "high"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "application_name",
          "risk_level"
        ],
        "additionalProperties": false,
        "description": "Minimal entitlement reference embedded inside other resources."
      },
      "IdentityListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Identity"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total number of records across all pages.",
            "example": 142
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "example": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "example": 25
          },
          "total_pages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Math.max(1, Math.ceil(total / limit)). Always at least 1, so an empty result set reports 1 page, not 0.",
            "example": 6
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "Identity": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "email": {
            "anyOf": [
              {
                "type": "string",
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "full_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": "string",
            "description": "hris | scim | manual | etc."
          },
          "external_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "linked_user_id": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string"
          },
          "created_at": {
            "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))$"
          }
        },
        "required": [
          "id",
          "email",
          "full_name",
          "source",
          "external_id",
          "linked_user_id",
          "status",
          "created_at"
        ],
        "additionalProperties": false,
        "description": "Cross-source identity record."
      },
      "BundleListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Bundle"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total number of records across all pages.",
            "example": 142
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "example": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "example": 25
          },
          "total_pages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Math.max(1, Math.ceil(total / limit)). Always at least 1, so an empty result set reports 1 page, not 0.",
            "example": 6
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "Bundle": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "name": {
            "type": "string",
            "example": "Engineering Onboarding"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "example": "onboarding",
            "type": [
              "string",
              "null"
            ]
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BundleItem"
            }
          },
          "is_active": {
            "type": "boolean"
          },
          "created_at": {
            "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))$"
          },
          "updated_at": {
            "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))$"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "category",
          "items",
          "is_active",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false,
        "description": "Named collection of entitlements that can be requested together."
      },
      "BundleItem": {
        "type": "object",
        "properties": {
          "entitlement_id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "entitlement_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "application_name": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "entitlement_id",
          "entitlement_name",
          "application_name"
        ],
        "additionalProperties": false
      },
      "AuditEventListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AuditEvent"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total number of records across all pages.",
            "example": 142
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "example": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "example": 25
          },
          "total_pages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Math.max(1, Math.ceil(total / limit)). Always at least 1, so an empty result set reports 1 page, not 0.",
            "example": 6
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "AuditEvent": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "tenant_id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "actor_id": {
            "description": "User ID, service-account ID, API key ID, or system identifier that initiated the action.",
            "type": [
              "string",
              "null"
            ]
          },
          "actor_name": {
            "description": "Snapshot of the actor name at the time of the action. For people: their name at the time of the action. For API keys: the key's name (e.g., \"production-stripe-sync\"). For agents: the registered agent name. For system jobs: \"System: <slug>\". For GDPR-redacted rows: \"[REDACTED]\". For legacy rows pre-Phase-2 sweep: JOIN-resolved current name (see actor_name_source).",
            "type": [
              "string",
              "null"
            ]
          },
          "actor_email": {
            "anyOf": [
              {
                "type": "string",
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              {
                "type": "null"
              }
            ],
            "description": "Snapshot of the actor email at write time. NULL for API keys, agents, and system actors."
          },
          "actor_name_source": {
            "description": "`snapshot` — the name recorded with the event at the time of the action (never rewritten). `lookup` — actor_name resolved at read time via JOIN against users (legacy entries pre-Phase-2 sweep; the name shown is CURRENT and may differ from name at action time). `redacted` — actor was redacted under GDPR Article 17.",
            "type": "string",
            "enum": [
              "snapshot",
              "lookup",
              "redacted"
            ]
          },
          "api_key_id": {
            "description": "For actions made with an API key, the ID of that key. Null for actions by people, agents or scheduled jobs.",
            "anyOf": [
              {
                "$ref": "#/components/schemas/Uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "request_id": {
            "description": "Correlation ID matching the X-Request-Id response header on the originating request. Format: req_<26-char-Crockford-base32 ULID>.",
            "example": "req_01KQ0N3AGNJYKE3R9DXRA1R3AN",
            "type": [
              "string",
              "null"
            ]
          },
          "actor_type": {
            "description": "Who initiated the action: `human` (the column DEFAULT, so all pre-April rows read this way), `agent`, `service`, `api_key`, or `system`. NOT a proof of provenance for historical rows — the default means \"unlabelled\", not \"verified human\".",
            "example": "agent",
            "type": [
              "string",
              "null"
            ]
          },
          "delegated_by": {
            "description": "For `actor_type = \"agent\"`, the human on whose authority the agent acted. Written as the delegating user's EMAIL, not their id. NULL for every other actor type.",
            "example": "sarah.chen@example.com",
            "type": [
              "string",
              "null"
            ]
          },
          "confirmation_method": {
            "description": "`proposal_card` — the user was shown a confirmation card for this specific action and clicked it (`slack_button` — the same, in Slack). `standing_auth` — it auto-executed under a standing grant, with no card and no per-action click. `workflow_step_confirm` — a workflow step its person confirmed at the step's prompt; `none` — a workflow step that ran without a per-step confirmation (the person started the workflow). `agent_autonomous_remediation` — an insight subscription's standing remediation, with no live session. For an AI-assisted action, `new_state.invocation` records the channel, the person it was done for, who confirmed it and when, and the workflow and step. NULL for non-agent rows. Rows written before 2026-08-26 say `proposal_card` on BOTH paths and cannot be trusted to distinguish them; workflow steps before 2026-10-28 say `proposal_card` too.",
            "example": "standing_auth",
            "type": [
              "string",
              "null"
            ]
          },
          "agent_session_id": {
            "description": "Correlates every action taken within one agent session. Currently populated only when the caller supplies a UUID-shaped id; non-UUID correlation ids (e.g. the Slack integration's `slack:<team>:<thread>`) are degraded to NULL upstream.",
            "type": [
              "string",
              "null"
            ]
          },
          "action_type": {
            "type": "string",
            "example": "ACCESS_REQUEST_SUBMITTED",
            "description": "The audit event name (upper case, underscores); every name is listed at docs.atmanid.com/reference/audit-events/."
          },
          "target_resource_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "target_resource_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "new_state": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ],
            "description": "JSONB payload — event-specific structured context. A registered agent's action also carries `agent_identities` (v 1): the person it acted for, the delegation it acted under, the agent and the workload it ran as (see the 1.36.0 changelog). An access review decision carries `state_version` and, when a screen showed the item, `facts_shown` (see the 1.37.0 changelog)."
          },
          "ip_address": {
            "type": [
              "string",
              "null"
            ]
          },
          "user_agent": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "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))$"
          }
        },
        "required": [
          "id",
          "actor_id",
          "actor_name",
          "actor_email",
          "action_type",
          "target_resource_type",
          "target_resource_id",
          "new_state",
          "ip_address",
          "created_at"
        ],
        "additionalProperties": false,
        "description": "Immutable audit-log entry (hash-chained, tamper-evident)."
      },
      "WebhookListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookSubscription"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total number of records across all pages.",
            "example": 142
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "example": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "example": 25
          },
          "total_pages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Math.max(1, Math.ceil(total / limit)). Always at least 1, so an empty result set reports 1 page, not 0.",
            "example": 6
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "WebhookSubscription": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "example": "https://hooks.acme.com/atmanid"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Event names this subscription fires on: the WebhookEvent values, plus admin-page-only events."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused",
              "failed"
            ]
          },
          "failure_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "last_delivery_at": {
            "anyOf": [
              {
                "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))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "signing_secret": {
            "description": "HMAC secret returned ONLY on create — null on subsequent reads.",
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "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))$"
          },
          "warnings": {
            "description": "On create or update only: events in `events` that are not sent yet, so this subscription would never receive them. Saved anyway while the tenant is in warn mode; refused with 400 EVENT_NOT_AVAILABLE once it enforces.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "const": "EVENT_NOT_AVAILABLE"
                },
                "message": {
                  "type": "string"
                },
                "events": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "code",
                "message",
                "events"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "url",
          "events",
          "description",
          "status",
          "failure_count",
          "last_delivery_at",
          "signing_secret",
          "created_at"
        ],
        "additionalProperties": false,
        "description": "Outbound event subscription."
      },
      "WebhookTestResult": {
        "type": "object",
        "properties": {
          "delivery_id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "target_url": {
            "type": "string",
            "format": "uri"
          },
          "response_status": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "response_snippet": {
            "type": [
              "string",
              "null"
            ]
          },
          "elapsed_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "delivery_id",
          "target_url",
          "response_status",
          "response_snippet",
          "elapsed_ms"
        ],
        "additionalProperties": false
      },
      "GithubOverview": {
        "type": "object",
        "properties": {
          "org": {
            "type": "string",
            "example": "acme-inc"
          },
          "total_workflows": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "total_deploy_keys": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "total_apps": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "existing_nhi_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "NHIs from this organisation that are already registered in AtmanID."
          }
        },
        "required": [
          "org",
          "total_workflows",
          "total_deploy_keys",
          "total_apps",
          "existing_nhi_count"
        ],
        "additionalProperties": false
      },
      "GithubDiscoverResult": {
        "type": "object",
        "properties": {
          "org": {
            "type": "string"
          },
          "discovered": {
            "type": "object",
            "properties": {
              "workflows": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "deploy_keys": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "apps": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "workflows",
              "deploy_keys",
              "apps"
            ],
            "additionalProperties": false
          },
          "upserted_nhi_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "org",
          "discovered",
          "upserted_nhi_count"
        ],
        "additionalProperties": false
      },
      "ReachabilityPreviewResponse": {
        "type": "object",
        "properties": {
          "confidence": {
            "type": "string",
            "enum": [
              "high",
              "medium",
              "low",
              "none",
              "unknown"
            ]
          },
          "summary": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string"
                  },
                  "tier": {
                    "type": "string",
                    "enum": [
                      "catastrophic",
                      "high",
                      "medium",
                      "low"
                    ]
                  },
                  "data_class_count": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "path_count": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "highest_edge_type": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "generated_at": {
                    "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))$"
                  }
                },
                "required": [
                  "text",
                  "tier",
                  "data_class_count",
                  "path_count",
                  "highest_edge_type",
                  "generated_at"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "paths": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "terminal_target": {
                  "type": "string"
                },
                "hop_count": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "total_confidence": {
                  "type": "string",
                  "enum": [
                    "high",
                    "medium",
                    "low",
                    "none"
                  ]
                },
                "data_class": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "identifier": {
                          "type": "string"
                        },
                        "kind": {
                          "type": "string"
                        },
                        "display_label": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "identifier",
                        "kind",
                        "display_label"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "via_action": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "target_identifier": {
                          "type": "string"
                        },
                        "edge_type": {
                          "type": "string"
                        },
                        "confidence_tier": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "target_identifier",
                        "edge_type",
                        "confidence_tier"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "terminal_target",
                "hop_count",
                "total_confidence",
                "data_class",
                "via_action"
              ],
              "additionalProperties": false
            }
          },
          "edges_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "entitlement": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "$ref": "#/components/schemas/Uuid"
                  },
                  "name": {
                    "type": "string"
                  },
                  "application_id": {
                    "$ref": "#/components/schemas/Uuid"
                  },
                  "application_name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name",
                  "application_id",
                  "application_name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "confidence",
          "summary",
          "paths",
          "edges_count",
          "entitlement"
        ],
        "additionalProperties": false
      },
      "WorkflowTemplateListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "$ref": "#/components/schemas/Uuid"
                },
                "name": {
                  "type": "string"
                },
                "manifest": {
                  "description": "Full ApprovalWorkflowTemplateManifest body (apiVersion/kind/metadata/spec)."
                },
                "is_default": {
                  "type": "boolean"
                },
                "managed_by": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "created_at": {
                  "type": "string"
                },
                "updated_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "manifest",
                "is_default",
                "managed_by",
                "created_at",
                "updated_at"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "total_pages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "WorkflowTemplateUpdated": {
        "type": "object",
        "properties": {
          "created": {
            "type": "boolean",
            "const": false
          },
          "template": {}
        },
        "required": [
          "created",
          "template"
        ],
        "additionalProperties": false
      },
      "WorkflowTemplateCreated": {
        "type": "object",
        "properties": {
          "created": {
            "type": "boolean",
            "const": true
          },
          "template": {}
        },
        "required": [
          "created",
          "template"
        ],
        "additionalProperties": false
      },
      "WorkflowTemplateDetail": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Uuid"
          },
          "name": {
            "type": "string"
          },
          "manifest": {},
          "is_default": {
            "type": "boolean"
          },
          "managed_by": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "manifest",
          "is_default",
          "managed_by",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "atman_<key>",
        "description": "API key issued from the API Keys page. Send as `Authorization: Bearer <key>`. Keys are tenant-scoped and have per-scope grants (read:users, write:access-requests, etc.)."
      },
      "extAuthzApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-atmanid-api-key",
        "description": "The API key (scope mcp:authorize), bare, for /mcp/ext-authz — set it in Envoy's headers_to_add."
      }
    }
  }
}
