{
  "openapi": "3.0.1",
  "info": {
    "title": "Kortexio API",
    "description": "Public integration API for Kortexio.\n\n- `/v1/chat/completions`, `/v1/models`, `/v1/embeddings` — OpenAI-compatible (App API key)\n- `/api/chat` — Ollama-compatible chat (App API key)\n- `/api/tenants/me/*` — Dashboard JWT (Keycloak) from the user app\n- `/api/tenants/signup` — Public, no auth\n\nFull developer docs: https://kortexio.io/docs",
    "version": "v1"
  },
  "paths": {
    "/api/tenants/me/apps/{appId}/api-keys": {
      "post": {
        "tags": [
          "API keys"
        ],
        "summary": "Create API key",
        "description": "Create a new API key for an app.",
        "parameters": [
          {
            "name": "appId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      },
      "get": {
        "tags": [
          "API keys"
        ],
        "summary": "List API keys",
        "description": "List active API keys for an app.",
        "parameters": [
          {
            "name": "appId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/apps/{appId}/api-keys/{keyId}/reveal": {
      "get": {
        "tags": [
          "API keys"
        ],
        "summary": "Reveal API key",
        "description": "Retrieve the full API key value for copying.",
        "parameters": [
          {
            "name": "appId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "keyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/apps/{appId}/api-keys/{keyId}": {
      "delete": {
        "tags": [
          "API keys"
        ],
        "summary": "Revoke API key",
        "description": "Revoke an app API key.",
        "parameters": [
          {
            "name": "appId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "keyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/apps": {
      "get": {
        "tags": [
          "Apps"
        ],
        "summary": "List apps",
        "description": "List tenant apps for the authenticated dashboard user.",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      },
      "post": {
        "tags": [
          "Apps"
        ],
        "summary": "Create app",
        "description": "Create a new integration app for the tenant.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTenantAppRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/apps/{id}": {
      "delete": {
        "tags": [
          "Apps"
        ],
        "summary": "Archive app",
        "description": "Archive (soft-delete) a tenant app.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/apps/{id}/config": {
      "get": {
        "tags": [
          "Apps"
        ],
        "summary": "Get app config",
        "description": "Read agentic and integration configuration for an app.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      },
      "patch": {
        "tags": [
          "Apps"
        ],
        "summary": "Patch app config",
        "description": "Partially update agentic and integration configuration.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {}
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/usage": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Get usage",
        "description": "Monthly usage summary for the tenant.",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/tier": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Change tier",
        "description": "Upgrade or downgrade the tenant plan.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangeTierRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/billing/checkout-config": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Checkout config",
        "description": "Order summary for hosted Mollie checkout.",
        "parameters": [
          {
            "name": "plan",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/TenantTier"
            }
          },
          {
            "name": "billing",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/billing/confirm": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Start checkout",
        "description": "Create Mollie hosted checkout session and return redirect URL.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfirmBillingCheckoutRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/invoices": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "List invoices",
        "description": "List billing invoices for the tenant.",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/invoices/{id}/pdf": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Download invoice PDF",
        "description": "Generate or download a PDF for a billing invoice.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/apps/{id}/llm": {
      "get": {
        "tags": [
          "BYOK"
        ],
        "summary": "Get LLM config",
        "description": "Read the current LLM provider configuration (secrets are never returned).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      },
      "put": {
        "tags": [
          "BYOK"
        ],
        "summary": "Update LLM config",
        "description": "Save provider, model, and credentials (validated before persisting).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTenantAppLlmRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/apps/{id}/llm/test": {
      "post": {
        "tags": [
          "BYOK"
        ],
        "summary": "Test LLM connection",
        "description": "Test an LLM provider configuration without saving it.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TestTenantAppLlmRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/chat": {
      "post": {
        "tags": [
          "Chat"
        ],
        "summary": "Chat completion",
        "description": "Ollama-compatible chat endpoint with memory, BYOK, and optional agentic loop. For OpenAI SDK clients use /v1/chat/completions.",
        "parameters": [
          {
            "name": "X-User-Id",
            "in": "header",
            "description": "Opaque end-user identifier for memory and rate-limit scoping.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Session-Id",
            "in": "header",
            "description": "Conversation session id. Auto-generated if omitted; returned in the response header.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "AppApiKey": []
          }
        ]
      }
    },
    "/api/tenants/me/apps/{id}/integrations": {
      "get": {
        "tags": [
          "MCP"
        ],
        "summary": "List MCP integrations",
        "description": "List outbound MCP servers for an app (secrets redacted).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      },
      "put": {
        "tags": [
          "MCP"
        ],
        "summary": "Replace MCP integrations",
        "description": "Replace the outbound MCP server list for an app.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplaceMcpIntegrationsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/apps/{id}/integrations/test": {
      "post": {
        "tags": [
          "MCP"
        ],
        "summary": "Test MCP integration",
        "description": "Probe an MCP server with initialize + tools/list.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TestMcpIntegrationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/apps/{id}/mcp/test": {
      "post": {
        "tags": [
          "MCP"
        ],
        "summary": "Test hosted memory MCP",
        "description": "Probe this app's hosted MCP endpoint with the caller's access token.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/apps/{id}/memory": {
      "get": {
        "tags": [
          "Memory"
        ],
        "summary": "Get memory context",
        "description": "Read session memory and notes for a user.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sessionId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "query",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-User-Id",
            "in": "header",
            "description": "End-user identifier (fallback when JWT sub is not used).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/apps/{id}/memory/notes": {
      "post": {
        "tags": [
          "Memory"
        ],
        "summary": "Save memory note",
        "description": "Persist a note across sessions for a user.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "X-User-Id",
            "in": "header",
            "description": "End-user identifier (fallback when JWT sub is not used).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveMemoryNoteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/apps/{id}/wiki/documents/{documentId}": {
      "put": {
        "tags": [
          "Memory"
        ],
        "summary": "Upsert global wiki document",
        "description": "Ingest or update an app-scoped knowledge document.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GlobalWikiUpsertRequestDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Memory"
        ],
        "summary": "Delete global wiki document",
        "description": "Remove an app-scoped knowledge document.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/apps/{id}/wiki/documents/batch": {
      "post": {
        "tags": [
          "Memory"
        ],
        "summary": "Batch upsert global wiki",
        "description": "Ingest multiple app-scoped knowledge documents.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GlobalWikiBatchUpsertRequestDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/apps/{id}/wiki/documents": {
      "get": {
        "tags": [
          "Memory"
        ],
        "summary": "List global wiki documents",
        "description": "List app-scoped knowledge documents.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sourceId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/apps/{id}/wiki/query": {
      "post": {
        "tags": [
          "Memory"
        ],
        "summary": "Query global wiki",
        "description": "Keyword search over app-scoped knowledge documents.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GlobalWikiQueryRequestDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/health": {
      "get": {
        "tags": [
          "Meta"
        ],
        "summary": "Health check",
        "description": "Service health and dependency status.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "tags": [
          "OpenAI"
        ],
        "summary": "Chat completions",
        "description": "OpenAI-compatible chat completions with Kortexio memory, BYOK, and optional agentic loop. Provide X-User-Id or body.user.",
        "parameters": [
          {
            "name": "X-User-Id",
            "in": "header",
            "description": "Opaque end-user identifier. Optional when body.user is set.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Session-Id",
            "in": "header",
            "description": "Conversation session id. Auto-generated if omitted; returned in the response header.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "AppApiKey": []
          }
        ]
      }
    },
    "/v1/models": {
      "get": {
        "tags": [
          "OpenAI"
        ],
        "summary": "List models",
        "description": "Lists the BYOK model configured for this App (OpenAI-compatible).",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "AppApiKey": []
          }
        ]
      }
    },
    "/v1/models/{id}": {
      "get": {
        "tags": [
          "OpenAI"
        ],
        "summary": "Retrieve model",
        "description": "Returns the configured BYOK model when id matches.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "AppApiKey": []
          }
        ]
      }
    },
    "/v1/embeddings": {
      "post": {
        "tags": [
          "OpenAI"
        ],
        "summary": "Create embeddings",
        "description": "OpenAI-compatible embeddings proxy to the App BYOK provider. Does not use Kortexio memory.",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "AppApiKey": []
          }
        ]
      }
    },
    "/api/tenants/signup": {
      "post": {
        "tags": [
          "Tenants"
        ],
        "summary": "Sign up",
        "description": "Create a new tenant account (public, no auth).",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/tenants/me": {
      "get": {
        "tags": [
          "Tenants"
        ],
        "summary": "Get tenant profile",
        "description": "Read the authenticated tenant profile.",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/impersonation-notices": {
      "get": {
        "tags": [
          "Tenants"
        ],
        "summary": "Impersonation notices",
        "description": "Audit notices when support accessed the tenant account.",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/onboarding": {
      "get": {
        "tags": [
          "Tenants"
        ],
        "summary": "Onboarding status",
        "description": "Activation checklist progress for the tenant.",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/api/tenants/me/team-invites": {
      "post": {
        "tags": [
          "Tenants"
        ],
        "summary": "Invite teammate",
        "description": "Invite a colleague to the tenant workspace.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamInviteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "DashboardJwt": []
          }
        ]
      }
    },
    "/openapi/v1.json": {
      "get": {
        "tags": [
          "Meta"
        ],
        "summary": "OpenAPI spec",
        "description": "Machine-readable OpenAPI document (live from production)."
      }
    }
  },
  "components": {
    "schemas": {
      "BillingVatDetails": {
        "type": "object",
        "properties": {
          "countryCode": {
            "type": "string",
            "nullable": true
          },
          "vatNumber": {
            "type": "string",
            "nullable": true
          },
          "billingAddress": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ChangeTierRequest": {
        "type": "object",
        "properties": {
          "tier": {
            "$ref": "#/components/schemas/TenantTier"
          }
        },
        "additionalProperties": false
      },
      "ConfirmBillingCheckoutRequest": {
        "type": "object",
        "properties": {
          "tier": {
            "$ref": "#/components/schemas/TenantTier"
          },
          "billingInterval": {
            "type": "string",
            "nullable": true
          },
          "vat": {
            "$ref": "#/components/schemas/BillingVatDetails"
          }
        },
        "additionalProperties": false
      },
      "CreateApiKeyRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CreateTenantAppRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GlobalWikiBatchDocumentDto": {
        "required": [
          "content",
          "documentId"
        ],
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "content": {
            "type": "string",
            "nullable": true
          },
          "summary": {
            "type": "string",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "nullable": true
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "nullable": true
          },
          "slug": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GlobalWikiBatchUpsertRequestDto": {
        "type": "object",
        "properties": {
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GlobalWikiBatchDocumentDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GlobalWikiQueryRequestDto": {
        "required": [
          "query"
        ],
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "nullable": true
          },
          "topK": {
            "type": "integer",
            "format": "int32"
          },
          "budgetChars": {
            "type": "integer",
            "format": "int32"
          },
          "includeIndex": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "GlobalWikiUpsertRequestDto": {
        "required": [
          "content"
        ],
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "nullable": true
          },
          "content": {
            "type": "string",
            "nullable": true
          },
          "summary": {
            "type": "string",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "nullable": true
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "nullable": true
          },
          "slug": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ReplaceMcpIntegrationsRequest": {
        "type": "object",
        "properties": {
          "agenticEnabled": {
            "type": "boolean",
            "nullable": true
          },
          "integrations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UpsertMcpIntegrationRequest"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SaveMemoryNoteRequest": {
        "type": "object",
        "properties": {
          "sessionId": {
            "type": "string",
            "nullable": true
          },
          "note": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SignupRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "password": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TeamInviteRequest": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "nullable": true
          },
          "role": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TenantTier": {
        "enum": [
          0,
          1,
          2,
          3
        ],
        "type": "integer",
        "format": "int32"
      },
      "TestMcpIntegrationRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "url": {
            "type": "string",
            "nullable": true
          },
          "authMode": {
            "type": "string",
            "nullable": true
          },
          "authToken": {
            "type": "string",
            "nullable": true
          },
          "allowEgress": {
            "type": "boolean"
          },
          "oAuthTokenUrl": {
            "type": "string",
            "nullable": true
          },
          "oAuthClientId": {
            "type": "string",
            "nullable": true
          },
          "oAuthClientSecret": {
            "type": "string",
            "nullable": true
          },
          "oAuthScope": {
            "type": "string",
            "nullable": true
          },
          "oAuthAudience": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TestTenantAppLlmRequest": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string",
            "nullable": true
          },
          "model": {
            "type": "string",
            "nullable": true
          },
          "baseUrl": {
            "type": "string",
            "nullable": true
          },
          "apiKey": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateTenantAppLlmRequest": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string",
            "nullable": true
          },
          "model": {
            "type": "string",
            "nullable": true
          },
          "baseUrl": {
            "type": "string",
            "nullable": true
          },
          "apiKey": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpsertMcpIntegrationRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "url": {
            "type": "string",
            "nullable": true
          },
          "authMode": {
            "type": "string",
            "nullable": true
          },
          "authToken": {
            "type": "string",
            "nullable": true
          },
          "allowEgress": {
            "type": "boolean"
          },
          "oAuthTokenUrl": {
            "type": "string",
            "nullable": true
          },
          "oAuthClientId": {
            "type": "string",
            "nullable": true
          },
          "oAuthClientSecret": {
            "type": "string",
            "nullable": true
          },
          "oAuthScope": {
            "type": "string",
            "nullable": true
          },
          "oAuthAudience": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "AppApiKey": {
        "type": "http",
        "description": "App API key from the dashboard (`cmk_live_...`).",
        "scheme": "bearer",
        "bearerFormat": "API Key"
      },
      "DashboardJwt": {
        "type": "http",
        "description": "Keycloak JWT from the user dashboard.",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  }
}
