{
  "openapi": "3.1.0",
  "info": {
    "title": "Hello by Flow API",
    "description": "The Hello by Flow API powers a multi-tenant cloud calling SaaS platform: external Twilio\nvoice & SMS, free internal Team Chat, peer-to-peer WebRTC meetings, agent dashboards,\nand a platform-owner console for managing customer organizations.\n\n## Authentication\n\nTwo equivalent auth schemes are supported on every protected endpoint:\n\n| Scheme | How |\n|---|---|\n| **`access_token` cookie** | Set automatically by `POST /api/auth/login`. Sent with every same-site request. |\n| **`Authorization: Bearer <jwt>`** | Use the `access_token` field returned by `/auth/login` (12-hour TTL). |\n\nThe token encodes the user id and role; org scoping is enforced server-side via\nthe `org_scope(user)` helper in `middleware/auth.py`.\n\n## Roles\n\n| Role | Visibility |\n|---|---|\n| `owner` | Cross-org \u2014 runs `/api/owner/*` platform console. |\n| `admin` | Full control of own organization. |\n| `supervisor` | Read-only across org (calls, recordings, analytics). |\n| `agent` | Only their own contacts / calls / SMS. |\n\n## Errors\n\nAll errors use the FastAPI default `{ \"detail\": \"...\" }` envelope. Status codes follow\nHTTP semantics: 400 (validation), 401 (no auth), 403 (wrong role), 404 (not found / not\nvisible), 429 (lockout), 503 (Twilio/LLM down). See per-endpoint `responses` for the\nexact failure modes.\n\n## Multi-tenancy\n\nEvery persisted document carries an `org_id`. Non-owner queries are automatically\nscoped to the caller's org. Agent-role users see only their own rows.",
    "contact": {
      "name": "Hello by Flow Partner Support",
      "url": "https://hellobyflow.com/developers",
      "email": "partners@hellobyflow.com"
    },
    "license": {
      "name": "Proprietary \u2014 Hello by Flow Cloud Inc."
    },
    "version": "1.0.0"
  },
  "paths": {
    "/api/auth/csrf": {
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "Bootstrap a CSRF token (sets `csrf_token` cookie)",
        "description": "Call this once before any unsafe (POST/PATCH/DELETE/PUT) request. The response sets a JS-readable `csrf_token` cookie that the frontend must echo back as the `X-CSRF-Token` header on subsequent unsafe calls. The token rotates every 90 days; reading the cookie does not consume it.",
        "operationId": "csrf_bootstrap_api_auth_csrf_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/auth/register": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Disabled \u2014 use POST /api/signup instead",
        "operationId": "register_disabled_api_auth_register_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/auth/login": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Sign in with email/username + password",
        "description": "Returns the authenticated user. Sets HttpOnly `access_token` (15 min) and `refresh_token` (90 d) cookies plus a JS-readable `csrf_token` cookie. After 5 failed attempts the identifier is locked for 15 minutes.",
        "operationId": "login_api_auth_login_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "429": {
            "description": "Rate-limited (e.g. login brute-force lockout).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Too many failed attempts. Try again in 15 minutes."
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/auth/refresh": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Rotate the refresh token (returns new access cookie)",
        "description": "Reads the `refresh_token` HttpOnly cookie, validates it against the server-side store, and ROTATES it: the old refresh is revoked, a new refresh + new access are issued as cookies. Replay of an already-rotated token revokes the entire token family and forces re-login.",
        "operationId": "refresh_api_auth_refresh_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/auth/forgot-password": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Send a password reset link to owner / admin accounts",
        "description": "Accepts {email}. If an eligible account exists (role in {owner, admin} and not disabled), a signed reset link is emailed with a 30-minute expiry. Always returns 200 with a generic message \u2014 no user enumeration. Rate-limited per email + client IP.",
        "operationId": "forgot_password_api_auth_forgot_password_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ForgotPasswordReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "429": {
            "description": "Rate-limited (e.g. login brute-force lockout).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Too many failed attempts. Try again in 15 minutes."
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/auth/reset-password": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Consume a password reset token and set a new password",
        "description": "Accepts {token, new_password}. Verifies the signed reset token and the server-side single-use row, sets the new bcrypt hash, bumps the user's session_epoch (invalidating all prior sessions) and marks the reset row consumed. On success the user must sign in again.",
        "operationId": "reset_password_api_auth_reset_password_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResetPasswordReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/auth/change-password": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Change the current user's password",
        "description": "Verifies the current password, sets the new one, clears any `must_change_password` flag, revokes every other session (session epoch bump) and re-mints fresh cookies for this device.",
        "operationId": "change_password_api_auth_change_password_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangePasswordReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/logout": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Sign out the current session (revokes the active refresh token)",
        "description": "Revokes only the current device's refresh token. Use /auth/sessions/revoke-all to sign out everywhere.",
        "operationId": "logout_api_auth_logout_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/ws-ticket": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Mint a short-lived WebSocket auth ticket (60-second TTL)",
        "description": "WebSockets cannot easily carry HttpOnly cookies across all browsers/proxies, so we expose a one-shot ticket: POST here (cookies + CSRF) and use the returned `ticket` as the `?ticket=\u2026` query param on the RTC WS URL. The ticket is a signed JWT with `type=ws` and a 60s lifetime; the WS handler validates it like any other JWT but rejects non-`ws` types.",
        "operationId": "ws_ticket_api_auth_ws_ticket_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/me": {
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "Get the current authenticated user",
        "operationId": "me_api_auth_me_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/otp/verify": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Email OTP \u2014 verify the 6-digit code emailed to the user",
        "description": "Called with the `challenge_token` returned from /auth/login when the server responded `email_otp_challenge=true`. Accepts a 6-digit code from the user's inbox. On success, mints auth cookies. Set `trust_device=true` to skip OTP on this browser for 30 days.",
        "operationId": "otp_verify_api_auth_otp_verify_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OtpVerifyReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/auth/otp/resend": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Email OTP \u2014 resend the verification code (30-second cool-down)",
        "description": "Issues a fresh 6-digit OTP and re-emails it. Rate-limited to once every 30 seconds per challenge; further calls return 429 with `Retry-After` and the remaining seconds in the error detail.",
        "operationId": "otp_resend_api_auth_otp_resend_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OtpResendReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "429": {
            "description": "Too many resend requests"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/auth/otp/status": {
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "Email OTP \u2014 return whether OTP is required for the current user",
        "operationId": "otp_status_api_auth_otp_status_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/otp/devices": {
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "Email OTP \u2014 list this user's trusted devices",
        "operationId": "otp_devices_api_auth_otp_devices_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Auth"
        ],
        "summary": "Email OTP \u2014 revoke ALL trusted devices for the current user",
        "operationId": "otp_devices_revoke_all_api_auth_otp_devices_delete",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/sessions": {
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "List the caller's active sessions across devices",
        "description": "Returns one entry per active refresh-token. The current device is marked `current: true` (matched by jti).",
        "operationId": "my_sessions_api_auth_sessions_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/sessions/{session_id}": {
      "delete": {
        "tags": [
          "Auth"
        ],
        "summary": "Revoke a specific session (the device behind that jti will be signed out on next API call)",
        "operationId": "revoke_session_api_auth_sessions__session_id__delete",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Session Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/sessions/revoke-all": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Revoke ALL of the caller's sessions (logout everywhere)",
        "operationId": "revoke_all_api_auth_sessions_revoke_all_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          }
        }
      }
    },
    "/api/me": {
      "patch": {
        "tags": [
          "Auth"
        ],
        "summary": "Update the current user's profile",
        "operationId": "update_me_api_me_patch",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProfileUpdateReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/onboarding/intent": {
      "post": {
        "tags": [
          "Business"
        ],
        "summary": "Phase-2 signup: create the signup intent (pre-payment)",
        "description": "Creates an `organizations` row in `status=\"intent\"`. Middleware blocks all product access until the intent is finalised by a successful Stripe payment (and KYC, if required). Legacy `POST /api/signup` remains available under `NEW_SIGNUP_FUNNEL_ENABLED=false`.",
        "operationId": "onboarding_create_intent_api_onboarding_intent_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OnboardingIntentIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OnboardingIntentOut"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/onboarding/intent/{intent_id}": {
      "get": {
        "tags": [
          "Business"
        ],
        "summary": "Phase-2 signup: poll intent state",
        "operationId": "onboarding_intent_status_api_onboarding_intent__intent_id__get",
        "parameters": [
          {
            "name": "intent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Intent Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OnboardingStatusOut"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/onboarding/intent/{intent_id}/kyc": {
      "post": {
        "tags": [
          "Business"
        ],
        "summary": "Phase-2 signup: start KYC (Persona/Stripe Identity)",
        "description": "Creates a verification session with the currently-active identity provider (per Owner Settings). Business rule: KYC must complete BEFORE the Stripe Checkout endpoint below will authorise payment.",
        "operationId": "onboarding_intent_start_kyc_api_onboarding_intent__intent_id__kyc_post",
        "parameters": [
          {
            "name": "intent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Intent Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OnboardingKycStartOut"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Twilio not configured"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/onboarding/intent/{intent_id}/checkout": {
      "post": {
        "tags": [
          "Business"
        ],
        "summary": "Phase-2 signup: create Stripe Checkout session (blocks pre-KYC)",
        "description": "Creates a hosted Stripe Checkout Session. **Explicitly blocks if KYC is required and not yet verified** \u2014 this is the KYC-before-payment gate mandated by the redesign. Metadata `hbf_intent_id` lets the `checkout.session.completed` webhook route the payment back to the intent org and trigger `finalize_intent()`.",
        "operationId": "onboarding_intent_checkout_api_onboarding_intent__intent_id__checkout_post",
        "parameters": [
          {
            "name": "intent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Intent Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OnboardingCheckoutIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OnboardingCheckoutOut"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Twilio not configured"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/onboarding/seats": {
      "get": {
        "tags": [
          "Business"
        ],
        "summary": "Phase-3 wizard: list this org's Communication Seats + their lifecycle",
        "description": "Returns every `virtual_numbers` row belonging to the admin's org.\n\nThe rows carry the extension-first Communication Seat identity: id,\nseat_number, lifecycle_state, and (if bound) phone_e164 and assigned user.",
        "operationId": "onboarding_list_seats_api_onboarding_seats_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeatsListOut"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/onboarding/seats/{seat_id}/bind-number": {
      "post": {
        "tags": [
          "Business"
        ],
        "summary": "Phase-3 wizard: bind a selected Twilio number to a purchased seat",
        "description": "Purchases the specified Twilio number and permanently attaches it to the given seat. Idempotent \u2014 once a seat has a bound number, the endpoint returns HTTP 400. Uses the existing Twilio provider primitive.",
        "operationId": "onboarding_bind_number_api_onboarding_seats__seat_id__bind_number_post",
        "parameters": [
          {
            "name": "seat_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Seat Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SeatBindNumberIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeatBindNumberOut"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Twilio not configured"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/onboarding/seats/{seat_id}/assign-user": {
      "post": {
        "tags": [
          "Business"
        ],
        "summary": "Phase-3 wizard: create a user and permanently assign to a seat",
        "description": "Creates a new employee user record and attaches them to the specified seat. Seat lifecycle transitions `number_assigned \u2192 active` (or `vacant \u2192 active` on re-assignment). Employees never own their identity \u2014 the org admin sets the username & password here.",
        "operationId": "onboarding_assign_user_to_seat_api_onboarding_seats__seat_id__assign_user_post",
        "parameters": [
          {
            "name": "seat_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Seat Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SeatAssignUserIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeatAssignUserOut"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/upgrade-to-business": {
      "post": {
        "tags": [
          "Business"
        ],
        "summary": "Upgrade a solo workspace to a multi-seat business org",
        "description": "Renames the org, switches `type` from `individual` to `business`, and promotes the caller to `admin` so they can invite teammates. Returns the updated org.",
        "operationId": "upgrade_to_business_api_auth_upgrade_to_business_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpgradeBusinessReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Contact not found"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/twilio/token": {
      "get": {
        "tags": [
          "Business"
        ],
        "summary": "Mint a Voice SDK access token",
        "description": "Returns a short-lived (1 hour) JWT the browser uses to register a Twilio Voice softphone. Identity is `vocalis_{username|user_id}` so inbound `dial.client()` rings the right agent.",
        "operationId": "twilio_access_token_api_twilio_token_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Twilio not configured"
                }
              }
            }
          }
        }
      }
    },
    "/api/twilio/account-status": {
      "get": {
        "tags": [
          "Business"
        ],
        "summary": "Twilio account info (Trial vs Full, verified callers)",
        "description": "Returns the upstream Twilio account type/status, the list of verified outbound caller IDs, and any recently rejected inbound callers (so admins know which numbers to verify on Trial accounts).",
        "operationId": "twilio_account_status_api_twilio_account_status_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/twilio/client-event": {
      "post": {
        "tags": [
          "Business"
        ],
        "summary": "Persist a Twilio Voice SDK browser event for diagnostics",
        "description": "Diagnostics-only. Frontend fires a small beacon for every Twilio Device / Call event (registered, unregistered, accept, disconnect, cancel, error) so a support engineer can correlate the browser SDK timeline with the /twilio/status backend callback and the CallSid on the Twilio Console. Zero effect on call routing / behaviour.",
        "operationId": "twilio_client_event_api_twilio_client_event_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/twilio/call-timeline/{call_sid}": {
      "get": {
        "tags": [
          "Business"
        ],
        "summary": "Correlated timeline for a Twilio CallSid",
        "description": "Returns everything we know about one call in a single view: the call row from Twilio itself, our /twilio/status callback snapshot, every browser SDK event we received, and any Twilio Notification records (SIP codes, error text). Use this instead of clicking through the Twilio Console when investigating 31005 / dropped calls.",
        "operationId": "twilio_call_timeline_api_twilio_call_timeline__call_sid__get",
        "parameters": [
          {
            "name": "call_sid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Call Sid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Twilio not configured"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/twilio/webhook-health": {
      "get": {
        "tags": [
          "Business"
        ],
        "summary": "Twilio webhook URLs current state",
        "description": "Shows the Voice/SMS/Status URLs that Twilio currently has on record for your TwiML App and each purchased number, side-by-side with what our backend expects. Any mismatch is a probable cause of call/SMS failures (Twilio error 31005, silent-drop, missing inbound recordings).",
        "operationId": "twilio_webhook_health_api_twilio_webhook_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Twilio not configured"
                }
              }
            }
          }
        }
      }
    },
    "/api/twilio/credentials-audit": {
      "get": {
        "tags": [
          "Business"
        ],
        "summary": "Twilio credential-source drift audit",
        "description": "iter140 diagnostic: reports the last 4 chars of the Twilio Account SID at each of the three credential sources \u2014 env vars, `db.platform_settings.twilio`, and `db.provider_configs.twilio.voice/sms` \u2014 plus which one the production calling client actually loaded at boot. Use this when the Owner-Console health widget disagrees with real outbound calling (symptom: `HTTP 403 Test Account Credentials` while live calls work). Any mismatch here is the root cause.",
        "operationId": "twilio_credentials_audit_api_twilio_credentials_audit_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/twilio/reconcile-webhooks": {
      "post": {
        "tags": [
          "Business"
        ],
        "summary": "Force-repoint Twilio TwiML App + numbers to this backend",
        "description": "One-click reconciliation for admins hitting Twilio error 31005 or silent call drops. Re-writes the Voice / SMS / Status URLs on your TwiML App AND every purchased number to point at this backend's `REACT_APP_BACKEND_URL`. Idempotent \u2014 safe to run any time.",
        "operationId": "twilio_reconcile_webhooks_api_twilio_reconcile_webhooks_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Twilio not configured"
                }
              }
            }
          }
        }
      }
    },
    "/api/twilio/recent-calls": {
      "get": {
        "tags": [
          "Business"
        ],
        "summary": "Recent Twilio call attempts with error codes",
        "description": "Reads the last 20 calls straight from Twilio's API. For each call, returns the direction, status, and \u2014 critically \u2014 any Twilio error code (e.g. 11200 'HTTP retrieval failure' or 32017 'unreachable') that explains why a call dropped. Use this to root-cause client-side 31005 errors.",
        "operationId": "twilio_recent_calls_api_twilio_recent_calls_get",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 20,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Twilio not configured"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/twilio/voice-probe": {
      "get": {
        "tags": [
          "Business"
        ],
        "summary": "Probe our /api/twilio/voice endpoint (bypasses signature check)",
        "description": "Simulates a Twilio POST to /api/twilio/voice with a fake From/To pair and returns the TwiML response body verbatim. Use this to confirm the endpoint produces valid TwiML \u2014 the #1 root cause of Twilio 31005 errors.",
        "operationId": "twilio_voice_probe_api_twilio_voice_probe_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Twilio not configured"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/email-health": {
      "get": {
        "tags": [
          "Business"
        ],
        "summary": "Recent transactional email delivery attempts",
        "description": "Returns the last 30 email delivery attempts with their status (sent / queued / failed). Use to root-cause 'password reset email never arrives' style reports. If everything is `queued` with reason 'RESEND_API_KEY missing', configure Resend in Owner Console \u2192 Providers \u2192 Resend. If entries are `failed` with an error message, that error surfaces Resend's own rejection reason.",
        "operationId": "admin_email_health_api_admin_email_health_get",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 30,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/twilio/verify-caller-id": {
      "post": {
        "tags": [
          "Business"
        ],
        "summary": "Start Twilio outbound caller-ID validation",
        "description": "Twilio places an automated call to the supplied number; the user enters the returned `validation_code` on their dialpad to complete verification. Required on Trial accounts before that number can place inbound calls to your Twilio number (otherwise Twilio rejects with error 21264).",
        "operationId": "twilio_start_caller_verification_api_twilio_verify_caller_id_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyCallerReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Twilio not configured"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/twilio/verified-caller/{sid}": {
      "delete": {
        "tags": [
          "Business"
        ],
        "summary": "Remove a verified caller ID",
        "operationId": "twilio_delete_verified_caller_api_twilio_verified_caller__sid__delete",
        "parameters": [
          {
            "name": "sid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Sid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Twilio not configured"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/ivr": {
      "get": {
        "tags": [
          "Business"
        ],
        "summary": "List IVR flows (admin only)",
        "operationId": "list_ivr_api_ivr_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Business"
        ],
        "summary": "Save an IVR flow",
        "description": "Persists a new IVR graph (nodes + edges). Replaces previous version on next save with the same name.",
        "operationId": "save_ivr_api_ivr_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IVRSaveReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team": {
      "get": {
        "tags": [
          "Users"
        ],
        "summary": "List teammates (admin/supervisor only)",
        "description": "Returns every user in the caller's organization including `calls_today` for each.",
        "operationId": "list_team_api_team_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Users"
        ],
        "summary": "Invite a new teammate (admin only)",
        "description": "Creates a user with a username auto-generated from `name` (no email required). The admin then shares the username + password with the teammate privately. **Enforced server-side**: rejected with **402 Payment Required** if the org has no available seats \u2014 the admin must buy more via `POST /api/billing/seats/purchase` first.",
        "operationId": "add_member_api_team_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamMemberCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "402": {
            "description": "Payment required \u2014 seat limit reached or downgrade rejected.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Seat limit reached. Purchase more seats to add another member."
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team/{user_id}": {
      "patch": {
        "tags": [
          "Users"
        ],
        "summary": "Edit a teammate's credentials + role (admin only)",
        "description": "Update the target user's username, password, display name and/or role. All fields optional \u2014 send only what you want to change. If the user is bound to a Communication Seat, the seat card label is kept in sync automatically. Role changes are limited to `agent`, `supervisor`, `quality`; admins/owners cannot be edited from here.",
        "operationId": "edit_team_member_api_team__user_id__patch",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "title": "Req"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Users"
        ],
        "summary": "Unassign a teammate from their Communication Seat (admin only)",
        "description": "Removes the user AND frees their Communication Seat so the admin can assign it to a new staff member later. The seat itself stays in the org \u2014 numbers are permanent, only the person behind them changes. Owners cannot be removed. Admins cannot remove themselves (would lock the org out). Call history and SMS owned by the removed user remain intact (org-scoped).",
        "operationId": "remove_member_api_team__user_id__delete",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/members": {
      "get": {
        "tags": [
          "Users"
        ],
        "summary": "List teammates (for chat member pickers)",
        "description": "Returns all teammates in the same org (excluding the caller). Any role can call.",
        "operationId": "team_chat_members_api_team_chat_members_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/contacts": {
      "get": {
        "tags": [
          "Contacts"
        ],
        "summary": "List contacts in the caller's organization",
        "description": "Returns up to 500 contacts sorted alphabetically by name. Agent-role users only see contacts they own; admin/supervisor see all org contacts. Pass `?q=` for a case-insensitive substring match on name/phone/email.",
        "operationId": "list_contacts_api_contacts_get",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Q"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Contacts"
        ],
        "summary": "Create a contact",
        "description": "Creates a contact owned by the current user. Auto-generates a DiceBear initials avatar. **Side effect**: any orphan inbound SMS in this org whose `from_number` matches the new contact's phone are automatically re-linked to the new contact. An SMS is considered orphan if its `contact_id` is null OR points to a contact that no longer exists (self-healing for stale references after a contact deletion).",
        "operationId": "add_contact_api_contacts_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactCreate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/contacts/{cid}": {
      "delete": {
        "tags": [
          "Contacts"
        ],
        "summary": "Delete a contact",
        "description": "Permanently removes a contact owned by the caller. Agents can only delete their own contacts.",
        "operationId": "del_contact_api_contacts__cid__delete",
        "parameters": [
          {
            "name": "cid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Cid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Contacts"
        ],
        "summary": "Update a contact",
        "description": "Full replace of name/phone/email/company/tags/notes. Refreshes the avatar if the name changed.",
        "operationId": "update_contact_api_contacts__cid__put",
        "parameters": [
          {
            "name": "cid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Cid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactCreate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/contacts/{cid}/calls": {
      "get": {
        "tags": [
          "Contacts"
        ],
        "summary": "List recent calls touching this contact",
        "description": "Returns calls (up to `limit`, default 50) where the contact's phone matches either side. Phone numbers are normalised \u2014 leading `1` and non-digits stripped before comparison.",
        "operationId": "list_contact_calls_api_contacts__cid__calls_get",
        "parameters": [
          {
            "name": "cid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Cid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/sms": {
      "get": {
        "tags": [
          "Messages"
        ],
        "summary": "List SMS in the caller's organization",
        "description": "Newest first. Pass `?contact_id=...` to scope to a known contact, or `?from_number=...` to fetch an orphan conversation (inbound from a number without a *live* matching contact \u2014 handles stale contact links).",
        "operationId": "list_sms_api_sms_get",
        "parameters": [
          {
            "name": "contact_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Contact Id"
            }
          },
          {
            "name": "from_number",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "From Number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Messages"
        ],
        "summary": "Send an SMS to a customer",
        "description": "Sends an SMS via Twilio's Messages API and persists an outbound record. If Twilio isn't configured (no env vars), the message is logged with `status='mock'` so demo flows still work.",
        "operationId": "send_sms_api_sms_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SmsCreate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/twilio/sms-inbound": {
      "post": {
        "tags": [
          "Messages"
        ],
        "summary": "Twilio inbound-SMS webhook",
        "description": "Public Twilio callback \u2014 persists the inbound message + auto-links the contact by `From` number.",
        "operationId": "twilio_sms_inbound_api_twilio_sms_inbound_post",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        },
        "security": []
      }
    },
    "/api/twilio/sms-status": {
      "post": {
        "tags": [
          "Messages"
        ],
        "summary": "Twilio outbound-SMS status callback",
        "description": "Public Twilio callback fired as an outbound message transitions through queued \u2192 sent \u2192 delivered (or failed / undelivered). Updates the matching sms row so the UI can surface failures instead of silently dropping messages.",
        "operationId": "twilio_sms_status_api_twilio_sms_status_post",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        },
        "security": []
      }
    },
    "/api/team-chat/threads": {
      "get": {
        "tags": [
          "Team Chat"
        ],
        "summary": "List all chat threads (DMs + groups)",
        "description": "Returns one entry per teammate (1:1 DM) and one entry per group the caller belongs to, each with `last_message` and `unread` count. Sorted by last activity descending.",
        "operationId": "team_chat_threads_api_team_chat_threads_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/messages": {
      "get": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Fetch messages for a DM or group thread",
        "description": "Pass exactly one of `with_user` (teammate id) or `group_id`. Auto-marks inbound messages as read for the caller.",
        "operationId": "team_chat_messages_api_team_chat_messages_get",
        "parameters": [
          {
            "name": "with_user",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "With User"
            }
          },
          {
            "name": "group_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Group Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Send a message to a teammate or group",
        "description": "Pass exactly one target (`to_user_id` OR `group_id`). Body may be empty if `attachments` or `call_room_id` is set. `@username` mentions in the body are auto-extracted to `mentions[]`.",
        "operationId": "team_chat_send_api_team_chat_messages_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamMsgReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/groups": {
      "get": {
        "tags": [
          "Team Chat"
        ],
        "summary": "List groups the caller belongs to",
        "operationId": "list_team_groups_api_team_chat_groups_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Create a new group thread",
        "description": "The caller is added automatically. Invalid member ids (outside the org) are silently dropped.",
        "operationId": "create_team_group_api_team_chat_groups_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamGroupCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/groups/{group_id}": {
      "patch": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Rename a group or update its members",
        "description": "Only the group creator or an admin can edit. The creator can never be removed.",
        "operationId": "update_team_group_api_team_chat_groups__group_id__patch",
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Group Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamGroupUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Delete a group and all its messages",
        "description": "Only the group creator or an admin can delete. **Irreversible** \u2014 drops every message in the thread.",
        "operationId": "delete_team_group_api_team_chat_groups__group_id__delete",
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Group Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/organizations/me/chat-settings": {
      "get": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Get current org chat-settings",
        "operationId": "get_org_chat_settings_endpoint_api_organizations_me_chat_settings_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Update org chat-settings (admin only)",
        "description": "Configure the delete/edit window (in seconds) and whether delete-for-everyone is enabled at all.",
        "operationId": "update_org_chat_settings_api_organizations_me_chat_settings_patch",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatSettingsReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/messages/{msg_id}": {
      "patch": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Edit a team-chat message (sender only)",
        "description": "Allowed only within the org's `edit_window_seconds` (default 5 minutes).",
        "operationId": "edit_message_api_team_chat_messages__msg_id__patch",
        "parameters": [
          {
            "name": "msg_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Msg Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MsgEditReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Delete a message (`scope` = me / all / recall)",
        "description": "**`me`**: hide only for the caller. **`recall`**: unsend if the message is still unread by recipients (any age). **`all`**: delete-for-everyone \u2014 sender only, within the org's `delete_window_seconds`, and only if the org admin has not disabled this feature.",
        "operationId": "delete_message_api_team_chat_messages__msg_id__delete",
        "parameters": [
          {
            "name": "msg_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Msg Id"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "me",
              "title": "Scope"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/messages/{msg_id}/react": {
      "post": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Toggle a reaction on a message",
        "description": "Allowed emoji: \ud83d\udc4d \u2764\ufe0f \ud83d\ude02 \ud83d\ude2e \ud83d\ude22 \ud83d\ude4f \ud83d\udc4f \ud83d\udd25. Sending the same emoji a second time removes the reaction.",
        "operationId": "toggle_reaction_api_team_chat_messages__msg_id__react_post",
        "parameters": [
          {
            "name": "msg_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Msg Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/models__schemas__ReactReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/messages/{msg_id}/pin": {
      "post": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Pin / unpin a message",
        "operationId": "toggle_pin_api_team_chat_messages__msg_id__pin_post",
        "parameters": [
          {
            "name": "msg_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Msg Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/messages/{msg_id}/star": {
      "post": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Star / unstar a message (per-user)",
        "operationId": "toggle_star_api_team_chat_messages__msg_id__star_post",
        "parameters": [
          {
            "name": "msg_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Msg Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/messages/{msg_id}/info": {
      "get": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Read receipts + delivery metadata for a message",
        "operationId": "message_info_api_team_chat_messages__msg_id__info_get",
        "parameters": [
          {
            "name": "msg_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Msg Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/search": {
      "get": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Full-text search across all threads the caller can see",
        "description": "Substring match on message body + sender name. Pass `kind=dm|group` and/or `with_user`/`group_id` to scope.",
        "operationId": "search_messages_api_team_chat_search_get",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Q"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Kind"
            }
          },
          {
            "name": "with_user",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "With User"
            }
          },
          {
            "name": "group_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Group Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/search-advanced": {
      "get": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Filtered search (date range, sender, attachments, links)",
        "operationId": "search_advanced_api_team_chat_search_advanced_get",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Q"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Kind"
            }
          },
          {
            "name": "from_user_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "From User 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": "has_attachments",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Has Attachments"
            }
          },
          {
            "name": "has_links",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Has Links"
            }
          },
          {
            "name": "has_documents",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Has Documents"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/upload": {
      "post": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Upload an attachment (\u226425 MB)",
        "description": "Multipart form upload. Returns a `{path, original_filename, content_type, size, kind}` envelope \u2014 pass this as one of the `attachments[]` when sending a message via `POST /api/team-chat/messages`.",
        "operationId": "upload_team_chat_attachment_api_team_chat_upload_post",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_upload_team_chat_attachment_api_team_chat_upload_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Twilio not configured"
                }
              }
            }
          },
          "413": {
            "description": "File exceeds 25 MB"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/files/{path}": {
      "get": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Download an attachment (org-scoped)",
        "description": "Returns the raw file bytes. The caller must belong to the org that uploaded the file.",
        "operationId": "download_team_chat_file_api_team_chat_files__path__get",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Path"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Twilio not configured"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/block/{user_id}": {
      "post": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Block a teammate (DM only)",
        "description": "Blocked users can't message you and you can't message them until you unblock.",
        "operationId": "block_user_api_team_chat_block__user_id__post",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Unblock a teammate",
        "operationId": "unblock_user_api_team_chat_block__user_id__delete",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/blocked": {
      "get": {
        "tags": [
          "Team Chat"
        ],
        "summary": "List blocked teammates",
        "operationId": "list_blocked_api_team_chat_blocked_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/messages/{msg_id}/forward": {
      "post": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Forward a message to teammates and/or groups",
        "description": "Pass at least one of `to_user_ids` or `group_ids`. Optional `comment` is prepended.",
        "operationId": "forward_message_api_team_chat_messages__msg_id__forward_post",
        "parameters": [
          {
            "name": "msg_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Msg Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ForwardReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/messages/{msg_id}/translate": {
      "post": {
        "tags": [
          "Team Chat"
        ],
        "summary": "Translate a message via Claude Sonnet 4.5",
        "description": "Auto-detects the source language and returns translated text in the requested `target` language code (e.g. `es`, `fr`, `hi`, `ja`). Preserves @mentions, URLs, and emoji.",
        "operationId": "translate_message_api_team_chat_messages__msg_id__translate_post",
        "parameters": [
          {
            "name": "msg_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Msg Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TranslateReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Twilio not configured"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "LLM call failed"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/calls": {
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "List calls in the caller's organization",
        "description": "Returns up to `limit` calls (default 100), newest first. Filter by `direction` (`inbound`/`outbound`) and/or `status` (`completed`/`missed`/`no-answer`/`busy`/`failed`/`in-progress`). Agents only see their own calls; admin/supervisor see all org calls.",
        "operationId": "list_calls_api_calls_get",
        "parameters": [
          {
            "name": "direction",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Direction"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/calls/start": {
      "post": {
        "tags": [
          "Calls"
        ],
        "summary": "Log an outbound call (creates an in-progress record)",
        "description": "Records a new call. If `from_number_id` is missing or invalid, the first available org virtual number is used. Returns the persisted call document \u2014 finalise it with `POST /api/calls/{cid}/end` once the call disconnects.",
        "operationId": "start_call_api_calls_start_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CallCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/calls/{cid}/end": {
      "post": {
        "tags": [
          "Calls"
        ],
        "summary": "Finalise a call with duration + outcome",
        "description": "Sets `duration`, final `status`, `recorded` flag, and free-text `notes`. If `recorded=true`, a `recordings` document is also inserted (synthetic in demo data, with a waveform array).",
        "operationId": "end_call_api_calls__cid__end_post",
        "parameters": [
          {
            "name": "cid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Cid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CallEnd"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/recordings": {
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "List call recordings",
        "description": "Returns the 200 most recent recordings the caller can see, each enriched with its parent `call` document.",
        "operationId": "list_recordings_api_recordings_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/recordings/{rid}/download": {
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "Get a download URL or synthetic transcript for a recording",
        "description": "Admin/supervisor/owner only \u2014 **agents receive 403** (compliance / audit policy). Returns the Twilio media URL for real calls, or a synthetic transcript stub for demo recordings (so the UI can still render a downloadable artifact).",
        "operationId": "download_recording_api_recordings__rid__download_get",
        "parameters": [
          {
            "name": "rid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Rid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/recordings/{rid}/audio": {
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "Stream a recording's audio bytes (server-side Twilio auth proxy)",
        "description": "Streams the recording's audio to the browser via our backend so Twilio's Basic-Auth credentials never leak to the client. Same org-scope + seat-gate rules as `/recordings/{id}/download`.",
        "operationId": "stream_recording_audio_api_recordings__rid__audio_get",
        "parameters": [
          {
            "name": "rid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Rid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/twilio/voice": {
      "post": {
        "tags": [
          "Calls"
        ],
        "summary": "Twilio voice webhook (TwiML)",
        "description": "Public Twilio callback \u2014 DO NOT call from a client. Twilio POSTs here when a call connects to our TwiML App; we respond with TwiML telling Twilio whether to ring agents (inbound PSTN) or dial out (outbound from browser softphone).",
        "operationId": "twilio_voice_webhook_api_twilio_voice_post",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        },
        "security": []
      }
    },
    "/api/twilio/voice-inbound": {
      "post": {
        "tags": [
          "Calls"
        ],
        "summary": "Twilio inbound-call webhook (TwiML)",
        "description": "Legacy inbound webhook used by older purchased numbers; the modern endpoint is `/api/twilio/voice`.",
        "operationId": "twilio_voice_inbound_api_twilio_voice_inbound_post",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        },
        "security": []
      }
    },
    "/api/twilio/status": {
      "post": {
        "tags": [
          "Calls"
        ],
        "summary": "Twilio call-status callback",
        "description": "Public Twilio callback that updates `status`, `duration`, and `ended_at` on the matching call record.",
        "operationId": "twilio_status_callback_api_twilio_status_post",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        },
        "security": []
      }
    },
    "/api/twilio/recording": {
      "post": {
        "tags": [
          "Calls"
        ],
        "summary": "Twilio recording-ready callback",
        "description": "Public Twilio callback that persists the recording URL + duration once Twilio finishes writing the MP3.",
        "operationId": "twilio_recording_callback_api_twilio_recording_post",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        },
        "security": []
      }
    },
    "/api/twilio/transfer": {
      "post": {
        "tags": [
          "Calls"
        ],
        "summary": "Transfer a live call (cold or warm)",
        "description": "Re-routes an in-progress call. **Cold** transfer: customer leg is dialed directly to the target while preserving the original caller ID. **Warm** transfer: customer is moved into a named conference; both agents can join.",
        "operationId": "twilio_transfer_api_twilio_transfer_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransferReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Contact not found"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Twilio not configured"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/twilio/conference/add": {
      "post": {
        "tags": [
          "Calls"
        ],
        "summary": "Add a 3rd participant to a live call",
        "description": "Converts a 2-leg call into a named conference and dials in an additional phone or `client:username`.",
        "operationId": "twilio_conference_add_api_twilio_conference_add_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConferenceAddReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Contact not found"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Twilio not configured"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/twilio/voicemail": {
      "post": {
        "tags": [
          "Voicemail"
        ],
        "summary": "Twilio voicemail-recording callback",
        "description": "Public Twilio callback fired when a voicemail recording finishes. Persists a row in the `voicemails` collection. The transcription step is **not** automatic \u2014 clients call `POST /api/voicemail/{id}/transcribe` to spend the Whisper credits on-demand.",
        "operationId": "twilio_voicemail_callback_api_twilio_voicemail_post",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        },
        "security": []
      }
    },
    "/api/voicemail": {
      "get": {
        "tags": [
          "Voicemail"
        ],
        "summary": "List voicemails (org-scoped)",
        "description": "Returns the 200 most recent voicemails the caller can see (admin/supervisor: org-wide; agent: own).",
        "operationId": "list_voicemails_api_voicemail_get",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/voicemail/unread-count": {
      "get": {
        "tags": [
          "Voicemail"
        ],
        "summary": "Unread voicemail count",
        "operationId": "voicemail_unread_count_api_voicemail_unread_count_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/voicemail/business-hours": {
      "get": {
        "tags": [
          "Voicemail"
        ],
        "summary": "Get the org's business-hours config",
        "operationId": "get_business_hours_api_voicemail_business_hours_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Voicemail"
        ],
        "summary": "Update the org's business-hours config (admin only)",
        "description": "When `enabled=true`, every inbound call landing on `/api/twilio/voice` outside the window is sent straight to voicemail (skipping the agent ring stage).",
        "operationId": "set_business_hours_api_voicemail_business_hours_put",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BusinessHours"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/voicemail/{vid}": {
      "get": {
        "tags": [
          "Voicemail"
        ],
        "summary": "Get a single voicemail",
        "operationId": "get_voicemail_api_voicemail__vid__get",
        "parameters": [
          {
            "name": "vid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Vid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Voicemail"
        ],
        "summary": "Delete a voicemail",
        "operationId": "delete_voicemail_api_voicemail__vid__delete",
        "parameters": [
          {
            "name": "vid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Vid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/voicemail/{vid}/transcribe": {
      "post": {
        "tags": [
          "Voicemail"
        ],
        "summary": "Transcribe a voicemail via OpenAI Whisper",
        "description": "Downloads the MP3 from the Twilio recording URL and runs it through `whisper-1`. Returns the transcript synchronously (typically 2-8s for a \u226460s message). Subsequent calls return the cached transcript.",
        "operationId": "transcribe_voicemail_api_voicemail__vid__transcribe_post",
        "parameters": [
          {
            "name": "vid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Vid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Twilio not configured"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/voicemail/{vid}/mark-read": {
      "post": {
        "tags": [
          "Voicemail"
        ],
        "summary": "Mark a voicemail as heard",
        "operationId": "mark_voicemail_read_api_voicemail__vid__mark_read_post",
        "parameters": [
          {
            "name": "vid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Vid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/numbers/entitlement": {
      "get": {
        "tags": [
          "Numbers"
        ],
        "summary": "Included-numbers entitlement for the current org",
        "description": "1 seat = 1 included business number. Returns `included`, `used`, and `remaining`. Toll-free numbers count as `used` too (Version 1 policy). When `remaining <= 0` the UI should suggest adding seats before purchase.",
        "operationId": "numbers_entitlement_api_numbers_entitlement_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/numbers/catalog": {
      "get": {
        "tags": [
          "Numbers"
        ],
        "summary": "List supported countries and assignment target types",
        "description": "Powers the Number Purchase wizard. Provider-agnostic.",
        "operationId": "numbers_catalog_api_numbers_catalog_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/numbers/search": {
      "get": {
        "tags": [
          "Numbers"
        ],
        "summary": "Search purchasable numbers from the configured provider",
        "description": "Returns candidate numbers matching the filters. `type` accepts `local`, `toll-free`, `mobile`, or `national`. Vanity/pattern filters (`contains`, `starts_with`, `ends_with`) are passed to the provider when supported; ignored otherwise. Response is provider-agnostic.",
        "operationId": "search_numbers_api_numbers_search_get",
        "parameters": [
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 2,
              "description": "ISO 3166-1 alpha-2",
              "default": "US",
              "title": "Country"
            },
            "description": "ISO 3166-1 alpha-2"
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "enum": [
                "local",
                "toll-free",
                "mobile",
                "national"
              ],
              "type": "string",
              "default": "local",
              "title": "Type"
            }
          },
          {
            "name": "region",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "State / Province",
              "title": "Region"
            },
            "description": "State / Province"
          },
          {
            "name": "city",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Locality / City",
              "title": "City"
            },
            "description": "Locality / City"
          },
          {
            "name": "area_code",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 6
                },
                {
                  "type": "null"
                }
              ],
              "title": "Area Code"
            }
          },
          {
            "name": "contains",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 10
                },
                {
                  "type": "null"
                }
              ],
              "description": "Vanity pattern (digits or letters)",
              "title": "Contains"
            },
            "description": "Vanity pattern (digits or letters)"
          },
          {
            "name": "starts_with",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 8
                },
                {
                  "type": "null"
                }
              ],
              "title": "Starts With"
            }
          },
          {
            "name": "ends_with",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 8
                },
                {
                  "type": "null"
                }
              ],
              "title": "Ends With"
            }
          },
          {
            "name": "voice",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Voice"
            }
          },
          {
            "name": "sms",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Sms"
            }
          },
          {
            "name": "mms",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Mms"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 50,
              "minimum": 1,
              "default": 20,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Twilio not configured"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/numbers": {
      "get": {
        "tags": [
          "Numbers"
        ],
        "summary": "List virtual numbers (admin/supervisor)",
        "operationId": "list_numbers_api_numbers_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Numbers"
        ],
        "summary": "Provision a synthetic demo number",
        "description": "Creates a fake virtual number for demo purposes. For real Twilio numbers see `POST /api/twilio/numbers/buy`.",
        "operationId": "buy_number_api_numbers_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NumberCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/numbers/{num_id}": {
      "delete": {
        "tags": [
          "Numbers"
        ],
        "summary": "Release a virtual number",
        "operationId": "release_number_api_numbers__num_id__delete",
        "parameters": [
          {
            "name": "num_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Num Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/twilio/numbers/buy": {
      "post": {
        "tags": [
          "Numbers"
        ],
        "summary": "Purchase a real Twilio number (optionally a specific one from search)",
        "description": "If `phone_number` is provided, buys that exact number. Otherwise picks the first available number matching `country` + `type` (legacy behavior). If `assign_to` is provided, the number is atomically assigned after purchase.",
        "operationId": "twilio_buy_real_number_api_twilio_numbers_buy_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Contact not found"
                }
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Twilio not configured"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/numbers/{num_id}/assign": {
      "post": {
        "tags": [
          "Numbers"
        ],
        "summary": "Assign or reassign a number to a routing destination",
        "description": "Assignment is org-scoped and audit-logged. `target_type=unassigned` clears the current assignment (the number becomes idle / parked). Active calls on this number are NOT interrupted.",
        "operationId": "assign_number_api_numbers__num_id__assign_post",
        "parameters": [
          {
            "name": "num_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Num Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssignReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/numbers/{num_id}/assignee": {
      "patch": {
        "tags": [
          "Numbers"
        ],
        "summary": "Edit the credentials of the staff member assigned to this number",
        "description": "Updates the username, password, and/or display name of the currently assigned staff user. The number stays with the same user; only their credentials change. All fields optional \u2014 send only what you want to update.",
        "operationId": "edit_assignee_api_numbers__num_id__assignee_patch",
        "parameters": [
          {
            "name": "num_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Num Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssigneeEditReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/numbers/{num_id}/reassign-new-user": {
      "post": {
        "tags": [
          "Numbers"
        ],
        "summary": "Reassign this number to a brand-new staff member",
        "description": "Creates a fresh staff user with the provided credentials and points this number at them. The previous user (if any) loses access to this seat's line \u2014 their account is preserved and can be reassigned later.",
        "operationId": "reassign_new_user_api_numbers__num_id__reassign_new_user_post",
        "parameters": [
          {
            "name": "num_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Num Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssigneeNewUserReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/numbers/bulk-assign": {
      "post": {
        "tags": [
          "Numbers"
        ],
        "summary": "Bulk assign or reassign multiple numbers",
        "description": "Applies the same target to all provided number ids atomically per record.",
        "operationId": "bulk_assign_numbers_api_numbers_bulk_assign_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkAssignReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/orgs": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "List every customer organization (platform owner only)",
        "description": "Returns all orgs with user/call counts and computed monthly charge. KYC media is excluded.",
        "operationId": "owner_list_orgs_api_owner_orgs_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Create an organization manually (owner only)",
        "description": "Bypass-KYC creation path used by the platform owner to onboard customers via direct contracts.",
        "operationId": "owner_create_org_api_owner_orgs_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OwnerCreateOrg"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/revenue": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Platform revenue summary (owner only)",
        "description": "Computes MRR/ARR across active orgs, broken down by plan tier. Prices are pulled LIVE from Stripe (source of truth) \u2014 never hardcoded. Paying-seat counts use `seats_total` (the quantity we actually bill in Stripe), so managerial-only admins who haven't purchased their own Communication Seat are correctly excluded.",
        "operationId": "owner_revenue_api_owner_revenue_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/orgs/{org_id}": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Get a single org with its users (owner only)",
        "operationId": "owner_get_org_api_owner_orgs__org_id__get",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Admin"
        ],
        "summary": "Hard-delete an organization + all its data (owner only)",
        "description": "Cascade-deletes users, contacts, calls, recordings, SMS, virtual numbers, and IVR flows.",
        "operationId": "owner_delete_api_owner_orgs__org_id__delete",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Admin"
        ],
        "summary": "Update org details (owner only)",
        "description": "Patches any combination of `name`, `plan`, `status`, `seats_total`, `owner_email`, `kyc_status`, `type`. Each field is optional. Writes an audit-log entry.",
        "operationId": "owner_update_org_api_owner_orgs__org_id__patch",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OwnerOrgUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/orgs/{org_id}/approve": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Approve a pending/intent org (owner only)",
        "description": "Owner-approve manually provisions an organisation. Two paths:\n\n1. `status=\"intent\"` \u2014 the org came in through the Signup-Intent funnel\n   but hasn't paid yet. Owner-approve treats this as a comped account:\n   routes through `finalize_intent()` so the org is activated AND the\n   Communication Seats are provisioned (empty `virtual_numbers` rows in\n   `lifecycle_state=\"purchased\"`), exactly like a successful Stripe\n   payment would have. The admin then walks the WelcomeWizard the\n   moment they log in.\n\n2. `status=\"pending\"` \u2014 a legacy signup awaiting review. Just flips the\n   status to `active` and stamps `kyc_status=\"approved\"`.\n\nEither way the welcome email fires afterwards.",
        "operationId": "owner_approve_api_owner_orgs__org_id__approve_post",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/orgs/{org_id}/suspend": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Suspend an active org (owner only)",
        "operationId": "owner_suspend_api_owner_orgs__org_id__suspend_post",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/orgs/{org_id}/reject": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Reject a pending KYC (owner only)",
        "operationId": "owner_reject_api_owner_orgs__org_id__reject_post",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/kyc/veriff/status": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Introspect the Veriff configuration (owner only)",
        "description": "Reports which Mongo collection Veriff was found in, whether api_key / shared_secret / base_url resolved to non-empty values, and what the effective base URL will be. Never returns the secret values themselves \u2014 just booleans + last-4 of the API key.",
        "operationId": "owner_veriff_status_api_owner_kyc_veriff_status_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/kyc/veriff/reset": {
      "delete": {
        "tags": [
          "Admin"
        ],
        "summary": "Delete the Veriff record from every collection (owner only)",
        "description": "Nukes any existing Veriff entry from provider_configs, custom_providers, and provider_registry \u2014 so the operator can re-register via the Marketplace form without the 'already exists' block. Idempotent.",
        "operationId": "owner_veriff_reset_api_owner_kyc_veriff_reset_delete",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/feature-flags": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "List every feature flag currently set (owner only)",
        "operationId": "owner_list_feature_flags_api_owner_feature_flags_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/feature-flags/{name}": {
      "put": {
        "tags": [
          "Admin"
        ],
        "summary": "Set a feature flag (owner only)",
        "description": "Value takes effect immediately \u2014 no redeploy required.",
        "operationId": "owner_set_feature_flag_api_owner_feature_flags__name__put",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Name"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FeatureFlagUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/stats": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Platform-wide counts (owner only)",
        "description": "Total orgs, pending/active/suspended counts, total users, total calls.",
        "operationId": "owner_stats_api_owner_stats_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/data-integrity": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Cross-tenant data-integrity scan (owner only)",
        "description": "Walks every organization in the platform and counts data-integrity signals: SMS records pointing to deleted contacts (`stale_contact_links`), call records pointing to deleted contacts (`stale_call_contact_links`), and meetings whose organizer/participants reference deleted users (`stale_meeting_user_refs`). Returns per-org counts plus a `worst` list sorted by total issues descending. Use the heal endpoint to auto-null those references so they surface as orphans / unknown in the per-tenant UI.",
        "operationId": "owner_data_integrity_api_owner_data_integrity_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/data-integrity/heal/{org_id}": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Self-heal stale references in one org (owner only)",
        "description": "Nulls out stale `contact_id` fields on SMS and call records that point to deleted contacts in the given org. SMS records will then surface as orphans in the tenant's Messages UI; calls will display as 'Unknown' on the call log. Meeting references are NOT auto-healed (deleting an organizer is rare and may indicate the meeting itself should be cancelled). Returns the number of records updated per collection.",
        "operationId": "owner_heal_org_api_owner_data_integrity_heal__org_id__post",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/activity": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Platform-wide activity feed (owner only)",
        "description": "Merged time-sorted activity across every organization: calls, SMS, meetings, new contacts, user signups, owner audit actions. Each row is normalised to {type, org_id, org_name, actor, summary, at}. Filter with `org_id`, `type`, or `q` (substring of summary). Returns newest first.",
        "operationId": "owner_activity_api_owner_activity_get",
        "parameters": [
          {
            "name": "org_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Org Id"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "call|sms|meeting|contact|user|audit",
              "title": "Type"
            },
            "description": "call|sms|meeting|contact|user|audit"
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "substring filter on summary",
              "title": "Q"
            },
            "description": "substring filter on summary"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 100,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/search": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Cross-tenant search (owner only)",
        "description": "Searches users (name/email), contacts (name/phone), virtual numbers, and orgs by name. Returns up to 50 matches across all tenants.",
        "operationId": "owner_search_api_owner_search_get",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "title": "Q"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/orgs/{org_id}/deep": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Org deep snapshot (owner only)",
        "description": "Comprehensive overview of a single tenant: org metadata, all team members (with last_active timestamps inferred from latest call / sms / meeting), counts of every resource (contacts, calls, recordings, sms, meetings, voicemails, numbers), and quick billing snapshot (MRR + plan).",
        "operationId": "owner_org_deep_api_owner_orgs__org_id__deep_get",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/orgs/{org_id}/users": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "List all users of an org (owner)",
        "operationId": "_list_api_owner_orgs__org_id__users_get",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "minimum": 1,
              "default": 500,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/orgs/{org_id}/contacts": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "List all contacts of an org (owner)",
        "operationId": "_list_api_owner_orgs__org_id__contacts_get",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "minimum": 1,
              "default": 200,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/orgs/{org_id}/calls": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "List all calls of an org (owner)",
        "operationId": "_list_api_owner_orgs__org_id__calls_get",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "minimum": 1,
              "default": 200,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/orgs/{org_id}/recordings": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "List all recordings of an org (owner)",
        "operationId": "_list_api_owner_orgs__org_id__recordings_get",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "minimum": 1,
              "default": 200,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/orgs/{org_id}/sms": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "List all SMS of an org (owner)",
        "operationId": "_list_api_owner_orgs__org_id__sms_get",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "minimum": 1,
              "default": 200,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/orgs/{org_id}/meetings": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "List all meetings of an org (owner)",
        "operationId": "_list_api_owner_orgs__org_id__meetings_get",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "minimum": 1,
              "default": 200,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/orgs/{org_id}/voicemails": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "List all voicemails of an org (owner)",
        "operationId": "_list_api_owner_orgs__org_id__voicemails_get",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "minimum": 1,
              "default": 200,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/orgs/{org_id}/numbers": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "List all virtual numbers of an org (owner)",
        "operationId": "_list_api_owner_orgs__org_id__numbers_get",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "minimum": 1,
              "default": 200,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/orgs/{org_id}/ivr": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "List all IVR flows of an org (owner)",
        "operationId": "_list_api_owner_orgs__org_id__ivr_get",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "minimum": 1,
              "default": 200,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/orgs/{org_id}/export": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Export full org data as JSON (owner only)",
        "description": "Returns the entire org's persisted state (org doc + every collection scoped to org_id) as a single JSON document. Use for GDPR data-subject requests or backup before deletion.",
        "operationId": "owner_export_org_api_owner_orgs__org_id__export_get",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/users/{user_id}": {
      "patch": {
        "tags": [
          "Admin"
        ],
        "summary": "Edit any user across the platform (owner only)",
        "description": "Patch `name`, `email`, `role`, or `deleted` (soft delete flag) on any user in any org. Writes an audit entry.",
        "operationId": "owner_update_user_api_owner_users__user_id__patch",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OwnerUserUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Admin"
        ],
        "summary": "Soft-delete a user (owner only)",
        "description": "Marks the user as `deleted: true`. They will no longer be able to log in and won't count against seat quotas, but their history (calls, SMS) is preserved.",
        "operationId": "owner_delete_user_api_owner_users__user_id__delete",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/users/{user_id}/reset-password": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Force-reset a user's password (owner only)",
        "description": "Owner sets a new password for any user. The user is **not** notified by email \u2014 owner must communicate the temp password out-of-band. Logged in the audit trail.",
        "operationId": "owner_reset_password_api_owner_users__user_id__reset_password_post",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OwnerPasswordReset"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/users/{user_id}/force-logout": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Force-logout a user everywhere (owner only)",
        "description": "Revokes every refresh session and invalidates all live access tokens via a session-epoch bump. The user must sign in again on every device.",
        "operationId": "owner_force_logout_api_owner_users__user_id__force_logout_post",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/users/{user_id}/unlock": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Unlock a user account (owner only)",
        "description": "Clears the `is_locked` flag AND wipes all brute-force lockout counters for the user's email so they can sign in immediately.",
        "operationId": "owner_unlock_user_api_owner_users__user_id__unlock_post",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/users/{user_id}/reset-mfa": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Reset a user's MFA (owner only)",
        "description": "Deletes every trusted device and pending email-OTP challenge for the user. On next login they will be re-challenged with a fresh OTP.",
        "operationId": "owner_reset_mfa_api_owner_users__user_id__reset_mfa_post",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/users/{user_id}/force-password-change": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Force a user to change their password at next login (owner only)",
        "description": "Sets `must_change_password`, revokes every session and invalidates live tokens. The user must sign in and immediately set a new password before using the app.",
        "operationId": "owner_force_password_change_api_owner_users__user_id__force_password_change_post",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/orgs/{org_id}/transfer-ownership": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Transfer organization ownership to another user (owner only)",
        "description": "Makes the target user the org's primary admin. Safeguards: the target must belong to the org and be active (not deleted, suspended or locked). Non-admin targets are promoted to admin as part of the transfer. The previous primary admin keeps their admin role.",
        "operationId": "owner_transfer_ownership_api_owner_orgs__org_id__transfer_ownership_post",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OwnerTransferOwnership"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/users/{user_id}/impersonate": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Begin impersonating a user (owner only) \u2014 swaps the active session cookies",
        "description": "Swaps the caller's HttpOnly auth cookies to a new pair authenticating AS the target user. The owner's previous session is preserved on the frontend via a special `owner_resume_token` cookie so the 'Exit impersonation' button can restore them in one click. Every impersonation is audit-logged.",
        "operationId": "owner_impersonate_api_owner_users__user_id__impersonate_post",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/impersonate/stop": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Stop impersonating and restore the owner session (owner-or-impersonator only)",
        "description": "Reads `owner_resume_token` and swaps the cookies back to the owner. Idempotent.",
        "operationId": "owner_impersonate_stop_api_owner_impersonate_stop_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/audit-log": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Owner audit log (owner only)",
        "description": "Returns the immutable trail of every privileged owner action (org edits, user edits, password resets, impersonation, deletes, exports, data-integrity heals). Filter by `org_id`, `action`, or `actor_id`.",
        "operationId": "owner_audit_log_api_owner_audit_log_get",
        "parameters": [
          {
            "name": "org_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Org Id"
            }
          },
          {
            "name": "action",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Action"
            }
          },
          {
            "name": "actor_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Actor Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "minimum": 1,
              "default": 200,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/recordings/{rid}/stream": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Stream a call recording (owner only)",
        "description": "Streams the audio of any recording on the platform through the backend. For real Twilio recordings, the backend fetches with HTTP Basic Auth (account SID + auth token) and pipes the response; for synthetic/demo recordings, returns a JSON 404. Use `<audio src=this-url>` in the UI.",
        "operationId": "owner_stream_recording_api_owner_recordings__rid__stream_get",
        "parameters": [
          {
            "name": "rid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Rid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/orgs/{org_id}/throttle": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Read per-org throttle limits + current usage (owner)",
        "description": "Returns the effective limits (default + org overrides) and the live usage counters for the current minute/hour/day windows for both the `outbound_sms` and `outbound_call` buckets.",
        "operationId": "owner_get_throttle_api_owner_orgs__org_id__throttle_get",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Admin"
        ],
        "summary": "Set (or clear) per-org throttle overrides (owner)",
        "description": "Pass a bucket to set its per-org override; omit / null a bucket to fall back to the platform defaults. Use `{minute: 0}` to hard-freeze a bucket.",
        "operationId": "owner_set_throttle_api_owner_orgs__org_id__throttle_put",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ThrottleOverrideBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/digest/preview": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Compute the current weekly digest (no save, no mail)",
        "description": "Returns the same dict that would be emailed if you clicked Send Now. Use this for the live dashboard preview.",
        "operationId": "digest_preview_api_owner_digest_preview_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/digest/send-now": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Compute, mail, and persist the digest now",
        "description": "Generates a fresh digest, mails it to every verified recipient (plus the owner), records the run in `digest_history`, and writes an audit log row. Returns the run record.",
        "operationId": "digest_send_now_api_owner_digest_send_now_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/digest/history": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Recent digest runs",
        "operationId": "digest_history_api_owner_digest_history_get",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 200,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/digest/history/{run_id}": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Single digest run with full payload",
        "operationId": "digest_history_one_api_owner_digest_history__run_id__get",
        "parameters": [
          {
            "name": "run_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Run Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/digest/history/{run_id}/csv": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Download a digest run as CSV",
        "operationId": "digest_history_csv_api_owner_digest_history__run_id__csv_get",
        "parameters": [
          {
            "name": "run_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Run Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/digest/history/{run_id}/pdf": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Download a digest run as PDF",
        "operationId": "digest_history_pdf_api_owner_digest_history__run_id__pdf_get",
        "parameters": [
          {
            "name": "run_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Run Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/digest/recipients": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "List digest recipients",
        "operationId": "list_recipients_api_owner_digest_recipients_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Add a recipient (sends verification email)",
        "description": "Adds the email as `pending`, generates a verification token, and sends/queues a verification email containing the link. The recipient is **not** mailed any digests until they click that link. If RESEND_API_KEY is not set, the email is queued to `email_outbox` and a copy of the verification URL is returned in `verify_url` so the owner can deliver it out-of-band.",
        "operationId": "add_recipient_api_owner_digest_recipients_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecipientCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/digest/recipients/{rid}/resend-verification": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Resend the verification email",
        "operationId": "resend_verification_api_owner_digest_recipients__rid__resend_verification_post",
        "parameters": [
          {
            "name": "rid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Rid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/digest/recipients/{rid}": {
      "delete": {
        "tags": [
          "Admin"
        ],
        "summary": "Remove a recipient",
        "operationId": "del_recipient_api_owner_digest_recipients__rid__delete",
        "parameters": [
          {
            "name": "rid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Rid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/digest/schedule": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Get the owner's digest schedule",
        "operationId": "get_schedule_api_owner_digest_schedule_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Admin"
        ],
        "summary": "Update the owner's digest schedule",
        "operationId": "update_schedule_api_owner_digest_schedule_patch",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScheduleUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/leaderboard": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Team productivity leaderboard for the caller's org",
        "description": "Returns KPIs, top callers, top SMS users, and a daily call series for the selected window. Scoped to the caller's `org_id`. Pass `range=today|week|month|custom` and (when custom) `from=YYYY-MM-DD&to=YYYY-MM-DD`. Optionally set `compare=previous` to also include the same KPIs for the prior equal-length window so the UI can render deltas.",
        "operationId": "leaderboard_api_leaderboard_get",
        "parameters": [
          {
            "name": "range",
            "in": "query",
            "required": false,
            "schema": {
              "enum": [
                "today",
                "week",
                "month",
                "custom"
              ],
              "type": "string",
              "default": "week",
              "title": "Range"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "From"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "To"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 50,
              "minimum": 1,
              "default": 10,
              "title": "Limit"
            }
          },
          {
            "name": "compare",
            "in": "query",
            "required": false,
            "schema": {
              "enum": [
                "none",
                "previous"
              ],
              "type": "string",
              "default": "none",
              "title": "Compare"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/v2/plans": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "List available plans for the caller's billing country",
        "description": "Return the plan catalog sourced from Stripe (single source of truth),\nmerged with the caller's country metadata (currency, tax_mode, tax_id_types).\n\nThis mirrors what `/api/public/pricing` returns to the landing page, so the\nBilling UI and the marketing site can never drift apart. Falls back to the\nlocal billing_config catalog only when Stripe is unreachable (same\nfallback that public_pricing uses).",
        "operationId": "list_plans_api_billing_v2_plans_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/v2/customer": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Get the org's billing customer state",
        "operationId": "get_customer_api_billing_v2_customer_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Contact not found"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Create or update billing address + tax id (admin/owner)",
        "operationId": "upsert_customer_api_billing_v2_customer_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerUpsertReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Contact not found"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/v2/payment-methods": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "List the org's saved payment methods",
        "operationId": "list_payment_methods_api_billing_v2_payment_methods_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/v2/payment-methods/setup-intent": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Create a setup intent so the UI can attach a card without charging",
        "operationId": "setup_intent_api_billing_v2_payment_methods_setup_intent_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/v2/payment-methods/{pm}/default": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Mark a payment method as default",
        "operationId": "set_default_pm_api_billing_v2_payment_methods__pm__default_post",
        "parameters": [
          {
            "name": "pm",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Pm"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/v2/payment-methods/{pm}/fallback": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Mark a payment method as fallback",
        "operationId": "set_fallback_pm_api_billing_v2_payment_methods__pm__fallback_post",
        "parameters": [
          {
            "name": "pm",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Pm"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/v2/payment-methods/{pm}": {
      "delete": {
        "tags": [
          "Billing"
        ],
        "summary": "Detach a payment method",
        "operationId": "del_pm_api_billing_v2_payment_methods__pm__delete",
        "parameters": [
          {
            "name": "pm",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Pm"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/v2/checkout": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Start a hosted checkout session for plan+seats",
        "operationId": "checkout_api_billing_v2_checkout_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/v2/portal": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Open the Stripe Customer Portal",
        "description": "Returns a short-lived Stripe-hosted portal URL where the org's admin/owner can update payment methods, download invoices, or cancel \u2014 no card data is stored in Hello by Flow.",
        "operationId": "portal_api_billing_v2_portal_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/v2/subscription": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Return the current subscription state",
        "operationId": "get_subscription_api_billing_v2_subscription_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/v2/subscription/cancel": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Cancel at period end",
        "operationId": "cancel_sub_api_billing_v2_subscription_cancel_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/v2/subscription/reactivate": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Reactivate a sub previously set to cancel at period end",
        "operationId": "reactivate_sub_api_billing_v2_subscription_reactivate_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/v2/subscription/change-plan": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Switch plan or seat count with proration",
        "operationId": "change_plan_api_billing_v2_subscription_change_plan_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangePlanReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/v2/subscription/auto-debit": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Enable / disable auto-debit",
        "operationId": "auto_debit_api_billing_v2_subscription_auto_debit_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutoDebitReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/v2/invoices": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "List recent invoices for this org",
        "operationId": "list_invoices_api_billing_v2_invoices_get",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 200,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/v2/invoices/{invoice_id}/pdf": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Proxy-stream the invoice PDF",
        "operationId": "invoice_pdf_api_billing_v2_invoices__invoice_id__pdf_get",
        "parameters": [
          {
            "name": "invoice_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Invoice Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/billing/config": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Read the billing config singleton",
        "operationId": "get_billing_config_api_owner_billing_config_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Billing"
        ],
        "summary": "Patch the billing config",
        "operationId": "patch_billing_config_api_owner_billing_config_patch",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": true,
                "type": "object",
                "title": "Patch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/billing/subscriptions": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "List every org's subscription state",
        "operationId": "list_all_subs_api_owner_billing_subscriptions_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/billing/refund": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Issue a refund against a payment",
        "operationId": "owner_refund_api_owner_billing_refund_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RefundReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/billing/credit": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Apply a manual credit (note recorded in DB)",
        "description": "Records a credit memo locally and increments a stored balance on the org.\nThe next invoice can be reduced by this amount manually until full Stripe\ncredit-note integration is added in Phase A.1.",
        "operationId": "owner_credit_api_owner_billing_credit_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreditReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/billing/reports/revenue": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Revenue rollup by country & currency",
        "operationId": "revenue_report_api_owner_billing_reports_revenue_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/billing/reports/failed": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Failed payments rollup",
        "operationId": "failed_report_api_owner_billing_reports_failed_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/billing/reports/tax-by-country": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Tax collected, grouped by country",
        "operationId": "tax_report_api_owner_billing_reports_tax_by_country_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/billing/config/full": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Read the full billing config + coupons (Billing Control Center)",
        "operationId": "read_full_config_api_owner_billing_config_full_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/billing/config/section/{section}": {
      "patch": {
        "tags": [
          "Billing"
        ],
        "summary": "Patch a single section of the billing config (deep-merge)",
        "operationId": "patch_section_api_owner_billing_config_section__section__patch",
        "parameters": [
          {
            "name": "section",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Section"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "title": "Patch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/billing/config/reset/{section}": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Reset a single section to its factory default",
        "operationId": "reset_section_api_owner_billing_config_reset__section__post",
        "parameters": [
          {
            "name": "section",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Section"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/billing/coupons": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "List coupons",
        "operationId": "list_coupons_api_owner_billing_coupons_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Create a coupon",
        "operationId": "create_coupon_api_owner_billing_coupons_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CouponIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/billing/coupons/{coupon_id}": {
      "patch": {
        "tags": [
          "Billing"
        ],
        "summary": "Update a coupon",
        "operationId": "patch_coupon_api_owner_billing_coupons__coupon_id__patch",
        "parameters": [
          {
            "name": "coupon_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Coupon Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CouponPatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Billing"
        ],
        "summary": "Delete a coupon",
        "operationId": "delete_coupon_api_owner_billing_coupons__coupon_id__delete",
        "parameters": [
          {
            "name": "coupon_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Coupon Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/billing/webhooks": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Create a billing webhook endpoint",
        "operationId": "create_webhook_api_owner_billing_webhooks_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/billing/webhooks/{webhook_id}": {
      "patch": {
        "tags": [
          "Billing"
        ],
        "summary": "Update a webhook endpoint",
        "operationId": "patch_webhook_api_owner_billing_webhooks__webhook_id__patch",
        "parameters": [
          {
            "name": "webhook_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Webhook Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookPatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Billing"
        ],
        "summary": "Delete a webhook endpoint",
        "operationId": "delete_webhook_api_owner_billing_webhooks__webhook_id__delete",
        "parameters": [
          {
            "name": "webhook_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Webhook Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/billing/webhooks/{webhook_id}/test": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Send a test ping to a webhook endpoint",
        "operationId": "test_webhook_api_owner_billing_webhooks__webhook_id__test_post",
        "parameters": [
          {
            "name": "webhook_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Webhook Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/billing/stripe-catalog": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Read-only view of the live Stripe product + price catalog",
        "description": "Return the live Stripe catalog + last-sync metadata.\n\nResponse shape:\n  {\n    \"products\": [\n      { \"id\", \"name\", \"active\", \"prices\": [\n          { \"id\", \"currency\", \"unit_amount\", \"interval\", \"recurring\": bool,\n            \"per_seat\": bool, \"active\", \"lookup_key\" }\n      ]}, ...\n    ],\n    \"last_sync_at\": ISO-8601,\n    \"source\": \"stripe\" | \"cache\",\n    \"stripe_account_id\": \"...\",\n    \"live_mode\": bool,\n    \"dashboard_url\": \"https://dashboard.stripe.com/products\"\n  }\n\nOn Stripe failure, returns the last cached snapshot with `source: \"cache\"`\nand a `stale: true` flag so the UI can render a warning banner.\n\nThe live fetch + persist logic is shared with the background scheduler in\n`services.stripe_catalog_sync` \u2014 keep them in lockstep.",
        "operationId": "get_stripe_catalog_api_owner_billing_stripe_catalog_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/coaching/live-calls": {
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "List currently-active calls in the caller's org (supervisor/admin)",
        "description": "Returns calls with status `in-progress` belonging to the same org. Each row exposes the agent, customer phone, direction, duration so far, and the Twilio parent/child call SIDs needed for coach-mode.",
        "operationId": "live_calls_api_coaching_live_calls_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/coaching/sessions": {
      "post": {
        "tags": [
          "Calls"
        ],
        "summary": "Start a coaching session against an active call",
        "description": "Creates a `coaching_sessions` row, redirects both legs of the agent's active call into a per-call conference (`coach_<callId>`), and returns the conference name + mode + audit id. The supervisor's softphone then dials `coach:<conf>:<mode>` which the Twilio voice webhook turns into the right conference-join TwiML (muted/coach/normal).",
        "operationId": "start_session_api_coaching_sessions_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/routes__coaching__StartSessionReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "Coaching session history (org-scoped, supervisor/admin only)",
        "operationId": "list_sessions_api_coaching_sessions_get",
        "parameters": [
          {
            "name": "range",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "week",
              "title": "Range"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 200,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/coaching/sessions/{session_id}/mode": {
      "patch": {
        "tags": [
          "Calls"
        ],
        "summary": "Change the active coaching mode without dropping the supervisor",
        "description": "Updates the session record and best-effort re-tells the supervisor's softphone to rejoin with the new flags. The browser is responsible for tearing down the current connection and dialing `coach:<conf>:<mode>` again on receipt of this response.",
        "operationId": "change_mode_api_coaching_sessions__session_id__mode_patch",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Session Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModeReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/coaching/sessions/{session_id}/stop": {
      "post": {
        "tags": [
          "Calls"
        ],
        "summary": "End a coaching session (kick supervisor; do not touch the agent leg)",
        "operationId": "stop_session_api_coaching_sessions__session_id__stop_post",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Session Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/coaching/sessions/{session_id}": {
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "Get a coaching session by id",
        "operationId": "get_session_api_coaching_sessions__session_id__get",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Session Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/coaching/sessions/{session_id}/react": {
      "post": {
        "tags": [
          "Calls"
        ],
        "summary": "Send a silent reaction (emoji) to the agent during a live coaching session",
        "description": "Pushes a `coach-reaction` WebSocket event to the agent's RTC socket so the agent sees a non-intrusive floating overlay on their dialer. The reaction is appended to `coaching_sessions.events[]` for audit and replay. Allowed types: `thumbs_up`, `heart`, `warning`, `fire`, `clap`. The session must be active (not ended).",
        "operationId": "send_reaction_api_coaching_sessions__session_id__react_post",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Session Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/routes__coaching__ReactReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Application health summary",
        "description": "Always returns 200 \u2014 body is a status snapshot for human inspection.\n\nUse `/health/live` for K8s liveness (binary up/down) and `/health/ready`\nfor readiness (won't accept traffic until DB is responsive).",
        "operationId": "health_api_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/health/live": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Liveness probe",
        "description": "Cheap liveness \u2014 if this returns 200, the process loop is alive.\n\nK8s livenessProbe: hit every 10s, restart pod on 3 consecutive failures.",
        "operationId": "liveness_api_health_live_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/health/ready": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Readiness probe \u2014 DB connectivity",
        "description": "Returns 200 ONLY when downstreams are responsive.\n\nK8s readinessProbe: hit every 5s, remove pod from Service on first failure.",
        "operationId": "readiness_api_health_ready_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/health/db": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Database connectivity + ping latency",
        "operationId": "health_db_api_health_db_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/onboarding/status": {
      "get": {
        "tags": [
          "Onboarding"
        ],
        "summary": "Get current org's onboarding state + step catalogue",
        "description": "Returns the wizard state for the caller's org plus the ordered list of steps (adapted to solo vs. business account types). Initialises state on first call.",
        "operationId": "get_status_api_onboarding_status_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/onboarding/complete/{step_id}": {
      "post": {
        "tags": [
          "Onboarding"
        ],
        "summary": "Mark an onboarding step complete",
        "description": "Idempotent \u2014 completing an already-completed step is a no-op. Re-completing a previously-skipped step removes the skip and counts as done.",
        "operationId": "complete_step_api_onboarding_complete__step_id__post",
        "parameters": [
          {
            "name": "step_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Step Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/onboarding/skip/{step_id}": {
      "post": {
        "tags": [
          "Onboarding"
        ],
        "summary": "Skip an onboarding step",
        "description": "Marks the step as deliberately skipped. Skipped steps are excluded from the progress denominator and can be re-completed later.",
        "operationId": "skip_step_api_onboarding_skip__step_id__post",
        "parameters": [
          {
            "name": "step_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Step Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/onboarding/mark/{event_type}": {
      "post": {
        "tags": [
          "Onboarding"
        ],
        "summary": "Record an activation event from the client",
        "description": "Used by the dialer / SMS composer / billing flows to fire `test_call_made`, `test_sms_sent`, etc. \u2014 events that have no clean server-side trigger.",
        "operationId": "mark_event_api_onboarding_mark__event_type__post",
        "parameters": [
          {
            "name": "event_type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Event Type"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/onboarding/reset": {
      "post": {
        "tags": [
          "Onboarding"
        ],
        "summary": "Reset onboarding for the caller's org (admin only)",
        "description": "Wipes completed/skipped steps and resets `current_step` to the first step.",
        "operationId": "reset_onboarding_api_onboarding_reset_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/onboarding/analytics": {
      "get": {
        "tags": [
          "Onboarding"
        ],
        "summary": "Platform-wide activation funnel + KPIs (owner only)",
        "description": "Aggregates `activation_events` across all orgs into the activation funnel (signup \u2192 onboarding_started \u2192 number_purchased \u2192 test_call_made \u2192 first_real_call), plus time-to-first-value and completion-rate KPIs.",
        "operationId": "owner_analytics_api_owner_onboarding_analytics_get",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 30,
              "title": "Days"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/notes": {
      "get": {
        "tags": [
          "Productivity"
        ],
        "summary": "List the current user's sticky notes",
        "description": "Filters: q (search title+body), tag, archived (default false), favorite, pinned. Pinned notes are returned first, then by updated_at desc.",
        "operationId": "list_notes_api_notes_get",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Q"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Tag"
            }
          },
          {
            "name": "archived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Archived"
            }
          },
          {
            "name": "favorite",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Favorite"
            }
          },
          {
            "name": "pinned",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Pinned"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 200,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Productivity"
        ],
        "summary": "Create a new sticky note",
        "operationId": "create_note_api_notes_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NoteCreate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/notes/{note_id}": {
      "patch": {
        "tags": [
          "Productivity"
        ],
        "summary": "Update a sticky note (title, body, color, pinned, favorite, archived, tags)",
        "operationId": "update_note_api_notes__note_id__patch",
        "parameters": [
          {
            "name": "note_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Note Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NoteUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Productivity"
        ],
        "summary": "Delete a sticky note permanently",
        "operationId": "delete_note_api_notes__note_id__delete",
        "parameters": [
          {
            "name": "note_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Note Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/notes/tags": {
      "get": {
        "tags": [
          "Productivity"
        ],
        "summary": "Distinct tags used by the current user's notes",
        "operationId": "list_note_tags_api_notes_tags_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/tasks": {
      "get": {
        "tags": [
          "Productivity"
        ],
        "summary": "List the current user's tasks",
        "description": "Filters: q, tag, completed, archived (default false), priority. Default sort: incomplete first, then priority desc, then due_at asc.",
        "operationId": "list_tasks_api_tasks_get",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Q"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Tag"
            }
          },
          {
            "name": "completed",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Completed"
            }
          },
          {
            "name": "archived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Archived"
            }
          },
          {
            "name": "priority",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "low",
                    "med",
                    "high"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Priority"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 200,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Productivity"
        ],
        "summary": "Create a new task",
        "operationId": "create_task_api_tasks_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskCreate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/tasks/{task_id}": {
      "patch": {
        "tags": [
          "Productivity"
        ],
        "summary": "Update a task (title, completed, priority, due_at, tags, archived, order_index)",
        "operationId": "update_task_api_tasks__task_id__patch",
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Task Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Productivity"
        ],
        "summary": "Delete a task permanently",
        "operationId": "delete_task_api_tasks__task_id__delete",
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Task Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/tasks/tags": {
      "get": {
        "tags": [
          "Productivity"
        ],
        "summary": "Distinct tags used by the current user's tasks",
        "operationId": "list_task_tags_api_tasks_tags_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/notepad": {
      "get": {
        "tags": [
          "Productivity"
        ],
        "summary": "Get the current user's notepad (single long-form document)",
        "description": "Returns the caller's notepad. Auto-creates an empty doc on first access. One notepad per (user_id, org_id) \u2014 distinct from sticky `notes`.",
        "operationId": "get_notepad_api_notepad_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Productivity"
        ],
        "summary": "Replace the current user's notepad body",
        "operationId": "update_notepad_api_notepad_put",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NotepadUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/notepad/history": {
      "get": {
        "tags": [
          "Productivity"
        ],
        "summary": "List up to 20 recent notepad snapshots for the caller",
        "operationId": "list_notepad_history_api_notepad_history_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/notepad/history/{snapshot_id}": {
      "get": {
        "tags": [
          "Productivity"
        ],
        "summary": "Fetch the full body of a specific notepad snapshot",
        "operationId": "get_notepad_snapshot_api_notepad_history__snapshot_id__get",
        "parameters": [
          {
            "name": "snapshot_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Snapshot Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/notepad/history/{snapshot_id}/restore": {
      "post": {
        "tags": [
          "Productivity"
        ],
        "summary": "Restore a snapshot as the current notepad (creates a new snapshot of the pre-restore state first)",
        "operationId": "restore_notepad_snapshot_api_notepad_history__snapshot_id__restore_post",
        "parameters": [
          {
            "name": "snapshot_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Snapshot Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/config": {
      "get": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Get the current object storage configuration (redacted)",
        "operationId": "cfg_api_owner_storage_config_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Save storage configuration and reinitialize (no restart required)",
        "operationId": "cfg_save_api_owner_storage_config_put",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StorageConfigIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/validate": {
      "post": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Dry-run test \u2014 validate candidate credentials WITHOUT saving",
        "operationId": "validate_api_owner_storage_validate_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StorageConfigIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/health": {
      "get": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Storage health dashboard",
        "operationId": "health_api_owner_storage_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/test-connection": {
      "post": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Sanity-check the current primary provider",
        "operationId": "test_conn_api_owner_storage_test_connection_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/retry-failed": {
      "post": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Kick the retry scheduler now",
        "operationId": "retry_now_api_owner_storage_retry_failed_post",
        "parameters": [
          {
            "name": "batch_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 20,
              "title": "Batch Size"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/cleanup-twilio": {
      "post": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Run the Twilio-copy cleanup pass now",
        "operationId": "cleanup_now_api_owner_storage_cleanup_twilio_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/backfill": {
      "post": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Run the stale-file backfill migration now",
        "operationId": "backfill_now_api_owner_storage_backfill_post",
        "parameters": [
          {
            "name": "batch_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 40,
              "title": "Batch Size"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/migrate/{recording_id}": {
      "post": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Force-migrate a single recording",
        "operationId": "migrate_one_api_owner_storage_migrate__recording_id__post",
        "parameters": [
          {
            "name": "recording_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Recording Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/usage-by-org": {
      "get": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Per-org storage usage (bytes + count)",
        "operationId": "usage_by_org_api_owner_storage_usage_by_org_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/quotas": {
      "get": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "List quota rules",
        "operationId": "list_quotas_api_owner_storage_quotas_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/quotas/{org_id}": {
      "put": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Set per-org quota",
        "operationId": "set_quota_api_owner_storage_quotas__org_id__put",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuotaIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Remove per-org quota",
        "operationId": "del_quota_api_owner_storage_quotas__org_id__delete",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Org Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/lifecycle": {
      "get": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Retention + lifecycle rules",
        "operationId": "get_lifecycle_api_owner_storage_lifecycle_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Update retention + lifecycle rules",
        "operationId": "set_lifecycle_api_owner_storage_lifecycle_put",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LifecycleIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/audit": {
      "get": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Audit log for storage-related actions",
        "operationId": "audit_api_owner_storage_audit_get",
        "parameters": [
          {
            "name": "action",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Action"
            }
          },
          {
            "name": "org_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Org Id"
            }
          },
          {
            "name": "actor_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Actor Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/analytics/overview": {
      "get": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Platform-wide storage totals + 30-day growth",
        "operationId": "analytics_overview_ep_api_owner_storage_analytics_overview_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/analytics/by-kind": {
      "get": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Storage usage grouped by file kind",
        "operationId": "analytics_by_kind_ep_api_owner_storage_analytics_by_kind_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/analytics/by-provider": {
      "get": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Storage usage grouped by provider (infra view)",
        "operationId": "analytics_by_provider_ep_api_owner_storage_analytics_by_provider_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/analytics/top-orgs": {
      "get": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Largest N organizations by storage usage",
        "operationId": "analytics_top_orgs_ep_api_owner_storage_analytics_top_orgs_get",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 20,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/analytics/largest-files": {
      "get": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Largest individual files",
        "operationId": "analytics_largest_ep_api_owner_storage_analytics_largest_files_get",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 25,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/analytics/oldest-files": {
      "get": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Oldest individual files (candidates for archive)",
        "operationId": "analytics_oldest_ep_api_owner_storage_analytics_oldest_files_get",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 25,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/analytics/growth": {
      "get": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Daily growth over the last N days",
        "operationId": "analytics_growth_ep_api_owner_storage_analytics_growth_get",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 30,
              "title": "Days"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/analytics/costs": {
      "get": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Current provider monthly cost + savings comparison",
        "operationId": "analytics_costs_ep_api_owner_storage_analytics_costs_get",
        "parameters": [
          {
            "name": "egress_gib_pm",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "default": 0.0,
              "title": "Egress Gib Pm"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/analytics/failed-retry": {
      "get": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Retry queue depth + failure counters",
        "operationId": "analytics_failed_retry_ep_api_owner_storage_analytics_failed_retry_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/analytics/migration-progress": {
      "get": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Twilio\u2192Hello by Flow + Emergent\u2192Owner migration %",
        "operationId": "analytics_migration_progress_ep_api_owner_storage_analytics_migration_progress_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/analytics/backup-dr": {
      "get": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Backup + DR readiness checklist (0-100 score)",
        "operationId": "analytics_backup_dr_ep_api_owner_storage_analytics_backup_dr_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/storage/analytics/export.csv": {
      "get": {
        "tags": [
          "Owner Storage"
        ],
        "summary": "Export all analytics rows as CSV (owner report)",
        "operationId": "analytics_export_csv_api_owner_storage_analytics_export_csv_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/org/storage/usage": {
      "get": {
        "tags": [
          "Organization Storage"
        ],
        "summary": "Your organization's storage usage (bytes + counts).",
        "operationId": "get_usage_api_org_storage_usage_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/org/storage/quota": {
      "get": {
        "tags": [
          "Organization Storage"
        ],
        "summary": "Your organization's storage quota + alert threshold.",
        "operationId": "get_quota_api_org_storage_quota_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/org/storage/retention": {
      "get": {
        "tags": [
          "Organization Storage"
        ],
        "summary": "Your organization's retention window (days).",
        "operationId": "get_retention_api_org_storage_retention_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/org/storage/download-history": {
      "get": {
        "tags": [
          "Organization Storage"
        ],
        "summary": "Recent downloads within your organization.",
        "operationId": "get_download_history_api_org_storage_download_history_get",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 25,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/org/storage/export.csv": {
      "get": {
        "tags": [
          "Organization Storage"
        ],
        "summary": "Export YOUR organization's storage inventory as CSV.",
        "operationId": "export_inventory_api_org_storage_export_csv_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/readiness/scorecard": {
      "get": {
        "tags": [
          "Owner Readiness"
        ],
        "summary": "Full production-readiness scorecard (48 checks, 9 categories, overall 0-100 score)",
        "operationId": "scorecard_api_owner_readiness_scorecard_get",
        "parameters": [
          {
            "name": "run_now",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Run Now"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/readiness/categories/{category_id}": {
      "get": {
        "tags": [
          "Owner Readiness"
        ],
        "summary": "One category's checks",
        "operationId": "category_detail_api_owner_readiness_categories__category_id__get",
        "parameters": [
          {
            "name": "category_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Category Id"
            }
          },
          {
            "name": "run_now",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Run Now"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/readiness/checks/{check_id}/verify": {
      "post": {
        "tags": [
          "Owner Readiness"
        ],
        "summary": "Re-run a single check",
        "operationId": "verify_one_api_owner_readiness_checks__check_id__verify_post",
        "parameters": [
          {
            "name": "check_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Check Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/readiness/checks/{check_id}/fix": {
      "post": {
        "tags": [
          "Owner Readiness"
        ],
        "summary": "Attempt automatic remediation, then re-verify",
        "operationId": "fix_one_api_owner_readiness_checks__check_id__fix_post",
        "parameters": [
          {
            "name": "check_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Check Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/readiness/verify-all": {
      "post": {
        "tags": [
          "Owner Readiness"
        ],
        "summary": "Re-run every check and return the fresh scorecard",
        "operationId": "verify_all_api_owner_readiness_verify_all_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/readiness/history": {
      "get": {
        "tags": [
          "Owner Readiness"
        ],
        "summary": "Recent verify / fix events",
        "operationId": "history_ep_api_owner_readiness_history_get",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/readiness/launch-status": {
      "get": {
        "tags": [
          "Owner Readiness"
        ],
        "summary": "Per-stage launch readiness (private-beta / public-beta / enterprise)",
        "operationId": "launch_status_ep_api_owner_readiness_launch_status_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/readiness/launch-blockers": {
      "get": {
        "tags": [
          "Owner Readiness"
        ],
        "summary": "Checks blocking the next launch stage (sorted by priority)",
        "operationId": "launch_blockers_ep_api_owner_readiness_launch_blockers_get",
        "parameters": [
          {
            "name": "target",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Target"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 20,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/readiness/report.pdf": {
      "get": {
        "tags": [
          "Owner Readiness"
        ],
        "summary": "Exportable PDF readiness report",
        "operationId": "readiness_report_api_owner_readiness_report_pdf_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/rtc/captures/health": {
      "get": {
        "tags": [
          "Owner RTC Captures"
        ],
        "summary": "iter148 pipeline health (owner only) \u2014 proves the auto-capture path is live",
        "description": "Returns per-replica counters plus the total capture count in\nMongo. Use this immediately after a failed production call to\nconfirm the pipeline is receiving events, running the watchdog,\nand persisting to the same database the Owner Console reads from.",
        "operationId": "captures_health_api_owner_rtc_captures_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/rtc/captures": {
      "get": {
        "tags": [
          "Owner RTC Captures"
        ],
        "summary": "List recent auto-captured RTC signaling timelines (owner only)",
        "description": "Newest-first list of captures. Events are omitted to keep the\npayload small \u2014 use `/owner/rtc/captures/{cid}` for the full record.",
        "operationId": "list_captures_api_owner_rtc_captures_get",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 200,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            }
          },
          {
            "name": "room_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by exact room id",
              "title": "Room Id"
            },
            "description": "Filter by exact room id"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/rtc/captures/{cid}": {
      "get": {
        "tags": [
          "Owner RTC Captures"
        ],
        "summary": "Fetch a single RTC signaling-timeline capture with full events (owner only)",
        "operationId": "get_capture_api_owner_rtc_captures__cid__get",
        "parameters": [
          {
            "name": "cid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Cid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Owner RTC Captures"
        ],
        "summary": "Delete one RTC signaling-timeline capture (owner only)",
        "operationId": "delete_capture_api_owner_rtc_captures__cid__delete",
        "parameters": [
          {
            "name": "cid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Cid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/rtc/captures/{cid}/download": {
      "get": {
        "tags": [
          "Owner RTC Captures"
        ],
        "summary": "Download a capture as a JSON attachment (owner only)",
        "description": "Returns the full capture JSON with a Content-Disposition header so\nthe browser saves it to disk. Used by the Owner Console 'Download'\nbutton so operators can attach the file to a support ticket.",
        "operationId": "download_capture_api_owner_rtc_captures__cid__download_get",
        "parameters": [
          {
            "name": "cid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Cid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/staff/permissions": {
      "get": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "List the canonical permission catalog",
        "operationId": "list_permissions_api_internal_staff_permissions_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/staff/roles": {
      "get": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "List all roles (system + custom)",
        "operationId": "list_roles_api_internal_staff_roles_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Create a custom role",
        "operationId": "create_role_api_internal_staff_roles_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RoleBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/staff/roles/{role_id}": {
      "put": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Update a role's name/description/permissions",
        "operationId": "update_role_api_internal_staff_roles__role_id__put",
        "parameters": [
          {
            "name": "role_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Role Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RoleBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Delete a non-system role",
        "operationId": "delete_role_api_internal_staff_roles__role_id__delete",
        "parameters": [
          {
            "name": "role_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Role Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/staff": {
      "get": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "List internal staff accounts",
        "operationId": "list_staff_api_internal_staff_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Invite a new internal staff member",
        "operationId": "invite_staff_api_internal_staff_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InviteStaffBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/staff/audit": {
      "get": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Audit log of internal staff actions",
        "operationId": "audit_log_api_internal_staff_audit_get",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100,
              "title": "Limit"
            }
          },
          {
            "name": "actor_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Actor Id"
            }
          },
          {
            "name": "action",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Action"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/me": {
      "get": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "My resolved permissions",
        "operationId": "me_api_internal_me_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/staff/{staff_id}": {
      "get": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Staff detail",
        "operationId": "get_staff_api_internal_staff__staff_id__get",
        "parameters": [
          {
            "name": "staff_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Staff Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Update staff (name / roles / permissions)",
        "operationId": "update_staff_api_internal_staff__staff_id__put",
        "parameters": [
          {
            "name": "staff_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Staff Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StaffUpdateBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Delete a staff account",
        "operationId": "delete_staff_api_internal_staff__staff_id__delete",
        "parameters": [
          {
            "name": "staff_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Staff Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/staff/{staff_id}/disable": {
      "post": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Disable",
        "operationId": "disable_api_internal_staff__staff_id__disable_post",
        "parameters": [
          {
            "name": "staff_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Staff Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/staff/{staff_id}/enable": {
      "post": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Enable",
        "operationId": "enable_api_internal_staff__staff_id__enable_post",
        "parameters": [
          {
            "name": "staff_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Staff Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/staff/{staff_id}/lock": {
      "post": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Lock",
        "operationId": "lock_api_internal_staff__staff_id__lock_post",
        "parameters": [
          {
            "name": "staff_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Staff Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/staff/{staff_id}/unlock": {
      "post": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Unlock",
        "operationId": "unlock_api_internal_staff__staff_id__unlock_post",
        "parameters": [
          {
            "name": "staff_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Staff Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/staff/{staff_id}/force-password-reset": {
      "post": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Force Pwd Reset",
        "operationId": "force_pwd_reset_api_internal_staff__staff_id__force_password_reset_post",
        "parameters": [
          {
            "name": "staff_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Staff Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/staff/{staff_id}/mfa": {
      "post": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Toggle Mfa",
        "operationId": "toggle_mfa_api_internal_staff__staff_id__mfa_post",
        "parameters": [
          {
            "name": "staff_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Staff Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MfaBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/staff/{staff_id}/reset-password": {
      "post": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Issue a one-time temporary password",
        "operationId": "reset_password_api_internal_staff__staff_id__reset_password_post",
        "parameters": [
          {
            "name": "staff_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Staff Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/staff/{staff_id}/sessions": {
      "get": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Sessions",
        "operationId": "sessions_api_internal_staff__staff_id__sessions_get",
        "parameters": [
          {
            "name": "staff_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Staff Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/staff/{staff_id}/sessions/{session_id}": {
      "delete": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Revoke Session",
        "operationId": "revoke_session_api_internal_staff__staff_id__sessions__session_id__delete",
        "parameters": [
          {
            "name": "staff_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Staff Id"
            }
          },
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Session Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/staff/{staff_id}/login-history": {
      "get": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Login History",
        "operationId": "login_history_api_internal_staff__staff_id__login_history_get",
        "parameters": [
          {
            "name": "staff_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Staff Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/invite/{token}": {
      "get": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Verify an invite token (public)",
        "operationId": "verify_invite_api_internal_invite__token__get",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Token"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/invite/{token}/accept": {
      "post": {
        "tags": [
          "Internal Staff"
        ],
        "summary": "Set password and activate the account (public)",
        "operationId": "accept_invite_api_internal_invite__token__accept_post",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Token"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AcceptInviteBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/auth/login": {
      "post": {
        "tags": [
          "Internal Staff Auth"
        ],
        "summary": "Internal staff login",
        "operationId": "internal_login_api_internal_auth_login_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InternalLoginBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/auth/logout": {
      "post": {
        "tags": [
          "Internal Staff Auth"
        ],
        "summary": "Internal staff logout",
        "operationId": "internal_logout_api_internal_auth_logout_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/auth/change-password": {
      "post": {
        "tags": [
          "Internal Staff Auth"
        ],
        "summary": "Change your own password",
        "operationId": "change_password_api_internal_auth_change_password_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangePasswordBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/security/events": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Search & paginate security events",
        "operationId": "list_events_api_owner_security_events_get",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Q"
            }
          },
          {
            "name": "org_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Org Id"
            }
          },
          {
            "name": "actor_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Actor Id"
            }
          },
          {
            "name": "target_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Target Id"
            }
          },
          {
            "name": "event_types",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "CSV of event_type",
              "title": "Event Types"
            },
            "description": "CSV of event_type"
          },
          {
            "name": "severities",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "CSV of severity levels",
              "title": "Severities"
            },
            "description": "CSV of severity levels"
          },
          {
            "name": "outcomes",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "CSV of outcomes (success, blocked, denied, flagged, restricted, info)",
              "title": "Outcomes"
            },
            "description": "CSV of outcomes (success, blocked, denied, flagged, restricted, info)"
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Since"
            }
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Until"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "title": "Offset"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/security/facets": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Filter facets for the events UI (orgs, actors, event types)",
        "operationId": "facets_api_owner_security_facets_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/security/summary": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "30-day rollup of counts by severity + top event types",
        "operationId": "summary_api_owner_security_summary_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/security/events.csv": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Download filtered events as CSV (Excel-friendly)",
        "operationId": "export_csv_api_owner_security_events_csv_get",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Q"
            }
          },
          {
            "name": "org_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Org Id"
            }
          },
          {
            "name": "actor_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Actor Id"
            }
          },
          {
            "name": "target_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Target Id"
            }
          },
          {
            "name": "event_types",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Event Types"
            }
          },
          {
            "name": "severities",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Severities"
            }
          },
          {
            "name": "outcomes",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Outcomes"
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Since"
            }
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Until"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/security/events.pdf": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Download filtered events as a Hello by Flow-branded PDF report",
        "operationId": "export_pdf_api_owner_security_events_pdf_get",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Q"
            }
          },
          {
            "name": "org_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Org Id"
            }
          },
          {
            "name": "actor_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Actor Id"
            }
          },
          {
            "name": "target_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Target Id"
            }
          },
          {
            "name": "event_types",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Event Types"
            }
          },
          {
            "name": "severities",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Severities"
            }
          },
          {
            "name": "outcomes",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Outcomes"
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Since"
            }
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Until"
            }
          },
          {
            "name": "label",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Report title shown on the PDF cover",
              "default": "Security & Operations Report",
              "title": "Label"
            },
            "description": "Report title shown on the PDF cover"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/security/remediate/unlock-user/{user_id}": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Clear the customer login-lockout counter for a user (owner)",
        "operationId": "remediate_unlock_user_api_owner_security_remediate_unlock_user__user_id__post",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/security/remediate/unlock-staff/{staff_id}": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Clear the internal-staff lockout counter for a staff account (owner)",
        "operationId": "remediate_unlock_staff_api_owner_security_remediate_unlock_staff__staff_id__post",
        "parameters": [
          {
            "name": "staff_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Staff Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/security/remediate/disable-user/{user_id}": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Emergency-disable a customer user (owner)",
        "operationId": "remediate_disable_user_api_owner_security_remediate_disable_user__user_id__post",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/security/remediate/revoke-api-key/{key_id}": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Revoke a developer API key (owner)",
        "operationId": "remediate_revoke_api_key_api_owner_security_remediate_revoke_api_key__key_id__post",
        "parameters": [
          {
            "name": "key_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Key Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/settings/privileged-accounts": {
      "get": {
        "tags": [
          "Owner Settings"
        ],
        "summary": "List every Owner + Organization Admin account with contact + auth state",
        "description": "Returns one row per privileged account (role \u2208 {owner, admin}) with the current email, org name/plan, last login, MFA enrolment state, and active trusted-device count. This is what the Owner Settings page renders so the operator can rotate emails to inboxes they own before flipping on Resend.",
        "operationId": "list_privileged_accounts_api_owner_settings_privileged_accounts_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/settings/privileged-accounts/{user_id}/email": {
      "patch": {
        "tags": [
          "Owner Settings"
        ],
        "summary": "Change the email address on a privileged account (owner or org admin)",
        "description": "Rotates the email on file for an owner or organization-admin user. The Owner can call this against **any** privileged account \u2014 including their own \u2014 before Resend goes live so they can direct OTP delivery to an inbox they actually control.\n\n\u2022 Rejects duplicate email addresses (case-insensitive) already in use.\n\u2022 Rejects non-privileged targets (agent/supervisor/quality) \u2014 those   accounts don't need an email for OTP, and the owner should use   the normal user-edit path for them.\n\u2022 By default, revokes every active `hbf_td` trusted-device cookie   belonging to the target so the next login re-verifies OTP into the   NEW inbox (pass `revoke_trusted_devices=false` to skip).\n\u2022 Writes a full audit log (`log_owner_action`) and a security event   (`user.email.changed`) with old + new email.",
        "operationId": "change_privileged_email_api_owner_settings_privileged_accounts__user_id__email_patch",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailChangeReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/settings/integrations": {
      "get": {
        "tags": [
          "Owner Settings"
        ],
        "summary": "List every production integration with its current config + last-test state",
        "operationId": "list_integrations_api_owner_settings_integrations_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/settings/integrations/{provider}": {
      "get": {
        "tags": [
          "Owner Settings"
        ],
        "summary": "Get one integration's config (secrets masked)",
        "operationId": "get_integration_api_owner_settings_integrations__provider__get",
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Provider"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Owner Settings"
        ],
        "summary": "Save configuration for one integration (secrets encrypted at rest)",
        "description": "Persists the submitted config into `db.platform_settings`. Empty field values keep the current stored value (so operators can re-save non-secret changes without re-typing every API key).",
        "operationId": "save_integration_api_owner_settings_integrations__provider__post",
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Provider"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationSaveReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/settings/integrations/{provider}/test": {
      "post": {
        "tags": [
          "Owner Settings"
        ],
        "summary": "Test the connection for one integration",
        "description": "Executes a lightweight provider-native probe (Resend GET /domains, R2 HeadBucket, Stripe Balance.retrieve, Twilio Account.fetch, Sentry DSN parse, Domain URL sanity). Pass `values` to test unsaved edits.",
        "operationId": "test_integration_api_owner_settings_integrations__provider__test_post",
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Provider"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationTestReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/settings/integrations/stripe/webhook-info": {
      "get": {
        "tags": [
          "Owner Settings"
        ],
        "summary": "Return the Stripe webhook URL + subscription checklist",
        "description": "The Owner Console shows this so admins can copy the URL directly into Stripe Dashboard \u2192 Developers \u2192 Webhooks and know exactly which events to subscribe.",
        "operationId": "stripe_webhook_info_api_owner_settings_integrations_stripe_webhook_info_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/state/{service}/{provider}/move": {
      "post": {
        "tags": [
          "Provider Orchestration \u00b7 Ext"
        ],
        "summary": "Move a provider up or down within a service (Primary/Backup/Standby)",
        "operationId": "move_provider_api_internal_providers_state__service___provider__move_post",
        "parameters": [
          {
            "name": "service",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Service"
            }
          },
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Provider"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MoveReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/state/{service}/order": {
      "post": {
        "tags": [
          "Provider Orchestration \u00b7 Ext"
        ],
        "summary": "Set explicit provider ordering (drag-drop equivalent)",
        "operationId": "set_provider_order_api_internal_providers_state__service__order_post",
        "parameters": [
          {
            "name": "service",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Service"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetOrderReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/state/{service}/failover-policy": {
      "get": {
        "tags": [
          "Provider Orchestration \u00b7 Ext"
        ],
        "summary": "Get the failover policy for a service",
        "operationId": "get_failover_policy_api_internal_providers_state__service__failover_policy_get",
        "parameters": [
          {
            "name": "service",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Service"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Provider Orchestration \u00b7 Ext"
        ],
        "summary": "Configure failover triggers, thresholds and failback mode",
        "operationId": "set_failover_policy_api_internal_providers_state__service__failover_policy_post",
        "parameters": [
          {
            "name": "service",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Service"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FailoverPolicyReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/custom": {
      "get": {
        "tags": [
          "Provider Orchestration \u00b7 Ext"
        ],
        "summary": "List all registered custom providers",
        "operationId": "list_custom_api_internal_providers_custom_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/custom/register": {
      "post": {
        "tags": [
          "Provider Orchestration \u00b7 Ext"
        ],
        "summary": "Register a new custom provider (any service category)",
        "operationId": "register_custom_api_internal_providers_custom_register_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomProviderRegisterReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/custom/{provider_id}": {
      "delete": {
        "tags": [
          "Provider Orchestration \u00b7 Ext"
        ],
        "summary": "Un-register a custom provider (cascades config delete)",
        "operationId": "delete_custom_api_internal_providers_custom__provider_id__delete",
        "parameters": [
          {
            "name": "provider_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Provider Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/{service}/{provider}/test/{kind}": {
      "post": {
        "tags": [
          "Provider Orchestration \u00b7 Ext"
        ],
        "summary": "Service-specific test (test_call / test_sms / test_email / test_upload / test_transaction)",
        "operationId": "service_test_api_internal_providers__service___provider__test__kind__post",
        "parameters": [
          {
            "name": "service",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Service"
            }
          },
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Provider"
            }
          },
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Kind"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ServiceTestReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/payment-routing": {
      "get": {
        "tags": [
          "Provider Orchestration \u00b7 Ext"
        ],
        "summary": "Get payment routing rules (country/region/org)",
        "operationId": "get_payment_routing_api_internal_providers_payment_routing_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Provider Orchestration \u00b7 Ext"
        ],
        "summary": "Update payment routing rules",
        "operationId": "set_payment_routing_api_internal_providers_payment_routing_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentRoutingReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/payment-routing/resolve": {
      "post": {
        "tags": [
          "Provider Orchestration \u00b7 Ext"
        ],
        "summary": "Resolve which payment provider serves a request (dry-run)",
        "operationId": "resolve_payment_api_internal_providers_payment_routing_resolve_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResolvePaymentReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/{service}/{provider}/usage": {
      "get": {
        "tags": [
          "Provider Orchestration \u00b7 Ext"
        ],
        "summary": "Requests today, success rate, avg latency, cost",
        "operationId": "get_usage_api_internal_providers__service___provider__usage_get",
        "parameters": [
          {
            "name": "service",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Service"
            }
          },
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Provider"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1,
              "title": "Days"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/marketplace": {
      "get": {
        "tags": [
          "Provider Orchestration \u00b7 Ext"
        ],
        "summary": "Browse the 35+ pre-configured provider templates",
        "operationId": "marketplace_list_api_internal_providers_marketplace_get",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Category"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Search"
            }
          },
          {
            "name": "popular",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Popular"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/marketplace/{template_id}": {
      "get": {
        "tags": [
          "Provider Orchestration \u00b7 Ext"
        ],
        "summary": "Fetch a single marketplace template",
        "operationId": "marketplace_template_api_internal_providers_marketplace__template_id__get",
        "parameters": [
          {
            "name": "template_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Template Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/marketplace/{template_id}/register": {
      "post": {
        "tags": [
          "Provider Orchestration \u00b7 Ext"
        ],
        "summary": "2-click register a marketplace template as a custom provider",
        "operationId": "marketplace_register_api_internal_providers_marketplace__template_id__register_post",
        "parameters": [
          {
            "name": "template_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Template Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/catalog": {
      "get": {
        "tags": [
          "Provider Orchestration"
        ],
        "summary": "List every service + registered provider template (no credentials)",
        "operationId": "catalog_api_internal_providers_catalog_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/state": {
      "get": {
        "tags": [
          "Provider Orchestration"
        ],
        "summary": "Inventory + health for every service and provider",
        "operationId": "all_states_api_internal_providers_state_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/state/{service}": {
      "get": {
        "tags": [
          "Provider Orchestration"
        ],
        "summary": "Inventory + health for one service",
        "operationId": "state_for_api_internal_providers_state__service__get",
        "parameters": [
          {
            "name": "service",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Service"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/health/run": {
      "post": {
        "tags": [
          "Provider Orchestration"
        ],
        "summary": "Run health checks across ALL enabled providers",
        "operationId": "health_run_all_api_internal_providers_health_run_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/{service}/{provider}": {
      "post": {
        "tags": [
          "Provider Orchestration"
        ],
        "summary": "Create or update a provider configuration (credentials encrypted at rest)",
        "operationId": "save_config_api_internal_providers__service___provider__post",
        "parameters": [
          {
            "name": "service",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Service"
            }
          },
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Provider"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProviderSaveReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Provider Orchestration"
        ],
        "summary": "Delete a provider configuration",
        "operationId": "delete_config_api_internal_providers__service___provider__delete",
        "parameters": [
          {
            "name": "service",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Service"
            }
          },
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Provider"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/{service}/{provider}/test": {
      "post": {
        "tags": [
          "Provider Orchestration"
        ],
        "summary": "Test a provider connection WITHOUT saving",
        "operationId": "test_conn_api_internal_providers__service___provider__test_post",
        "parameters": [
          {
            "name": "service",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Service"
            }
          },
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Provider"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TestReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/{service}/{provider}/health": {
      "post": {
        "tags": [
          "Provider Orchestration"
        ],
        "summary": "Run a full health check + persist result",
        "operationId": "health_check_api_internal_providers__service___provider__health_post",
        "parameters": [
          {
            "name": "service",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Service"
            }
          },
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Provider"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/state/{service}/activate": {
      "post": {
        "tags": [
          "Provider Orchestration"
        ],
        "summary": "Manually switch the active provider for a service",
        "operationId": "activate_api_internal_providers_state__service__activate_post",
        "parameters": [
          {
            "name": "service",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Service"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActivateReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/providers/state/{service}/failback-mode": {
      "post": {
        "tags": [
          "Provider Orchestration"
        ],
        "summary": "Configure automatic vs manual failback for one service",
        "operationId": "failback_mode_api_internal_providers_state__service__failback_mode_post",
        "parameters": [
          {
            "name": "service",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Service"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FailbackModeReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/status": {
      "get": {
        "tags": [
          "Public Status"
        ],
        "summary": "Aggregate service status for customers (no provider details)",
        "description": "Public endpoint. Returns opaque per-service statuses (`operational`, `degraded`, `outage`, `not_configured`). Customers never see provider names, credentials, or switch controls.",
        "operationId": "public_status_api_status_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/internal/wizard/overview": {
      "get": {
        "tags": [
          "Launch Wizard"
        ],
        "summary": "High-level wizard state \u2014 progress %, ETA, per-step status",
        "operationId": "overview_api_internal_wizard_overview_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/wizard/state/current-step": {
      "post": {
        "tags": [
          "Launch Wizard"
        ],
        "summary": "Persist the step the operator is looking at (resume support)",
        "operationId": "set_current_step_api_internal_wizard_state_current_step_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetCurrentStepReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/wizard/state/note": {
      "post": {
        "tags": [
          "Launch Wizard"
        ],
        "summary": "Attach an operator note to a step",
        "operationId": "set_note_api_internal_wizard_state_note_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetNoteReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/wizard/steps/domain": {
      "get": {
        "tags": [
          "Launch Wizard"
        ],
        "summary": "Step Domain",
        "operationId": "step_domain_api_internal_wizard_steps_domain_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/wizard/steps/integrations": {
      "get": {
        "tags": [
          "Launch Wizard"
        ],
        "summary": "Step Integrations",
        "operationId": "step_integrations_api_internal_wizard_steps_integrations_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/wizard/steps/security": {
      "get": {
        "tags": [
          "Launch Wizard"
        ],
        "summary": "Step Security",
        "operationId": "step_security_api_internal_wizard_steps_security_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/wizard/steps/health": {
      "get": {
        "tags": [
          "Launch Wizard"
        ],
        "summary": "Step Health",
        "operationId": "step_health_api_internal_wizard_steps_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/wizard/steps/readiness": {
      "get": {
        "tags": [
          "Launch Wizard"
        ],
        "summary": "Step Readiness",
        "operationId": "step_readiness_api_internal_wizard_steps_readiness_get",
        "parameters": [
          {
            "name": "run_now",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Run Now"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/wizard/steps/go-live": {
      "get": {
        "tags": [
          "Launch Wizard"
        ],
        "summary": "Step Go Live",
        "operationId": "step_go_live_api_internal_wizard_steps_go_live_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/wizard/integrations/save": {
      "post": {
        "tags": [
          "Launch Wizard"
        ],
        "summary": "Save one integration (Fernet-encrypted secrets; masked in responses)",
        "operationId": "integrations_save_api_internal_wizard_integrations_save_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveIntegrationReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/wizard/integrations/test": {
      "post": {
        "tags": [
          "Launch Wizard"
        ],
        "summary": "Test a connection without saving",
        "operationId": "integrations_test_api_internal_wizard_integrations_test_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TestIntegrationReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/wizard/readiness/verify-all": {
      "post": {
        "tags": [
          "Launch Wizard"
        ],
        "summary": "Re-run every readiness check (Launch Command Center refresh)",
        "operationId": "readiness_verify_all_api_internal_wizard_readiness_verify_all_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/wizard/readiness/export.pdf": {
      "get": {
        "tags": [
          "Launch Wizard"
        ],
        "summary": "Download the readiness report as PDF",
        "operationId": "readiness_export_pdf_api_internal_wizard_readiness_export_pdf_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/wizard/readiness/export.csv": {
      "get": {
        "tags": [
          "Launch Wizard"
        ],
        "summary": "Download the readiness report as CSV",
        "operationId": "readiness_export_csv_api_internal_wizard_readiness_export_csv_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/audit/sources": {
      "get": {
        "tags": [
          "Audit & Activity Center"
        ],
        "summary": "List every audit sink Hello by Flow writes to",
        "operationId": "sources_api_internal_audit_sources_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/audit/action-prefixes": {
      "get": {
        "tags": [
          "Audit & Activity Center"
        ],
        "summary": "Distinct action prefixes for filter chips",
        "operationId": "action_prefixes_api_internal_audit_action_prefixes_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/audit/search": {
      "post": {
        "tags": [
          "Audit & Activity Center"
        ],
        "summary": "Search the unified audit stream",
        "operationId": "search_api_internal_audit_search_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/audit/analytics": {
      "get": {
        "tags": [
          "Audit & Activity Center"
        ],
        "summary": "Dashboard analytics for the last N hours",
        "operationId": "analytics_api_internal_audit_analytics_get",
        "parameters": [
          {
            "name": "hours",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 720,
              "minimum": 1,
              "default": 24,
              "title": "Hours"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/audit/export.csv": {
      "post": {
        "tags": [
          "Audit & Activity Center"
        ],
        "summary": "Export the current search as CSV (up to 10k rows)",
        "operationId": "export_csv_api_internal_audit_export_csv_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/soc/live-ops": {
      "get": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Live Operations Dashboard \u2014 health, throughput, incidents",
        "operationId": "live_ops_api_internal_soc_live_ops_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/soc/rules": {
      "get": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "List Rules",
        "operationId": "list_rules_api_internal_soc_rules_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Create Rule",
        "operationId": "create_rule_api_internal_soc_rules_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RuleCreateReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/soc/rules/{rule_id}": {
      "patch": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Patch Rule",
        "operationId": "patch_rule_api_internal_soc_rules__rule_id__patch",
        "parameters": [
          {
            "name": "rule_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Rule Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RulePatchReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Delete Rule",
        "operationId": "delete_rule_api_internal_soc_rules__rule_id__delete",
        "parameters": [
          {
            "name": "rule_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Rule Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/soc/rules/evaluate-now": {
      "post": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Force one immediate evaluation cycle (for testing)",
        "operationId": "evaluate_now_api_internal_soc_rules_evaluate_now_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/soc/alerts": {
      "get": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "List Alerts",
        "operationId": "list_alerts_api_internal_soc_alerts_get",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "name": "severity",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Severity"
            }
          },
          {
            "name": "rule_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Rule Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/soc/alerts/dashboard": {
      "get": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Alerts Dashboard",
        "operationId": "alerts_dashboard_api_internal_soc_alerts_dashboard_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/soc/alerts/{alert_id}/acknowledge": {
      "post": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Acknowledge Alert",
        "operationId": "acknowledge_alert_api_internal_soc_alerts__alert_id__acknowledge_post",
        "parameters": [
          {
            "name": "alert_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Alert Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AlertActionReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/soc/alerts/{alert_id}/resolve": {
      "post": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Resolve Alert",
        "operationId": "resolve_alert_api_internal_soc_alerts__alert_id__resolve_post",
        "parameters": [
          {
            "name": "alert_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Alert Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AlertActionReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/soc/channels": {
      "get": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "List Channels",
        "operationId": "list_channels_api_internal_soc_channels_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Create Channel",
        "operationId": "create_channel_api_internal_soc_channels_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChannelCreateReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/soc/channels/{channel_id}": {
      "delete": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Delete Channel",
        "operationId": "delete_channel_api_internal_soc_channels__channel_id__delete",
        "parameters": [
          {
            "name": "channel_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Channel Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/soc/notify-targets": {
      "get": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Roles + channel types for the escalation-policy builder",
        "description": "Return the internal-staff role catalog + channel type catalog. Used\nby the frontend's escalation-policy builder to render role/channel\npickers. Roles include headcount so the UI can warn if a role has no\nactive members.",
        "operationId": "notify_targets_api_internal_soc_notify_targets_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/internal/soc/escalation-policies": {
      "get": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "List Policies",
        "operationId": "list_policies_api_internal_soc_escalation_policies_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Create Policy",
        "operationId": "create_policy_api_internal_soc_escalation_policies_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EscalationPolicyReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/soc/escalation-policies/{policy_id}": {
      "get": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Get Policy",
        "operationId": "get_policy_api_internal_soc_escalation_policies__policy_id__get",
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "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": [
          "Security & Operations Center"
        ],
        "summary": "Patch Policy",
        "operationId": "patch_policy_api_internal_soc_escalation_policies__policy_id__patch",
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Policy Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EscalationPolicyPatchReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Delete Policy",
        "operationId": "delete_policy_api_internal_soc_escalation_policies__policy_id__delete",
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "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/internal/soc/escalation-policies/{policy_id}/incidents": {
      "get": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Policy Incidents",
        "operationId": "policy_incidents_api_internal_soc_escalation_policies__policy_id__incidents_get",
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Policy Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/soc/incidents": {
      "get": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "List Incidents",
        "operationId": "list_incidents_api_internal_soc_incidents_get",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/soc/incidents/{incident_id}": {
      "get": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Get Incident",
        "operationId": "get_incident_api_internal_soc_incidents__incident_id__get",
        "parameters": [
          {
            "name": "incident_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Incident Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Patch",
        "operationId": "patch_api_internal_soc_incidents__incident_id__patch",
        "parameters": [
          {
            "name": "incident_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Incident Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IncidentPatchReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/soc/incidents/{incident_id}/status": {
      "post": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Change Status",
        "operationId": "change_status_api_internal_soc_incidents__incident_id__status_post",
        "parameters": [
          {
            "name": "incident_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Incident Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IncidentStatusReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/soc/incidents/{incident_id}/assign": {
      "post": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Assign",
        "operationId": "assign_api_internal_soc_incidents__incident_id__assign_post",
        "parameters": [
          {
            "name": "incident_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Incident Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IncidentAssignReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/soc/incidents/{incident_id}/report.pdf": {
      "get": {
        "tags": [
          "Security & Operations Center"
        ],
        "summary": "Incident Report",
        "operationId": "incident_report_api_internal_soc_incidents__incident_id__report_pdf_get",
        "parameters": [
          {
            "name": "incident_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Incident Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/identity/verification-session": {
      "post": {
        "tags": [
          "identity"
        ],
        "summary": "Start (or resume) an identity verification session for the current user",
        "operationId": "start_session_api_identity_verification_session_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/routes__identity__StartSessionReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/identity/status": {
      "get": {
        "tags": [
          "identity"
        ],
        "summary": "Return the current user's identity verification state",
        "operationId": "get_status_api_identity_status_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/identity/refresh": {
      "post": {
        "tags": [
          "identity"
        ],
        "summary": "Force-poll the active provider (webhook fallback)",
        "operationId": "refresh_status_api_identity_refresh_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/identity/webhook/veriff": {
      "post": {
        "tags": [
          "identity"
        ],
        "summary": "Veriff decision webhook (HMAC-signed)",
        "operationId": "veriff_webhook_api_identity_webhook_veriff_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/internal/identity/settings": {
      "get": {
        "tags": [
          "identity"
        ],
        "summary": "Get identity verification settings",
        "operationId": "get_settings_route_api_internal_identity_settings_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "identity"
        ],
        "summary": "Update identity verification settings",
        "operationId": "put_settings_route_api_internal_identity_settings_put",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IdentitySettingsPatch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/identity/verifications": {
      "get": {
        "tags": [
          "identity"
        ],
        "summary": "Review queue of identity verifications (filter by status)",
        "operationId": "list_verifications_api_internal_identity_verifications_get",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/identity/verifications/{verification_id}": {
      "get": {
        "tags": [
          "identity"
        ],
        "summary": "Detail on a single verification",
        "operationId": "get_verification_api_internal_identity_verifications__verification_id__get",
        "parameters": [
          {
            "name": "verification_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Verification Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal/identity/verifications/{verification_id}/override": {
      "post": {
        "tags": [
          "identity"
        ],
        "summary": "Manually approve or reject an inconclusive verification",
        "operationId": "override_verification_api_internal_identity_verifications__verification_id__override_post",
        "parameters": [
          {
            "name": "verification_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Verification Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OverrideReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/config/sentry": {
      "get": {
        "summary": "Public Sentry runtime config for the browser SDK",
        "description": "Returns the frontend DSN, environment tag, trace sample rate, and release string. Consumed once at app boot by @sentry/react. Returns `{ dsn: null }` when no DSN is configured \u2014 the frontend then skips SDK init and error monitoring is silently disabled.",
        "operationId": "get_sentry_config_api_config_sentry_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object",
                  "title": "Response Get Sentry Config Api Config Sentry Get"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/pricing": {
      "get": {
        "summary": "Active Stripe products and prices for the landing page",
        "description": "Public, unauthenticated. Stripe is the single source of truth: products+prices are fetched from Stripe, normalised, cached 60s. Falls back to the local billing_config catalog only when Stripe is not configured (preview / staging).",
        "operationId": "get_public_pricing_api_public_pricing_get",
        "parameters": [
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 3,
              "maxLength": 3,
              "default": "usd",
              "title": "Currency"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/pricing/refresh": {
      "post": {
        "summary": "Force-refresh the pricing cache (owner-only invoked from the frontend)",
        "description": "Drops the in-memory Stripe pricing cache so the very next GET /api/public/pricing hits Stripe again. Useful right after you change a price in the Stripe Dashboard and don't want to wait 60s.",
        "operationId": "refresh_pricing_api_public_pricing_refresh_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/search": {
      "get": {
        "tags": [
          "Search"
        ],
        "summary": "Global command-palette search (owner only)",
        "description": "Multi-entity fuzzy lookup for the Cmd+K palette. Accepts a comma-separated `types` filter (orgs,users,staff,numbers,contacts). Each type returns at most `limit` results. Missing/blank q returns empty. No new indexes required.",
        "operationId": "global_search_api_search_get",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Search query",
              "default": "",
              "title": "Q"
            },
            "description": "Search query"
          },
          {
            "name": "types",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Comma-separated entity types",
              "default": "orgs,users,staff",
              "title": "Types"
            },
            "description": "Comma-separated entity types"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 25,
              "minimum": 1,
              "default": 8,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/growth/funnel": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Growth & conversion analytics (owner only)",
        "description": "Single payload returning: filtered funnel steps, KPI tiles, top performers by country/currency/plan/gateway, and a daily revenue trend. All filters are optional; omit them to get the platform-wide view. Steps for which we don't yet collect events (visitors, email verified, marketing source) are returned with `future_ready: true` so the UI can render a placeholder instead of a misleading zero.",
        "operationId": "growth_funnel_api_owner_growth_funnel_get",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "From"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "To"
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Country"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Currency"
            }
          },
          {
            "name": "plan",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Plan"
            }
          },
          {
            "name": "gateway",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Gateway"
            }
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Source"
            }
          },
          {
            "name": "device",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Device"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/analytics/overview": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Org-wide call analytics",
        "description": "Aggregated call stats over the last `days` (default 7): totals, day-by-day timeline, and hour-of-day distribution. Agent users see only their own metrics.",
        "operationId": "analytics_overview_api_analytics_overview_get",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 7,
              "title": "Days"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/analytics/agent-performance": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Per-agent leaderboard (admin/supervisor only)",
        "description": "Returns one row per teammate with calls, completed, missed, answer-rate, talk-time, and average call duration over the last `days`. Sorted by total calls descending.",
        "operationId": "agent_performance_api_analytics_agent_performance_get",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 7,
              "title": "Days"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/sms-pool": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Get the org's monthly SMS pool status",
        "description": "Returns the current calendar-month SMS pool entitlement, usage, and remaining count for the caller's organization. Pool resets on the 1st of every month \u2014 there is no carry-forward.",
        "operationId": "get_sms_pool_api_billing_sms_pool_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Contact not found"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/seats": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Get the organization's seat usage and pricing",
        "description": "Returns the org's current seat allocation, how many are in use, the per-seat price for the active plan, and the resulting monthly total. Available to any authenticated member.",
        "operationId": "get_seats_api_billing_seats_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Contact not found"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Update the org's seat count (admin/owner only)",
        "description": "Sets the org's `seats_total` to the provided value. Rejected with **402 Payment Required** if the new total is below the number of currently active users \u2014 remove members first. **Note:** while Stripe is paused this applies immediately with no charge. After Stripe A4 wiring this will sync the subscription's `quantity` on the active price.",
        "operationId": "update_seats_api_billing_seats_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SeatsUpdateReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "402": {
            "description": "Payment required \u2014 seat limit reached or downgrade rejected.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Seat limit reached. Purchase more seats to add another member."
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Contact not found"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/seats/preview": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Preview the cost of adding N more seats (no charge)",
        "description": "Returns the prorated cost breakdown (per-seat, prorated, tax, total) and the resolved billing mode (`immediate` vs `proration`). UI calls this to show the Are You Sure? modal before `POST /billing/seats/purchase`.",
        "operationId": "preview_seats_api_billing_seats_preview_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutSeatsReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Contact not found"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/seats/purchase": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Purchase additional seats (admin/owner only)",
        "description": "Adds N seats. Honours the platform's seat_billing policy:\n- **immediate** mode (default): charges the org's default payment method via Stripe PaymentIntent for the prorated amount + tax NOW. Seats activate only on successful charge. Returns 402 on payment failure.\n- **proration** mode: activates seats immediately and lets Stripe roll the prorated charge into the next invoice.\nThe mode is resolved per request: org override \u2192 plan default \u2192 global default. Owners configure this from the Billing & Commerce Control Center.",
        "operationId": "purchase_seats_api_billing_seats_purchase_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutSeatsReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "402": {
            "description": "Payment required \u2014 seat limit reached or downgrade rejected.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Seat limit reached. Purchase more seats to add another member."
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Contact not found"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/seats/transactions": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "List seat transactions for the org (admin/owner only)",
        "description": "Returns the audit trail of seat purchases \u2014 prev/new seats, mode, payment status, invoice/PaymentIntent IDs, timestamp, and initiator.",
        "operationId": "list_seat_transactions_api_billing_seats_transactions_get",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/unread-count": {
      "get": {
        "tags": [
          "Notifications"
        ],
        "summary": "Team-chat unread badge counts",
        "description": "Returns total unread (excluding muted threads), DM/group breakdown, mention count, and the latest unread message.",
        "operationId": "team_chat_unread_count_api_team_chat_unread_count_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/threads/{thread_key}/mute": {
      "post": {
        "tags": [
          "Notifications"
        ],
        "summary": "Toggle mute on a DM or group thread",
        "description": "Muted threads still receive messages but are excluded from `/team-chat/unread-count`.",
        "operationId": "toggle_mute_api_team_chat_threads__thread_key__mute_post",
        "parameters": [
          {
            "name": "thread_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Thread Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/team-chat/muted-threads": {
      "get": {
        "tags": [
          "Notifications"
        ],
        "summary": "List thread keys the caller has muted",
        "operationId": "list_muted_threads_api_team_chat_muted_threads_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/sms/unread-count": {
      "get": {
        "tags": [
          "Notifications"
        ],
        "summary": "Customer-SMS unread badge count",
        "description": "Only inbound SMS owned by this user (their seat's conversations) count towards the bell. Admins without a seat see zero unless they enable sms_monitor_all.",
        "operationId": "sms_unread_count_api_sms_unread_count_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/sms/{sms_id}/mark-read": {
      "post": {
        "tags": [
          "Notifications"
        ],
        "summary": "Mark a single inbound SMS as read",
        "operationId": "sms_mark_read_api_sms__sms_id__mark_read_post",
        "parameters": [
          {
            "name": "sms_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Sms Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/sms/unread-by-contact": {
      "get": {
        "tags": [
          "Notifications"
        ],
        "summary": "Unread inbound SMS counts grouped by contact + orphan-sender threads",
        "description": "Returns `{counts: {contact_id: count}, unknown: count, orphan_threads: [...]}`. `orphan_threads` lists inbound conversations that are NOT linked to any *existing* contact (either `contact_id` is null OR the referenced contact was deleted) so the UI can render synthetic thread rows for them grouped by `from_number`. Self-heals stale contact links: dangling references no longer hide messages from the UI. Agents only see their own SMS; admin/supervisor/owner see org-wide.",
        "operationId": "sms_unread_by_contact_api_sms_unread_by_contact_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/sms/mark-thread-read": {
      "post": {
        "tags": [
          "Notifications"
        ],
        "summary": "Bulk-mark every inbound SMS in a conversation as read",
        "description": "Pass `contact_id` (preferred) or `from_number`. Returns the number of rows updated.",
        "operationId": "sms_mark_thread_read_api_sms_mark_thread_read_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": true,
                "type": "object",
                "title": "Payload"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/notifications/feed": {
      "get": {
        "tags": [
          "Notifications"
        ],
        "summary": "Server-authoritative notification feed for the current user",
        "description": "Returns up to `limit` recent notifications for this user across team chat, meetings, meeting reminders and system messages. Use this as the source of truth for the bell dropdown so notifications generated while the user was offline / on another device are not lost.",
        "operationId": "notifications_feed_api_notifications_feed_get",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 30,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/notifications/{notification_id}/read": {
      "post": {
        "tags": [
          "Notifications"
        ],
        "summary": "Mark a single notification read",
        "operationId": "notifications_mark_read_api_notifications__notification_id__read_post",
        "parameters": [
          {
            "name": "notification_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Notification Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/notifications/mark-all-read": {
      "post": {
        "tags": [
          "Notifications"
        ],
        "summary": "Mark every notification for the current user as read",
        "operationId": "notifications_mark_all_read_api_notifications_mark_all_read_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/notifications/clear": {
      "delete": {
        "tags": [
          "Notifications"
        ],
        "summary": "Delete every notification for the current user",
        "operationId": "notifications_clear_api_notifications_clear_delete",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/notifications": {
      "get": {
        "tags": [
          "Owner \u00b7 Notifications"
        ],
        "summary": "List Owner Console notifications grouped by category",
        "description": "Returns notifications grouped into the 5 canonical Owner categories: `platform`, `billing`, `security`, `communications`, `infrastructure`. Most-recent-first within each group. If the collection is empty, hydrates from live platform signals (R2 health, Stripe sync, Readiness, email outbox, SOC events) before returning.",
        "operationId": "list_owner_notifications_api_owner_notifications_get",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/notifications/unread_count": {
      "get": {
        "tags": [
          "Owner \u00b7 Notifications"
        ],
        "summary": "Unread notification count (for the top-bar badge)",
        "description": "Cheap endpoint safe to poll every 60 s from the shell.",
        "operationId": "owner_notifications_unread_count_api_owner_notifications_unread_count_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/owner/notifications/all": {
      "get": {
        "tags": [
          "Owner \u00b7 Notifications"
        ],
        "summary": "Flat list of all notifications (most recent first)",
        "description": "Used by the `View all notifications` page.",
        "operationId": "owner_notifications_all_api_owner_notifications_all_get",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 200,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/notifications/{notification_id}/read": {
      "post": {
        "tags": [
          "Owner \u00b7 Notifications"
        ],
        "summary": "Mark a single notification as read",
        "operationId": "owner_notifications_read_api_owner_notifications__notification_id__read_post",
        "parameters": [
          {
            "name": "notification_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Notification Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/notifications/read_all": {
      "post": {
        "tags": [
          "Owner \u00b7 Notifications"
        ],
        "summary": "Mark every notification as read (optionally limited to one category)",
        "operationId": "owner_notifications_read_all_api_owner_notifications_read_all_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "additionalProperties": true,
                    "type": "object"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Payload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/notifications/{notification_id}": {
      "delete": {
        "tags": [
          "Owner \u00b7 Notifications"
        ],
        "summary": "Dismiss (delete) a notification",
        "operationId": "owner_notifications_delete_api_owner_notifications__notification_id__delete",
        "parameters": [
          {
            "name": "notification_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Notification Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/notifications/prefs": {
      "get": {
        "tags": [
          "Owner \u00b7 Notifications"
        ],
        "summary": "Read the caller's notification preferences",
        "operationId": "owner_notifications_prefs_get_api_owner_notifications_prefs_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Owner \u00b7 Notifications"
        ],
        "summary": "Update the caller's notification preferences",
        "operationId": "owner_notifications_prefs_set_api_owner_notifications_prefs_patch",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": true,
                "type": "object",
                "title": "Payload"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/support/chat": {
      "post": {
        "tags": [
          "AI"
        ],
        "summary": "Chat with Vox \u2014 the Hello by Flow AI support assistant",
        "description": "Public endpoint (no auth). Pass a stable `session_id` to maintain conversation history across messages \u2014 Vox keeps the last 10 turns. Powered by Claude Sonnet 4.5 via the Emergent LLM key.",
        "operationId": "support_chat_api_support_chat_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupportChatReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "503": {
            "description": "An external dependency (Twilio, storage, LLM) is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Twilio not configured"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/support/history/{session_id}": {
      "get": {
        "tags": [
          "AI"
        ],
        "summary": "Retrieve a Vox conversation history",
        "description": "Returns up to all messages for the given session (user + assistant). Public \u2014 no auth.",
        "operationId": "support_history_api_support_history__session_id__get",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Session Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/meetings": {
      "get": {
        "tags": [
          "Meetings"
        ],
        "summary": "List meetings the caller is part of",
        "description": "Includes meetings the caller organized OR is invited to. Optionally filter by ISO `date_from`/`date_to` (both inclusive). Each row is enriched with `organizer` + `participants` objects.",
        "operationId": "list_meetings_api_meetings_get",
        "parameters": [
          {
            "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"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Meetings"
        ],
        "summary": "Schedule a new meeting",
        "description": "Creates a peer-to-peer WebRTC meeting and pushes a `meeting-invited` event over the RTC WebSocket to each participant (best-effort).",
        "operationId": "create_meeting_api_meetings_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MeetingCreate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/meetings/{mid}": {
      "get": {
        "tags": [
          "Meetings"
        ],
        "summary": "Get a single meeting (must be a participant)",
        "operationId": "get_meeting_api_meetings__mid__get",
        "parameters": [
          {
            "name": "mid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Mid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Meetings"
        ],
        "summary": "Update meeting fields (organizer or admin only)",
        "operationId": "update_meeting_api_meetings__mid__patch",
        "parameters": [
          {
            "name": "mid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Mid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MeetingUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Email already registered"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Meetings"
        ],
        "summary": "Cancel a meeting (organizer or admin only)",
        "operationId": "cancel_meeting_api_meetings__mid__delete",
        "parameters": [
          {
            "name": "mid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Mid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/meetings/{mid}/join": {
      "post": {
        "tags": [
          "Meetings"
        ],
        "summary": "Get the WebRTC room id + invitees for joining",
        "description": "Returns the WebRTC `room_id` and the list of other expected participants so the browser can ring them.",
        "operationId": "join_meeting_api_meetings__mid__join_post",
        "parameters": [
          {
            "name": "mid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Mid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/meetings/{mid}/ics": {
      "get": {
        "tags": [
          "Meetings"
        ],
        "summary": "Download an RFC 5545 .ics calendar invite for this meeting",
        "description": "Returns the meeting as a downloadable `.ics` file. Pass `?tz=America/Los_Angeles` to have the recipient's calendar app default-display in that timezone via the `X-WR-TIMEZONE` hint. The canonical event times stay in UTC, so every standards-compliant client (Apple Calendar, Google Calendar, Outlook, Thunderbird) renders the event correctly in the viewer's own local time.",
        "operationId": "meeting_ics_api_meetings__mid__ics_get",
        "parameters": [
          {
            "name": "mid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Mid"
            }
          },
          {
            "name": "tz",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "UTC",
              "title": "Tz"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "RFC 5545 calendar payload",
            "content": {
              "application/json": {
                "schema": {}
              },
              "text/calendar": {}
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Not authenticated"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Admin only"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or not visible to this user.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contact not found"
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal-call/start": {
      "post": {
        "tags": [
          "Meetings"
        ],
        "summary": "Start an ad-hoc internal group call",
        "description": "Spins up a fresh WebRTC room id for the caller + provided `participant_ids`. The caller's browser is then expected to send a `ring` message over the RTC WebSocket so each invitee's browser shows an incoming-call prompt.",
        "operationId": "internal_call_start_api_internal_call_start_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InternalCallStart"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/internal-call/users": {
      "get": {
        "tags": [
          "Meetings"
        ],
        "summary": "List teammates eligible for an internal call",
        "description": "Returns all org teammates (excluding the caller) who can be rung internally via free peer-to-peer WebRTC.",
        "operationId": "internal_call_users_api_internal_call_users_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          }
        }
      }
    },
    "/api/meetings/availability": {
      "post": {
        "tags": [
          "Meetings"
        ],
        "summary": "Scan when a set of teammates are simultaneously free",
        "description": "Given a target date and a set of participants, returns a 30-min slot grid for the viewer's window. Each slot reports per-user status (`available` / `off_hours` / `conflict`) so the UI can render a green/amber/red availability matrix. Honours each participant's saved `timezone` + `working_hours` (defaults 09:00-18:00 Mon-Fri) and their existing non-cancelled meetings for the day.",
        "operationId": "meeting_availability_api_meetings_availability_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AvailabilityScanReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Not authenticated"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated but lacks the required role / scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Admin only"
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 validation or business rule violated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "detail": "Email already registered"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/developers/openapi.json": {
      "get": {
        "tags": [
          "Developer Portal"
        ],
        "summary": "Download the OpenAPI 3.1 spec",
        "description": "Public mirror of `/api/openapi.json`. Useful for piping into third-party SDK generators (`openapi-typescript`, `openapi-python-client`, etc).",
        "operationId": "developers_openapi_api_developers_openapi_json_get",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        },
        "security": []
      }
    },
    "/api/developers/postman": {
      "get": {
        "tags": [
          "Developer Portal"
        ],
        "summary": "Download the Postman v2.1.0 collection",
        "description": "Pre-built Postman collection with every endpoint pre-organized by tag, auto-login pre-request script, and a `{{baseUrl}}` variable.",
        "operationId": "developers_postman_api_developers_postman_get",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        },
        "security": []
      }
    },
    "/api/developers/sdk/python.tar.gz": {
      "get": {
        "tags": [
          "Developer Portal"
        ],
        "summary": "Download the official Python SDK (tar.gz)",
        "description": "Tarball of the auto-generated Python SDK package. Extract and `pip install -e ./sdk-python`. Source: `developer_portal/sdk-python/`.",
        "operationId": "developers_sdk_python_api_developers_sdk_python_tar_gz_get",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        },
        "security": []
      }
    },
    "/api/developers/sdk/typescript.tar.gz": {
      "get": {
        "tags": [
          "Developer Portal"
        ],
        "summary": "Download the official TypeScript SDK (tar.gz)",
        "description": "Tarball of the auto-generated TypeScript SDK package.",
        "operationId": "developers_sdk_typescript_api_developers_sdk_typescript_tar_gz_get",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        },
        "security": []
      }
    },
    "/api/developers/manifest": {
      "get": {
        "tags": [
          "Developer Portal"
        ],
        "summary": "List the developer-portal artifacts and their freshness",
        "description": "Returns the file sizes + last-modified timestamps for the Postman collection, the two SDK tarballs, and the OpenAPI spec. The Developer Portal frontend uses this to show 'Last regenerated: ...' next to each download.",
        "operationId": "developers_manifest_api_developers_manifest_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/waitlist/desktop": {
      "post": {
        "tags": [
          "Waitlist"
        ],
        "summary": "Join Desktop Waitlist",
        "operationId": "join_desktop_waitlist_api_waitlist_desktop_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DesktopWaitlistIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DesktopWaitlistOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/waitlist/enterprise": {
      "post": {
        "tags": [
          "Waitlist"
        ],
        "summary": "Submit Enterprise Inquiry",
        "description": "Enterprise inquiry \u2014 public unauth POST from `/enterprise-inquiry`.\n\nStored in `desktop_waitlist` with kind=\"enterprise\". Owner Console lists it\nvia the existing waitlist page (with a kind filter). Also emits an email\nto `contact@hellobyflow.com` (Phase 4 wires the email template).",
        "operationId": "submit_enterprise_inquiry_api_waitlist_enterprise_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnterpriseInquiryIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnterpriseInquiryOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/waitlist/desktop": {
      "get": {
        "tags": [
          "Owner \u00b7 Waitlist"
        ],
        "summary": "Owner List Desktop Waitlist",
        "operationId": "owner_list_desktop_waitlist_api_owner_waitlist_desktop_get",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 320,
              "default": "",
              "title": "Q"
            }
          },
          {
            "name": "platform",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(mac|win|linux|other|)$",
              "default": "",
              "title": "Platform"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 5000,
              "minimum": 1,
              "default": 500,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WaitlistListOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/owner/waitlist/desktop/export.csv": {
      "get": {
        "tags": [
          "Owner \u00b7 Waitlist"
        ],
        "summary": "Owner Export Desktop Waitlist Csv",
        "operationId": "owner_export_desktop_waitlist_csv_api_owner_waitlist_desktop_export_csv_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/": {
      "get": {
        "tags": [
          "Realtime"
        ],
        "summary": "API health probe",
        "description": "Returns a tiny JSON payload \u2014 used by load balancers and the frontend to detect that the API is reachable.",
        "operationId": "root_api__get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object",
                  "title": "Response Root Api  Get"
                }
              }
            }
          }
        }
      }
    },
    "/api/rtc/ice-servers": {
      "get": {
        "tags": [
          "Realtime"
        ],
        "summary": "Ice Servers",
        "operationId": "ice_servers_api_rtc_ice_servers_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/rtc/room-status/{room_id}": {
      "get": {
        "tags": [
          "Realtime"
        ],
        "summary": "Room Status",
        "description": "Live-room status probe \u2014 reads shared state (Redis in multi-replica).",
        "operationId": "room_status_api_rtc_room_status__room_id__get",
        "parameters": [
          {
            "name": "room_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Room Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/rtc/state-health": {
      "get": {
        "tags": [
          "Realtime"
        ],
        "summary": "Rtc State Health",
        "description": "Reports the RTC signaling backend health. Returns:\n- `backend`: \"in-process\" or \"redis\"\n- `healthy`: true if Redis is reachable (or backend is in-process)\n- `local_sockets`: count of process-local WebSocket connections\n- `local_rooms`: count of process-local room references\n- `redis_pool`: {max_connections, in_use, available, pubsub_active}\nMulti-replica deployments should alert on `healthy=false` or on\n`redis_pool.in_use` approaching `redis_pool.max_connections`.",
        "operationId": "rtc_state_health_api_rtc_state_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/rtc/publish-drops": {
      "get": {
        "tags": [
          "Realtime"
        ],
        "summary": "Rtc Publish Drops",
        "description": "iter144 support tool \u2014 reports every cross-replica message this\nreplica has FAILED to publish to the pub/sub bus in its lifetime.\nEach drop = one `peer-joined` / `signal` / `ring` payload that was\ndelivered locally but silently vanished for users on the sibling\nreplica. Non-zero `total` here is the smoking gun for group-call\nfragmentation. Public-safe (only counters + type/scope, no PII).",
        "operationId": "rtc_publish_drops_api_rtc_publish_drops_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/rtc/pair-timeline/{room_id}": {
      "get": {
        "tags": [
          "Realtime"
        ],
        "summary": "Rtc Pair Timeline",
        "description": "iter147: full signaling-lifecycle timeline for one room.\n\nCombines the frontend telemetry (offer_created, offer_forwarded,\noffer_received, remote_desc_applied, answer_created,\nanswer_forwarded, answer_received, ice_sent, ice_received,\npc_state=<connected|failed|closed|\u2026>) with the server-side\nsignal-forwarding events into a single per-pair sequence.\n\nOptional filters `peer_a` and `peer_b` narrow to a single pair.\nPublic-safe \u2014 only user IDs (which are UUIDs the caller already\nhas if they know the room_id) and event names, no SDP or ICE\nbodies.\n\nNOTE: each replica holds its own ring buffer; hit the ingress a\nfew times to collect both replicas' data. Look for events with\nmatching `pid` to see which replica saw what.",
        "operationId": "rtc_pair_timeline_api_rtc_pair_timeline__room_id__get",
        "parameters": [
          {
            "name": "room_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Room Id"
            }
          },
          {
            "name": "peer_a",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Peer A"
            }
          },
          {
            "name": "peer_b",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Peer B"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/rtc/room-diagnostic/{room_id}": {
      "get": {
        "tags": [
          "Realtime"
        ],
        "summary": "Rtc Room Diagnostic",
        "description": "iter142 support tool \u2014 shows exactly who Redis thinks is in a\ngiven RTC room vs who this replica's in-process mirror thinks is\nthere. When a group-call participant reports \"I'm alone in the\nroom but Alice says she's there too\", hit this on both replicas\nand compare \u2014 any drift between `redis_members` and\n`mirror_members` (or between replicas) is the fragmentation.\n\nAlso reports which of this replica's local sockets are pinned to\nthe room via `rtc_room_socket`, so ops can spot the classic\n\"user has 2 tabs, only one is in the room\" pathology.\n\nPublic-safe (only exposes user IDs, no PII / audio content). No\nauth required so support/ops tools can hit it directly against\neach replica's internal endpoint. If PII exposure becomes a\nconcern later, gate this behind `require_admin`.",
        "operationId": "rtc_room_diagnostic_api_rtc_room_diagnostic__room_id__get",
        "parameters": [
          {
            "name": "room_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Room Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AcceptInviteBody": {
        "properties": {
          "password": {
            "type": "string",
            "maxLength": 200,
            "minLength": 10,
            "title": "Password"
          }
        },
        "type": "object",
        "required": [
          "password"
        ],
        "title": "AcceptInviteBody"
      },
      "ActivateReq": {
        "properties": {
          "config_id": {
            "type": "string",
            "title": "Config Id"
          },
          "reason": {
            "type": "string",
            "title": "Reason",
            "default": "manual"
          }
        },
        "type": "object",
        "required": [
          "config_id"
        ],
        "title": "ActivateReq"
      },
      "AddressIn": {
        "properties": {
          "line1": {
            "type": "string",
            "title": "Line1"
          },
          "line2": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Line2"
          },
          "city": {
            "type": "string",
            "title": "City"
          },
          "state": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "State"
          },
          "postal_code": {
            "type": "string",
            "title": "Postal Code"
          },
          "country": {
            "type": "string",
            "maxLength": 2,
            "minLength": 2,
            "title": "Country"
          }
        },
        "type": "object",
        "required": [
          "line1",
          "city",
          "postal_code",
          "country"
        ],
        "title": "AddressIn"
      },
      "AlertActionReq": {
        "properties": {
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Note"
          }
        },
        "type": "object",
        "title": "AlertActionReq"
      },
      "AssignReq": {
        "properties": {
          "target_type": {
            "type": "string",
            "enum": [
              "unassigned",
              "user",
              "team",
              "ring_group",
              "queue",
              "reception",
              "ivr",
              "voicemail",
              "department",
              "shared_inbox",
              "campaign"
            ],
            "title": "Target Type",
            "default": "unassigned"
          },
          "target_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Id"
          },
          "target_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Label"
          }
        },
        "type": "object",
        "title": "AssignReq"
      },
      "AssigneeEditReq": {
        "properties": {
          "username": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Username"
          },
          "password": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Password"
          },
          "display_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Display Name"
          }
        },
        "type": "object",
        "title": "AssigneeEditReq"
      },
      "AssigneeNewUserReq": {
        "properties": {
          "username": {
            "type": "string",
            "minLength": 2,
            "title": "Username"
          },
          "password": {
            "type": "string",
            "minLength": 6,
            "title": "Password"
          },
          "display_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Display Name"
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          }
        },
        "type": "object",
        "required": [
          "username",
          "password"
        ],
        "title": "AssigneeNewUserReq"
      },
      "AutoDebitReq": {
        "properties": {
          "enabled": {
            "type": "boolean",
            "title": "Enabled"
          }
        },
        "type": "object",
        "required": [
          "enabled"
        ],
        "title": "AutoDebitReq"
      },
      "AvailabilityScanReq": {
        "properties": {
          "participant_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "maxItems": 50,
            "minItems": 1,
            "title": "Participant Ids",
            "description": "User IDs to check (includes the requester if you want self in the grid)."
          },
          "date": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "title": "Date",
            "description": "Target date in the viewer's TZ (YYYY-MM-DD)."
          },
          "viewer_tz": {
            "type": "string",
            "maxLength": 64,
            "title": "Viewer Tz",
            "description": "IANA TZ of the requester; slot rendering anchors to this zone.",
            "default": "UTC"
          },
          "duration_minutes": {
            "type": "integer",
            "maximum": 480.0,
            "minimum": 15.0,
            "title": "Duration Minutes",
            "default": 30
          },
          "slot_minutes": {
            "type": "integer",
            "maximum": 60.0,
            "minimum": 15.0,
            "title": "Slot Minutes",
            "default": 30
          },
          "window_start": {
            "type": "string",
            "pattern": "^\\d{2}:\\d{2}$",
            "title": "Window Start",
            "default": "06:00"
          },
          "window_end": {
            "type": "string",
            "pattern": "^\\d{2}:\\d{2}$",
            "title": "Window End",
            "default": "22:00"
          }
        },
        "type": "object",
        "required": [
          "participant_ids",
          "date"
        ],
        "title": "AvailabilityScanReq"
      },
      "Body_upload_team_chat_attachment_api_team_chat_upload_post": {
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "title": "File"
          }
        },
        "type": "object",
        "required": [
          "file"
        ],
        "title": "Body_upload_team_chat_attachment_api_team_chat_upload_post"
      },
      "BulkAssignReq": {
        "properties": {
          "number_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "minItems": 1,
            "title": "Number Ids"
          },
          "target_type": {
            "type": "string",
            "enum": [
              "unassigned",
              "user",
              "team",
              "ring_group",
              "queue",
              "reception",
              "ivr",
              "voicemail",
              "department",
              "shared_inbox",
              "campaign"
            ],
            "title": "Target Type",
            "default": "unassigned"
          },
          "target_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Id"
          },
          "target_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Label"
          }
        },
        "type": "object",
        "required": [
          "number_ids"
        ],
        "title": "BulkAssignReq"
      },
      "BusinessHours": {
        "properties": {
          "enabled": {
            "type": "boolean",
            "title": "Enabled",
            "default": false
          },
          "timezone": {
            "type": "string",
            "title": "Timezone",
            "default": "UTC"
          },
          "weekdays": {
            "items": {
              "type": "integer"
            },
            "type": "array",
            "title": "Weekdays"
          },
          "start_hour": {
            "type": "integer",
            "maximum": 23.0,
            "minimum": 0.0,
            "title": "Start Hour",
            "default": 9
          },
          "end_hour": {
            "type": "integer",
            "maximum": 23.0,
            "minimum": 0.0,
            "title": "End Hour",
            "default": 18
          },
          "voicemail_greeting": {
            "type": "string",
            "maxLength": 400,
            "title": "Voicemail Greeting",
            "default": "You've reached us outside business hours. Please leave a message after the beep."
          }
        },
        "type": "object",
        "title": "BusinessHours",
        "description": "Per-org business-hours window. Outside this window, inbound calls are routed straight to voicemail.",
        "examples": [
          {
            "enabled": true,
            "end_hour": 18,
            "start_hour": 9,
            "timezone": "America/Los_Angeles",
            "voicemail_greeting": "Hi, we're closed right now. Leave a message and we'll call you back tomorrow.",
            "weekdays": [
              0,
              1,
              2,
              3,
              4
            ]
          }
        ]
      },
      "CallCreate": {
        "properties": {
          "to_number": {
            "type": "string",
            "title": "To Number"
          },
          "to_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "To Name"
          },
          "from_number_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "From Number Id"
          },
          "direction": {
            "type": "string",
            "enum": [
              "outbound",
              "inbound"
            ],
            "title": "Direction",
            "default": "outbound"
          }
        },
        "type": "object",
        "required": [
          "to_number"
        ],
        "title": "CallCreate",
        "examples": [
          {
            "direction": "outbound",
            "from_number_id": "num_abc",
            "to_name": "Hana Park",
            "to_number": "+13072402137"
          }
        ]
      },
      "CallEnd": {
        "properties": {
          "duration": {
            "type": "integer",
            "title": "Duration"
          },
          "status": {
            "type": "string",
            "enum": [
              "completed",
              "missed",
              "no-answer",
              "busy",
              "failed"
            ],
            "title": "Status",
            "default": "completed"
          },
          "recorded": {
            "type": "boolean",
            "title": "Recorded",
            "default": false
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notes"
          }
        },
        "type": "object",
        "required": [
          "duration"
        ],
        "title": "CallEnd",
        "examples": [
          {
            "duration": 142,
            "notes": "Demo booked for Thursday",
            "recorded": true,
            "status": "completed"
          }
        ]
      },
      "ChangePasswordBody": {
        "properties": {
          "current_password": {
            "type": "string",
            "maxLength": 200,
            "minLength": 1,
            "title": "Current Password"
          },
          "new_password": {
            "type": "string",
            "maxLength": 200,
            "minLength": 10,
            "title": "New Password"
          }
        },
        "type": "object",
        "required": [
          "current_password",
          "new_password"
        ],
        "title": "ChangePasswordBody"
      },
      "ChangePasswordReq": {
        "properties": {
          "current_password": {
            "type": "string",
            "title": "Current Password"
          },
          "new_password": {
            "type": "string",
            "title": "New Password"
          }
        },
        "type": "object",
        "required": [
          "current_password",
          "new_password"
        ],
        "title": "ChangePasswordReq"
      },
      "ChangePlanReq": {
        "properties": {
          "plan_key": {
            "type": "string",
            "title": "Plan Key"
          },
          "seats": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 10000.0,
                "minimum": 1.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Seats"
          }
        },
        "type": "object",
        "required": [
          "plan_key"
        ],
        "title": "ChangePlanReq"
      },
      "ChannelCreateReq": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name"
          },
          "type": {
            "type": "string",
            "title": "Type"
          },
          "config": {
            "additionalProperties": true,
            "type": "object",
            "title": "Config"
          },
          "enabled": {
            "type": "boolean",
            "title": "Enabled",
            "default": true
          }
        },
        "type": "object",
        "required": [
          "name",
          "type",
          "config"
        ],
        "title": "ChannelCreateReq"
      },
      "ChatSettingsReq": {
        "properties": {
          "delete_window_seconds": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 86400.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Delete Window Seconds"
          },
          "delete_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Delete Enabled"
          },
          "edit_window_seconds": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 86400.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Edit Window Seconds"
          }
        },
        "type": "object",
        "title": "ChatSettingsReq"
      },
      "CheckoutReq": {
        "properties": {
          "plan_key": {
            "type": "string",
            "title": "Plan Key"
          },
          "seats": {
            "type": "integer",
            "maximum": 10000.0,
            "minimum": 1.0,
            "title": "Seats",
            "default": 1
          }
        },
        "type": "object",
        "required": [
          "plan_key"
        ],
        "title": "CheckoutReq"
      },
      "CheckoutSeatsReq": {
        "properties": {
          "add_seats": {
            "type": "integer",
            "maximum": 1000.0,
            "minimum": 1.0,
            "title": "Add Seats",
            "description": "How many seats to add to the current total."
          },
          "plan": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "individual",
                  "business",
                  "enterprise",
                  "starter",
                  "growth",
                  "scale"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Plan",
            "description": "Optional plan switch on upgrade (Stripe-canonical plan_key)."
          }
        },
        "type": "object",
        "required": [
          "add_seats"
        ],
        "title": "CheckoutSeatsReq",
        "description": "While Stripe is paused this just bumps `seats_total` immediately (no charge).\nOnce Stripe lands, this will return a Checkout URL and the seat increase will\ncommit only on the `invoice.paid` webhook."
      },
      "Condition": {
        "properties": {
          "field": {
            "type": "string",
            "title": "Field"
          },
          "op": {
            "type": "string",
            "title": "Op"
          },
          "value": {
            "title": "Value"
          }
        },
        "type": "object",
        "required": [
          "field",
          "op",
          "value"
        ],
        "title": "Condition"
      },
      "ConferenceAddReq": {
        "properties": {
          "call_sid": {
            "type": "string",
            "title": "Call Sid"
          },
          "participant": {
            "type": "string",
            "title": "Participant"
          }
        },
        "type": "object",
        "required": [
          "call_sid",
          "participant"
        ],
        "title": "ConferenceAddReq"
      },
      "ContactCreate": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name"
          },
          "phone": {
            "type": "string",
            "title": "Phone"
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "company": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Company"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Tags",
            "default": []
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notes"
          }
        },
        "type": "object",
        "required": [
          "name",
          "phone"
        ],
        "title": "ContactCreate",
        "examples": [
          {
            "company": "Nakamura Trading",
            "email": "aiko@nakamura-trading.jp",
            "name": "Aiko Tanaka",
            "notes": "Decision maker for Q3 procurement",
            "phone": "+81 90-1234-5678",
            "tags": [
              "VIP",
              "Tokyo"
            ]
          }
        ]
      },
      "CouponIn": {
        "properties": {
          "code": {
            "type": "string",
            "maxLength": 40,
            "minLength": 2,
            "title": "Code"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "discount_type": {
            "type": "string",
            "title": "Discount Type",
            "default": "percent"
          },
          "discount_value": {
            "type": "number",
            "exclusiveMinimum": 0.0,
            "title": "Discount Value"
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Currency"
          },
          "duration": {
            "type": "string",
            "title": "Duration",
            "default": "once"
          },
          "duration_months": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Duration Months"
          },
          "max_redemptions": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Redemptions"
          },
          "redemptions": {
            "type": "integer",
            "title": "Redemptions",
            "default": 0
          },
          "valid_from": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Valid From"
          },
          "valid_until": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Valid Until"
          },
          "applies_to_plans": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Applies To Plans"
          },
          "applies_to_countries": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Applies To Countries"
          },
          "first_time_customer_only": {
            "type": "boolean",
            "title": "First Time Customer Only",
            "default": false
          },
          "enabled": {
            "type": "boolean",
            "title": "Enabled",
            "default": true
          }
        },
        "type": "object",
        "required": [
          "code",
          "discount_value"
        ],
        "title": "CouponIn"
      },
      "CouponPatch": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "discount_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Discount Type"
          },
          "discount_value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Discount Value"
          },
          "duration": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Duration"
          },
          "duration_months": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Duration Months"
          },
          "max_redemptions": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Redemptions"
          },
          "valid_until": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Valid Until"
          },
          "applies_to_plans": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Applies To Plans"
          },
          "applies_to_countries": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Applies To Countries"
          },
          "first_time_customer_only": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "First Time Customer Only"
          },
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Enabled"
          }
        },
        "type": "object",
        "title": "CouponPatch"
      },
      "CreditReq": {
        "properties": {
          "org_id": {
            "type": "string",
            "title": "Org Id"
          },
          "amount_minor": {
            "type": "integer",
            "exclusiveMinimum": 0.0,
            "title": "Amount Minor"
          },
          "currency": {
            "type": "string",
            "maxLength": 3,
            "minLength": 3,
            "title": "Currency"
          },
          "memo": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Memo"
          }
        },
        "type": "object",
        "required": [
          "org_id",
          "amount_minor",
          "currency"
        ],
        "title": "CreditReq"
      },
      "CustomProviderField": {
        "properties": {
          "key": {
            "type": "string",
            "title": "Key"
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Label"
          },
          "secret": {
            "type": "boolean",
            "title": "Secret",
            "default": false
          },
          "required": {
            "type": "boolean",
            "title": "Required",
            "default": false
          },
          "hint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hint"
          }
        },
        "type": "object",
        "required": [
          "key"
        ],
        "title": "CustomProviderField"
      },
      "CustomProviderRegisterReq": {
        "properties": {
          "category": {
            "type": "string",
            "title": "Category"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Label"
          },
          "docs_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Docs Url"
          },
          "api_base_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Api Base Url"
          },
          "auth_type": {
            "type": "string",
            "title": "Auth Type",
            "default": "api_key"
          },
          "fields": {
            "items": {
              "$ref": "#/components/schemas/CustomProviderField"
            },
            "type": "array",
            "title": "Fields"
          },
          "webhook_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Webhook Url"
          },
          "extra_headers": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Extra Headers"
          },
          "env_vars": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Env Vars"
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notes"
          }
        },
        "type": "object",
        "required": [
          "category",
          "name"
        ],
        "title": "CustomProviderRegisterReq"
      },
      "CustomerUpsertReq": {
        "properties": {
          "address": {
            "$ref": "#/components/schemas/AddressIn"
          },
          "tax_id": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaxIdIn"
              },
              {
                "type": "null"
              }
            ]
          },
          "email": {
            "anyOf": [
              {
                "type": "string",
                "format": "email"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          }
        },
        "type": "object",
        "required": [
          "address"
        ],
        "title": "CustomerUpsertReq"
      },
      "DesktopWaitlistIn": {
        "properties": {
          "email": {
            "type": "string",
            "maxLength": 320,
            "title": "Email"
          },
          "platform": {
            "type": "string",
            "enum": [
              "mac",
              "win",
              "linux",
              "other"
            ],
            "title": "Platform",
            "default": "other"
          }
        },
        "type": "object",
        "required": [
          "email"
        ],
        "title": "DesktopWaitlistIn"
      },
      "DesktopWaitlistOut": {
        "properties": {
          "ok": {
            "type": "boolean",
            "title": "Ok"
          },
          "already_on_list": {
            "type": "boolean",
            "title": "Already On List"
          },
          "id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          }
        },
        "type": "object",
        "required": [
          "ok",
          "already_on_list"
        ],
        "title": "DesktopWaitlistOut"
      },
      "EmailChangeReq": {
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "title": "Email",
            "description": "New primary email address for this account"
          },
          "revoke_trusted_devices": {
            "type": "boolean",
            "title": "Revoke Trusted Devices",
            "description": "Invalidate this user's `hbf_td` trusted-device cookies. Safe default: rotating the email should also invalidate the trust so the next login re-verifies via OTP into the new inbox.",
            "default": true
          }
        },
        "type": "object",
        "required": [
          "email"
        ],
        "title": "EmailChangeReq"
      },
      "EnterpriseInquiryIn": {
        "properties": {
          "company_name": {
            "type": "string",
            "maxLength": 200,
            "minLength": 1,
            "title": "Company Name"
          },
          "country": {
            "type": "string",
            "maxLength": 80,
            "minLength": 2,
            "title": "Country"
          },
          "website": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ],
            "title": "Website"
          },
          "industry": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ],
            "title": "Industry"
          },
          "contact_name": {
            "type": "string",
            "maxLength": 200,
            "minLength": 1,
            "title": "Contact Name"
          },
          "work_email": {
            "type": "string",
            "maxLength": 320,
            "title": "Work Email"
          },
          "phone": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ],
            "title": "Phone"
          },
          "seats_estimate": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ],
            "title": "Seats Estimate"
          },
          "company_size": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ],
            "title": "Company Size"
          },
          "requirements": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Requirements"
          },
          "additional_notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 4000
              },
              {
                "type": "null"
              }
            ],
            "title": "Additional Notes"
          }
        },
        "type": "object",
        "required": [
          "company_name",
          "country",
          "contact_name",
          "work_email"
        ],
        "title": "EnterpriseInquiryIn"
      },
      "EnterpriseInquiryOut": {
        "properties": {
          "ok": {
            "type": "boolean",
            "title": "Ok"
          },
          "id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          }
        },
        "type": "object",
        "required": [
          "ok"
        ],
        "title": "EnterpriseInquiryOut"
      },
      "ErrorResponse": {
        "properties": {
          "detail": {
            "type": "string",
            "title": "Detail",
            "description": "Human-readable error message.",
            "examples": [
              "Not authenticated"
            ]
          }
        },
        "type": "object",
        "required": [
          "detail"
        ],
        "title": "ErrorResponse",
        "description": "RFC 7807-flavoured error envelope (FastAPI default `{detail: ...}` shape)."
      },
      "EscalationPolicyPatchReq": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Enabled"
          },
          "priority": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Priority"
          },
          "severity_filter": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Severity Filter"
          },
          "trigger_conditions": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trigger Conditions"
          },
          "ack_timeout_minutes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ack Timeout Minutes"
          },
          "repeat_interval_minutes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Repeat Interval Minutes"
          },
          "max_attempts": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Attempts"
          },
          "steps": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/EscalationStep"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Steps"
          }
        },
        "type": "object",
        "title": "EscalationPolicyPatchReq"
      },
      "EscalationPolicyReq": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "default": ""
          },
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Enabled",
            "default": true
          },
          "priority": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Priority",
            "default": 100
          },
          "severity_filter": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Severity Filter"
          },
          "trigger_conditions": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trigger Conditions"
          },
          "ack_timeout_minutes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ack Timeout Minutes",
            "default": 15
          },
          "repeat_interval_minutes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Repeat Interval Minutes",
            "default": 30
          },
          "max_attempts": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Attempts",
            "default": 5
          },
          "steps": {
            "items": {
              "$ref": "#/components/schemas/EscalationStep"
            },
            "type": "array",
            "title": "Steps"
          }
        },
        "type": "object",
        "required": [
          "name",
          "steps"
        ],
        "title": "EscalationPolicyReq"
      },
      "EscalationStep": {
        "properties": {
          "after_minutes": {
            "type": "integer",
            "title": "After Minutes",
            "default": 0
          },
          "role_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Role Ids"
          },
          "channel_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Channel Ids"
          },
          "message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Message"
          }
        },
        "type": "object",
        "title": "EscalationStep"
      },
      "FailbackModeReq": {
        "properties": {
          "mode": {
            "type": "string",
            "pattern": "^(auto|manual)$",
            "title": "Mode"
          }
        },
        "type": "object",
        "required": [
          "mode"
        ],
        "title": "FailbackModeReq"
      },
      "FailoverPolicyReq": {
        "properties": {
          "trigger_on_auth_failure": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trigger On Auth Failure"
          },
          "trigger_on_5xx": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trigger On 5Xx"
          },
          "trigger_on_network_timeout": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trigger On Network Timeout"
          },
          "trigger_on_rate_limit": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trigger On Rate Limit"
          },
          "trigger_on_latency_threshold": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trigger On Latency Threshold"
          },
          "latency_threshold_ms": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Latency Threshold Ms"
          },
          "consecutive_failure_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Consecutive Failure Count"
          },
          "failback_mode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Failback Mode"
          },
          "cooldown_seconds": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cooldown Seconds"
          }
        },
        "type": "object",
        "title": "FailoverPolicyReq"
      },
      "FeatureFlagUpdate": {
        "properties": {
          "value": {
            "type": "boolean",
            "title": "Value"
          }
        },
        "type": "object",
        "required": [
          "value"
        ],
        "title": "FeatureFlagUpdate"
      },
      "ForgotPasswordReq": {
        "properties": {
          "email": {
            "type": "string",
            "maxLength": 200,
            "minLength": 3,
            "title": "Email"
          }
        },
        "type": "object",
        "required": [
          "email"
        ],
        "title": "ForgotPasswordReq"
      },
      "ForwardReq": {
        "properties": {
          "to_user_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "To User Ids"
          },
          "group_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Group Ids"
          },
          "comment": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ],
            "title": "Comment"
          }
        },
        "type": "object",
        "title": "ForwardReq"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "IVRSaveReq": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name"
          },
          "nodes": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Nodes"
          },
          "edges": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Edges"
          }
        },
        "type": "object",
        "required": [
          "name",
          "nodes",
          "edges"
        ],
        "title": "IVRSaveReq"
      },
      "IdentitySettingsPatch": {
        "properties": {
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Enabled"
          },
          "active_provider": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Active Provider"
          },
          "require_for_individual_plan": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Require For Individual Plan"
          },
          "require_for_business_owner": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Require For Business Owner"
          },
          "require_for_seat": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Require For Seat"
          }
        },
        "type": "object",
        "title": "IdentitySettingsPatch"
      },
      "IncidentAssignReq": {
        "properties": {
          "assignee_id": {
            "type": "string",
            "title": "Assignee Id"
          },
          "assignee_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Assignee Email"
          }
        },
        "type": "object",
        "required": [
          "assignee_id"
        ],
        "title": "IncidentAssignReq"
      },
      "IncidentPatchReq": {
        "properties": {
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          },
          "root_cause": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Root Cause"
          },
          "corrective_actions": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Corrective Actions"
          },
          "preventive_actions": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Preventive Actions"
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notes"
          },
          "resolution_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Resolution Notes"
          },
          "affected_services": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Affected Services"
          },
          "linked_providers": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Linked Providers"
          },
          "linked_organizations": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Linked Organizations"
          }
        },
        "type": "object",
        "title": "IncidentPatchReq"
      },
      "IncidentStatusReq": {
        "properties": {
          "status": {
            "type": "string",
            "title": "Status"
          },
          "detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Detail"
          }
        },
        "type": "object",
        "required": [
          "status"
        ],
        "title": "IncidentStatusReq"
      },
      "IntegrationSaveReq": {
        "properties": {
          "values": {
            "additionalProperties": true,
            "type": "object",
            "title": "Values",
            "description": "Field key \u2192 value map. Empty strings keep existing stored value."
          }
        },
        "type": "object",
        "required": [
          "values"
        ],
        "title": "IntegrationSaveReq"
      },
      "IntegrationTestReq": {
        "properties": {
          "values": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Values",
            "description": "Optional overlay to test WITHOUT saving. Empty falls back to the currently-stored config so operators can hit 'Test' after a save."
          },
          "variant": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Variant",
            "description": "Provider-specific sub-test selector. Sentry accepts 'backend' or 'frontend' to pick which DSN to send the test event to. Ignored by other providers."
          }
        },
        "type": "object",
        "title": "IntegrationTestReq"
      },
      "InternalCallStart": {
        "properties": {
          "participant_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Participant Ids"
          }
        },
        "type": "object",
        "title": "InternalCallStart"
      },
      "InternalLoginBody": {
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "title": "Email"
          },
          "password": {
            "type": "string",
            "maxLength": 200,
            "minLength": 1,
            "title": "Password"
          }
        },
        "type": "object",
        "required": [
          "email",
          "password"
        ],
        "title": "InternalLoginBody"
      },
      "InviteStaffBody": {
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "title": "Email"
          },
          "name": {
            "type": "string",
            "maxLength": 200,
            "minLength": 1,
            "title": "Name"
          },
          "roles": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Roles"
          },
          "custom_permissions": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Custom Permissions"
          }
        },
        "type": "object",
        "required": [
          "email",
          "name"
        ],
        "title": "InviteStaffBody"
      },
      "LifecycleIn": {
        "properties": {
          "retention_days": {
            "type": "integer",
            "maximum": 3650.0,
            "minimum": 0.0,
            "title": "Retention Days",
            "description": "Twilio copy retention (days)",
            "default": 30
          },
          "lifecycle_archive_days": {
            "type": "integer",
            "maximum": 3650.0,
            "minimum": 0.0,
            "title": "Lifecycle Archive Days",
            "description": "Move to cold-storage after N days (0=off)",
            "default": 365
          },
          "lifecycle_delete_days": {
            "type": "integer",
            "maximum": 3650.0,
            "minimum": 0.0,
            "title": "Lifecycle Delete Days",
            "description": "Permanently delete after N days (0=off)",
            "default": 0
          }
        },
        "type": "object",
        "title": "LifecycleIn"
      },
      "LoginReq": {
        "properties": {
          "email": {
            "type": "string",
            "title": "Email"
          },
          "password": {
            "type": "string",
            "title": "Password"
          }
        },
        "type": "object",
        "required": [
          "email",
          "password"
        ],
        "title": "LoginReq",
        "examples": [
          {
            "email": "admin@hellobyflow.com",
            "password": "admin123"
          }
        ]
      },
      "MeetingCreate": {
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 200,
            "minLength": 1,
            "title": "Title"
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "start_at": {
            "type": "string",
            "title": "Start At"
          },
          "end_at": {
            "type": "string",
            "title": "End At"
          },
          "participant_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Participant Ids"
          }
        },
        "type": "object",
        "required": [
          "title",
          "start_at",
          "end_at"
        ],
        "title": "MeetingCreate"
      },
      "MeetingUpdate": {
        "properties": {
          "title": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200,
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "start_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start At"
          },
          "end_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "End At"
          },
          "participant_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Participant Ids"
          }
        },
        "type": "object",
        "title": "MeetingUpdate"
      },
      "MfaBody": {
        "properties": {
          "enabled": {
            "type": "boolean",
            "title": "Enabled"
          }
        },
        "type": "object",
        "required": [
          "enabled"
        ],
        "title": "MfaBody"
      },
      "ModeReq": {
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "listen",
              "whisper",
              "barge"
            ],
            "title": "Mode"
          }
        },
        "type": "object",
        "required": [
          "mode"
        ],
        "title": "ModeReq"
      },
      "MoveReq": {
        "properties": {
          "direction": {
            "type": "string",
            "pattern": "^(up|down)$",
            "title": "Direction"
          }
        },
        "type": "object",
        "required": [
          "direction"
        ],
        "title": "MoveReq"
      },
      "MsgEditReq": {
        "properties": {
          "body": {
            "type": "string",
            "maxLength": 2000,
            "minLength": 1,
            "title": "Body"
          }
        },
        "type": "object",
        "required": [
          "body"
        ],
        "title": "MsgEditReq"
      },
      "NoteCreate": {
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 200,
            "title": "Title",
            "default": ""
          },
          "body": {
            "type": "string",
            "maxLength": 20000,
            "title": "Body",
            "default": ""
          },
          "color": {
            "type": "string",
            "enum": [
              "yellow",
              "pink",
              "green",
              "blue",
              "purple",
              "orange",
              "grey"
            ],
            "title": "Color",
            "default": "yellow"
          },
          "pinned": {
            "type": "boolean",
            "title": "Pinned",
            "default": false
          },
          "favorite": {
            "type": "boolean",
            "title": "Favorite",
            "default": false
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Tags"
          }
        },
        "type": "object",
        "title": "NoteCreate"
      },
      "NoteUpdate": {
        "properties": {
          "title": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          },
          "body": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "null"
              }
            ],
            "title": "Body"
          },
          "color": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "yellow",
                  "pink",
                  "green",
                  "blue",
                  "purple",
                  "orange",
                  "grey"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Color"
          },
          "pinned": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pinned"
          },
          "favorite": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Favorite"
          },
          "archived": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Archived"
          },
          "tags": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tags"
          },
          "order_index": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Order Index"
          }
        },
        "type": "object",
        "title": "NoteUpdate"
      },
      "NotepadUpdate": {
        "properties": {
          "body": {
            "type": "string",
            "maxLength": 200000,
            "title": "Body",
            "default": ""
          }
        },
        "type": "object",
        "title": "NotepadUpdate"
      },
      "NumberCreate": {
        "properties": {
          "country": {
            "type": "string",
            "title": "Country"
          },
          "area": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Area"
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Label"
          },
          "type": {
            "type": "string",
            "enum": [
              "local",
              "toll-free",
              "mobile"
            ],
            "title": "Type",
            "default": "local"
          }
        },
        "type": "object",
        "required": [
          "country"
        ],
        "title": "NumberCreate"
      },
      "OnboardingCheckoutIn": {
        "properties": {
          "success_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Success Url"
          },
          "cancel_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cancel Url"
          }
        },
        "type": "object",
        "title": "OnboardingCheckoutIn"
      },
      "OnboardingCheckoutOut": {
        "properties": {
          "ok": {
            "type": "boolean",
            "title": "Ok"
          },
          "checkout_url": {
            "type": "string",
            "title": "Checkout Url"
          }
        },
        "type": "object",
        "required": [
          "ok",
          "checkout_url"
        ],
        "title": "OnboardingCheckoutOut"
      },
      "OnboardingIntentIn": {
        "properties": {
          "account_type": {
            "type": "string",
            "title": "Account Type"
          },
          "plan": {
            "type": "string",
            "enum": [
              "individual",
              "business",
              "enterprise",
              "starter",
              "growth",
              "scale"
            ],
            "title": "Plan",
            "default": "individual"
          },
          "org_name": {
            "type": "string",
            "title": "Org Name"
          },
          "admin_name": {
            "type": "string",
            "title": "Admin Name"
          },
          "admin_email": {
            "type": "string",
            "title": "Admin Email"
          },
          "admin_password": {
            "type": "string",
            "title": "Admin Password"
          },
          "country": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Country"
          },
          "seats": {
            "type": "integer",
            "title": "Seats",
            "default": 1
          }
        },
        "type": "object",
        "required": [
          "account_type",
          "org_name",
          "admin_name",
          "admin_email",
          "admin_password"
        ],
        "title": "OnboardingIntentIn"
      },
      "OnboardingIntentOut": {
        "properties": {
          "ok": {
            "type": "boolean",
            "title": "Ok"
          },
          "intent_id": {
            "type": "string",
            "title": "Intent Id"
          }
        },
        "type": "object",
        "required": [
          "ok",
          "intent_id"
        ],
        "title": "OnboardingIntentOut"
      },
      "OnboardingKycStartOut": {
        "properties": {
          "ok": {
            "type": "boolean",
            "title": "Ok"
          },
          "provider": {
            "type": "string",
            "title": "Provider"
          },
          "verification_url": {
            "type": "string",
            "title": "Verification Url"
          },
          "session_id": {
            "type": "string",
            "title": "Session Id"
          }
        },
        "type": "object",
        "required": [
          "ok",
          "provider",
          "verification_url",
          "session_id"
        ],
        "title": "OnboardingKycStartOut"
      },
      "OnboardingStatusOut": {
        "properties": {
          "ok": {
            "type": "boolean",
            "title": "Ok"
          },
          "stage": {
            "type": "string",
            "title": "Stage"
          },
          "status": {
            "type": "string",
            "title": "Status"
          },
          "kyc_status": {
            "type": "string",
            "title": "Kyc Status"
          },
          "subscription_status": {
            "type": "string",
            "title": "Subscription Status"
          },
          "identity_required": {
            "type": "boolean",
            "title": "Identity Required"
          },
          "seats_total": {
            "type": "integer",
            "title": "Seats Total"
          },
          "plan": {
            "type": "string",
            "title": "Plan"
          }
        },
        "type": "object",
        "required": [
          "ok",
          "stage",
          "status",
          "kyc_status",
          "subscription_status",
          "identity_required",
          "seats_total",
          "plan"
        ],
        "title": "OnboardingStatusOut"
      },
      "OtpResendReq": {
        "properties": {
          "challenge_token": {
            "type": "string",
            "title": "Challenge Token"
          }
        },
        "type": "object",
        "required": [
          "challenge_token"
        ],
        "title": "OtpResendReq"
      },
      "OtpVerifyReq": {
        "properties": {
          "challenge_token": {
            "type": "string",
            "title": "Challenge Token"
          },
          "code": {
            "type": "string",
            "maxLength": 6,
            "minLength": 6,
            "pattern": "^\\d{6}$",
            "title": "Code"
          },
          "trust_device": {
            "type": "boolean",
            "title": "Trust Device",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "challenge_token",
          "code"
        ],
        "title": "OtpVerifyReq"
      },
      "OverrideReq": {
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "verified",
              "failed"
            ],
            "title": "Decision"
          },
          "reason": {
            "type": "string",
            "title": "Reason"
          }
        },
        "type": "object",
        "required": [
          "decision",
          "reason"
        ],
        "title": "OverrideReq"
      },
      "OwnerCreateOrg": {
        "properties": {
          "org_name": {
            "type": "string",
            "title": "Org Name"
          },
          "account_type": {
            "type": "string",
            "enum": [
              "business",
              "individual"
            ],
            "title": "Account Type"
          },
          "admin_name": {
            "type": "string",
            "title": "Admin Name"
          },
          "admin_email": {
            "type": "string",
            "format": "email",
            "title": "Admin Email"
          },
          "admin_password": {
            "type": "string",
            "minLength": 6,
            "title": "Admin Password"
          },
          "plan": {
            "type": "string",
            "enum": [
              "individual",
              "business",
              "enterprise",
              "starter",
              "growth",
              "scale"
            ],
            "title": "Plan",
            "default": "individual"
          },
          "auto_approve": {
            "type": "boolean",
            "title": "Auto Approve",
            "default": true
          }
        },
        "type": "object",
        "required": [
          "org_name",
          "account_type",
          "admin_name",
          "admin_email",
          "admin_password"
        ],
        "title": "OwnerCreateOrg"
      },
      "OwnerOrgUpdate": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "plan": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "individual",
                  "business",
                  "enterprise",
                  "starter",
                  "growth",
                  "scale"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Plan"
          },
          "status": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "pending",
                  "active",
                  "suspended",
                  "rejected"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          },
          "seats_total": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Seats Total"
          },
          "owner_email": {
            "anyOf": [
              {
                "type": "string",
                "format": "email"
              },
              {
                "type": "null"
              }
            ],
            "title": "Owner Email"
          },
          "kyc_status": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "pending",
                  "approved",
                  "rejected"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Kyc Status"
          },
          "type": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "business",
                  "individual"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Type"
          }
        },
        "type": "object",
        "title": "OwnerOrgUpdate"
      },
      "OwnerPasswordReset": {
        "properties": {
          "new_password": {
            "type": "string",
            "minLength": 6,
            "title": "New Password"
          }
        },
        "type": "object",
        "required": [
          "new_password"
        ],
        "title": "OwnerPasswordReset"
      },
      "OwnerTransferOwnership": {
        "properties": {
          "new_primary_user_id": {
            "type": "string",
            "title": "New Primary User Id"
          }
        },
        "type": "object",
        "required": [
          "new_primary_user_id"
        ],
        "title": "OwnerTransferOwnership"
      },
      "OwnerUserUpdate": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "email": {
            "anyOf": [
              {
                "type": "string",
                "format": "email"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "role": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "admin",
                  "supervisor",
                  "quality",
                  "agent"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Role"
          },
          "deleted": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deleted"
          },
          "is_disabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Disabled"
          },
          "is_locked": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Locked"
          }
        },
        "type": "object",
        "title": "OwnerUserUpdate"
      },
      "PaymentRoutingReq": {
        "properties": {
          "country_routes": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Country Routes"
          },
          "organization_routes": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Organization Routes"
          },
          "region_routes": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Region Routes"
          },
          "environment_routes": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Environment Routes"
          },
          "current_environment": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Current Environment"
          },
          "default_provider": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Default Provider"
          }
        },
        "type": "object",
        "title": "PaymentRoutingReq"
      },
      "ProfileUpdateReq": {
        "properties": {
          "timezone": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64
              },
              {
                "type": "null"
              }
            ],
            "title": "Timezone"
          },
          "name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "avatar_url": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 512
              },
              {
                "type": "null"
              }
            ],
            "title": "Avatar Url"
          },
          "working_hours": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WorkingHoursReq"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "title": "ProfileUpdateReq"
      },
      "ProviderSaveReq": {
        "properties": {
          "values": {
            "additionalProperties": true,
            "type": "object",
            "title": "Values"
          },
          "priority": {
            "type": "integer",
            "title": "Priority",
            "default": 1
          },
          "enabled": {
            "type": "boolean",
            "title": "Enabled",
            "default": true
          }
        },
        "type": "object",
        "title": "ProviderSaveReq"
      },
      "PurchaseReq": {
        "properties": {
          "country": {
            "type": "string",
            "title": "Country",
            "default": "US"
          },
          "type": {
            "type": "string",
            "enum": [
              "local",
              "toll-free",
              "mobile",
              "national"
            ],
            "title": "Type",
            "default": "local"
          },
          "phone_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Phone Number"
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Label"
          },
          "assign_to": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AssignReq"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "title": "PurchaseReq"
      },
      "QuotaIn": {
        "properties": {
          "bytes_limit": {
            "type": "integer",
            "minimum": 0.0,
            "title": "Bytes Limit",
            "description": "0 = unlimited"
          },
          "alert_threshold_pct": {
            "type": "integer",
            "maximum": 100.0,
            "minimum": 0.0,
            "title": "Alert Threshold Pct",
            "default": 80
          }
        },
        "type": "object",
        "required": [
          "bytes_limit"
        ],
        "title": "QuotaIn"
      },
      "RecipientCreate": {
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "title": "Email"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          }
        },
        "type": "object",
        "required": [
          "email"
        ],
        "title": "RecipientCreate"
      },
      "RefundReq": {
        "properties": {
          "payment_or_charge_id": {
            "type": "string",
            "title": "Payment Or Charge Id"
          },
          "amount_minor": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount Minor"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "duplicate",
                  "fraudulent",
                  "requested_by_customer"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Note"
          }
        },
        "type": "object",
        "required": [
          "payment_or_charge_id"
        ],
        "title": "RefundReq"
      },
      "RegisterReq": {
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "title": "Email"
          },
          "password": {
            "type": "string",
            "minLength": 6,
            "title": "Password"
          },
          "name": {
            "type": "string",
            "maxLength": 80,
            "minLength": 1,
            "title": "Name"
          }
        },
        "type": "object",
        "required": [
          "email",
          "password",
          "name"
        ],
        "title": "RegisterReq"
      },
      "ResetPasswordReq": {
        "properties": {
          "token": {
            "type": "string",
            "minLength": 10,
            "title": "Token"
          },
          "new_password": {
            "type": "string",
            "maxLength": 200,
            "minLength": 8,
            "title": "New Password"
          }
        },
        "type": "object",
        "required": [
          "token",
          "new_password"
        ],
        "title": "ResetPasswordReq"
      },
      "ResolvePaymentReq": {
        "properties": {
          "country": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Country"
          },
          "organization_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Organization Id"
          },
          "region": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Region"
          },
          "environment": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Environment"
          }
        },
        "type": "object",
        "title": "ResolvePaymentReq"
      },
      "RoleBody": {
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "minLength": 2,
            "pattern": "^[a-z0-9_]+$",
            "title": "Id"
          },
          "name": {
            "type": "string",
            "maxLength": 100,
            "minLength": 2,
            "title": "Name"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "permissions": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Permissions"
          }
        },
        "type": "object",
        "required": [
          "id",
          "name",
          "permissions"
        ],
        "title": "RoleBody"
      },
      "RuleCreateReq": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "default": ""
          },
          "severity": {
            "type": "string",
            "title": "Severity"
          },
          "conditions": {
            "items": {
              "$ref": "#/components/schemas/Condition"
            },
            "type": "array",
            "title": "Conditions"
          },
          "logic": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Logic",
            "default": "AND"
          },
          "time_window_minutes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Time Window Minutes",
            "default": 5
          },
          "threshold": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Threshold",
            "default": 1
          },
          "group_by": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Group By"
          },
          "notification_channel_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notification Channel Ids"
          },
          "escalation_policy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Escalation Policy Id"
          },
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Enabled",
            "default": true
          }
        },
        "type": "object",
        "required": [
          "name",
          "severity",
          "conditions"
        ],
        "title": "RuleCreateReq"
      },
      "RulePatchReq": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "severity": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Severity"
          },
          "conditions": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/Condition"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Conditions"
          },
          "logic": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Logic"
          },
          "time_window_minutes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Time Window Minutes"
          },
          "threshold": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Threshold"
          },
          "group_by": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Group By"
          },
          "notification_channel_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notification Channel Ids"
          },
          "escalation_policy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Escalation Policy Id"
          },
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Enabled"
          }
        },
        "type": "object",
        "title": "RulePatchReq"
      },
      "SaveIntegrationReq": {
        "properties": {
          "provider": {
            "type": "string",
            "title": "Provider"
          },
          "values": {
            "additionalProperties": true,
            "type": "object",
            "title": "Values"
          }
        },
        "type": "object",
        "required": [
          "provider",
          "values"
        ],
        "title": "SaveIntegrationReq"
      },
      "ScheduleUpdate": {
        "properties": {
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Enabled"
          },
          "timezone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Timezone",
            "description": "IANA tz e.g. America/Los_Angeles"
          },
          "day_of_week": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 6.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Day Of Week",
            "description": "0=Mon..6=Sun"
          },
          "hour": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 23.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Hour"
          }
        },
        "type": "object",
        "title": "ScheduleUpdate"
      },
      "SearchReq": {
        "properties": {
          "sources": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sources"
          },
          "action_prefix": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Action Prefix"
          },
          "actor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor"
          },
          "target_search": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Search"
          },
          "result": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Result"
          },
          "ip": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ip"
          },
          "organization_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Organization Id"
          },
          "date_from": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Date From"
          },
          "date_to": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Date To"
          },
          "free_text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Free Text"
          },
          "limit": {
            "type": "integer",
            "title": "Limit",
            "default": 100
          },
          "skip": {
            "type": "integer",
            "title": "Skip",
            "default": 0
          }
        },
        "type": "object",
        "title": "SearchReq"
      },
      "SeatAssignUserIn": {
        "properties": {
          "username": {
            "type": "string",
            "maxLength": 80,
            "minLength": 2,
            "title": "Username"
          },
          "password": {
            "type": "string",
            "maxLength": 200,
            "minLength": 6,
            "title": "Password"
          },
          "email": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 320
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "display_name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ],
            "title": "Display Name"
          }
        },
        "type": "object",
        "required": [
          "username",
          "password"
        ],
        "title": "SeatAssignUserIn"
      },
      "SeatAssignUserOut": {
        "properties": {
          "ok": {
            "type": "boolean",
            "title": "Ok"
          },
          "seat_id": {
            "type": "string",
            "title": "Seat Id"
          },
          "user_id": {
            "type": "string",
            "title": "User Id"
          },
          "lifecycle_state": {
            "type": "string",
            "title": "Lifecycle State"
          }
        },
        "type": "object",
        "required": [
          "ok",
          "seat_id",
          "user_id",
          "lifecycle_state"
        ],
        "title": "SeatAssignUserOut"
      },
      "SeatBindNumberIn": {
        "properties": {
          "phone_e164": {
            "type": "string",
            "maxLength": 20,
            "minLength": 8,
            "title": "Phone E164"
          },
          "country": {
            "type": "string",
            "maxLength": 2,
            "minLength": 2,
            "title": "Country"
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Label"
          }
        },
        "type": "object",
        "required": [
          "phone_e164",
          "country"
        ],
        "title": "SeatBindNumberIn"
      },
      "SeatBindNumberOut": {
        "properties": {
          "ok": {
            "type": "boolean",
            "title": "Ok"
          },
          "seat_id": {
            "type": "string",
            "title": "Seat Id"
          },
          "phone_e164": {
            "type": "string",
            "title": "Phone E164"
          },
          "lifecycle_state": {
            "type": "string",
            "title": "Lifecycle State"
          }
        },
        "type": "object",
        "required": [
          "ok",
          "seat_id",
          "phone_e164",
          "lifecycle_state"
        ],
        "title": "SeatBindNumberOut"
      },
      "SeatSummary": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "seat_number": {
            "type": "integer",
            "title": "Seat Number"
          },
          "lifecycle_state": {
            "type": "string",
            "title": "Lifecycle State"
          },
          "phone_e164": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Phone E164"
          },
          "assign_target_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Assign Target Id"
          },
          "assigned_username": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Assigned Username"
          }
        },
        "type": "object",
        "required": [
          "id",
          "seat_number",
          "lifecycle_state"
        ],
        "title": "SeatSummary"
      },
      "SeatsListOut": {
        "properties": {
          "ok": {
            "type": "boolean",
            "title": "Ok"
          },
          "seats": {
            "items": {
              "$ref": "#/components/schemas/SeatSummary"
            },
            "type": "array",
            "title": "Seats"
          }
        },
        "type": "object",
        "required": [
          "ok",
          "seats"
        ],
        "title": "SeatsListOut"
      },
      "SeatsUpdateReq": {
        "properties": {
          "seats_total": {
            "type": "integer",
            "maximum": 10000.0,
            "minimum": 1.0,
            "title": "Seats Total",
            "description": "New total seat count for the org (>=1, <=10000)."
          }
        },
        "type": "object",
        "required": [
          "seats_total"
        ],
        "title": "SeatsUpdateReq"
      },
      "ServiceTestReq": {
        "properties": {
          "to": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "To"
          }
        },
        "type": "object",
        "title": "ServiceTestReq"
      },
      "SetCurrentStepReq": {
        "properties": {
          "step_id": {
            "type": "string",
            "title": "Step Id"
          }
        },
        "type": "object",
        "required": [
          "step_id"
        ],
        "title": "SetCurrentStepReq"
      },
      "SetNoteReq": {
        "properties": {
          "step_id": {
            "type": "string",
            "title": "Step Id"
          },
          "note": {
            "type": "string",
            "title": "Note"
          }
        },
        "type": "object",
        "required": [
          "step_id",
          "note"
        ],
        "title": "SetNoteReq"
      },
      "SetOrderReq": {
        "properties": {
          "provider_order": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "minItems": 1,
            "title": "Provider Order"
          }
        },
        "type": "object",
        "required": [
          "provider_order"
        ],
        "title": "SetOrderReq"
      },
      "SmsCreate": {
        "properties": {
          "to_number": {
            "type": "string",
            "title": "To Number"
          },
          "from_number_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "From Number Id"
          },
          "body": {
            "type": "string",
            "title": "Body"
          },
          "contact_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contact Id"
          }
        },
        "type": "object",
        "required": [
          "to_number",
          "body"
        ],
        "title": "SmsCreate",
        "examples": [
          {
            "body": "Hi Hana, our 3pm meeting moved to 3:30 \u2014 see you then!",
            "contact_id": "ct_abc",
            "to_number": "+13072402137"
          }
        ]
      },
      "StaffUpdateBody": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "roles": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Roles"
          },
          "custom_permissions": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Custom Permissions"
          }
        },
        "type": "object",
        "title": "StaffUpdateBody"
      },
      "StorageConfigIn": {
        "properties": {
          "provider": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Provider",
            "description": "\"s3\" | \"r2\" | \"b2\" | \"wasabi\" | \"minio\" | \"emergent\""
          },
          "bucket": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bucket"
          },
          "region": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Region"
          },
          "endpoint_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Endpoint Url"
          },
          "access_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Access Key"
          },
          "secret_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Secret Key"
          },
          "sse": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sse"
          },
          "presign_expiry": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 3600.0,
                "minimum": 30.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Presign Expiry"
          },
          "migrate_twilio": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Migrate Twilio"
          },
          "versioning_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Versioning Enabled"
          },
          "retention_days": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 3650.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Retention Days"
          },
          "lifecycle_archive_days": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 3650.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Lifecycle Archive Days"
          },
          "lifecycle_delete_days": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 3650.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Lifecycle Delete Days"
          },
          "secondary": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Secondary"
          }
        },
        "type": "object",
        "title": "StorageConfigIn"
      },
      "SupportChatReq": {
        "properties": {
          "session_id": {
            "type": "string",
            "title": "Session Id"
          },
          "message": {
            "type": "string",
            "maxLength": 2000,
            "title": "Message"
          }
        },
        "type": "object",
        "required": [
          "session_id",
          "message"
        ],
        "title": "SupportChatReq"
      },
      "TaskCreate": {
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 300,
            "minLength": 1,
            "title": "Title"
          },
          "priority": {
            "type": "string",
            "enum": [
              "low",
              "med",
              "high"
            ],
            "title": "Priority",
            "default": "med"
          },
          "due_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Due At"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Tags"
          }
        },
        "type": "object",
        "required": [
          "title"
        ],
        "title": "TaskCreate"
      },
      "TaskUpdate": {
        "properties": {
          "title": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 300,
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          },
          "completed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed"
          },
          "priority": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "low",
                  "med",
                  "high"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Priority"
          },
          "due_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Due At"
          },
          "tags": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tags"
          },
          "archived": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Archived"
          },
          "order_index": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Order Index"
          }
        },
        "type": "object",
        "title": "TaskUpdate"
      },
      "TaxIdIn": {
        "properties": {
          "type": {
            "type": "string",
            "title": "Type"
          },
          "value": {
            "type": "string",
            "title": "Value"
          }
        },
        "type": "object",
        "required": [
          "type",
          "value"
        ],
        "title": "TaxIdIn"
      },
      "TeamGroupCreate": {
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 80,
            "minLength": 1,
            "title": "Name"
          },
          "member_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Member Ids"
          }
        },
        "type": "object",
        "required": [
          "name"
        ],
        "title": "TeamGroupCreate"
      },
      "TeamGroupUpdate": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 80,
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "member_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Member Ids"
          }
        },
        "type": "object",
        "title": "TeamGroupUpdate"
      },
      "TeamMemberCreate": {
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 80,
            "minLength": 1,
            "title": "Name"
          },
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "supervisor",
              "quality",
              "agent"
            ],
            "title": "Role",
            "default": "agent"
          },
          "password": {
            "type": "string",
            "minLength": 6,
            "title": "Password"
          }
        },
        "type": "object",
        "required": [
          "name",
          "password"
        ],
        "title": "TeamMemberCreate",
        "examples": [
          {
            "name": "Leo Martinez",
            "password": "starting-pass-9X3",
            "role": "agent"
          }
        ]
      },
      "TeamMsgReq": {
        "properties": {
          "to_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "To User Id"
          },
          "group_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Group Id"
          },
          "body": {
            "type": "string",
            "maxLength": 2000,
            "minLength": 0,
            "title": "Body"
          },
          "reply_to": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reply To"
          },
          "attachments": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Attachments"
          },
          "priority": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "low",
                  "medium",
                  "high"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Priority"
          },
          "call_room_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Call Room Id"
          }
        },
        "type": "object",
        "required": [
          "body"
        ],
        "title": "TeamMsgReq",
        "examples": [
          {
            "body": "Heads up \u2014 Aiko called back, can you take over?",
            "priority": "high",
            "to_user_id": "u_leo"
          },
          {
            "body": "\ud83d\udcc8 Hit our weekly target. Drinks on me!",
            "group_id": "g_sales"
          }
        ]
      },
      "TestIntegrationReq": {
        "properties": {
          "provider": {
            "type": "string",
            "title": "Provider"
          },
          "values": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Values"
          }
        },
        "type": "object",
        "required": [
          "provider"
        ],
        "title": "TestIntegrationReq"
      },
      "TestReq": {
        "properties": {
          "values": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Values"
          }
        },
        "type": "object",
        "title": "TestReq"
      },
      "ThrottleBucketLimits": {
        "properties": {
          "minute": {
            "type": "integer",
            "maximum": 100000.0,
            "minimum": 0.0,
            "title": "Minute"
          },
          "hour": {
            "type": "integer",
            "maximum": 1000000.0,
            "minimum": 0.0,
            "title": "Hour"
          },
          "day": {
            "type": "integer",
            "maximum": 10000000.0,
            "minimum": 0.0,
            "title": "Day"
          }
        },
        "type": "object",
        "required": [
          "minute",
          "hour",
          "day"
        ],
        "title": "ThrottleBucketLimits"
      },
      "ThrottleOverrideBody": {
        "properties": {
          "outbound_sms": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ThrottleBucketLimits"
              },
              {
                "type": "null"
              }
            ]
          },
          "outbound_call": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ThrottleBucketLimits"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "title": "ThrottleOverrideBody"
      },
      "TransferReq": {
        "properties": {
          "call_sid": {
            "type": "string",
            "title": "Call Sid"
          },
          "target": {
            "type": "string",
            "title": "Target"
          },
          "mode": {
            "type": "string",
            "enum": [
              "cold",
              "warm"
            ],
            "title": "Mode",
            "default": "cold"
          }
        },
        "type": "object",
        "required": [
          "call_sid",
          "target"
        ],
        "title": "TransferReq",
        "examples": [
          {
            "call_sid": "CAxxxx",
            "mode": "cold",
            "target": "+13072402137"
          }
        ]
      },
      "TranslateReq": {
        "properties": {
          "target": {
            "type": "string",
            "maxLength": 10,
            "minLength": 2,
            "title": "Target"
          }
        },
        "type": "object",
        "required": [
          "target"
        ],
        "title": "TranslateReq"
      },
      "UpgradeBusinessReq": {
        "properties": {
          "org_name": {
            "type": "string",
            "maxLength": 120,
            "minLength": 1,
            "title": "Org Name"
          }
        },
        "type": "object",
        "required": [
          "org_name"
        ],
        "title": "UpgradeBusinessReq",
        "description": "Convert a solo (individual) workspace into a business one."
      },
      "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"
      },
      "VerifyCallerReq": {
        "properties": {
          "phone_number": {
            "type": "string",
            "title": "Phone Number"
          },
          "friendly_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Friendly Name"
          }
        },
        "type": "object",
        "required": [
          "phone_number"
        ],
        "title": "VerifyCallerReq"
      },
      "WaitlistEntry": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "email": {
            "type": "string",
            "title": "Email"
          },
          "platform": {
            "type": "string",
            "title": "Platform"
          },
          "ip": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ip"
          },
          "user_agent": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Agent"
          },
          "created_at": {
            "type": "string",
            "title": "Created At"
          },
          "notified_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notified At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "email",
          "platform",
          "created_at"
        ],
        "title": "WaitlistEntry"
      },
      "WaitlistListOut": {
        "properties": {
          "total": {
            "type": "integer",
            "title": "Total"
          },
          "by_platform": {
            "additionalProperties": true,
            "type": "object",
            "title": "By Platform"
          },
          "rows": {
            "items": {
              "$ref": "#/components/schemas/WaitlistEntry"
            },
            "type": "array",
            "title": "Rows"
          }
        },
        "type": "object",
        "required": [
          "total",
          "by_platform",
          "rows"
        ],
        "title": "WaitlistListOut"
      },
      "WebhookIn": {
        "properties": {
          "url": {
            "type": "string",
            "title": "Url"
          },
          "events": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "minItems": 1,
            "title": "Events"
          },
          "enabled": {
            "type": "boolean",
            "title": "Enabled",
            "default": true
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          }
        },
        "type": "object",
        "required": [
          "url",
          "events"
        ],
        "title": "WebhookIn"
      },
      "WebhookPatch": {
        "properties": {
          "url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Url"
          },
          "events": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Events"
          },
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Enabled"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          }
        },
        "type": "object",
        "title": "WebhookPatch"
      },
      "WorkingHoursReq": {
        "properties": {
          "start": {
            "type": "string",
            "title": "Start",
            "description": "HH:MM 24h, viewer's local TZ.",
            "default": "09:00"
          },
          "end": {
            "type": "string",
            "title": "End",
            "description": "HH:MM 24h, viewer's local TZ.",
            "default": "18:00"
          },
          "days": {
            "items": {
              "type": "integer"
            },
            "type": "array",
            "title": "Days",
            "description": "Working weekdays (Mon=1 \u2026 Sun=7)."
          }
        },
        "type": "object",
        "title": "WorkingHoursReq"
      },
      "models__schemas__ReactReq": {
        "properties": {
          "emoji": {
            "type": "string",
            "title": "Emoji"
          }
        },
        "type": "object",
        "required": [
          "emoji"
        ],
        "title": "ReactReq"
      },
      "routes__coaching__ReactReq": {
        "properties": {
          "type": {
            "type": "string",
            "title": "Type"
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Note"
          }
        },
        "type": "object",
        "required": [
          "type"
        ],
        "title": "ReactReq"
      },
      "routes__coaching__StartSessionReq": {
        "properties": {
          "call_id": {
            "type": "string",
            "title": "Call Id"
          },
          "mode": {
            "type": "string",
            "enum": [
              "listen",
              "whisper",
              "barge"
            ],
            "title": "Mode",
            "default": "listen"
          }
        },
        "type": "object",
        "required": [
          "call_id"
        ],
        "title": "StartSessionReq"
      },
      "routes__identity__StartSessionReq": {
        "properties": {
          "plan_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Plan Key"
          },
          "role": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "individual",
                  "business_owner",
                  "business_seat"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Role"
          }
        },
        "type": "object",
        "title": "StartSessionReq"
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Paste the `access_token` returned by `POST /api/auth/login`."
      },
      "cookieAuth": {
        "type": "apiKey",
        "in": "cookie",
        "name": "access_token",
        "description": "HttpOnly cookie set automatically by `POST /api/auth/login` on same-site requests."
      }
    }
  },
  "tags": [
    {
      "name": "Auth",
      "description": "Login, logout, token refresh, current-user lookup. Brute-force lockout after 5 failed attempts."
    },
    {
      "name": "Business",
      "description": "Self-serve signup with KYC, solo\u2192business upgrade, Twilio account configuration, and IVR flow CRUD."
    },
    {
      "name": "Users",
      "description": "Team management \u2014 list teammates, invite new agents/supervisors (admin only)."
    },
    {
      "name": "Contacts",
      "description": "Address-book CRUD plus per-contact call history."
    },
    {
      "name": "Messages",
      "description": "Customer SMS \u2014 send/list outbound, receive inbound via Twilio webhook."
    },
    {
      "name": "Team Chat",
      "description": "Internal direct messages + group threads, reactions, pins, edit/delete/recall, attachments, blocks, forward, and LLM-powered translation."
    },
    {
      "name": "Calls",
      "description": "Outbound/inbound call records, recordings, and the Twilio voice TwiML webhooks (transfer & conference)."
    },
    {
      "name": "Voicemail",
      "description": "Voicemail capture & Whisper transcription. (P1 backlog \u2014 placeholder router.)"
    },
    {
      "name": "Numbers",
      "description": "Virtual numbers \u2014 demo provisioning + real Twilio number purchase."
    },
    {
      "name": "Admin",
      "description": "Platform-owner console \u2014 list/approve/suspend/delete tenant organizations and view revenue stats."
    },
    {
      "name": "Analytics",
      "description": "Call analytics \u2014 org-wide overview, per-agent leaderboard."
    },
    {
      "name": "Billing",
      "description": "Subscription billing. (P2 backlog \u2014 real Stripe migration pending.)"
    },
    {
      "name": "Notifications",
      "description": "Unread counters, mute toggles, mark-read endpoints across SMS and Team Chat."
    },
    {
      "name": "AI",
      "description": "AI features \u2014 Vox support chatbot (Claude Sonnet 4.5)."
    },
    {
      "name": "Meetings",
      "description": "Internal scheduled meetings + ad-hoc group calls (peer-to-peer WebRTC \u2014 no Twilio cost)."
    },
    {
      "name": "Developer Portal",
      "description": "Public downloads \u2014 Postman collection, official Python + TypeScript SDKs, and the OpenAPI mirror."
    },
    {
      "name": "Realtime",
      "description": "WebSocket signaling for WebRTC peer connections \u2014 `/api/rtc/ws`."
    }
  ],
  "security": [
    {
      "bearerAuth": []
    },
    {
      "cookieAuth": []
    }
  ]
}