{
  "openapi": "3.1.0",
  "info": {
    "title": "gateco API",
    "description": "Backend API for gateco",
    "version": "1.0.0"
  },
  "paths": {
    "/api/admin/db/status": {
      "get": {
        "tags": [
          "admin"
        ],
        "summary": "Db Status",
        "description": "Get current database setup status.\n\nReturns:\n    dict: Status information including connectivity and migration state.",
        "operationId": "db_status_api_admin_db_status_get",
        "parameters": [
          {
            "name": "X-Admin-Token",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "X-Admin-Token"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/db/test": {
      "post": {
        "tags": [
          "admin"
        ],
        "summary": "Test Connection",
        "description": "Test database connectivity without saving the URL.\n\nArgs:\n    body (TestRequest): Contains the database_url to test.\n\nReturns:\n    dict: Success flag and message.",
        "operationId": "test_connection_api_admin_db_test_post",
        "parameters": [
          {
            "name": "X-Admin-Token",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "X-Admin-Token"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TestRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/db/apply": {
      "post": {
        "tags": [
          "admin"
        ],
        "summary": "Apply Setup",
        "description": "Save DATABASE_URL to .env and run migrations.\n\nArgs:\n    body (ApplyRequest): Contains database_url and optional mode.\n\nReturns:\n    dict: List of step results and final status.",
        "operationId": "apply_setup_api_admin_db_apply_post",
        "parameters": [
          {
            "name": "X-Admin-Token",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "X-Admin-Token"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/db/retry": {
      "post": {
        "tags": [
          "admin"
        ],
        "summary": "Retry Setup",
        "description": "Re-run migrations using the existing DATABASE_URL from .env.\n\nReturns:\n    dict: List of step results and final status.",
        "operationId": "retry_setup_api_admin_db_retry_post",
        "parameters": [
          {
            "name": "X-Admin-Token",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "X-Admin-Token"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/db/organizations/{org_id}/plan": {
      "patch": {
        "tags": [
          "admin"
        ],
        "summary": "Update Org Plan",
        "description": "Update an organization's subscription plan tier.",
        "operationId": "update_org_plan_api_admin_db_organizations__org_id__plan_patch",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Org Id"
            }
          },
          {
            "name": "X-Admin-Token",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "X-Admin-Token"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlanUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/health/db": {
      "get": {
        "tags": [
          "health"
        ],
        "summary": "Health Db",
        "description": "Database health check endpoint.\n\nReturns:\n    JSONResponse: 200 with DB details if healthy, 503 if not ready.",
        "operationId": "health_db_health_db_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/auth/login": {
      "post": {
        "tags": [
          "auth"
        ],
        "summary": "Login",
        "description": "Authenticate with email and password.",
        "operationId": "login_api_auth_login_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/signup": {
      "post": {
        "tags": [
          "auth"
        ],
        "summary": "Signup",
        "description": "Register a new user and organization.",
        "operationId": "signup_api_auth_signup_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/refresh": {
      "post": {
        "tags": [
          "auth"
        ],
        "summary": "Refresh",
        "description": "Refresh access token using a valid refresh token.",
        "operationId": "refresh_api_auth_refresh_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RefreshTokenRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/logout": {
      "post": {
        "tags": [
          "auth"
        ],
        "summary": "Logout",
        "description": "Revoke all sessions for the current user.",
        "operationId": "logout_api_auth_logout_post",
        "responses": {
          "204": {
            "description": "Successful Response"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/auth/exchange": {
      "post": {
        "tags": [
          "auth"
        ],
        "summary": "Exchange Code",
        "description": "Exchange a one-time OAuth auth code for tokens (D3).",
        "operationId": "exchange_code_api_auth_exchange_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExchangeCodeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/google": {
      "get": {
        "tags": [
          "auth"
        ],
        "summary": "Google Auth",
        "description": "Redirect to Google OAuth consent screen. Sets HttpOnly state cookie for CSRF protection.",
        "operationId": "google_auth_api_auth_google_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/auth/github": {
      "get": {
        "tags": [
          "auth"
        ],
        "summary": "Github Auth",
        "description": "Redirect to GitHub OAuth consent screen. Sets HttpOnly state cookie for CSRF protection.",
        "operationId": "github_auth_api_auth_github_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/auth/google/callback": {
      "get": {
        "tags": [
          "auth"
        ],
        "summary": "Google Callback",
        "description": "Handle Google OAuth callback \u2192 validate CSRF state \u2192 redirect to FE with auth_code.",
        "operationId": "google_callback_api_auth_google_callback_get",
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Code"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "State"
            }
          },
          {
            "name": "oauth_state_google",
            "in": "cookie",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Oauth State Google"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/github/callback": {
      "get": {
        "tags": [
          "auth"
        ],
        "summary": "Github Callback",
        "description": "Handle GitHub OAuth callback \u2192 validate CSRF state \u2192 redirect to FE with auth_code.",
        "operationId": "github_callback_api_auth_github_callback_get",
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Code"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "State"
            }
          },
          {
            "name": "oauth_state_github",
            "in": "cookie",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Oauth State Github"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/users/me": {
      "get": {
        "tags": [
          "users"
        ],
        "summary": "Get Me",
        "description": "Get the current authenticated user with organization.plan for FE entitlement gating.",
        "operationId": "get_me_api_users_me_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserResponse"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "users"
        ],
        "summary": "Update Me",
        "description": "Update current user's profile.",
        "operationId": "update_me_api_users_me_patch",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateUserRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/organization/settings": {
      "get": {
        "tags": [
          "organization"
        ],
        "summary": "Get Org Settings",
        "description": "Get organization settings including LLM key configuration status. Requires org_admin role.",
        "operationId": "get_org_settings_api_organization_settings_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      },
      "patch": {
        "tags": [
          "organization"
        ],
        "summary": "Update Org Settings",
        "description": "Update organization-level settings. Requires org_admin role.",
        "operationId": "update_org_settings_api_organization_settings_patch",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOrgSettingsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/plans": {
      "get": {
        "tags": [
          "billing"
        ],
        "summary": "List Plans",
        "description": "List all available plans (public, no auth required).",
        "operationId": "list_plans_api_plans_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/checkout/start": {
      "post": {
        "tags": [
          "billing"
        ],
        "summary": "Start Checkout",
        "description": "Create a Stripe Checkout Session for plan upgrade.",
        "operationId": "start_checkout_api_checkout_start_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/billing/portal": {
      "post": {
        "tags": [
          "billing"
        ],
        "summary": "Billing Portal",
        "description": "Create a Stripe Billing Portal session.",
        "operationId": "billing_portal_api_billing_portal_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BillingPortalRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingPortalResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/billing/usage": {
      "get": {
        "tags": [
          "billing"
        ],
        "summary": "Get Usage",
        "description": "Get current billing period usage for the authenticated organization.",
        "operationId": "get_usage_api_billing_usage_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/billing/invoices": {
      "get": {
        "tags": [
          "billing"
        ],
        "summary": "List Invoices",
        "description": "List invoices for the authenticated organization.",
        "operationId": "list_invoices_api_billing_invoices_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1,
              "title": "Page"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "default": 20,
              "title": "Per Page"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/subscription": {
      "get": {
        "tags": [
          "billing"
        ],
        "summary": "Get Subscription",
        "description": "Get current subscription for the authenticated organization.",
        "operationId": "get_subscription_api_billing_subscription_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/billing/sync-subscription": {
      "post": {
        "tags": [
          "billing"
        ],
        "summary": "Sync Subscription",
        "description": "Force-sync org plan from Stripe. Use when plan didn't update after checkout.\n\nQueries Stripe for the org's active subscription and applies the plan.\nSafe to call repeatedly \u2014 idempotent if plan already matches.",
        "operationId": "sync_subscription_api_billing_sync_subscription_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/webhooks/stripe": {
      "post": {
        "tags": [
          "billing"
        ],
        "summary": "Stripe Webhook",
        "description": "Handle Stripe webhook events.",
        "operationId": "stripe_webhook_api_webhooks_stripe_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/connectors": {
      "get": {
        "tags": [
          "connectors"
        ],
        "summary": "List Connectors",
        "operationId": "list_connectors_api_connectors_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "connectors"
        ],
        "summary": "Create Connector",
        "operationId": "create_connector_api_connectors_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateConnectorRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/connectors/{connector_id}": {
      "get": {
        "tags": [
          "connectors"
        ],
        "summary": "Get Connector",
        "operationId": "get_connector_api_connectors__connector_id__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "connector_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Connector Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "connectors"
        ],
        "summary": "Update Connector",
        "operationId": "update_connector_api_connectors__connector_id__patch",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "connector_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Connector Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateConnectorRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "connectors"
        ],
        "summary": "Delete Connector",
        "operationId": "delete_connector_api_connectors__connector_id__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "connector_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Connector Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/connectors/{connector_id}/search-config": {
      "get": {
        "tags": [
          "connectors"
        ],
        "summary": "Get Search Config",
        "operationId": "get_search_config_api_connectors__connector_id__search_config_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "connector_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Connector Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "connectors"
        ],
        "summary": "Update Search Config",
        "operationId": "update_search_config_api_connectors__connector_id__search_config_patch",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "connector_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Connector Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSearchConfigRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/connectors/{connector_id}/db-schema": {
      "get": {
        "tags": [
          "connectors"
        ],
        "summary": "Get Db Schema",
        "description": "Return live table + column schema for connected Postgres-family connectors.",
        "operationId": "get_db_schema_api_connectors__connector_id__db_schema_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "connector_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Connector Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/connectors/{connector_id}/test": {
      "post": {
        "tags": [
          "connectors"
        ],
        "summary": "Test Connector",
        "operationId": "test_connector_api_connectors__connector_id__test_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "connector_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Connector Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/connectors/{connector_id}/bind": {
      "post": {
        "tags": [
          "connectors"
        ],
        "summary": "Bind Metadata",
        "operationId": "bind_metadata_api_connectors__connector_id__bind_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "connector_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Connector Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BindRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/connectors/{connector_id}/ingestion-config": {
      "get": {
        "tags": [
          "connectors"
        ],
        "summary": "Get Ingestion Config",
        "operationId": "get_ingestion_config_api_connectors__connector_id__ingestion_config_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "connector_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Connector Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "connectors"
        ],
        "summary": "Update Ingestion Config",
        "operationId": "update_ingestion_config_api_connectors__connector_id__ingestion_config_patch",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "connector_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Connector Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateIngestionConfigRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/connectors/{connector_id}/coverage": {
      "get": {
        "tags": [
          "connectors"
        ],
        "summary": "Get Coverage",
        "operationId": "get_coverage_api_connectors__connector_id__coverage_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "connector_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Connector Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/connectors/{connector_id}/preflight": {
      "get": {
        "tags": [
          "connectors"
        ],
        "summary": "Get Preflight",
        "description": "Run blocking preflight readiness checks before a connector is used in production.\n\nReturns an L0-L4 readiness level, per-check results, and a human-readable\nrecommendation for the first failing blocking check.",
        "operationId": "get_preflight_api_connectors__connector_id__preflight_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "connector_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Connector Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreflightResult"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/connectors/{connector_id}/suggest-classifications": {
      "post": {
        "tags": [
          "connectors"
        ],
        "summary": "Suggest Classifications",
        "operationId": "suggest_classifications_api_connectors__connector_id__suggest_classifications_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "connector_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Connector Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SuggestClassificationsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/connectors/{connector_id}/apply-suggestions": {
      "post": {
        "tags": [
          "connectors"
        ],
        "summary": "Apply Suggestions",
        "operationId": "apply_suggestions_api_connectors__connector_id__apply_suggestions_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "connector_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Connector Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplySuggestionsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/identity-providers": {
      "get": {
        "tags": [
          "identity-providers"
        ],
        "summary": "List Identity Providers",
        "operationId": "list_identity_providers_api_identity_providers_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "identity-providers"
        ],
        "summary": "Create Identity Provider",
        "operationId": "create_identity_provider_api_identity_providers_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateIdentityProviderRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/identity-providers/{idp_id}": {
      "get": {
        "tags": [
          "identity-providers"
        ],
        "summary": "Get Identity Provider",
        "operationId": "get_identity_provider_api_identity_providers__idp_id__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "idp_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Idp Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "identity-providers"
        ],
        "summary": "Update Identity Provider",
        "operationId": "update_identity_provider_api_identity_providers__idp_id__patch",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "idp_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Idp Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateIdentityProviderRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "identity-providers"
        ],
        "summary": "Delete Identity Provider",
        "operationId": "delete_identity_provider_api_identity_providers__idp_id__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "idp_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Idp Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/identity-providers/{idp_id}/sync": {
      "post": {
        "tags": [
          "identity-providers"
        ],
        "summary": "Sync Identity Provider",
        "operationId": "sync_identity_provider_api_identity_providers__idp_id__sync_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "idp_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Idp Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/identity-providers/{idp_id}/suggest-policies": {
      "post": {
        "tags": [
          "identity-providers"
        ],
        "summary": "Suggest Policies",
        "description": "Generate conservative policy starting points from IDP principal data.\n\nAnalyzes synced principals from the specified IDP and returns suggested\npolicy configurations grouped by group membership and department attributes.\nRequires Team or above plan (policy_studio feature).",
        "operationId": "suggest_policies_api_identity_providers__idp_id__suggest_policies_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "idp_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Idp Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/identity-providers/{idp_id}/apply-policy-suggestions": {
      "post": {
        "tags": [
          "identity-providers"
        ],
        "summary": "Apply Policy Suggestions",
        "description": "Apply accepted policy suggestions, creating draft policies from templates.\n\nAll created policies are in DRAFT status \u2014 this endpoint never auto-activates.\nRequires Team or above plan (policy_studio feature).",
        "operationId": "apply_policy_suggestions_api_identity_providers__idp_id__apply_policy_suggestions_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "idp_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Idp Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyPolicySuggestionsRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/identity-providers/{idp_id}/scim-token": {
      "post": {
        "tags": [
          "identity-providers"
        ],
        "summary": "Generate Scim Token",
        "description": "Generate a SCIM bearer token for this IDP. Enterprise only.\n\nThe plaintext token is returned exactly once. Store it securely.\nReplaces any existing token for this IDP.",
        "operationId": "generate_scim_token_api_identity_providers__idp_id__scim_token_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "idp_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Idp Id"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "identity-providers"
        ],
        "summary": "Revoke Scim Token Endpoint",
        "description": "Revoke the SCIM token for this IDP. Enterprise only.",
        "operationId": "revoke_scim_token_endpoint_api_identity_providers__idp_id__scim_token_delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "idp_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Idp Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/policies": {
      "get": {
        "tags": [
          "policies"
        ],
        "summary": "List Policies",
        "operationId": "list_policies_api_policies_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "policies"
        ],
        "summary": "Create Policy",
        "operationId": "create_policy_api_policies_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePolicyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/policies/templates": {
      "get": {
        "tags": [
          "policies"
        ],
        "summary": "List Policy Templates",
        "description": "Return all available policy templates.\n\nNo entitlement gate \u2014 templates are visible on all plans so the catalog can\nserve as upgrade-marketing material for Free plan users.",
        "operationId": "list_policy_templates_api_policies_templates_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/policies/from-template": {
      "post": {
        "tags": [
          "policies"
        ],
        "summary": "Create Policy From Template",
        "description": "Instantiate a policy template and persist it as a new draft policy.\n\nRequires the ``policy_studio`` feature (Team+).  Placeholder values are\nsubstituted into the template before the policy is created, so the caller\nnever touches raw rule structures.",
        "operationId": "create_policy_from_template_api_policies_from_template_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateFromTemplateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/policies/{policy_id}": {
      "get": {
        "tags": [
          "policies"
        ],
        "summary": "Get Policy",
        "operationId": "get_policy_api_policies__policy_id__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Policy Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "policies"
        ],
        "summary": "Update Policy",
        "operationId": "update_policy_api_policies__policy_id__patch",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Policy Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "policies"
        ],
        "summary": "Delete Policy",
        "operationId": "delete_policy_api_policies__policy_id__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Policy Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/policies/{policy_id}/versions": {
      "get": {
        "tags": [
          "policies"
        ],
        "summary": "List Policy Versions",
        "description": "List saved version snapshots for a policy. Requires policy_versioning (Team+).",
        "operationId": "list_policy_versions_api_policies__policy_id__versions_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Policy Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/policies/{policy_id}/activate": {
      "post": {
        "tags": [
          "policies"
        ],
        "summary": "Activate Policy",
        "operationId": "activate_policy_api_policies__policy_id__activate_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Policy Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/policies/{policy_id}/archive": {
      "post": {
        "tags": [
          "policies"
        ],
        "summary": "Archive Policy",
        "operationId": "archive_policy_api_policies__policy_id__archive_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Policy Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/policies/{policy_id}/versions/{version}/restore": {
      "post": {
        "tags": [
          "policies"
        ],
        "summary": "Restore Policy Version",
        "description": "Restore a policy to a previous version snapshot (policy_versioning, Team+).",
        "operationId": "restore_policy_version_api_policies__policy_id__versions__version__restore_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Policy Id"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Version"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team/invites": {
      "get": {
        "tags": [
          "team"
        ],
        "summary": "List Team Invites",
        "description": "List all pending (unused, non-expired) team invites for this organization.",
        "operationId": "list_team_invites_api_team_invites_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "team"
        ],
        "summary": "Create Team Invite",
        "description": "Invite a new member to join this organization. Enforces the plan's team_members limit.",
        "operationId": "create_team_invite_api_team_invites_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InviteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/team/invites/{invite_id}": {
      "delete": {
        "tags": [
          "team"
        ],
        "summary": "Revoke Team Invite",
        "description": "Revoke (delete) a pending team invite.",
        "operationId": "revoke_team_invite_api_team_invites__invite_id__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "invite_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Invite Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/data-catalog": {
      "get": {
        "tags": [
          "data-catalog"
        ],
        "summary": "List Resources",
        "operationId": "list_resources_api_data_catalog_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "classification",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Classification"
            }
          },
          {
            "name": "sensitivity",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Sensitivity"
            }
          },
          {
            "name": "domain",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Domain"
            }
          },
          {
            "name": "label",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Label"
            }
          },
          {
            "name": "source_connector_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Source Connector Id"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "title": "Page"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "default": 20,
              "title": "Per Page"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/data-catalog/{resource_id}": {
      "get": {
        "tags": [
          "data-catalog"
        ],
        "summary": "Get Resource Detail",
        "operationId": "get_resource_detail_api_data_catalog__resource_id__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "resource_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Resource Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "data-catalog"
        ],
        "summary": "Update Resource",
        "operationId": "update_resource_api_data_catalog__resource_id__patch",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "resource_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Resource Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateResourceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/resources/{resource_id}/metadata": {
      "patch": {
        "tags": [
          "resources"
        ],
        "summary": "Update Resource Metadata",
        "description": "Update policy-relevant metadata on a resource (Deliverable B).\n\nOnly non-None fields are updated. Changes take effect immediately\nfor policy decisions. Audit trail records old and new values.",
        "operationId": "update_resource_metadata_api_v1_resources__resource_id__metadata_patch",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "resource_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Resource Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateResourceMetadataRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/pipelines": {
      "get": {
        "tags": [
          "pipelines"
        ],
        "summary": "List Pipelines",
        "operationId": "list_pipelines_api_pipelines_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "pipelines"
        ],
        "summary": "Create Pipeline",
        "operationId": "create_pipeline_api_pipelines_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePipelineRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/pipelines/{pipeline_id}": {
      "get": {
        "tags": [
          "pipelines"
        ],
        "summary": "Get Pipeline",
        "operationId": "get_pipeline_api_pipelines__pipeline_id__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "pipeline_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Pipeline Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "pipelines"
        ],
        "summary": "Update Pipeline",
        "operationId": "update_pipeline_api_pipelines__pipeline_id__patch",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "pipeline_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Pipeline Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePipelineRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/pipelines/{pipeline_id}/run": {
      "post": {
        "tags": [
          "pipelines"
        ],
        "summary": "Run Pipeline",
        "operationId": "run_pipeline_api_pipelines__pipeline_id__run_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "pipeline_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Pipeline Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/pipelines/{pipeline_id}/runs": {
      "get": {
        "tags": [
          "pipelines"
        ],
        "summary": "List Runs",
        "operationId": "list_runs_api_pipelines__pipeline_id__runs_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "pipeline_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Pipeline Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/dashboard/stats": {
      "get": {
        "tags": [
          "dashboard"
        ],
        "summary": "Get Dashboard Stats",
        "description": "Aggregate dashboard stats with real data from all milestones.",
        "operationId": "get_dashboard_stats_api_dashboard_stats_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "sparklines",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Sparklines"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardStats"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/dashboard/activation": {
      "get": {
        "tags": [
          "dashboard"
        ],
        "summary": "Get Activation Stats",
        "description": "Activation funnel metrics for internal monitoring.\n\nCross-org funnel steps reflect counts across all organizations in the\ndeployment.  Per-org stats (retrievals, latency, time-to-value) are scoped\nto the authenticated user's organization.  Gated by JWT auth only \u2014 no\nadditional plan entitlement required.",
        "operationId": "get_activation_stats_api_dashboard_activation_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActivationFunnelStats"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/audit-log": {
      "get": {
        "tags": [
          "audit"
        ],
        "summary": "List Audit Events",
        "operationId": "list_audit_events_api_audit_log_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "event_types",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Event Types"
            }
          },
          {
            "name": "actor",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Actor"
            }
          },
          {
            "name": "date_from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Date From"
            }
          },
          {
            "name": "date_to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Date To"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "title": "Page"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "default": 20,
              "title": "Per Page"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/audit-log/export": {
      "post": {
        "tags": [
          "audit"
        ],
        "summary": "Export Audit Log",
        "description": "Export audit log as JSON or CSV (requires audit_export feature).",
        "operationId": "export_audit_log_api_audit_log_export_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "event_types",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Event Types"
            }
          },
          {
            "name": "date_from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Date From"
            }
          },
          {
            "name": "date_to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Date To"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(json|csv)$",
              "default": "json",
              "title": "Format"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/audit-log/stream": {
      "get": {
        "tags": [
          "audit"
        ],
        "summary": "Stream Audit Log",
        "description": "SIEM streaming export (siem_export feature, Enterprise only). Planned for Release B.",
        "operationId": "stream_audit_log_api_audit_log_stream_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/principals": {
      "get": {
        "tags": [
          "principals"
        ],
        "summary": "List Principals",
        "operationId": "list_principals_api_principals_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "title": "Page"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "default": 20,
              "title": "Per Page"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/principals/resolve": {
      "post": {
        "tags": [
          "principals"
        ],
        "summary": "Resolve Principal",
        "description": "Resolve a principal by email or provider_subject without creating one.\n\nLookup order:\n1. If ``email`` is provided, match on ``(org_id, email, status=active)``\n   ordered by ``last_seen DESC NULLS LAST``.\n2. If no email match (or ``email`` was not provided), and ``provider_subject``\n   is provided, match on ``(org_id, provider_subject, status=active)``\n   optionally scoped by ``identity_provider_id``.\n\nReturns 404 with an actionable message when no active principal is found.",
        "operationId": "resolve_principal_api_principals_resolve_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResolveRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/principals/{principal_id}": {
      "get": {
        "tags": [
          "principals"
        ],
        "summary": "Get Principal",
        "operationId": "get_principal_api_principals__principal_id__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "principal_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Principal Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/simulator/run": {
      "post": {
        "tags": [
          "simulator"
        ],
        "summary": "Run Simulation",
        "description": "Dry-run policy evaluation for a principal against resources.",
        "operationId": "run_simulation_api_simulator_run_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SimulationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimulationResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/simulator/preview": {
      "post": {
        "tags": [
          "simulator"
        ],
        "summary": "Run Preview",
        "description": "Execute a live search and apply policy evaluation to show per-result allow/deny.\n\nReadiness guards:\n- Entitlement: access_simulator feature (Growth+)\n- Connector: must be connected with a valid search_config\n- Principals: at least one active principal must exist in the org\n- Policies: at least one active policy must exist in the org\n\nDenied results never expose content_preview.\nEmits a simulator_preview_executed audit event on success.",
        "operationId": "run_preview_api_simulator_preview_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/simulator/preview-batch": {
      "post": {
        "tags": [
          "simulator"
        ],
        "summary": "Run Preview Batch",
        "description": "Execute a live search once and evaluate policies per principal.\n\nRuns the search a single time across the connector, then fans out policy\nevaluation for up to 5 principals in parallel. Returns a list envelope:\n``{\"data\": [PreviewResponse, ...]}``.\n\nReadiness guards and audit behaviour are identical to ``/preview``.",
        "operationId": "run_preview_batch_api_simulator_preview_batch_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchPreviewRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object",
                  "title": "Response Run Preview Batch Api Simulator Preview Batch Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/retrievals/execute": {
      "post": {
        "tags": [
          "retrievals"
        ],
        "summary": "Execute Retrieval",
        "operationId": "execute_retrieval_api_retrievals_execute_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecuteRetrievalRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/retrievals/filter": {
      "post": {
        "tags": [
          "retrievals"
        ],
        "summary": "Filter Candidates",
        "operationId": "filter_candidates_api_retrievals_filter_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FilterRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/retrievals": {
      "get": {
        "tags": [
          "retrievals"
        ],
        "summary": "List Retrievals",
        "operationId": "list_retrievals_api_retrievals_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "outcome",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Outcome"
            }
          },
          {
            "name": "principal_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Principal Id"
            }
          },
          {
            "name": "connector_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Connector Id"
            }
          },
          {
            "name": "date_from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Date From"
            }
          },
          {
            "name": "date_to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Date To"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "title": "Page"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "default": 20,
              "title": "Per Page"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/retrievals/{retrieval_id}": {
      "get": {
        "tags": [
          "retrievals"
        ],
        "summary": "Get Retrieval",
        "operationId": "get_retrieval_api_retrievals__retrieval_id__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "retrieval_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Retrieval Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ingest": {
      "post": {
        "tags": [
          "ingestion"
        ],
        "summary": "Ingest Document",
        "description": "Ingest a single document: chunk, embed, store vectors, register metadata.",
        "operationId": "ingest_document_api_v1_ingest_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IngestDocumentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/v1/ingest/batch": {
      "post": {
        "tags": [
          "ingestion"
        ],
        "summary": "Ingest Batch",
        "description": "Ingest a batch of documents. Returns partial success semantics.",
        "operationId": "ingest_batch_api_v1_ingest_batch_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchIngestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/v1/ingest/file": {
      "post": {
        "tags": [
          "ingestion"
        ],
        "summary": "Ingest File",
        "description": "Upload and ingest a single file (PDF, DOCX, CSV, XLSX, etc.).\n\nExtracts text via Docling or native parsers, then feeds through\nthe standard chunk -> embed -> store pipeline.",
        "operationId": "ingest_file_api_v1_ingest_file_post",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_ingest_file_api_v1_ingest_file_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/v1/ingest/files": {
      "post": {
        "tags": [
          "ingestion"
        ],
        "summary": "Ingest Files",
        "description": "Upload and ingest multiple files. Returns per-file results with partial success.",
        "operationId": "ingest_files_api_v1_ingest_files_post",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_ingest_files_api_v1_ingest_files_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/v1/retroactive-register": {
      "post": {
        "tags": [
          "retroactive-registration"
        ],
        "summary": "Retroactive Register",
        "description": "Scan a connector's vector DB and register unmanaged vectors as gated resources.",
        "operationId": "retroactive_register_api_v1_retroactive_register_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RetroactiveRegisterRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/answers/execute": {
      "post": {
        "tags": [
          "answers"
        ],
        "summary": "Execute Answer",
        "description": "Execute a grounded answer synthesis from allowed retrieval chunks.",
        "operationId": "execute_answer_api_answers_execute_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecuteAnswerRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/onboarding/status": {
      "get": {
        "tags": [
          "onboarding"
        ],
        "summary": "Onboarding Status",
        "description": "Return the guided setup wizard state for the authenticated user's organization.\n\nThe response envelope matches the standard Gateco `{ data: {...} }` shape.\nA top-level `dismissed` field indicates whether the admin has already\ndismissed the wizard (derived from `organization.onboarding_dismissed_at`).\n\nReturns:\n    JSON body:\n        data: OnboardingStatus dict with `steps`, `completed_count`, and\n              `total_count`.\n        dismissed: bool \u2014 True when the organization has dismissed the wizard.",
        "operationId": "onboarding_status_api_onboarding_status_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/onboarding/dismiss": {
      "post": {
        "tags": [
          "onboarding"
        ],
        "summary": "Dismiss Onboarding",
        "description": "Dismiss the guided setup wizard for the authenticated user's organization.\n\nSets `organization.onboarding_dismissed_at` to the current UTC timestamp and\nemits an `onboarding_dismissed` audit event. Idempotent \u2014 re-dismissing an\nalready-dismissed org is a no-op in terms of business logic (the timestamp is\nsimply refreshed).\n\nReturns:\n    HTTP 204 No Content.",
        "operationId": "dismiss_onboarding_api_onboarding_dismiss_post",
        "responses": {
          "204": {
            "description": "Successful Response"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/scim/v2/Users": {
      "get": {
        "tags": [
          "scim"
        ],
        "summary": "Scim List Users",
        "description": "List SCIM Users with optional filter and pagination.\n\nSupports filter=userName eq \"value\" as per RFC 7644 \u00a73.4.2.2.",
        "operationId": "scim_list_users_api_scim_v2_Users_get",
        "parameters": [
          {
            "name": "filter",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Filter"
            }
          },
          {
            "name": "startIndex",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1,
              "title": "Startindex"
            }
          },
          {
            "name": "count",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100,
              "title": "Count"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "scim"
        ],
        "summary": "Scim Create User",
        "description": "Create a SCIM User, provisioning a new Principal in Gateco.",
        "operationId": "scim_create_user_api_scim_v2_Users_post",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/scim/v2/Users/{user_id}": {
      "get": {
        "tags": [
          "scim"
        ],
        "summary": "Scim Get User",
        "description": "Get a single SCIM User by Gateco principal ID.",
        "operationId": "scim_get_user_api_scim_v2_Users__user_id__get",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "User Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "scim"
        ],
        "summary": "Scim Replace User",
        "description": "Full replacement of a SCIM User (RFC 7644 \u00a73.5.1).",
        "operationId": "scim_replace_user_api_scim_v2_Users__user_id__put",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "User Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "scim"
        ],
        "summary": "Scim Patch User",
        "description": "Partial update of a SCIM User via PatchOp (RFC 7644 \u00a73.5.2).",
        "operationId": "scim_patch_user_api_scim_v2_Users__user_id__patch",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "User Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "scim"
        ],
        "summary": "Scim Delete User",
        "description": "Deactivate a SCIM User. Sets principal status to inactive (soft delete).",
        "operationId": "scim_delete_user_api_scim_v2_Users__user_id__delete",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "User Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/scim/v2/Groups": {
      "get": {
        "tags": [
          "scim"
        ],
        "summary": "Scim List Groups",
        "description": "List SCIM Groups with optional filter and pagination.\n\nSupports ``filter=displayName eq \"value\"`` as per RFC 7644 \u00a73.4.2.2.\nMembers are omitted from list responses; use GET /Groups/{id} to retrieve them.",
        "operationId": "scim_list_groups_api_scim_v2_Groups_get",
        "parameters": [
          {
            "name": "filter",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Filter"
            }
          },
          {
            "name": "startIndex",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1,
              "title": "Startindex"
            }
          },
          {
            "name": "count",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100,
              "title": "Count"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "scim"
        ],
        "summary": "Scim Create Group",
        "description": "Create a SCIM Group, provisioning a new PrincipalGroup in Gateco.\n\nIf ``members`` are included, each referenced principal's ``groups`` array\nis updated to include this group's display name.",
        "operationId": "scim_create_group_api_scim_v2_Groups_post",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/scim/v2/Groups/{group_id}": {
      "get": {
        "tags": [
          "scim"
        ],
        "summary": "Scim Get Group",
        "description": "Get a single SCIM Group by Gateco PrincipalGroup ID, including its members.",
        "operationId": "scim_get_group_api_scim_v2_Groups__group_id__get",
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Group Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "scim"
        ],
        "summary": "Scim Replace Group",
        "description": "Full replacement of a SCIM Group (RFC 7644 \u00a73.5.1).\n\nReconciles membership and migrates principal group arrays when the group\nis renamed.",
        "operationId": "scim_replace_group_api_scim_v2_Groups__group_id__put",
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Group Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "scim"
        ],
        "summary": "Scim Patch Group",
        "description": "Partial update of a SCIM Group via PatchOp (RFC 7644 \u00a73.5.2).\n\nSupported paths: ``displayName``, ``members`` (add/remove).\nSupports both the bare ``members`` path with a value list and the filtered\npath ``members[value eq \"<principal_id>\"]`` for single-member removal.",
        "operationId": "scim_patch_group_api_scim_v2_Groups__group_id__patch",
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Group Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "scim"
        ],
        "summary": "Scim Delete Group",
        "description": "Hard-delete a SCIM Group and remove it from all member principals' group arrays.",
        "operationId": "scim_delete_group_api_scim_v2_Groups__group_id__delete",
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Group Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/capabilities/connectors": {
      "get": {
        "tags": [
          "capabilities"
        ],
        "summary": "List Connector Capabilities",
        "description": "Return the canonical capability matrix for all supported connector types.\n\nThis endpoint is public (no auth required) and derives its data entirely from\nthe in-process registries: SEARCH_CAPABILITIES, LISTERS, and TIER_1_CONNECTORS.\nIt is the authoritative source for connector counts and feature support.",
        "operationId": "list_connector_capabilities_api_capabilities_connectors_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/api-keys": {
      "get": {
        "tags": [
          "api-keys"
        ],
        "summary": "List Api Keys",
        "description": "List all active API keys for the current organization.\n\nSoft-deleted keys are excluded. Hash and plaintext are never returned.",
        "operationId": "list_api_keys_api_api_keys_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "api-keys"
        ],
        "summary": "Create Api Key",
        "description": "Create a new API key.\n\nThe full plaintext key is returned **once** in the ``key`` field of the\nresponse. It is not stored and cannot be retrieved again.\n\nRequires JWT authentication. API keys may not create other API keys.",
        "operationId": "create_api_key_api_api_keys_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateApiKeyResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/api-keys/{key_id}": {
      "delete": {
        "tags": [
          "api-keys"
        ],
        "summary": "Delete Api Key",
        "description": "Soft-delete an API key.\n\nThe key immediately stops authenticating after deletion.\nRequires JWT authentication.",
        "operationId": "delete_api_key_api_api_keys__key_id__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "key_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Key Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/api-keys/{key_id}/rotate": {
      "post": {
        "tags": [
          "api-keys"
        ],
        "summary": "Rotate Api Key",
        "description": "Rotate an API key.\n\nCreates a replacement key with the same name. The old key continues to\nauthenticate for a 24-hour grace period (its expires_at is set to now + 24h),\ngiving deployments time to roll the new credential.\n\nReturns the new plaintext key exactly once.\nRequires JWT authentication.",
        "operationId": "rotate_api_key_api_api_keys__key_id__rotate_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "key_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Key Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateApiKeyResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/relationships": {
      "post": {
        "tags": [
          "relationships"
        ],
        "summary": "Create Relationship",
        "description": "Create a direct relationship edge.\n\nIdempotent: if the exact same (org, subject, relation, object) tuple already\nexists the existing row is returned with HTTP 201 rather than raising 409.\nThis makes the operation safe to retry without any client-side deduplication.\n\nThe creating user is recorded in ``created_by_user_id`` for auditability.",
        "operationId": "create_relationship_api_relationships_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRelationshipRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RelationshipResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "relationships"
        ],
        "summary": "List Relationships",
        "description": "List relationship edges for the current organization.\n\nAll three filter parameters are optional and combinable.  Results are\nalways scoped to the caller's organization.\n\nReturns:\n    A paginated envelope ``{\"data\": [...], \"meta\": {...}}``.",
        "operationId": "list_relationships_api_relationships_get",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "title": "Page"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "default": 20,
              "title": "Per Page"
            }
          },
          {
            "name": "subject_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by subject_principal_id",
              "title": "Subject Id"
            },
            "description": "Filter by subject_principal_id"
          },
          {
            "name": "relation",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by relation_name",
              "title": "Relation"
            },
            "description": "Filter by relation_name"
          },
          {
            "name": "object_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by object_resource_id",
              "title": "Object Id"
            },
            "description": "Filter by object_resource_id"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response List Relationships Api Relationships Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/relationships/{relationship_id}": {
      "delete": {
        "tags": [
          "relationships"
        ],
        "summary": "Delete Relationship",
        "description": "Hard-delete a relationship edge.\n\nInvalidates the in-memory TTL cache for the owning org immediately after\ndeletion so that subsequent ``has_relation`` checks reflect the removal.\n\nReturns 404 when the relationship does not exist or belongs to a different\norganization (cross-org isolation).",
        "operationId": "delete_relationship_api_relationships__relationship_id__delete",
        "parameters": [
          {
            "name": "relationship_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Relationship Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "summary": "Health Check",
        "description": "Health check endpoint.",
        "operationId": "health_check_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/": {
      "get": {
        "summary": "Root",
        "description": "Root endpoint.",
        "operationId": "root__get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ActivationFunnelStats": {
        "properties": {
          "orgs_with_connector": {
            "type": "integer",
            "title": "Orgs With Connector"
          },
          "orgs_with_first_retrieval": {
            "type": "integer",
            "title": "Orgs With First Retrieval"
          },
          "orgs_with_active_policy": {
            "type": "integer",
            "title": "Orgs With Active Policy"
          },
          "orgs_at_l3_or_above": {
            "type": "integer",
            "title": "Orgs At L3 Or Above"
          },
          "total_retrievals_30d": {
            "type": "integer",
            "title": "Total Retrievals 30D"
          },
          "allowed_retrievals_30d": {
            "type": "integer",
            "title": "Allowed Retrievals 30D"
          },
          "denied_retrievals_30d": {
            "type": "integer",
            "title": "Denied Retrievals 30D"
          },
          "no_access_retrievals_30d": {
            "type": "integer",
            "title": "No Access Retrievals 30D"
          },
          "p95_latency_ms": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "P95 Latency Ms"
          },
          "days_since_signup": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Days Since Signup"
          },
          "days_since_first_retrieval": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Days Since First Retrieval"
          },
          "days_to_first_active_policy": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Days To First Active Policy"
          }
        },
        "type": "object",
        "required": [
          "orgs_with_connector",
          "orgs_with_first_retrieval",
          "orgs_with_active_policy",
          "orgs_at_l3_or_above",
          "total_retrievals_30d",
          "allowed_retrievals_30d",
          "denied_retrievals_30d",
          "no_access_retrievals_30d",
          "p95_latency_ms",
          "days_since_signup",
          "days_since_first_retrieval",
          "days_to_first_active_policy"
        ],
        "title": "ActivationFunnelStats",
        "description": "Activation funnel metrics derived from existing DB state.\n\nCross-org funnel steps show counts of organizations that have completed\neach step.  Per-org metrics (retrievals, latency, time-to-value) are\nscoped to the authenticated organization."
      },
      "ApplyPolicySuggestionsRequest": {
        "properties": {
          "suggestion_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "minItems": 1,
            "title": "Suggestion Ids"
          },
          "suggestions_data": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "minItems": 1,
            "title": "Suggestions Data"
          }
        },
        "type": "object",
        "required": [
          "suggestion_ids",
          "suggestions_data"
        ],
        "title": "ApplyPolicySuggestionsRequest",
        "description": "Request body for applying accepted policy suggestions."
      },
      "ApplyRequest": {
        "properties": {
          "database_url": {
            "type": "string",
            "title": "Database Url"
          },
          "mode": {
            "type": "string",
            "title": "Mode",
            "default": "default"
          }
        },
        "type": "object",
        "required": [
          "database_url"
        ],
        "title": "ApplyRequest",
        "description": "Request body for applying database setup."
      },
      "ApplySuggestionsRequest": {
        "properties": {
          "suggestions": {
            "items": {
              "$ref": "#/components/schemas/ClassificationSuggestion"
            },
            "type": "array",
            "title": "Suggestions"
          }
        },
        "type": "object",
        "required": [
          "suggestions"
        ],
        "title": "ApplySuggestionsRequest",
        "description": "Request body for ``POST /api/connectors/{id}/apply-suggestions``."
      },
      "BatchIngestRecord": {
        "properties": {
          "external_resource_id": {
            "type": "string",
            "maxLength": 500,
            "minLength": 1,
            "title": "External Resource Id"
          },
          "text": {
            "type": "string",
            "minLength": 1,
            "title": "Text"
          },
          "classification": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Classification"
          },
          "sensitivity": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sensitivity"
          },
          "domain": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Domain"
          },
          "labels": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Labels"
          },
          "metadata": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Metadata"
          },
          "owner_principal_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Owner Principal Id"
          }
        },
        "type": "object",
        "required": [
          "external_resource_id",
          "text"
        ],
        "title": "BatchIngestRecord",
        "description": "A single record in a batch ingestion request."
      },
      "BatchIngestRequest": {
        "properties": {
          "connector_id": {
            "type": "string",
            "title": "Connector Id"
          },
          "records": {
            "items": {
              "$ref": "#/components/schemas/BatchIngestRecord"
            },
            "type": "array",
            "maxItems": 100,
            "minItems": 1,
            "title": "Records"
          },
          "idempotency_key": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 255
              },
              {
                "type": "null"
              }
            ],
            "title": "Idempotency Key"
          }
        },
        "type": "object",
        "required": [
          "connector_id",
          "records"
        ],
        "title": "BatchIngestRequest",
        "description": "Request to ingest a batch of documents."
      },
      "BatchPreviewRequest": {
        "properties": {
          "principal_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "maxItems": 5,
            "title": "Principal Ids"
          },
          "connector_id": {
            "type": "string",
            "title": "Connector Id"
          },
          "query": {
            "type": "string",
            "title": "Query"
          },
          "top_k": {
            "type": "integer",
            "maximum": 20.0,
            "minimum": 1.0,
            "title": "Top K",
            "default": 10
          },
          "search_mode": {
            "type": "string",
            "enum": [
              "vector",
              "keyword",
              "hybrid"
            ],
            "title": "Search Mode",
            "default": "vector"
          },
          "alpha": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 1.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Alpha"
          }
        },
        "type": "object",
        "required": [
          "principal_ids",
          "connector_id",
          "query"
        ],
        "title": "BatchPreviewRequest",
        "description": "Request body for the batch live preview endpoint."
      },
      "BillingPortalRequest": {
        "properties": {
          "return_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Return Url"
          }
        },
        "type": "object",
        "title": "BillingPortalRequest",
        "description": "Request to create a billing portal session."
      },
      "BillingPortalResponse": {
        "properties": {
          "portal_url": {
            "type": "string",
            "title": "Portal Url"
          }
        },
        "type": "object",
        "required": [
          "portal_url"
        ],
        "title": "BillingPortalResponse",
        "description": "Billing portal response."
      },
      "BindRequest": {
        "properties": {
          "bindings": {
            "items": {
              "$ref": "#/components/schemas/BindingEntry"
            },
            "type": "array",
            "maxItems": 5000,
            "minItems": 1,
            "title": "Bindings"
          }
        },
        "type": "object",
        "required": [
          "bindings"
        ],
        "title": "BindRequest"
      },
      "BindingEntry": {
        "properties": {
          "vector_id": {
            "type": "string",
            "maxLength": 255,
            "minLength": 1,
            "title": "Vector Id"
          },
          "external_resource_id": {
            "type": "string",
            "maxLength": 500,
            "minLength": 1,
            "title": "External Resource Id"
          },
          "classification": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Classification"
          },
          "sensitivity": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sensitivity"
          },
          "domain": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Domain"
          },
          "labels": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Labels"
          }
        },
        "type": "object",
        "required": [
          "vector_id",
          "external_resource_id"
        ],
        "title": "BindingEntry"
      },
      "Body_ingest_file_api_v1_ingest_file_post": {
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "title": "File"
          },
          "connector_id": {
            "type": "string",
            "title": "Connector Id"
          },
          "external_resource_id": {
            "type": "string",
            "title": "External Resource Id"
          },
          "classification": {
            "type": "string",
            "title": "Classification"
          },
          "sensitivity": {
            "type": "string",
            "title": "Sensitivity"
          },
          "domain": {
            "type": "string",
            "title": "Domain"
          },
          "labels": {
            "type": "string",
            "title": "Labels"
          },
          "metadata_json": {
            "type": "string",
            "title": "Metadata Json"
          },
          "idempotency_key": {
            "type": "string",
            "title": "Idempotency Key"
          }
        },
        "type": "object",
        "required": [
          "file",
          "connector_id"
        ],
        "title": "Body_ingest_file_api_v1_ingest_file_post"
      },
      "Body_ingest_files_api_v1_ingest_files_post": {
        "properties": {
          "files": {
            "items": {
              "type": "string",
              "format": "binary"
            },
            "type": "array",
            "title": "Files"
          },
          "connector_id": {
            "type": "string",
            "title": "Connector Id"
          },
          "domain": {
            "type": "string",
            "title": "Domain"
          },
          "classification": {
            "type": "string",
            "title": "Classification"
          },
          "sensitivity": {
            "type": "string",
            "title": "Sensitivity"
          },
          "labels": {
            "type": "string",
            "title": "Labels"
          }
        },
        "type": "object",
        "required": [
          "files",
          "connector_id"
        ],
        "title": "Body_ingest_files_api_v1_ingest_files_post"
      },
      "CandidatePolicyMetadata": {
        "properties": {
          "classification": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Classification"
          },
          "sensitivity": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sensitivity"
          },
          "domain": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Domain"
          },
          "labels": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Labels"
          },
          "encryption_mode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Encryption Mode"
          }
        },
        "type": "object",
        "title": "CandidatePolicyMetadata",
        "description": "Typed inline metadata for policy evaluation.\n\nOnly used when no registered resource_id is provided."
      },
      "CheckoutRequest": {
        "properties": {
          "plan_id": {
            "type": "string",
            "title": "Plan Id"
          },
          "billing_period": {
            "type": "string",
            "title": "Billing Period",
            "default": "monthly"
          }
        },
        "type": "object",
        "required": [
          "plan_id"
        ],
        "title": "CheckoutRequest",
        "description": "Request to start a checkout session."
      },
      "CheckoutResponse": {
        "properties": {
          "checkout_url": {
            "type": "string",
            "title": "Checkout Url"
          },
          "session_id": {
            "type": "string",
            "title": "Session Id"
          }
        },
        "type": "object",
        "required": [
          "checkout_url",
          "session_id"
        ],
        "title": "CheckoutResponse",
        "description": "Checkout session response."
      },
      "ClassificationSuggestion": {
        "properties": {
          "resource_key": {
            "type": "string",
            "title": "Resource Key"
          },
          "vector_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Vector Ids",
            "default": []
          },
          "suggested_classification": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Suggested Classification"
          },
          "suggested_sensitivity": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Suggested Sensitivity"
          },
          "suggested_domain": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Suggested Domain"
          },
          "confidence": {
            "type": "number",
            "title": "Confidence",
            "default": 0.0
          },
          "reasoning": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reasoning"
          }
        },
        "type": "object",
        "required": [
          "resource_key"
        ],
        "title": "ClassificationSuggestion",
        "description": "A single classification suggestion for a resource group."
      },
      "CreateApiKeyRequest": {
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100,
            "minLength": 1,
            "title": "Name",
            "description": "Human-readable label"
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At",
            "description": "Optional expiry timestamp (timezone-aware). Omit for no expiry."
          }
        },
        "type": "object",
        "required": [
          "name"
        ],
        "title": "CreateApiKeyRequest",
        "description": "Request body for POST /api/api-keys."
      },
      "CreateApiKeyResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "prefix": {
            "type": "string",
            "title": "Prefix"
          },
          "last_used_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Used At"
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "created_at": {
            "type": "string",
            "title": "Created At"
          },
          "key": {
            "type": "string",
            "title": "Key",
            "description": "Full API key \u2014 display once and discard"
          }
        },
        "type": "object",
        "required": [
          "id",
          "name",
          "prefix",
          "last_used_at",
          "expires_at",
          "created_at",
          "key"
        ],
        "title": "CreateApiKeyResponse",
        "description": "Response for POST /api/api-keys \u2014 includes the plaintext key exactly once."
      },
      "CreateConnectorRequest": {
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200,
            "minLength": 1,
            "title": "Name"
          },
          "type": {
            "type": "string",
            "title": "Type"
          },
          "config": {
            "additionalProperties": true,
            "type": "object",
            "title": "Config"
          },
          "metadata_resolution_mode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Metadata Resolution Mode"
          }
        },
        "type": "object",
        "required": [
          "name",
          "type"
        ],
        "title": "CreateConnectorRequest"
      },
      "CreateFromTemplateRequest": {
        "properties": {
          "template_id": {
            "type": "string",
            "title": "Template Id"
          },
          "placeholder_values": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object",
            "title": "Placeholder Values"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          }
        },
        "type": "object",
        "required": [
          "template_id",
          "placeholder_values"
        ],
        "title": "CreateFromTemplateRequest",
        "description": "Request body for ``POST /api/policies/from-template``.\n\nAttributes:\n    template_id: ID of the template to instantiate (e.g., ``\"group_rbac\"``).\n    placeholder_values: Mapping of placeholder key to substitution string.\n    name: Optional override for the rendered policy name."
      },
      "CreateIdentityProviderRequest": {
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200,
            "minLength": 1,
            "title": "Name"
          },
          "type": {
            "type": "string",
            "title": "Type"
          },
          "config": {
            "additionalProperties": true,
            "type": "object",
            "title": "Config"
          },
          "sync_config": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sync Config"
          }
        },
        "type": "object",
        "required": [
          "name",
          "type"
        ],
        "title": "CreateIdentityProviderRequest"
      },
      "CreatePipelineRequest": {
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200,
            "minLength": 1,
            "title": "Name"
          },
          "source_connector_id": {
            "type": "string",
            "title": "Source Connector Id"
          },
          "envelope_config": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Envelope Config"
          },
          "schedule": {
            "type": "string",
            "title": "Schedule",
            "default": "manual"
          }
        },
        "type": "object",
        "required": [
          "name",
          "source_connector_id"
        ],
        "title": "CreatePipelineRequest"
      },
      "CreatePolicyRequest": {
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200,
            "minLength": 1,
            "title": "Name"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "type": {
            "type": "string",
            "title": "Type"
          },
          "effect": {
            "type": "string",
            "title": "Effect"
          },
          "resource_selectors": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Resource Selectors"
          },
          "rules": {
            "items": {
              "$ref": "#/components/schemas/PolicyRuleRequest"
            },
            "type": "array",
            "title": "Rules"
          },
          "apply_to_all_resources": {
            "type": "boolean",
            "title": "Apply To All Resources",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "name",
          "type",
          "effect"
        ],
        "title": "CreatePolicyRequest"
      },
      "CreateRelationshipRequest": {
        "properties": {
          "subject_principal_id": {
            "type": "string",
            "format": "uuid",
            "title": "Subject Principal Id"
          },
          "relation_name": {
            "type": "string",
            "maxLength": 64,
            "minLength": 1,
            "title": "Relation Name"
          },
          "object_resource_id": {
            "type": "string",
            "format": "uuid",
            "title": "Object Resource Id"
          }
        },
        "type": "object",
        "required": [
          "subject_principal_id",
          "relation_name",
          "object_resource_id"
        ],
        "title": "CreateRelationshipRequest",
        "description": "Body for POST /api/relationships.\n\nAttributes:\n    subject_principal_id: UUID of the principal who holds the relation.\n    relation_name: Named relation (e.g. ``\"viewer\"``, ``\"editor\"``).\n        Between 1 and 64 characters.\n    object_resource_id: UUID of the gated resource being related to."
      },
      "DashboardSparklines": {
        "properties": {
          "retrievals_24h": {
            "items": {
              "type": "integer"
            },
            "type": "array",
            "title": "Retrievals 24H"
          },
          "denied_24h": {
            "items": {
              "type": "integer"
            },
            "type": "array",
            "title": "Denied 24H"
          },
          "principals_7d": {
            "items": {
              "type": "integer"
            },
            "type": "array",
            "title": "Principals 7D"
          },
          "coverage_7d": {
            "items": {
              "type": "number"
            },
            "type": "array",
            "title": "Coverage 7D"
          }
        },
        "type": "object",
        "required": [
          "retrievals_24h",
          "denied_24h",
          "principals_7d",
          "coverage_7d"
        ],
        "title": "DashboardSparklines",
        "description": "Time-series data for dashboard KPI sparklines.\n\nAll arrays are zero-filled server-side to exact lengths.\n\n- retrievals_24h: 24 hourly buckets ending at the current hour (UTC).\n  Sums allowed + partial + denied outcomes per bucket.\n- denied_24h: 24 hourly buckets aligned to retrievals_24h; denied outcomes only.\n- principals_7d: 7 daily buckets ending today; counts principals with\n  status='active' AND last_seen falling within each day's window.\n- coverage_7d: 7 daily buckets; v1 returns a flat line of the current\n  coverage value (no historical snapshots exist yet). A future migration\n  will add a coverage_snapshots table for true 7-day trend data."
      },
      "DashboardStats": {
        "properties": {
          "retrievals_today": {
            "type": "integer",
            "title": "Retrievals Today",
            "default": 0
          },
          "retrievals_allowed": {
            "type": "integer",
            "title": "Retrievals Allowed",
            "default": 0
          },
          "retrievals_denied": {
            "type": "integer",
            "title": "Retrievals Denied",
            "default": 0
          },
          "connectors_connected": {
            "type": "integer",
            "title": "Connectors Connected",
            "default": 0
          },
          "connectors_error": {
            "type": "integer",
            "title": "Connectors Error",
            "default": 0
          },
          "idps_connected": {
            "type": "integer",
            "title": "Idps Connected",
            "default": 0
          },
          "idps_principal_count": {
            "type": "integer",
            "title": "Idps Principal Count",
            "default": 0
          },
          "last_idp_sync": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Idp Sync"
          },
          "recent_denied": {
            "items": {
              "$ref": "#/components/schemas/RecentDeniedRetrieval"
            },
            "type": "array",
            "title": "Recent Denied",
            "default": []
          },
          "total_bound_vectors": {
            "type": "integer",
            "title": "Total Bound Vectors",
            "default": 0
          },
          "total_vectors": {
            "type": "integer",
            "title": "Total Vectors",
            "default": 0
          },
          "overall_coverage_pct": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Overall Coverage Pct"
          },
          "connectors_policy_ready": {
            "type": "integer",
            "title": "Connectors Policy Ready",
            "default": 0
          },
          "sparklines": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DashboardSparklines"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "title": "DashboardStats"
      },
      "ExchangeCodeRequest": {
        "properties": {
          "code": {
            "type": "string",
            "title": "Code"
          }
        },
        "type": "object",
        "required": [
          "code"
        ],
        "title": "ExchangeCodeRequest"
      },
      "ExecuteAnswerRequest": {
        "properties": {
          "query": {
            "type": "string",
            "maxLength": 2000,
            "minLength": 1,
            "title": "Query"
          },
          "principal_id": {
            "type": "string",
            "title": "Principal Id"
          },
          "connector_id": {
            "type": "string",
            "title": "Connector Id"
          },
          "top_k": {
            "type": "integer",
            "maximum": 20.0,
            "minimum": 1.0,
            "title": "Top K",
            "default": 15
          },
          "filters": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Filters"
          },
          "search_mode": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "vector",
                  "keyword",
                  "hybrid"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Search Mode"
          },
          "alpha": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 1.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Alpha"
          }
        },
        "type": "object",
        "required": [
          "query",
          "principal_id",
          "connector_id"
        ],
        "title": "ExecuteAnswerRequest"
      },
      "ExecuteRetrievalRequest": {
        "properties": {
          "query_vector": {
            "anyOf": [
              {
                "items": {
                  "type": "number"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Query Vector",
            "description": "Pre-computed query embedding. If omitted, server embeds query text."
          },
          "query": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Query",
            "description": "Natural language query. Required if query_vector is omitted."
          },
          "principal_id": {
            "type": "string",
            "title": "Principal Id"
          },
          "connector_id": {
            "type": "string",
            "title": "Connector Id"
          },
          "top_k": {
            "type": "integer",
            "maximum": 100.0,
            "minimum": 1.0,
            "title": "Top K",
            "default": 10
          },
          "filters": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Filters"
          },
          "include_unresolved": {
            "type": "boolean",
            "title": "Include Unresolved",
            "description": "Include unresolved results for diagnostics",
            "default": false
          },
          "search_mode": {
            "type": "string",
            "enum": [
              "vector",
              "keyword",
              "hybrid",
              "grep"
            ],
            "title": "Search Mode",
            "description": "Search mode: vector (ANN), keyword (FTS), hybrid (vector+keyword), grep (exact match)",
            "default": "vector"
          },
          "alpha": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 1.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Alpha",
            "description": "Hybrid weight: 1.0=all-vector, 0.0=all-keyword. Only for hybrid mode."
          },
          "pattern_type": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "substring",
                  "regex"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Pattern Type",
            "description": "Grep pattern type. Only for grep mode."
          },
          "case_sensitive": {
            "type": "boolean",
            "title": "Case Sensitive",
            "description": "Case-sensitive grep matching. Only for grep mode.",
            "default": false
          },
          "content_mode": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "inline",
                  "ref"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Content Mode",
            "description": "Content delivery mode. 'ref' returns signed URLs instead of inline content (Enterprise only)."
          }
        },
        "type": "object",
        "required": [
          "principal_id",
          "connector_id"
        ],
        "title": "ExecuteRetrievalRequest"
      },
      "FilterCandidate": {
        "properties": {
          "vector_id": {
            "type": "string",
            "title": "Vector Id"
          },
          "score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Score"
          },
          "text": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 10000
              },
              {
                "type": "null"
              }
            ],
            "title": "Text"
          },
          "resource_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Resource Id"
          },
          "metadata": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CandidatePolicyMetadata"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "required": [
          "vector_id"
        ],
        "title": "FilterCandidate",
        "description": "A single candidate for policy filtering."
      },
      "FilterRequest": {
        "properties": {
          "principal_id": {
            "type": "string",
            "title": "Principal Id"
          },
          "connector_id": {
            "type": "string",
            "title": "Connector Id"
          },
          "candidates": {
            "items": {
              "$ref": "#/components/schemas/FilterCandidate"
            },
            "type": "array",
            "maxItems": 100,
            "minItems": 1,
            "title": "Candidates"
          },
          "include_trace": {
            "type": "boolean",
            "title": "Include Trace",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "principal_id",
          "connector_id",
          "candidates"
        ],
        "title": "FilterRequest",
        "description": "Request body for POST /api/retrievals/filter."
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "IngestDocumentRequest": {
        "properties": {
          "connector_id": {
            "type": "string",
            "title": "Connector Id"
          },
          "external_resource_id": {
            "type": "string",
            "maxLength": 500,
            "minLength": 1,
            "title": "External Resource Id"
          },
          "text": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Text"
          },
          "pre_embedded_chunks": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/PreEmbeddedChunk"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pre Embedded Chunks"
          },
          "classification": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Classification"
          },
          "sensitivity": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sensitivity"
          },
          "domain": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Domain"
          },
          "labels": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Labels"
          },
          "metadata": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Metadata"
          },
          "owner_principal_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Owner Principal Id"
          },
          "idempotency_key": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 255
              },
              {
                "type": "null"
              }
            ],
            "title": "Idempotency Key"
          }
        },
        "type": "object",
        "required": [
          "connector_id",
          "external_resource_id"
        ],
        "title": "IngestDocumentRequest",
        "description": "Request to ingest a single document."
      },
      "InviteRequest": {
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "title": "Email"
          }
        },
        "type": "object",
        "required": [
          "email"
        ],
        "title": "InviteRequest"
      },
      "LoginRequest": {
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "title": "Email"
          },
          "password": {
            "type": "string",
            "title": "Password"
          },
          "rememberMe": {
            "type": "boolean",
            "title": "Rememberme",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "email",
          "password"
        ],
        "title": "LoginRequest"
      },
      "LoginResponse": {
        "properties": {
          "user": {
            "$ref": "#/components/schemas/UserResponse"
          },
          "tokens": {
            "$ref": "#/components/schemas/TokenResponse"
          }
        },
        "type": "object",
        "required": [
          "user",
          "tokens"
        ],
        "title": "LoginResponse"
      },
      "OrganizationResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "slug": {
            "type": "string",
            "title": "Slug"
          },
          "plan": {
            "type": "string",
            "title": "Plan"
          }
        },
        "type": "object",
        "required": [
          "id",
          "name",
          "slug",
          "plan"
        ],
        "title": "OrganizationResponse"
      },
      "PlanUpdateRequest": {
        "properties": {
          "plan": {
            "type": "string",
            "title": "Plan"
          }
        },
        "type": "object",
        "required": [
          "plan"
        ],
        "title": "PlanUpdateRequest",
        "description": "Request body for updating an organization's plan."
      },
      "PolicyRuleRequest": {
        "properties": {
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "effect": {
            "type": "string",
            "title": "Effect"
          },
          "conditions": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Conditions"
          },
          "priority": {
            "type": "integer",
            "title": "Priority",
            "default": 0
          }
        },
        "type": "object",
        "required": [
          "effect"
        ],
        "title": "PolicyRuleRequest"
      },
      "PreEmbeddedChunk": {
        "properties": {
          "text": {
            "type": "string",
            "title": "Text"
          },
          "vector": {
            "items": {
              "type": "number"
            },
            "type": "array",
            "title": "Vector"
          }
        },
        "type": "object",
        "required": [
          "text",
          "vector"
        ],
        "title": "PreEmbeddedChunk",
        "description": "A pre-embedded chunk with text and its vector embedding (BYOE)."
      },
      "PreflightCheck": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name"
          },
          "passed": {
            "type": "boolean",
            "title": "Passed"
          },
          "message": {
            "type": "string",
            "title": "Message"
          },
          "blocking": {
            "type": "boolean",
            "title": "Blocking",
            "default": true
          }
        },
        "type": "object",
        "required": [
          "name",
          "passed",
          "message"
        ],
        "title": "PreflightCheck",
        "description": "A single preflight readiness check result."
      },
      "PreflightResult": {
        "properties": {
          "connector_id": {
            "type": "string",
            "title": "Connector Id"
          },
          "readiness_level": {
            "type": "integer",
            "title": "Readiness Level"
          },
          "ready_for_production": {
            "type": "boolean",
            "title": "Ready For Production"
          },
          "checks": {
            "items": {
              "$ref": "#/components/schemas/PreflightCheck"
            },
            "type": "array",
            "title": "Checks"
          },
          "recommendation": {
            "type": "string",
            "title": "Recommendation"
          }
        },
        "type": "object",
        "required": [
          "connector_id",
          "readiness_level",
          "ready_for_production",
          "checks",
          "recommendation"
        ],
        "title": "PreflightResult",
        "description": "Preflight readiness result for a connector."
      },
      "PreviewRequest": {
        "properties": {
          "principal_id": {
            "type": "string",
            "title": "Principal Id"
          },
          "connector_id": {
            "type": "string",
            "title": "Connector Id"
          },
          "query": {
            "type": "string",
            "title": "Query"
          },
          "top_k": {
            "type": "integer",
            "maximum": 20.0,
            "minimum": 1.0,
            "title": "Top K",
            "default": 10
          },
          "search_mode": {
            "type": "string",
            "enum": [
              "vector",
              "keyword",
              "hybrid"
            ],
            "title": "Search Mode",
            "default": "vector"
          },
          "alpha": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 1.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Alpha"
          }
        },
        "type": "object",
        "required": [
          "principal_id",
          "connector_id",
          "query"
        ],
        "title": "PreviewRequest",
        "description": "Request body for the live preview endpoint."
      },
      "PreviewResponse": {
        "properties": {
          "outcome": {
            "type": "string",
            "title": "Outcome"
          },
          "query": {
            "type": "string",
            "title": "Query"
          },
          "principal_name": {
            "type": "string",
            "title": "Principal Name"
          },
          "connector_name": {
            "type": "string",
            "title": "Connector Name"
          },
          "search_mode": {
            "type": "string",
            "title": "Search Mode"
          },
          "total_results": {
            "type": "integer",
            "title": "Total Results"
          },
          "allowed_results": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Allowed Results"
          },
          "denied_results": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Denied Results"
          },
          "policy_trace": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Policy Trace"
          },
          "timing_ms": {
            "type": "number",
            "title": "Timing Ms"
          }
        },
        "type": "object",
        "required": [
          "outcome",
          "query",
          "principal_name",
          "connector_name",
          "search_mode",
          "total_results",
          "allowed_results",
          "denied_results",
          "policy_trace",
          "timing_ms"
        ],
        "title": "PreviewResponse",
        "description": "Response from the live preview endpoint."
      },
      "RecentDeniedRetrieval": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "query": {
            "type": "string",
            "title": "Query"
          },
          "principal_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Principal Name"
          },
          "denial_reason": {
            "type": "string",
            "title": "Denial Reason"
          },
          "timestamp": {
            "type": "string",
            "title": "Timestamp"
          }
        },
        "type": "object",
        "required": [
          "id",
          "query",
          "principal_name",
          "denial_reason",
          "timestamp"
        ],
        "title": "RecentDeniedRetrieval"
      },
      "RefreshTokenRequest": {
        "properties": {
          "refresh_token": {
            "type": "string",
            "title": "Refresh Token"
          }
        },
        "type": "object",
        "required": [
          "refresh_token"
        ],
        "title": "RefreshTokenRequest"
      },
      "RelationshipResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "organization_id": {
            "type": "string",
            "title": "Organization Id"
          },
          "subject_principal_id": {
            "type": "string",
            "title": "Subject Principal Id"
          },
          "relation_name": {
            "type": "string",
            "title": "Relation Name"
          },
          "object_resource_id": {
            "type": "string",
            "title": "Object Resource Id"
          },
          "created_by_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By User Id"
          },
          "created_at": {
            "type": "string",
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "organization_id",
          "subject_principal_id",
          "relation_name",
          "object_resource_id",
          "created_by_user_id",
          "created_at"
        ],
        "title": "RelationshipResponse",
        "description": "Safe serialization of a Relationship row.\n\nAll UUID fields are returned as strings for JSON compatibility.\n``created_by_user_id`` is ``None`` when the creator user has been deleted\n(SET NULL on FK) or was not provided at creation time."
      },
      "ResolveRequest": {
        "properties": {
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "provider_subject": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Provider Subject"
          },
          "identity_provider_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Identity Provider Id"
          }
        },
        "type": "object",
        "title": "ResolveRequest",
        "description": "Request body for the principal resolver endpoint.\n\nAt least one of ``email`` or ``provider_subject`` must be supplied.\nWhen both are provided the resolver queries by email first and falls\nback to ``provider_subject`` only if no email match is found.\nOptionally scope the ``provider_subject`` lookup to a specific IDP via\n``identity_provider_id``."
      },
      "RetroactiveRegisterRequest": {
        "properties": {
          "connector_id": {
            "type": "string",
            "title": "Connector Id"
          },
          "scan_limit": {
            "type": "integer",
            "maximum": 10000.0,
            "minimum": 1.0,
            "title": "Scan Limit",
            "default": 1000
          },
          "default_classification": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Default Classification"
          },
          "default_sensitivity": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Default Sensitivity"
          },
          "default_domain": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Default Domain"
          },
          "default_labels": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Default Labels"
          },
          "grouping_strategy": {
            "type": "string",
            "title": "Grouping Strategy",
            "default": "individual"
          },
          "grouping_pattern": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Grouping Pattern"
          },
          "dry_run": {
            "type": "boolean",
            "title": "Dry Run",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "connector_id"
        ],
        "title": "RetroactiveRegisterRequest",
        "description": "Request to retroactively register unmanaged vectors as gated resources."
      },
      "SignupRequest": {
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100,
            "minLength": 1,
            "title": "Name"
          },
          "email": {
            "type": "string",
            "format": "email",
            "title": "Email"
          },
          "password": {
            "type": "string",
            "maxLength": 128,
            "minLength": 8,
            "title": "Password"
          },
          "organization_name": {
            "type": "string",
            "maxLength": 100,
            "minLength": 1,
            "title": "Organization Name",
            "default": ""
          },
          "invite_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Invite Token"
          }
        },
        "type": "object",
        "required": [
          "name",
          "email",
          "password"
        ],
        "title": "SignupRequest"
      },
      "SimulationRequest": {
        "properties": {
          "principal_id": {
            "type": "string",
            "title": "Principal Id"
          },
          "query": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Query"
          },
          "connector_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Connector Id"
          },
          "resource_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Resource Ids"
          }
        },
        "type": "object",
        "required": [
          "principal_id"
        ],
        "title": "SimulationRequest",
        "description": "Request body for the dry-run simulation endpoint."
      },
      "SimulationResponse": {
        "properties": {
          "outcome": {
            "type": "string",
            "title": "Outcome"
          },
          "matched_resources": {
            "type": "integer",
            "title": "Matched Resources"
          },
          "allowed": {
            "type": "integer",
            "title": "Allowed"
          },
          "denied": {
            "type": "integer",
            "title": "Denied"
          },
          "policy_trace": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Policy Trace"
          },
          "denial_reasons": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Denial Reasons"
          }
        },
        "type": "object",
        "required": [
          "outcome",
          "matched_resources",
          "allowed",
          "denied",
          "policy_trace",
          "denial_reasons"
        ],
        "title": "SimulationResponse",
        "description": "Response from the dry-run simulation endpoint."
      },
      "SuggestClassificationsRequest": {
        "properties": {
          "scan_limit": {
            "type": "integer",
            "maximum": 10000.0,
            "minimum": 1.0,
            "title": "Scan Limit",
            "default": 1000
          },
          "grouping_strategy": {
            "type": "string",
            "title": "Grouping Strategy",
            "default": "individual"
          },
          "grouping_pattern": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Grouping Pattern"
          },
          "sample_size": {
            "type": "integer",
            "maximum": 100.0,
            "minimum": 1.0,
            "title": "Sample Size",
            "default": 10
          }
        },
        "type": "object",
        "title": "SuggestClassificationsRequest",
        "description": "Request body for ``POST /api/connectors/{id}/suggest-classifications``."
      },
      "TestRequest": {
        "properties": {
          "database_url": {
            "type": "string",
            "title": "Database Url"
          }
        },
        "type": "object",
        "required": [
          "database_url"
        ],
        "title": "TestRequest",
        "description": "Request body for connection test."
      },
      "TokenResponse": {
        "properties": {
          "access_token": {
            "type": "string",
            "title": "Access Token"
          },
          "refresh_token": {
            "type": "string",
            "title": "Refresh Token"
          },
          "token_type": {
            "type": "string",
            "title": "Token Type",
            "default": "Bearer"
          },
          "expires_in": {
            "type": "integer",
            "title": "Expires In"
          }
        },
        "type": "object",
        "required": [
          "access_token",
          "refresh_token",
          "expires_in"
        ],
        "title": "TokenResponse"
      },
      "UpdateConnectorRequest": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "config": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Config"
          },
          "metadata_resolution_mode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Metadata Resolution Mode"
          }
        },
        "type": "object",
        "title": "UpdateConnectorRequest"
      },
      "UpdateIdentityProviderRequest": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "config": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Config"
          },
          "sync_config": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sync Config"
          }
        },
        "type": "object",
        "title": "UpdateIdentityProviderRequest"
      },
      "UpdateIngestionConfigRequest": {
        "properties": {
          "ingestion_config": {
            "additionalProperties": true,
            "type": "object",
            "title": "Ingestion Config"
          }
        },
        "type": "object",
        "required": [
          "ingestion_config"
        ],
        "title": "UpdateIngestionConfigRequest"
      },
      "UpdateOrgSettingsRequest": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "failure_mode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Failure Mode"
          },
          "kms_key_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Kms Key Id"
          },
          "llm_api_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Llm Api Key"
          },
          "llm_provider": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Llm Provider"
          },
          "clear_llm_api_key": {
            "type": "boolean",
            "title": "Clear Llm Api Key",
            "default": false
          },
          "llm_key_query_cap": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Llm Key Query Cap"
          }
        },
        "type": "object",
        "title": "UpdateOrgSettingsRequest"
      },
      "UpdatePipelineRequest": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "envelope_config": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Envelope Config"
          },
          "status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          },
          "schedule": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Schedule"
          }
        },
        "type": "object",
        "title": "UpdatePipelineRequest"
      },
      "UpdatePolicyRequest": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "effect": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Effect"
          },
          "resource_selectors": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Resource Selectors"
          },
          "rules": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/PolicyRuleRequest"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rules"
          },
          "apply_to_all_resources": {
            "type": "boolean",
            "title": "Apply To All Resources",
            "default": false
          }
        },
        "type": "object",
        "title": "UpdatePolicyRequest"
      },
      "UpdateResourceMetadataRequest": {
        "properties": {
          "classification": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Classification"
          },
          "sensitivity": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sensitivity"
          },
          "domain": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Domain"
          },
          "labels": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Labels"
          }
        },
        "type": "object",
        "title": "UpdateResourceMetadataRequest",
        "description": "Request to update policy-relevant metadata on a resource (Deliverable B)."
      },
      "UpdateResourceRequest": {
        "properties": {
          "classification": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Classification"
          },
          "sensitivity": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sensitivity"
          },
          "domain": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Domain"
          },
          "labels": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Labels"
          },
          "encryption_mode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Encryption Mode"
          }
        },
        "type": "object",
        "title": "UpdateResourceRequest"
      },
      "UpdateSearchConfigRequest": {
        "properties": {
          "search_config": {
            "additionalProperties": true,
            "type": "object",
            "title": "Search Config"
          }
        },
        "type": "object",
        "required": [
          "search_config"
        ],
        "title": "UpdateSearchConfigRequest"
      },
      "UpdateUserRequest": {
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100,
            "minLength": 1,
            "title": "Name"
          }
        },
        "type": "object",
        "required": [
          "name"
        ],
        "title": "UpdateUserRequest"
      },
      "UserResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "email": {
            "type": "string",
            "title": "Email"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "role": {
            "type": "string",
            "title": "Role"
          },
          "organization": {
            "$ref": "#/components/schemas/OrganizationResponse"
          },
          "created_at": {
            "type": "string",
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "email",
          "name",
          "role",
          "organization",
          "created_at"
        ],
        "title": "UserResponse"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    },
    "securitySchemes": {
      "OAuth2PasswordBearer": {
        "type": "oauth2",
        "flows": {
          "password": {
            "scopes": {},
            "tokenUrl": "/api/auth/login"
          }
        }
      }
    }
  }
}
