openapi: 3.1.0
info:
  title: Expedify API
  description: 'REST API for Expedify CRM & Marketing Automation Platform.


    ## Authentication

    All API requests require authentication using an API key or JWT token.

    Include your API key in the X-API-Key header or use Bearer token authentication.


    ## Base URL

    - Production: https://api.expedify.ai

    - Staging: https://staging-api.expedify.ai


    ## Support

    - Email: support@expedify.ai

    - Documentation: https://docs.expedify.ai

    '
  version: 1.0.0
  contact:
    name: Expedify Support
    email: support@expedify.ai
    url: https://docs.expedify.ai
paths:
  /test-logging:
    get:
      summary: Test Logging
      operationId: test_logging_test_logging_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /.well-known/assetlinks.json:
    get:
      summary: Get Assetlinks
      description: Serve Android App Links verification file for OAuth deep linking
      operationId: get_assetlinks__well_known_assetlinks_json_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /login/:
    get:
      tags:
      - Login
      summary: Login Page
      description: Serve the login page
      operationId: login_page_login__get
      responses:
        '200':
          description: Successful Response
          content:
            text/html:
              schema:
                type: string
  /login/authenticate:
    post:
      tags:
      - Login
      summary: Login
      description: Authenticate user with email and password
      operationId: login_login_authenticate_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoginRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /login/check-auth:
    get:
      tags:
      - Login
      summary: Check Auth
      description: Check if the user is authenticated
      operationId: check_auth_login_check_auth_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /login/logout:
    get:
      tags:
      - Login
      summary: Logout
      description: Clear the session and logout
      operationId: logout_login_logout_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /login/databases:
    get:
      tags:
      - Login
      summary: Get User Databases Endpoint
      description: API endpoint to get the databases a user has access to
      operationId: get_user_databases_endpoint_login_databases_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /login/get-api-token:
    post:
      tags:
      - Login
      summary: Get Api Token
      description: 'Get session token for API usage (for testing/development)


        This endpoint returns the session token in the response body

        for easier use with Postman and API testing tools.


        SECURITY NOTE: This endpoint should be disabled in production

        or restricted to development environments only.'
      operationId: get_api_token_login_get_api_token_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoginRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/signup:
    post:
      tags:
      - Authentication
      - authentication
      summary: Signup
      description: Create a new user account with organization
      operationId: signup_auth_signup_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SignupRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SignupResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/check-email:
    get:
      tags:
      - Authentication
      - authentication
      summary: Check Email Availability
      description: Check if an email is already registered
      operationId: check_email_availability_auth_check_email_get
      parameters:
      - name: email
        in: query
        required: true
        schema:
          type: string
          format: email
          title: Email
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/provision/status:
    get:
      tags:
      - Authentication
      - authentication
      summary: Check Provision Status
      description: Check database provisioning status
      operationId: check_provision_status_auth_provision_status_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /auth/me:
    get:
      tags:
      - Authentication
      - authentication
      summary: Get Current User
      description: Get current user information
      operationId: get_current_user_auth_me_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /auth/onboarding-complete:
    post:
      tags:
      - Authentication
      - authentication
      summary: Mark Onboarding Complete
      description: Mark the onboarding as complete for the current user
      operationId: mark_onboarding_complete_auth_onboarding_complete_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /auth/validate-session:
    get:
      tags:
      - Authentication
      - authentication
      summary: Validate Session
      description: Validate current session and return session info
      operationId: validate_session_auth_validate_session_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/settings/api-keys:
    post:
      tags:
      - API Key Management
      - API Keys
      summary: Create Api Key
      description: 'Create a new API key for the organization


        The API key will only be shown once in the response.

        Store it securely as it cannot be retrieved again.'
      operationId: create_api_key_api_settings_api_keys_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAPIKeyRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - API Key Management
      - API Keys
      summary: List Api Keys
      description: List all API keys for the organization
      operationId: list_api_keys_api_settings_api_keys_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/settings/api-keys/{key_id}:
    delete:
      tags:
      - API Key Management
      - API Keys
      summary: Revoke Api Key
      description: Revoke an API key
      operationId: revoke_api_key_api_settings_api_keys__key_id__delete
      parameters:
      - name: key_id
        in: path
        required: true
        schema:
          type: string
          title: Key Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /invitations:
    post:
      tags:
      - Team Invitations
      - invitations
      summary: Create Invitation
      description: Create a new invitation to join the organization
      operationId: create_invitation_invitations_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvitationCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Invitation Invitations Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Team Invitations
      - invitations
      summary: List Invitations
      description: List all invitations for the organization
      operationId: list_invitations_invitations_get
      parameters:
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Filter by status: pending, accepted, expired'
          title: Status
        description: 'Filter by status: pending, accepted, expired'
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response List Invitations Invitations Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /invitations/my-invitations:
    get:
      tags:
      - Team Invitations
      - invitations
      summary: Get My Invitations
      description: Get all pending invitations for the current user
      operationId: get_my_invitations_invitations_my_invitations_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get My Invitations Invitations My Invitations Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /invitations/verify/{token}:
    get:
      tags:
      - Team Invitations
      - invitations
      summary: Verify Invitation
      description: Verify an invitation token (public endpoint - no auth required)
      operationId: verify_invitation_invitations_verify__token__get
      parameters:
      - name: token
        in: path
        required: true
        schema:
          type: string
          title: Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Verify Invitation Invitations Verify  Token  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /invitations/accept-existing/{token}:
    post:
      tags:
      - Team Invitations
      - invitations
      summary: Accept Invitation Existing User
      description: Accept an invitation for an existing authenticated user
      operationId: accept_invitation_existing_user_invitations_accept_existing__token__post
      parameters:
      - name: token
        in: path
        required: true
        schema:
          type: string
          title: Token
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Accept Invitation Existing User Invitations Accept
                  Existing  Token  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /invitations/{invitation_id}/accept:
    post:
      tags:
      - Team Invitations
      - invitations
      summary: Accept Invitation By Id
      description: Accept an invitation by ID (for authenticated users viewing their
        invitations list)
      operationId: accept_invitation_by_id_invitations__invitation_id__accept_post
      parameters:
      - name: invitation_id
        in: path
        required: true
        schema:
          type: string
          title: Invitation Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Accept Invitation By Id Invitations  Invitation Id  Accept
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /invitations/accept/{token}:
    post:
      tags:
      - Team Invitations
      - invitations
      summary: Accept Invitation
      description: Accept an invitation and create user account (public endpoint)
      operationId: accept_invitation_invitations_accept__token__post
      parameters:
      - name: token
        in: path
        required: true
        schema:
          type: string
          title: Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvitationAccept'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Accept Invitation Invitations Accept  Token  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /invitations/{invitation_id}:
    delete:
      tags:
      - Team Invitations
      - invitations
      summary: Cancel Invitation
      description: Cancel a pending invitation (actually deletes it)
      operationId: cancel_invitation_invitations__invitation_id__delete
      parameters:
      - name: invitation_id
        in: path
        required: true
        schema:
          type: string
          title: Invitation Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Cancel Invitation Invitations  Invitation Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /invitations/{invitation_id}/resend:
    post:
      tags:
      - Team Invitations
      - invitations
      summary: Resend Invitation
      description: Resend an invitation email
      operationId: resend_invitation_invitations__invitation_id__resend_post
      parameters:
      - name: invitation_id
        in: path
        required: true
        schema:
          type: string
          title: Invitation Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Resend Invitation Invitations  Invitation Id  Resend
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /organizations/my-organizations:
    get:
      tags:
      - Organizations
      - Organizations
      summary: List User Organizations
      description: 'List all organizations the current user belongs to.


        Platform admin (PLATFORM_ADMIN_EMAIL) gets access to ALL organizations.'
      operationId: list_user_organizations_organizations_my_organizations_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response List User Organizations Organizations My Organizations
                  Get
  /organizations/create:
    post:
      tags:
      - Organizations
      - Organizations
      summary: Create Organization
      description: Create a new organization for the logged-in user
      operationId: create_organization_organizations_create_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrganizationCreate'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Create Organization Organizations Create Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /organizations/switch:
    post:
      tags:
      - Organizations
      - Organizations
      summary: Switch Organization
      description: 'Switch to a different organization.


        Platform admin can switch to ANY organization.'
      operationId: switch_organization_organizations_switch_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrganizationSwitch'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Switch Organization Organizations Switch Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /organizations/current:
    get:
      tags:
      - Organizations
      - Organizations
      summary: Get Current Organization
      description: Get current organization details including onboarding status and
        user phone
      operationId: get_current_organization_organizations_current_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Current Organization Organizations Current Get
  /organizations/{org_id}/complete-onboarding:
    put:
      tags:
      - Organizations
      - Organizations
      summary: Complete Organization Onboarding
      description: Complete onboarding for an organization
      operationId: complete_organization_onboarding_organizations__org_id__complete_onboarding_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/OrganizationOnboarding'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Complete Organization Onboarding Organizations  Org
                  Id  Complete Onboarding Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /organizations/check-phone:
    post:
      tags:
      - Organizations
      - Organizations
      summary: Check Phone Availability
      description: Check if a phone number is already registered
      operationId: check_phone_availability_organizations_check_phone_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Phone Data
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Check Phone Availability Organizations Check Phone
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /organizations/{org_id}/update-name:
    put:
      tags:
      - Organizations
      - Organizations
      summary: Update Organization Name
      description: Update organization name (owners only)
      operationId: update_organization_name_organizations__org_id__update_name_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/OrganizationNameUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Organization Name Organizations  Org Id  Update
                  Name Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/verify-email:
    post:
      tags:
      - Email Verification
      summary: Verify Email
      description: Verify user email with token
      operationId: verify_email_auth_verify_email_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VerifyEmailRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/resend-verification:
    post:
      tags:
      - Email Verification
      summary: Resend Verification
      description: Resend verification email
      operationId: resend_verification_auth_resend_verification_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResendVerificationRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/forgot-password:
    post:
      tags:
      - Email Verification
      summary: Forgot Password
      description: Send password reset email
      operationId: forgot_password_auth_forgot_password_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ForgotPasswordRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/setup-password:
    post:
      tags:
      - Email Verification
      summary: Setup Password
      description: 'Send password setup email for OAuth users

        This allows OAuth users (Google/Microsoft) to set a password for email/password
        login'
      operationId: setup_password_auth_setup_password_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ForgotPasswordRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/reset-password:
    post:
      tags:
      - Email Verification
      summary: Reset Password
      description: Reset password with token
      operationId: reset_password_auth_reset_password_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResetPasswordRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/otp/verify:
    post:
      tags:
      - OTP Verification
      - otp
      summary: Verify Otp
      description: Verify OTP code
      operationId: verify_otp_auth_otp_verify_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__auth__otp_routes__VerifyOTPRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/otp/resend:
    post:
      tags:
      - OTP Verification
      - otp
      summary: Resend Otp
      description: Resend OTP to email
      operationId: resend_otp_auth_otp_resend_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResendOTPRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/otp/status:
    post:
      tags:
      - OTP Verification
      - otp
      summary: Get Otp Status
      description: Get OTP status
      operationId: get_otp_status_auth_otp_status_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OTPStatusRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/otp/send-mobile:
    post:
      tags:
      - OTP Verification
      - otp
      summary: Send Mobile Otp
      description: Send OTP to mobile number
      operationId: send_mobile_otp_auth_otp_send_mobile_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMobileOTPRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/otp/verify-mobile:
    post:
      tags:
      - OTP Verification
      - otp
      summary: Verify Mobile Otp
      description: Verify mobile OTP
      operationId: verify_mobile_otp_auth_otp_verify_mobile_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VerifyMobileOTPRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/mobile-session:
    post:
      tags:
      - OAuth
      summary: Create Mobile Session
      description: 'Create session from OAuth access token (mobile apps only)


        This endpoint is used by mobile apps using the OAuth plugin.

        The plugin handles PKCE and returns an access_token directly to the app.

        The app sends the access_token here to create a session.


        Unlike web OAuth, this returns session_token in response body (not cookie).


        Route: /api/mobile-session (mounted with /api prefix in app.py)

        Mobile app should call: /api/mobile-session'
      operationId: create_mobile_session_api_mobile_session_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MobileSessionRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/oauth/debug:
    get:
      tags:
      - OAuth
      summary: Oauth Debug
      description: Debug endpoint to check OAuth configuration
      operationId: oauth_debug_api_oauth_debug_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/oauth/authorize:
    post:
      tags:
      - OAuth
      summary: Oauth Authorize
      description: Initiate OAuth flow
      operationId: oauth_authorize_api_oauth_authorize_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OAuthProviderRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - OAuth
      summary: Oauth Authorize Get
      description: Initiate OAuth flow via GET (for invitation acceptance)
      operationId: oauth_authorize_get_api_oauth_authorize_get
      parameters:
      - name: provider
        in: query
        required: true
        schema:
          type: string
          title: Provider
      - name: invitation_token
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Invitation Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/auth/callback/{provider}:
    get:
      tags:
      - OAuth
      summary: Oauth Callback
      description: Handle OAuth callback
      operationId: oauth_callback_api_auth_callback__provider__get
      parameters:
      - 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'
  /auth/refresh-session:
    post:
      tags:
      - Session Management
      - session
      summary: Refresh Session
      description: Refresh the current session to extend its expiration
      operationId: refresh_session_auth_refresh_session_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /ownership-transfers:
    post:
      tags:
      - Ownership Transfer
      - ownership-transfers
      summary: Initiate Transfer
      description: Initiate an ownership transfer. Owner only.
      operationId: initiate_transfer_ownership_transfers_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InitiateTransferRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Initiate Transfer Ownership Transfers Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /ownership-transfers/pending:
    get:
      tags:
      - Ownership Transfer
      - ownership-transfers
      summary: Get Pending Transfer
      description: Get the pending transfer for this org, if any.
      operationId: get_pending_transfer_ownership_transfers_pending_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                title: Response Get Pending Transfer Ownership Transfers Pending Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /ownership-transfers/{transfer_id}:
    delete:
      tags:
      - Ownership Transfer
      - ownership-transfers
      summary: Cancel Transfer
      description: Cancel a pending transfer. Only the initiator can cancel.
      operationId: cancel_transfer_ownership_transfers__transfer_id__delete
      parameters:
      - name: transfer_id
        in: path
        required: true
        schema:
          type: string
          title: Transfer Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Cancel Transfer Ownership Transfers  Transfer Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /ownership-transfers/verify/{token}:
    get:
      tags:
      - Ownership Transfer
      - ownership-transfers
      summary: Verify Token
      description: Verify a transfer token. Public endpoint, no auth required.
      operationId: verify_token_ownership_transfers_verify__token__get
      parameters:
      - name: token
        in: path
        required: true
        schema:
          type: string
          title: Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Verify Token Ownership Transfers Verify  Token  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /ownership-transfers/accept/{token}:
    post:
      tags:
      - Ownership Transfer
      - ownership-transfers
      summary: Accept Transfer New User
      description: Accept transfer and create a new account. Public endpoint.
      operationId: accept_transfer_new_user_ownership_transfers_accept__token__post
      parameters:
      - name: token
        in: path
        required: true
        schema:
          type: string
          title: Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AcceptTransferNewUserRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Accept Transfer New User Ownership Transfers Accept  Token  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /ownership-transfers/accept-existing/{token}:
    post:
      tags:
      - Ownership Transfer
      - ownership-transfers
      summary: Accept Transfer Existing User
      description: Accept transfer for an authenticated user. Requires auth.
      operationId: accept_transfer_existing_user_ownership_transfers_accept_existing__token__post
      parameters:
      - name: token
        in: path
        required: true
        schema:
          type: string
          title: Token
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Accept Transfer Existing User Ownership Transfers
                  Accept Existing  Token  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/auth/debug/oauth-config:
    get:
      tags:
      - OAuth Debug
      - oauth-debug
      summary: Get Oauth Config
      description: Get current OAuth configuration for debugging
      operationId: get_oauth_config_api_auth_debug_oauth_config_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /organizations/members/:
    get:
      tags:
      - Organization Members
      - Organization Members
      summary: List Organization Members
      description: 'List all members in the organization.

        Available to all authenticated users in the organization.'
      operationId: list_organization_members_organizations_members__get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                items:
                  additionalProperties: true
                  type: object
                type: array
                title: Response List Organization Members Organizations Members  Get
  /organizations/members/stats:
    get:
      tags:
      - Organization Members
      - Organization Members
      summary: Get Member Stats
      description: 'Get member statistics for the organization.

        Available to all authenticated users.'
      operationId: get_member_stats_organizations_members_stats_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Member Stats Organizations Members Stats Get
  /organizations/database-configs:
    get:
      tags:
      - Organization Configurations
      summary: List Database Configs
      description: List all database configurations for the organization (All members)
      operationId: list_database_configs_organizations_database_configs_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
    post:
      tags:
      - Organization Configurations
      summary: Create Database Config
      description: Create organization-wide database configuration (Admin/Owner only)
      operationId: create_database_config_organizations_database_configs_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DatabaseConfigCreate'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /organizations/database-configs/{config_id}:
    get:
      tags:
      - Organization Configurations
      summary: Get Database Config
      description: Get specific database configuration (All members, password only
        for admins)
      operationId: get_database_config_organizations_database_configs__config_id__get
      parameters:
      - name: config_id
        in: path
        required: true
        schema:
          type: string
          title: Config Id
      - name: include_password
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Include Password
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Organization Configurations
      summary: Update Database Config
      description: Update database configuration (Admin/Owner only)
      operationId: update_database_config_organizations_database_configs__config_id__put
      parameters:
      - name: config_id
        in: path
        required: true
        schema:
          type: string
          title: Config Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DatabaseConfigUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Organization Configurations
      summary: Delete Database Config
      description: Delete database configuration (Admin/Owner only)
      operationId: delete_database_config_organizations_database_configs__config_id__delete
      parameters:
      - name: config_id
        in: path
        required: true
        schema:
          type: string
          title: Config Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /organizations/vector-configs:
    get:
      tags:
      - Organization Configurations
      summary: List Vector Configs
      description: List all vector store configurations for the organization (All
        members)
      operationId: list_vector_configs_organizations_vector_configs_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
    post:
      tags:
      - Organization Configurations
      summary: Create Vector Config
      description: Create organization-wide vector store configuration (Admin/Owner
        only)
      operationId: create_vector_config_organizations_vector_configs_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VectorConfigCreate'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /organizations/vector-configs/{config_id}:
    get:
      tags:
      - Organization Configurations
      summary: Get Vector Config
      description: Get specific vector store configuration (All members, password
        only for admins)
      operationId: get_vector_config_organizations_vector_configs__config_id__get
      parameters:
      - name: config_id
        in: path
        required: true
        schema:
          type: string
          title: Config Id
      - name: include_password
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Include Password
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Organization Configurations
      summary: Update Vector Config
      description: Update vector store configuration (Admin/Owner only)
      operationId: update_vector_config_organizations_vector_configs__config_id__put
      parameters:
      - name: config_id
        in: path
        required: true
        schema:
          type: string
          title: Config Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VectorConfigCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Organization Configurations
      summary: Delete Vector Config
      description: Delete vector store configuration (Admin/Owner only)
      operationId: delete_vector_config_organizations_vector_configs__config_id__delete
      parameters:
      - name: config_id
        in: path
        required: true
        schema:
          type: string
          title: Config Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /organizations/available-configs:
    get:
      tags:
      - Organization Configurations
      summary: Get Available Configs
      description: Get all available database and vector store configurations (All
        members)
      operationId: get_available_configs_organizations_available_configs_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /organizations/apply-database-config:
    post:
      tags:
      - Organization Configurations
      summary: Apply Database Config
      description: Apply a database configuration as the active one for the current
        session
      operationId: apply_database_config_organizations_apply_database_config_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApplyConfigRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /organizations/apply-vector-config:
    post:
      tags:
      - Organization Configurations
      summary: Apply Vector Config
      description: Apply a vector store configuration as the active one for the current
        session
      operationId: apply_vector_config_organizations_apply_vector_config_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApplyConfigRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /organizations/current-configs:
    get:
      tags:
      - Organization Configurations
      summary: Get Current Configs
      description: Get the currently applied database and vector store configurations
        from session
      operationId: get_current_configs_organizations_current_configs_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/organization/usage/summary:
    get:
      tags:
      - Organization Usage
      - organization-usage
      summary: Get Usage Summary
      description: Get usage summary for the organization
      operationId: get_usage_summary_api_organization_usage_summary_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          default: 30
          title: Days
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/organization/usage/balance:
    get:
      tags:
      - Organization Usage
      - organization-usage
      summary: Get Current Balance
      description: Get current credit balance and plan information
      operationId: get_current_balance_api_organization_usage_balance_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/organization/usage/detailed-summary:
    get:
      tags:
      - Organization Usage
      - organization-usage
      summary: Get Detailed Usage Summary
      description: Get detailed usage summary with comprehensive analytics
      operationId: get_detailed_usage_summary_api_organization_usage_detailed_summary_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          default: 30
          title: Days
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/organization/crm-config:
    get:
      tags:
      - CRM Configuration
      - Organization
      summary: Get Crm Config
      description: Get CRM module configuration for the organization
      operationId: get_crm_config_api_organization_crm_config_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
    put:
      tags:
      - CRM Configuration
      - Organization
      summary: Update Crm Config
      description: Update CRM module configuration for the organization
      operationId: update_crm_config_api_organization_crm_config_put
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CRMConfig'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/organization/settings/timezone:
    get:
      tags:
      - Organization Settings
      summary: Get Timezone Settings
      description: Get timezone and regional settings for the organization
      operationId: get_timezone_settings_api_organization_settings_timezone_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
    put:
      tags:
      - Organization Settings
      summary: Update Timezone Settings
      description: Update timezone and regional settings (Admin/Owner only)
      operationId: update_timezone_settings_api_organization_settings_timezone_put
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TimezoneSettings'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/organization/settings/{key}:
    get:
      tags:
      - Organization Settings
      summary: Get Setting
      description: Get a specific setting value
      operationId: get_setting_api_organization_settings__key__get
      parameters:
      - name: key
        in: path
        required: true
        schema:
          type: string
          title: Key
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/organization/settings:
    get:
      tags:
      - Organization Settings
      summary: List All Settings
      description: Get all settings for the organization
      operationId: list_all_settings_api_organization_settings_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
    put:
      tags:
      - Organization Settings
      summary: Update Setting
      description: Update a specific setting (Admin/Owner only)
      operationId: update_setting_api_organization_settings_put
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SettingUpdate'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/organization/settings/tracking/performance:
    get:
      tags:
      - Organization Settings
      summary: Get Tracking Performance Settings
      description: "Get tracking performance settings for the organization.\n\nReturns:\n\
        \    async_tracking_enabled: Whether async queue-based tracking is enabled\n\
        \    tracking_disabled: Whether all tracking is disabled for this org"
      operationId: get_tracking_performance_settings_api_organization_settings_tracking_performance_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
    put:
      tags:
      - Organization Settings
      summary: Update Tracking Performance Settings
      description: "Update tracking performance settings (Admin/Owner only).\n\nArgs:\n\
        \    async_tracking_enabled: Enable/disable async queue-based tracking\n \
        \   tracking_disabled: Enable/disable all tracking for this org"
      operationId: update_tracking_performance_settings_api_organization_settings_tracking_performance_put
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TrackingPerformanceSettings'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/organization/round-robin/config:
    get:
      tags:
      - Round Robin Assignment
      - Round Robin
      summary: Get Round Robin Config
      description: Get round robin configuration for entity type
      operationId: get_round_robin_config_api_organization_round_robin_config_get
      parameters:
      - name: entity_type
        in: query
        required: false
        schema:
          type: string
          default: contact
          title: Entity Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Round Robin Assignment
      - Round Robin
      summary: Create Or Update Config
      description: 'Create or update round robin configuration


        Requires: Admin or Owner role'
      operationId: create_or_update_config_api_organization_round_robin_config_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RoundRobinConfigRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/organization/round-robin/next-assignee:
    get:
      tags:
      - Round Robin Assignment
      - Round Robin
      summary: Get Next Assignee
      description: Get next user in round robin rotation (without assigning)
      operationId: get_next_assignee_api_organization_round_robin_next_assignee_get
      parameters:
      - name: entity_type
        in: query
        required: false
        schema:
          type: string
          default: contact
          title: Entity Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/organization/round-robin/assign:
    post:
      tags:
      - Round Robin Assignment
      - Round Robin
      summary: Assign Entity
      description: Manually trigger round robin assignment for an entity
      operationId: assign_entity_api_organization_round_robin_assign_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AssignEntityRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/organization/round-robin/stats:
    get:
      tags:
      - Round Robin Assignment
      - Round Robin
      summary: Get Assignment Stats
      description: Get round robin assignment statistics
      operationId: get_assignment_stats_api_organization_round_robin_stats_get
      parameters:
      - name: entity_type
        in: query
        required: false
        schema:
          type: string
          default: contact
          title: Entity Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/organization/round-robin/history:
    get:
      tags:
      - Round Robin Assignment
      - Round Robin
      summary: Get Assignment History
      description: Get assignment history with optional filters
      operationId: get_assignment_history_api_organization_round_robin_history_get
      parameters:
      - name: entity_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Entity Type
      - name: entity_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Entity Id
      - name: user_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: User Id
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 50
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/organization/round-robin/stage-rules:
    get:
      tags:
      - Round Robin Assignment
      - Round Robin
      summary: Get Stage Rules
      description: Get all stage-based round robin rules
      operationId: get_stage_rules_api_organization_round_robin_stage_rules_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Round Robin Assignment
      - Round Robin
      summary: Create Stage Rule
      description: 'Create a stage-based round robin rule


        Requires: Admin or Owner role'
      operationId: create_stage_rule_api_organization_round_robin_stage_rules_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StageRuleRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/organization/round-robin/stage-rules/{rule_id}:
    get:
      tags:
      - Round Robin Assignment
      - Round Robin
      summary: Get Stage Rule
      description: Get a single stage rule by ID
      operationId: get_stage_rule_api_organization_round_robin_stage_rules__rule_id__get
      parameters:
      - name: rule_id
        in: path
        required: true
        schema:
          type: string
          title: Rule Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Round Robin Assignment
      - Round Robin
      summary: Update Stage Rule
      description: 'Update a stage-based round robin rule


        Requires: Admin or Owner role'
      operationId: update_stage_rule_api_organization_round_robin_stage_rules__rule_id__put
      parameters:
      - name: rule_id
        in: path
        required: true
        schema:
          type: string
          title: Rule Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StageRuleUpdateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Round Robin Assignment
      - Round Robin
      summary: Delete Stage Rule
      description: 'Delete a stage-based round robin rule


        Requires: Admin or Owner role'
      operationId: delete_stage_rule_api_organization_round_robin_stage_rules__rule_id__delete
      parameters:
      - name: rule_id
        in: path
        required: true
        schema:
          type: string
          title: Rule Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/organization/round-robin/stage-rules/{rule_id}/stats:
    get:
      tags:
      - Round Robin Assignment
      - Round Robin
      summary: Get Stage Rule Stats
      description: Get statistics for a specific stage rule
      operationId: get_stage_rule_stats_api_organization_round_robin_stage_rules__rule_id__stats_get
      parameters:
      - name: rule_id
        in: path
        required: true
        schema:
          type: string
          title: Rule Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/refresh-billing-dates:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Refresh Billing Dates
      description: Manually refresh billing dates from Razorpay
      operationId: refresh_billing_dates_api_billing_refresh_billing_dates_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/test-upgrade-calculation:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Test Upgrade Calculation
      description: Test endpoint to verify upgrade proration calculations
      operationId: test_upgrade_calculation_api_billing_test_upgrade_calculation_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/test-upgrade-detection/{plan_id}:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Test Upgrade Detection
      description: Test endpoint to debug upgrade detection
      operationId: test_upgrade_detection_api_billing_test_upgrade_detection__plan_id__get
      parameters:
      - name: plan_id
        in: path
        required: true
        schema:
          type: string
          title: Plan Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/test-all-plans:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Test All Plans
      description: Test endpoint to check all plans in database
      operationId: test_all_plans_api_billing_test_all_plans_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/api/billing/addresses:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      - billing_address
      summary: Get Billing Addresses
      description: 'Get all billing addresses for the current user/organization

        For now, return the single org billing address from master DB'
      operationId: get_billing_addresses_api_billing_api_billing_addresses_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Billing Addresses Api Billing Api Billing Addresses
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Billing & Subscriptions
      - billing
      - billing_address
      summary: Create Billing Address
      description: 'Create or update billing address for organization

        Since org_billing_address allows only one per org, we''ll do UPSERT'
      operationId: create_billing_address_api_billing_api_billing_addresses_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BillingAddressCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Billing Address Api Billing Api Billing Addresses
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/api/billing/addresses/{address_id}:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      - billing_address
      summary: Get Billing Address
      description: 'Get a specific billing address

        Since we only have one per org, return the org address if ID matches'
      operationId: get_billing_address_api_billing_api_billing_addresses__address_id__get
      parameters:
      - name: address_id
        in: path
        required: true
        schema:
          type: string
          title: Address Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Billing Address Api Billing Api Billing Addresses  Address
                  Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Billing & Subscriptions
      - billing
      - billing_address
      summary: Update Billing Address
      description: 'Update an existing billing address

        Since we only have one per org, update the org address'
      operationId: update_billing_address_api_billing_api_billing_addresses__address_id__put
      parameters:
      - name: address_id
        in: path
        required: true
        schema:
          type: string
          title: Address Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BillingAddressUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Billing Address Api Billing Api Billing Addresses  Address
                  Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Billing & Subscriptions
      - billing
      - billing_address
      summary: Delete Billing Address
      description: Delete a billing address - no-op since we only have one per org
      operationId: delete_billing_address_api_billing_api_billing_addresses__address_id__delete
      parameters:
      - name: address_id
        in: path
        required: true
        schema:
          type: string
          title: Address Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Billing Address Api Billing Api Billing Addresses  Address
                  Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/api/billing/addresses/{address_id}/set-default:
    put:
      tags:
      - Billing & Subscriptions
      - billing
      - billing_address
      summary: Set Default Billing Address
      description: Set a billing address as default - no-op since we only have one
        per org
      operationId: set_default_billing_address_api_billing_api_billing_addresses__address_id__set_default_put
      parameters:
      - name: address_id
        in: path
        required: true
        schema:
          type: string
          title: Address Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Set Default Billing Address Api Billing Api Billing
                  Addresses  Address Id  Set Default Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/api/billing/address:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      - billing_address
      summary: Get Billing Address Legacy
      description: 'Get organization billing address (backward compatibility)

        Returns org billing address from master DB'
      operationId: get_billing_address_legacy_api_billing_api_billing_address_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Billing Address Legacy Api Billing Api Billing
                  Address Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Billing & Subscriptions
      - billing
      - billing_address
      summary: Create Billing Address Legacy
      description: Create/update organization billing address (backward compatibility)
      operationId: create_billing_address_legacy_api_billing_api_billing_address_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Address Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Billing Address Legacy Api Billing Api Billing
                  Address Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/health:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Billing Health Check
      description: Health check for billing service
      operationId: billing_health_check_api_billing_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/overview:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Get Billing Overview
      description: Get comprehensive billing overview
      operationId: get_billing_overview_api_billing_overview_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/plans:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Get Billing Plans
      description: Get all available billing plans from master database
      operationId: get_billing_plans_api_billing_plans_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/upgrade-plan-preview:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Preview Plan Upgrade
      description: Preview plan upgrade with proration details
      operationId: preview_plan_upgrade_api_billing_upgrade_plan_preview_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlanChangeRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/create-subscription:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Create Razorpay Subscription
      description: Create a new Razorpay subscription and return subscription_id for
        checkout
      operationId: create_razorpay_subscription_api_billing_create_subscription_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlanChangeRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/subscription-authorized:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Handle Subscription Authorization
      description: Handle subscription authorization from frontend
      operationId: handle_subscription_authorization_api_billing_subscription_authorized_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Request
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/upgrade-subscription:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Upgrade Razorpay Subscription
      description: Upgrade existing subscription using Razorpay API (no popup needed)
      operationId: upgrade_razorpay_subscription_api_billing_upgrade_subscription_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlanChangeRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/downgrade-subscription:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Downgrade Razorpay Subscription
      description: Downgrade existing subscription using Razorpay API (no popup needed)
      operationId: downgrade_razorpay_subscription_api_billing_downgrade_subscription_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlanChangeRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/subscription/cancel:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Cancel Subscription
      description: Cancel current subscription
      operationId: cancel_subscription_api_billing_subscription_cancel_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/change-plan:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Change Billing Plan
      description: Change billing plan - handles upgrades, downgrades, and new subscriptions
      operationId: change_billing_plan_api_billing_change_plan_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlanChangeRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/payment-success:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Handle Payment Success
      description: Handle successful payment confirmation from frontend
      operationId: handle_payment_success_api_billing_payment_success_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Request
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/webhook/subscription:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Handle Subscription Webhook
      description: Handle Razorpay subscription webhook events
      operationId: handle_subscription_webhook_api_billing_webhook_subscription_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Request
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/subscription-status:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Get Subscription Status
      description: Get current subscription status and all details
      operationId: get_subscription_status_api_billing_subscription_status_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/force-activate-subscription:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Force Activate Subscription
      description: Manually activate a subscription (for testing/debugging)
      operationId: force_activate_subscription_api_billing_force_activate_subscription_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Request
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/webhook/razorpay:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Razorpay Webhook
      description: Handle Razorpay webhook notifications
      operationId: razorpay_webhook_api_billing_webhook_razorpay_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/current-plan:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Get Current Plan
      description: Debug endpoint to check current plan from master database
      operationId: get_current_plan_api_billing_current_plan_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/credit-packages:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Get Credit Packages
      description: No predefined packages - use dynamic pricing
      operationId: get_credit_packages_api_billing_credit_packages_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/credit-pricing:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Get Credit Pricing
      description: Get credit pricing information
      operationId: get_credit_pricing_api_billing_credit_pricing_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/purchase-credits:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Purchase Credits
      description: Purchase additional credits - dynamic pricing
      operationId: purchase_credits_api_billing_purchase_credits_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreditPurchaseRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/process-payment-success:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Process Payment Success
      description: Process payment success from frontend
      operationId: process_payment_success_api_billing_process_payment_success_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Request
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/debug/check-credits:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Debug Check Credits
      description: Debug endpoint to check current credits in database
      operationId: debug_check_credits_api_billing_debug_check_credits_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/debug/check-database:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Debug Check Database
      description: Debug endpoint to check database table structure
      operationId: debug_check_database_api_billing_debug_check_database_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/payment-methods:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Get Payment Methods
      description: Get saved payment methods
      operationId: get_payment_methods_api_billing_payment_methods_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/invoices:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Get Invoices
      description: Get billing invoices
      operationId: get_invoices_api_billing_invoices_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/invoices/{invoice_id}/download:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Download Invoice
      description: Download invoice PDF
      operationId: download_invoice_api_billing_invoices__invoice_id__download_get
      parameters:
      - name: invoice_id
        in: path
        required: true
        schema:
          type: string
          title: Invoice Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/gst-details:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Get Gst Details
      description: Get GST details
      operationId: get_gst_details_api_billing_gst_details_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Update Gst Details
      description: Update GST details
      operationId: update_gst_details_api_billing_gst_details_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GSTDetailsRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/auto-purchase:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Update Auto Purchase Settings
      description: Update auto-purchase settings
      operationId: update_auto_purchase_settings_api_billing_auto_purchase_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AutoPurchaseRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/trial/status:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Get Trial Status
      description: Get current trial status for the organization
      operationId: get_trial_status_api_billing_trial_status_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/trial/convert:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Convert Trial To Paid
      description: Convert trial to paid subscription
      operationId: convert_trial_to_paid_api_billing_trial_convert_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlanChangeRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/trial/ending-soon:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Get Trials Ending Soon
      description: Get list of organizations with trials ending soon (admin only)
      operationId: get_trials_ending_soon_api_billing_trial_ending_soon_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/trial/check-expired:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Check Expired Trials
      description: Check and expire any trials that have ended (admin only)
      operationId: check_expired_trials_api_billing_trial_check_expired_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/subscription/current:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Get Current Subscription
      description: Get current subscription details from master database
      operationId: get_current_subscription_api_billing_subscription_current_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/subscription/reactivate:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Reactivate Subscription
      description: Reactivate cancelled subscription
      operationId: reactivate_subscription_api_billing_subscription_reactivate_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/payment-history:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Get Payment History
      description: Get payment history for the organization
      operationId: get_payment_history_api_billing_payment_history_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/test-simple-upgrade:
    post:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Test Simple Upgrade
      description: Test endpoint without any parameters
      operationId: test_simple_upgrade_api_billing_test_simple_upgrade_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/billing/usage/integrations:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Get Integration Usage
      description: Get LLM usage breakdown by integration for the organization
      operationId: get_integration_usage_api_billing_usage_integrations_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          maximum: 365
          minimum: 1
          description: Number of days to analyze
          default: 30
          title: Days
        description: Number of days to analyze
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/usage/costs/trends:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Get Cost Trends
      description: Get daily cost trends for LLM usage
      operationId: get_cost_trends_api_billing_usage_costs_trends_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          maximum: 30
          minimum: 1
          description: Number of days for trends
          default: 7
          title: Days
        description: Number of days for trends
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/usage/real-time:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Get Real Time Usage
      description: Get real-time usage statistics for the organization
      operationId: get_real_time_usage_api_billing_usage_real_time_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/usage/integration/{integration_id}:
    get:
      tags:
      - Billing & Subscriptions
      - billing
      summary: Get Specific Integration Usage
      description: Get detailed usage for a specific integration
      operationId: get_specific_integration_usage_api_billing_usage_integration__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: days
        in: query
        required: false
        schema:
          type: integer
          maximum: 365
          minimum: 1
          description: Number of days to analyze
          default: 30
          title: Days
        description: Number of days to analyze
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/address:
    get:
      tags:
      - Billing Addresses
      - billing_address
      summary: Get Billing Address Legacy
      description: 'Get organization billing address (backward compatibility)

        Returns org billing address from master DB'
      operationId: get_billing_address_legacy_api_billing_address_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Billing Address Legacy Api Billing Address Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Billing Addresses
      - billing_address
      summary: Create Billing Address Legacy
      description: Create/update organization billing address (backward compatibility)
      operationId: create_billing_address_legacy_api_billing_address_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Address Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Billing Address Legacy Api Billing Address
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/addresses:
    get:
      tags:
      - Billing Addresses
      - billing_address
      summary: Get Billing Addresses
      description: 'Get all billing addresses for the current user/organization

        For now, return the single org billing address from master DB'
      operationId: get_billing_addresses_api_billing_addresses_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Billing Addresses Api Billing Addresses Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Billing Addresses
      - billing_address
      summary: Create Billing Address
      description: 'Create or update billing address for organization

        Since org_billing_address allows only one per org, we''ll do UPSERT'
      operationId: create_billing_address_api_billing_addresses_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BillingAddressCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Billing Address Api Billing Addresses Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/addresses/{address_id}:
    get:
      tags:
      - Billing Addresses
      - billing_address
      summary: Get Billing Address
      description: 'Get a specific billing address

        Since we only have one per org, return the org address if ID matches'
      operationId: get_billing_address_api_billing_addresses__address_id__get
      parameters:
      - name: address_id
        in: path
        required: true
        schema:
          type: string
          title: Address Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Billing Address Api Billing Addresses  Address
                  Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Billing Addresses
      - billing_address
      summary: Update Billing Address
      description: 'Update an existing billing address

        Since we only have one per org, update the org address'
      operationId: update_billing_address_api_billing_addresses__address_id__put
      parameters:
      - name: address_id
        in: path
        required: true
        schema:
          type: string
          title: Address Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BillingAddressUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Billing Address Api Billing Addresses  Address
                  Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Billing Addresses
      - billing_address
      summary: Delete Billing Address
      description: Delete a billing address - no-op since we only have one per org
      operationId: delete_billing_address_api_billing_addresses__address_id__delete
      parameters:
      - name: address_id
        in: path
        required: true
        schema:
          type: string
          title: Address Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Billing Address Api Billing Addresses  Address
                  Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/addresses/{address_id}/set-default:
    put:
      tags:
      - Billing Addresses
      - billing_address
      summary: Set Default Billing Address
      description: Set a billing address as default - no-op since we only have one
        per org
      operationId: set_default_billing_address_api_billing_addresses__address_id__set_default_put
      parameters:
      - name: address_id
        in: path
        required: true
        schema:
          type: string
          title: Address Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Set Default Billing Address Api Billing Addresses  Address
                  Id  Set Default Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/invoices/{invoice_id}:
    get:
      tags:
      - Invoices
      - Invoices
      summary: Get Invoice Details
      description: Get detailed invoice information including billing address snapshot
      operationId: get_invoice_details_api_billing_invoices__invoice_id__get
      parameters:
      - name: invoice_id
        in: path
        required: true
        schema:
          type: string
          title: Invoice Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /training/extract-ddl-from-mapping:
    post:
      tags:
      - Training v2
      summary: Extract Ddl From Mapping
      description: 'Extract DDL statements from table mapping configuration.

        This endpoint analyzes the table mapping and generates CREATE TABLE statements.

        Note: This is a pure data transformation that doesn''t need database connections.'
      operationId: extract_ddl_from_mapping_training_extract_ddl_from_mapping_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /training/add-ddl:
    post:
      tags:
      - Training v2
      summary: Add Ddl Endpoint
      description: 'Add DDL statements directly to the training data.

        Supports both integration-based and session-based configuration.'
      operationId: add_ddl_endpoint_training_add_ddl_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /training/add-documentation:
    post:
      tags:
      - Training v2
      summary: Add Documentation Endpoint
      description: Add documentation for a table to the training data.
      operationId: add_documentation_endpoint_training_add_documentation_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /training/add-custom-pairs:
    post:
      tags:
      - Training v2
      summary: Add Custom Pairs Endpoint
      description: Add custom question-SQL pairs for a table.
      operationId: add_custom_pairs_endpoint_training_add_custom_pairs_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /training/get-training-data:
    get:
      tags:
      - Training v2
      summary: Get Training Data Endpoint
      description: 'DEPRECATED: Get all training data with optional filtering.


        Training data is now stored in the Knowledge Base system.

        Use /api/knowledge-base/{kb_id}/documents instead.'
      operationId: get_training_data_endpoint_training_get_training_data_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /training/delete-training-data/{data_id}:
    delete:
      tags:
      - Training v2
      summary: Delete Training Data Endpoint
      description: 'DEPRECATED: Delete a specific training data entry.


        Training data is now stored in the Knowledge Base system.

        Use /api/knowledge-base/{kb_id}/documents/{document_id} DELETE instead.'
      operationId: delete_training_data_endpoint_training_delete_training_data__data_id__delete
      parameters:
      - name: data_id
        in: path
        required: true
        schema:
          type: string
          title: Data Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /training/delete-all-training-data:
    delete:
      tags:
      - Training v2
      summary: Delete All Training Data Endpoint
      description: 'DEPRECATED: Delete all training data.


        Training data is now stored in the Knowledge Base system.

        To clear training data, delete all documents from the Data Model knowledge
        base.'
      operationId: delete_all_training_data_endpoint_training_delete_all_training_data_delete
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /training/search-similar-questions:
    get:
      tags:
      - Training v2
      summary: Search Similar Questions Endpoint
      description: 'DEPRECATED: Search for similar questions in the training data.


        Training data is now stored in the Knowledge Base system.

        Use /api/knowledge-base/{kb_id}/search instead.'
      operationId: search_similar_questions_endpoint_training_search_similar_questions_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /training/get-schemas-tables:
    get:
      tags:
      - Training v2
      summary: Get Schemas And Tables
      description: 'Get all schemas and tables from the database.

        This replaces the legacy db_train get-schemas-tables endpoint.'
      operationId: get_schemas_and_tables_training_get_schemas_tables_get
      parameters:
      - name: db_integration_id
        in: query
        required: true
        schema:
          type: string
          title: Db Integration Id
      - name: vector_integration_id
        in: query
        required: true
        schema:
          type: string
          title: Vector Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /training/table-schema:
    get:
      tags:
      - Training v2
      summary: Get Table Schema
      description: 'Get column information for a specific table.

        This replaces the legacy db_train table-schema endpoint.'
      operationId: get_table_schema_training_table_schema_get
      parameters:
      - name: schema
        in: query
        required: true
        schema:
          type: string
          title: Schema
      - name: table
        in: query
        required: true
        schema:
          type: string
          title: Table
      - name: db_integration_id
        in: query
        required: true
        schema:
          type: string
          title: Db Integration Id
      - name: vector_integration_id
        in: query
        required: true
        schema:
          type: string
          title: Vector Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /training/training-stats:
    get:
      tags:
      - Training v2
      summary: Get Training Stats Endpoint
      description: 'DEPRECATED: Get statistics about the training data.


        Training data is now stored in the Knowledge Base system.

        Use /api/knowledge-base/{kb_id} to get Knowledge Base stats instead.'
      operationId: get_training_stats_endpoint_training_training_stats_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /training/table-mappings:
    get:
      tags:
      - Training v2
      summary: Get Table Mappings
      description: Get all table mappings for the organization
      operationId: get_table_mappings_training_table_mappings_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
    post:
      tags:
      - Training v2
      summary: Create Table Mapping
      description: Create a new table mapping
      operationId: create_table_mapping_training_table_mappings_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /training/table-mappings/{mapping_id}:
    get:
      tags:
      - Training v2
      summary: Get Table Mapping
      description: Get a specific table mapping by ID
      operationId: get_table_mapping_training_table_mappings__mapping_id__get
      parameters:
      - name: mapping_id
        in: path
        required: true
        schema:
          type: string
          title: Mapping Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Training v2
      summary: Update Table Mapping
      description: Update an existing table mapping
      operationId: update_table_mapping_training_table_mappings__mapping_id__put
      parameters:
      - name: mapping_id
        in: path
        required: true
        schema:
          type: string
          title: Mapping Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Training v2
      summary: Delete Table Mapping
      description: Delete a table mapping
      operationId: delete_table_mapping_training_table_mappings__mapping_id__delete
      parameters:
      - name: mapping_id
        in: path
        required: true
        schema:
          type: string
          title: Mapping Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /dashboard/summary:
    get:
      tags:
      - Dashboard
      - dashboard
      summary: Get Dashboard Summary
      description: 'Get pre-computed dashboard summary statistics.


        Periods:

        - today: Stats for current day

        - last_7_days: Stats for the past 7 days

        - last_30_days: Stats for the past 30 days

        - all_time: All-time statistics


        Returns cached data that is refreshed every 15 minutes by Celery.'
      operationId: get_dashboard_summary_dashboard_summary_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          pattern: ^(today|last_7_days|last_30_days|all_time)$
          default: all_time
          title: Period
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /dashboard/refresh:
    post:
      tags:
      - Dashboard
      - dashboard
      summary: Refresh Dashboard Summary
      description: 'Manually trigger a refresh of dashboard statistics.

        If period is specified, only that period is refreshed.

        Otherwise, all periods are refreshed.


        This queues a Celery task for async processing.'
      operationId: refresh_dashboard_summary_dashboard_refresh_post
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            pattern: ^(today|last_7_days|last_30_days|all_time)$
          - type: 'null'
          title: Period
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /dashboard/refresh-sync:
    post:
      tags:
      - Dashboard
      - dashboard
      summary: Refresh Dashboard Summary Sync
      description: 'Synchronously refresh dashboard statistics for a specific period.

        Use this for immediate updates after user action.


        Note: This may be slower than the async endpoint but returns

        the updated data immediately.'
      operationId: refresh_dashboard_summary_sync_dashboard_refresh_sync_post
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          pattern: ^(today|last_7_days|last_30_days|all_time)$
          default: all_time
          title: Period
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /dashboard/layout/:
    get:
      tags:
      - Dashboard Layout
      summary: Get Dashboard Layout
      description: 'Get dashboard widget layout for the current user.

        Returns custom layout if exists, otherwise returns null (frontend uses defaults).'
      operationId: get_dashboard_layout_dashboard_layout__get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Dashboard Layout Dashboard Layout  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Dashboard Layout
      summary: Save Dashboard Layout
      description: Save dashboard widget layout for the current user.
      operationId: save_dashboard_layout_dashboard_layout__put
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DashboardLayoutUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Save Dashboard Layout Dashboard Layout  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /dashboard/layout/reset:
    post:
      tags:
      - Dashboard Layout
      summary: Reset Dashboard Layout
      description: Reset dashboard layout to defaults for the current user.
      operationId: reset_dashboard_layout_dashboard_layout_reset_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Reset Dashboard Layout Dashboard Layout Reset Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts:
    post:
      tags:
      - CRM
      - CRM
      - Contacts
      summary: Create Contact
      description: Create a new contact with enhanced error handling and flexible
        field support
      operationId: create_contact_api_crm_contacts_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Contacts
      summary: List Contacts
      description: List contacts with pagination and filters
      operationId: list_contacts_api_crm_contacts_get
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Limit
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
      - name: company_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Company Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/by-lifecycle-stages:
    get:
      tags:
      - CRM
      - CRM
      - Contacts
      summary: List Contacts By Lifecycle Stages
      description: 'Get contacts grouped by lifecycle stage for kanban view with pagination


        Supports infinite scroll - initially loads first 20 contacts per stage,

        then loads more as user scrolls down in each stage column.

        Also supports search and advanced filters.'
      operationId: list_contacts_by_lifecycle_stages_api_crm_contacts_by_lifecycle_stages_get
      parameters:
      - name: limit_per_stage
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          description: Number of contacts to load per stage
          default: 20
          title: Limit Per Stage
        description: Number of contacts to load per stage
      - name: offset_per_stage
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          description: Pagination offset for each stage
          default: 0
          title: Offset Per Stage
        description: Pagination offset for each stage
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: advanced_filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Advanced Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/check-phone:
    get:
      tags:
      - CRM
      - CRM
      - Contacts
      summary: Check Phone Uniqueness
      description: Check if a phone number is already in use
      operationId: check_phone_uniqueness_api_crm_contacts_check_phone_get
      parameters:
      - name: phone
        in: query
        required: true
        schema:
          type: string
          description: Phone number to check
          title: Phone
        description: Phone number to check
      - name: exclude_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Contact ID to exclude from check
          title: Exclude Id
        description: Contact ID to exclude from check
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/filter-fields:
    get:
      tags:
      - CRM
      - CRM
      - Contacts
      summary: Get Contact Filter Fields
      description: Get all available fields for filtering contacts (standard + custom)
      operationId: get_contact_filter_fields_api_crm_contacts_filter_fields_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/filter:
    post:
      tags:
      - CRM
      - CRM
      - Contacts
      summary: Filter Contacts
      description: Advanced field-based filtering for contacts with cross-entity support
      operationId: filter_contacts_api_crm_contacts_filter_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__crm__contact_routes__FilterRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/{contact_id}:
    get:
      tags:
      - CRM
      - CRM
      - Contacts
      summary: Get Contact
      description: Get a single contact with related data
      operationId: get_contact_api_crm_contacts__contact_id__get
      parameters:
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - CRM
      - CRM
      - Contacts
      summary: Update Contact
      description: Update a contact
      operationId: update_contact_api_crm_contacts__contact_id__put
      parameters:
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Contacts
      summary: Delete Contact
      description: Delete a contact and all its relationships
      operationId: delete_contact_api_crm_contacts__contact_id__delete
      parameters:
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/batch-update:
    post:
      tags:
      - CRM
      - CRM
      - Contacts
      summary: Batch Update Contacts
      description: Batch update multiple contacts with the same changes
      operationId: batch_update_contacts_api_crm_contacts_batch_update_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactBatchUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/{contact_id}/companies:
    get:
      tags:
      - CRM
      - CRM
      - Contacts
      summary: Get Contact Companies
      description: Get all companies associated with a contact
      operationId: get_contact_companies_api_crm_contacts__contact_id__companies_get
      parameters:
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - CRM
      - CRM
      - Contacts
      summary: Add Companies To Contact
      description: Add companies to contact via junction table
      operationId: add_companies_to_contact_api_crm_contacts__contact_id__companies_post
      parameters:
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__crm__contact_routes__CompanyLink'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/{contact_id}/deals:
    get:
      tags:
      - CRM
      - CRM
      - Contacts
      summary: Get Contact Deals
      description: Get all deals associated with a contact
      operationId: get_contact_deals_api_crm_contacts__contact_id__deals_get
      parameters:
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - CRM
      - CRM
      - Contacts
      summary: Add Deals To Contact
      description: Add deals to contact via junction table
      operationId: add_deals_to_contact_api_crm_contacts__contact_id__deals_post
      parameters:
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__crm__contact_routes__DealLink'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/{contact_id}/companies/{company_id}:
    delete:
      tags:
      - CRM
      - CRM
      - Contacts
      summary: Remove Company From Contact
      description: Remove a company from contact via junction table
      operationId: remove_company_from_contact_api_crm_contacts__contact_id__companies__company_id__delete
      parameters:
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: company_id
        in: path
        required: true
        schema:
          type: string
          title: Company Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/{contact_id}/deals/{deal_id}:
    delete:
      tags:
      - CRM
      - CRM
      - Contacts
      summary: Remove Deal From Contact
      description: Remove a deal from contact via junction table
      operationId: remove_deal_from_contact_api_crm_contacts__contact_id__deals__deal_id__delete
      parameters:
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/{contact_id}/events:
    get:
      tags:
      - CRM
      - CRM
      - Contacts
      summary: Get Contact Events
      description: 'Get all tracking events and page views for a contact''s visitor
        sessions.

        Returns combined events from tracking_events and page_views tables.

        Includes matched actions for each event.'
      operationId: get_contact_events_api_crm_contacts__contact_id__events_get
      parameters:
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
      - name: action
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Action
      - name: include_actions
        in: query
        required: false
        schema:
          type: boolean
          description: Include matched actions in response
          default: true
          title: Include Actions
        description: Include matched actions in response
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 200
          default: 50
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          default: 0
          title: Offset
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/{contact_id}/stats:
    get:
      tags:
      - CRM
      - CRM
      - Contacts
      summary: Get Contact Stats
      description: 'Get aggregated stats for a contact.

        Returns deal values, task counts, note counts, activity counts, etc.'
      operationId: get_contact_stats_api_crm_contacts__contact_id__stats_get
      parameters:
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactStatsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/companies:
    post:
      tags:
      - CRM
      - CRM
      - Companies
      summary: Create Company
      description: Create a new company with enhanced error handling and flexible
        field support
      operationId: create_company_api_crm_companies_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompanyCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Companies
      summary: List Companies
      description: List companies with pagination and filters
      operationId: list_companies_api_crm_companies_get
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Limit
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: industry
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Industry
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/companies/filter-fields:
    get:
      tags:
      - CRM
      - CRM
      - Companies
      summary: Get Company Filter Fields
      description: Get all available fields for filtering companies (standard + custom)
      operationId: get_company_filter_fields_api_crm_companies_filter_fields_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/companies/filter:
    post:
      tags:
      - CRM
      - CRM
      - Companies
      summary: Filter Companies
      description: Advanced field-based filtering for companies
      operationId: filter_companies_api_crm_companies_filter_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__crm__company_routes__FilterRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/companies/batch-update:
    post:
      tags:
      - CRM
      - CRM
      - Companies
      summary: Batch Update Companies
      description: Batch update multiple companies with the same changes
      operationId: batch_update_companies_api_crm_companies_batch_update_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompanyBatchUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/companies/{company_id}:
    get:
      tags:
      - CRM
      - CRM
      - Companies
      summary: Get Company
      description: Get a single company with related data
      operationId: get_company_api_crm_companies__company_id__get
      parameters:
      - name: company_id
        in: path
        required: true
        schema:
          type: string
          title: Company Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - CRM
      - CRM
      - Companies
      summary: Update Company
      description: Update a company
      operationId: update_company_api_crm_companies__company_id__put
      parameters:
      - name: company_id
        in: path
        required: true
        schema:
          type: string
          title: Company Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompanyUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Companies
      summary: Delete Company
      description: Delete a company
      operationId: delete_company_api_crm_companies__company_id__delete
      parameters:
      - name: company_id
        in: path
        required: true
        schema:
          type: string
          title: Company Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/companies/{company_id}/contacts:
    get:
      tags:
      - CRM
      - CRM
      - Companies
      summary: Get Company Contacts
      description: Get all contacts associated with a company
      operationId: get_company_contacts_api_crm_companies__company_id__contacts_get
      parameters:
      - name: company_id
        in: path
        required: true
        schema:
          type: string
          title: Company Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - CRM
      - CRM
      - Companies
      summary: Add Contacts To Company
      description: Add contacts to company via junction table
      operationId: add_contacts_to_company_api_crm_companies__company_id__contacts_post
      parameters:
      - name: company_id
        in: path
        required: true
        schema:
          type: string
          title: Company Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactLink'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/companies/{company_id}/deals:
    get:
      tags:
      - CRM
      - CRM
      - Companies
      summary: Get Company Deals
      description: Get all deals associated with a company
      operationId: get_company_deals_api_crm_companies__company_id__deals_get
      parameters:
      - name: company_id
        in: path
        required: true
        schema:
          type: string
          title: Company Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - CRM
      - CRM
      - Companies
      summary: Add Deals To Company
      description: Add deals to company via junction table
      operationId: add_deals_to_company_api_crm_companies__company_id__deals_post
      parameters:
      - name: company_id
        in: path
        required: true
        schema:
          type: string
          title: Company Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__crm__company_routes__DealLink'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/companies/{company_id}/contacts/{contact_id}:
    delete:
      tags:
      - CRM
      - CRM
      - Companies
      summary: Remove Contact From Company
      description: Remove a contact from company via junction table
      operationId: remove_contact_from_company_api_crm_companies__company_id__contacts__contact_id__delete
      parameters:
      - name: company_id
        in: path
        required: true
        schema:
          type: string
          title: Company Id
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/companies/{company_id}/deals/{deal_id}:
    delete:
      tags:
      - CRM
      - CRM
      - Companies
      summary: Remove Deal From Company
      description: Remove a deal from company via junction table
      operationId: remove_deal_from_company_api_crm_companies__company_id__deals__deal_id__delete
      parameters:
      - name: company_id
        in: path
        required: true
        schema:
          type: string
          title: Company Id
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals:
    post:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Create Deal
      description: Create a new deal with enhanced error handling and flexible field
        support
      operationId: create_deal_api_crm_deals_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DealCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Deals
      summary: List Deals
      description: List deals with pagination and filters
      operationId: list_deals_api_crm_deals_get
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Limit
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: stage_name
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Stage Name
      - name: is_won
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Won
      - name: is_lost
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Lost
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/by-stages:
    get:
      tags:
      - CRM
      - CRM
      - Deals
      summary: List Deals By Stages
      description: 'Get deals grouped by stage for pipeline/kanban view with pagination


        Supports infinite scroll - initially loads first 20 deals per stage,

        then loads more as user scrolls down in each stage column.

        Also supports search and advanced filters.'
      operationId: list_deals_by_stages_api_crm_deals_by_stages_get
      parameters:
      - name: limit_per_stage
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          description: Number of deals to load per stage
          default: 20
          title: Limit Per Stage
        description: Number of deals to load per stage
      - name: offset_per_stage
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          description: Pagination offset for each stage
          default: 0
          title: Offset Per Stage
        description: Pagination offset for each stage
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: advanced_filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Advanced Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/filter-fields:
    get:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Get Deal Filter Fields
      description: Get all available fields for filtering deals (standard + custom)
      operationId: get_deal_filter_fields_api_crm_deals_filter_fields_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/filter:
    post:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Filter Deals
      description: Advanced field-based filtering for deals
      operationId: filter_deals_api_crm_deals_filter_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__crm__deal_routes__FilterRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/batch-update:
    post:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Batch Update Deals
      description: Batch update multiple deals with the same changes
      operationId: batch_update_deals_api_crm_deals_batch_update_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DealBatchUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}:
    get:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Get Deal
      description: Get a single deal with related data
      operationId: get_deal_api_crm_deals__deal_id__get
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Update Deal
      description: Update a deal (including stage changes and closing)
      operationId: update_deal_api_crm_deals__deal_id__put
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DealUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Delete Deal
      description: Delete a deal
      operationId: delete_deal_api_crm_deals__deal_id__delete
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/full:
    get:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Get Deal Full
      description: Get a deal with all related data (same as get_deal for compatibility)
      operationId: get_deal_full_api_crm_deals__deal_id__full_get
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/test-renew:
    get:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Test Renew
      description: Test endpoint to verify routing
      operationId: test_renew_api_crm_deals_test_renew_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/crm/deals/{deal_id}/renew:
    post:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Renew Deal
      description: Create a renewal deal from an existing deal
      operationId: renew_deal_api_crm_deals__deal_id__renew_post
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
              - type: object
                additionalProperties: true
              - type: 'null'
              default: {}
              title: Renewal Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/duplicate:
    post:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Duplicate Deal
      description: Duplicate a deal with all its relationships
      operationId: duplicate_deal_api_crm_deals__deal_id__duplicate_post
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
              - type: object
                additionalProperties: true
              - type: 'null'
              default: {}
              title: Duplicate Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/companies:
    post:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Add Company To Deal
      description: Add a company to a deal via junction table
      operationId: add_company_to_deal_api_crm_deals__deal_id__companies_post
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Request
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Get Deal Companies
      description: Get all companies associated with a deal through junction table
      operationId: get_deal_companies_api_crm_deals__deal_id__companies_get
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/companies/{company_id}:
    delete:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Remove Company From Deal
      description: Remove a company from a deal via junction table
      operationId: remove_company_from_deal_api_crm_deals__deal_id__companies__company_id__delete
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: company_id
        in: path
        required: true
        schema:
          type: string
          title: Company Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/contacts:
    post:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Add Contact To Deal
      description: Add a contact to a deal
      operationId: add_contact_to_deal_api_crm_deals__deal_id__contacts_post
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Request
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Get Deal Contacts
      description: Get all contacts associated with a deal through junction table
      operationId: get_deal_contacts_api_crm_deals__deal_id__contacts_get
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/contacts/{contact_id}:
    delete:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Remove Contact From Deal
      description: Remove a contact from a deal via junction table
      operationId: remove_contact_from_deal_api_crm_deals__deal_id__contacts__contact_id__delete
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/contacts/junction:
    post:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Add Contacts To Deal Junction
      description: Add contacts to deal via junction table
      operationId: add_contacts_to_deal_junction_api_crm_deals__deal_id__contacts_junction_post
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactLink'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/contacts/junction/{contact_id}:
    delete:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Remove Contact From Deal Junction
      description: Remove a contact from deal via junction table
      operationId: remove_contact_from_deal_junction_api_crm_deals__deal_id__contacts_junction__contact_id__delete
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/companies/junction:
    post:
      tags:
      - CRM
      - CRM
      - Deals
      summary: Add Companies To Deal Junction
      description: Add companies to deal via junction table
      operationId: add_companies_to_deal_junction_api_crm_deals__deal_id__companies_junction_post
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__crm__deal_routes__CompanyLink'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/notes:
    post:
      tags:
      - CRM
      - CRM
      - Notes
      summary: Create Note
      description: Create a new note with enhanced error handling and flexible field
        support
      operationId: create_note_api_crm_notes_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NoteCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Notes
      summary: List Notes
      description: List notes with pagination and filters
      operationId: list_notes_api_crm_notes_get
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Limit
      - name: entity_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Entity Type
      - name: entity_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Entity Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/notes/{note_id}:
    get:
      tags:
      - CRM
      - CRM
      - Notes
      summary: Get Note
      description: Get a single note
      operationId: get_note_api_crm_notes__note_id__get
      parameters:
      - name: note_id
        in: path
        required: true
        schema:
          type: string
          title: Note Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - CRM
      - CRM
      - Notes
      summary: Update Note
      description: Update a note
      operationId: update_note_api_crm_notes__note_id__put
      parameters:
      - name: note_id
        in: path
        required: true
        schema:
          type: string
          title: Note Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NoteUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Notes
      summary: Delete Note
      description: Delete a note
      operationId: delete_note_api_crm_notes__note_id__delete
      parameters:
      - name: note_id
        in: path
        required: true
        schema:
          type: string
          title: Note Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/notes/{note_id}/attachments:
    post:
      tags:
      - CRM
      - CRM
      - Notes
      summary: Upload Note Attachment
      description: Upload a file attachment to a note
      operationId: upload_note_attachment_api_crm_notes__note_id__attachments_post
      parameters:
      - name: note_id
        in: path
        required: true
        schema:
          type: string
          title: Note Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_note_attachment_api_crm_notes__note_id__attachments_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Notes
      summary: List Note Attachments
      description: List all attachments for a note
      operationId: list_note_attachments_api_crm_notes__note_id__attachments_get
      parameters:
      - name: note_id
        in: path
        required: true
        schema:
          type: string
          title: Note Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/notes/{note_id}/attachments/{file_id}/download:
    get:
      tags:
      - CRM
      - CRM
      - Notes
      summary: Download Note Attachment
      description: Generate secure download URL for note attachment
      operationId: download_note_attachment_api_crm_notes__note_id__attachments__file_id__download_get
      parameters:
      - name: note_id
        in: path
        required: true
        schema:
          type: string
          title: Note Id
      - name: file_id
        in: path
        required: true
        schema:
          type: string
          title: File Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/notes/{note_id}/attachments/{file_id}/serve:
    get:
      tags:
      - CRM
      - CRM
      - Notes
      summary: Serve Note Attachment
      description: Serve local file attachment directly (for preview/download)
      operationId: serve_note_attachment_api_crm_notes__note_id__attachments__file_id__serve_get
      parameters:
      - name: note_id
        in: path
        required: true
        schema:
          type: string
          title: Note Id
      - name: file_id
        in: path
        required: true
        schema:
          type: string
          title: File Id
      - name: sig
        in: query
        required: true
        schema:
          type: string
          description: Signature for verification
          title: Sig
        description: Signature for verification
      - name: exp
        in: query
        required: true
        schema:
          type: integer
          description: Expiry timestamp
          title: Exp
        description: Expiry timestamp
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/notes/{note_id}/attachments/{file_id}:
    delete:
      tags:
      - CRM
      - CRM
      - Notes
      summary: Delete Note Attachment
      description: Delete a file attachment from a note
      operationId: delete_note_attachment_api_crm_notes__note_id__attachments__file_id__delete
      parameters:
      - name: note_id
        in: path
        required: true
        schema:
          type: string
          title: Note Id
      - name: file_id
        in: path
        required: true
        schema:
          type: string
          title: File Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks:
    post:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Create Task
      description: Create a new task with enhanced error handling and flexible field
        support
      operationId: create_task_api_crm_tasks_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: List Tasks
      description: List tasks with pagination, filters, and search
      operationId: list_tasks_api_crm_tasks_get
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Limit
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
      - name: status_not
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Status Not
      - name: status_empty
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Status Empty
      - name: status_not_empty
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Status Not Empty
      - name: priority
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Priority
      - name: priority_not
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Priority Not
      - name: priority_empty
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Priority Empty
      - name: priority_not_empty
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Priority Not Empty
      - name: assigned_to_email
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Assigned To Email
      - name: assigned_to_not
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Assigned To Not
      - name: assigned_to_email_empty
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Assigned To Email Empty
      - name: assigned_to_email_not_empty
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Assigned To Email Not Empty
      - name: entity_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Entity Type
      - name: entity_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Entity Id
      - name: contact_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Contact Id
      - name: company_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Company Id
      - name: deal_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Deal Id
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: due_date_after
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Due Date After
      - name: due_date_before
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Due Date Before
      - name: due_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Due Date
      - name: due_date_not
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Due Date Not
      - name: due_date_empty
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Due Date Empty
      - name: due_date_not_empty
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Due Date Not Empty
      - name: type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Type
      - name: type_not
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Type Not
      - name: type_empty
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Type Empty
      - name: type_not_empty
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Type Not Empty
      - name: title_contains
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Title Contains
      - name: title_empty
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Title Empty
      - name: title_not_empty
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Title Not Empty
      - name: created_at_after
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Created At After
      - name: created_at_before
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Created At Before
      - name: created_at
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Created At
      - name: created_at_not
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Created At Not
      - name: updated_at_after
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Updated At After
      - name: updated_at_before
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Updated At Before
      - name: updated_at
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Updated At
      - name: updated_at_not
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Updated At Not
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/overdue:
    get:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: List Overdue Tasks
      description: List overdue tasks (due_date < now AND status not completed/cancelled)
      operationId: list_overdue_tasks_api_crm_tasks_overdue_get
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/counts:
    get:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Get Task Counts
      description: Get task counts by status in a single query - much faster than
        multiple API calls
      operationId: get_task_counts_api_crm_tasks_counts_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/by-status/{status}/load-more:
    get:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Load More Tasks For Status
      description: Load more tasks for a specific status column in Kanban view
      operationId: load_more_tasks_for_status_api_crm_tasks_by_status__status__load_more_get
      parameters:
      - name: status
        in: path
        required: true
        schema:
          type: string
          title: Status
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          default: 0
          title: Offset
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Limit
      - name: priority
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Priority
      - name: assigned_to_email
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Assigned To Email
      - name: due_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Due Date
      - name: due_date_after
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Due Date After
      - name: due_date_before
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Due Date Before
      - name: due_date_not
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Due Date Not
      - name: due_date_empty
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Due Date Empty
      - name: due_date_not_empty
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Due Date Not Empty
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/by-status:
    get:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: List Tasks By Status
      description: List tasks grouped by status for Kanban view
      operationId: list_tasks_by_status_api_crm_tasks_by_status_get
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Limit
      - name: priority
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Priority
      - name: assigned_to_email
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Assigned To Email
      - name: due_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Due Date
      - name: due_date_after
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Due Date After
      - name: due_date_before
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Due Date Before
      - name: due_date_not
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Due Date Not
      - name: due_date_empty
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Due Date Empty
      - name: due_date_not_empty
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Due Date Not Empty
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/{task_id}:
    get:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Get Task
      description: Get a single task
      operationId: get_task_api_crm_tasks__task_id__get
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Update Task
      description: Update a task
      operationId: update_task_api_crm_tasks__task_id__put
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Delete Task
      description: Delete a task
      operationId: delete_task_api_crm_tasks__task_id__delete
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/{task_id}/complete:
    post:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Complete Task
      description: Mark a task as completed
      operationId: complete_task_api_crm_tasks__task_id__complete_post
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/debug/test-filters:
    get:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Test Task Filters
      description: Debug endpoint to test task filtering
      operationId: test_task_filters_api_crm_tasks_debug_test_filters_get
      parameters:
      - name: contact_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Contact Id
      - name: company_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Company Id
      - name: deal_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/{task_id}/attachments:
    post:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Upload Task Attachment
      description: Upload a file attachment to a task
      operationId: upload_task_attachment_api_crm_tasks__task_id__attachments_post
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_task_attachment_api_crm_tasks__task_id__attachments_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: List Task Attachments
      description: List all attachments for a task
      operationId: list_task_attachments_api_crm_tasks__task_id__attachments_get
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/{task_id}/attachments/{file_id}/download:
    get:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Download Task Attachment
      description: Generate secure download URL for task attachment
      operationId: download_task_attachment_api_crm_tasks__task_id__attachments__file_id__download_get
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: file_id
        in: path
        required: true
        schema:
          type: string
          title: File Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/{task_id}/attachments/{file_id}/serve:
    get:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Serve Task Attachment
      description: Serve local file attachment directly (for preview/download)
      operationId: serve_task_attachment_api_crm_tasks__task_id__attachments__file_id__serve_get
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: file_id
        in: path
        required: true
        schema:
          type: string
          title: File Id
      - name: sig
        in: query
        required: true
        schema:
          type: string
          description: Signature for verification
          title: Sig
        description: Signature for verification
      - name: exp
        in: query
        required: true
        schema:
          type: integer
          description: Expiry timestamp
          title: Exp
        description: Expiry timestamp
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/{task_id}/attachments/{file_id}:
    delete:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Delete Task Attachment
      description: Delete a file attachment from a task
      operationId: delete_task_attachment_api_crm_tasks__task_id__attachments__file_id__delete
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: file_id
        in: path
        required: true
        schema:
          type: string
          title: File Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/{task_id}/subtasks:
    get:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Get Subtasks
      description: Get all subtasks for a parent task
      operationId: get_subtasks_api_crm_tasks__task_id__subtasks_get
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Create Subtask
      description: Create a new subtask under a parent task
      operationId: create_subtask_api_crm_tasks__task_id__subtasks_post
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubtaskCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/{task_id}/subtasks/reorder:
    put:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Reorder Subtasks
      description: Reorder subtasks under a parent task
      operationId: reorder_subtasks_api_crm_tasks__task_id__subtasks_reorder_put
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubtaskReorder'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/{task_id}/with-subtasks:
    get:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Get Task With Subtasks
      description: Get a task with all its subtasks populated
      operationId: get_task_with_subtasks_api_crm_tasks__task_id__with_subtasks_get
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/{task_id}/comments:
    get:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Get Task Comments
      description: Get all comments for a task in threaded format
      operationId: get_task_comments_api_crm_tasks__task_id__comments_get
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Create Task Comment
      description: Create a new comment or reply on a task
      operationId: create_task_comment_api_crm_tasks__task_id__comments_post
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__crm__task_routes__CommentCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/comments/{comment_id}:
    put:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Update Task Comment
      description: Update a comment (only owner can update)
      operationId: update_task_comment_api_crm_tasks_comments__comment_id__put
      parameters:
      - name: comment_id
        in: path
        required: true
        schema:
          type: string
          title: Comment Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__crm__task_routes__CommentUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Delete Task Comment
      description: Delete a comment (only owner can delete)
      operationId: delete_task_comment_api_crm_tasks_comments__comment_id__delete
      parameters:
      - name: comment_id
        in: path
        required: true
        schema:
          type: string
          title: Comment Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/{task_id}/watchers:
    get:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Get Task Watchers
      description: Get all watchers for a task
      operationId: get_task_watchers_api_crm_tasks__task_id__watchers_get
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/{task_id}/watch:
    post:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Watch Task
      description: Add current user (or specified user) as a watcher on this task
      operationId: watch_task_api_crm_tasks__task_id__watch_post
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
              - $ref: '#/components/schemas/WatcherAdd'
              - type: 'null'
              title: Watcher
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Unwatch Task
      description: Remove current user as a watcher from this task
      operationId: unwatch_task_api_crm_tasks__task_id__watch_delete
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/{task_id}/collaborators/{target_email}:
    delete:
      tags:
      - CRM
      - CRM
      - Tasks
      summary: Remove Task Collaborator
      description: Remove a specific collaborator from this task
      operationId: remove_task_collaborator_api_crm_tasks__task_id__collaborators__target_email__delete
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: target_email
        in: path
        required: true
        schema:
          type: string
          title: Target Email
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/voice-calls:
    post:
      tags:
      - CRM
      - CRM
      - Voice Calls
      summary: Create Voice Call
      description: Create a new voice call with enhanced error handling and flexible
        field support
      operationId: create_voice_call_api_crm_voice_calls_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VoiceCallCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Voice Calls
      summary: List Voice Calls
      description: List voice calls with filters
      operationId: list_voice_calls_api_crm_voice_calls_get
      parameters:
      - name: contact_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Contact Id
      - name: call_status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Call Status
      - name: provider
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Provider
      - name: direction
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Direction
      - name: call_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Call Type
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 1000
          minimum: 1
          default: 50
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          default: 0
          title: Offset
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/voice-calls/{call_id}:
    put:
      tags:
      - CRM
      - CRM
      - Voice Calls
      summary: Update Voice Call
      description: Update voice call - EXACTLY like contact update
      operationId: update_voice_call_api_crm_voice_calls__call_id__put
      parameters:
      - name: call_id
        in: path
        required: true
        schema:
          type: string
          title: Call Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VoiceCallUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Voice Calls
      summary: Get Voice Call
      description: Get voice call by ID
      operationId: get_voice_call_api_crm_voice_calls__call_id__get
      parameters:
      - name: call_id
        in: path
        required: true
        schema:
          type: string
          title: Call Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Voice Calls
      summary: Delete Voice Call
      description: Delete voice call
      operationId: delete_voice_call_api_crm_voice_calls__call_id__delete
      parameters:
      - name: call_id
        in: path
        required: true
        schema:
          type: string
          title: Call Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/task-types:
    get:
      tags:
      - CRM
      - CRM
      - Task Types
      summary: Get Task Types
      description: Get all task types for the organization
      operationId: get_task_types_api_crm_task_types_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/TaskType'
                type: array
                title: Response Get Task Types Api Crm Task Types Get
    post:
      tags:
      - CRM
      - CRM
      - Task Types
      summary: Create Task Type
      description: Create a new task type
      operationId: create_task_type_api_crm_task_types_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskTypeCreate'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskType'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/task-types/{task_type_id}:
    put:
      tags:
      - CRM
      - CRM
      - Task Types
      summary: Update Task Type
      description: Update a task type
      operationId: update_task_type_api_crm_task_types__task_type_id__put
      parameters:
      - name: task_type_id
        in: path
        required: true
        schema:
          type: string
          title: Task Type Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskTypeUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskType'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Task Types
      summary: Delete Task Type
      description: Soft delete a task type (mark as inactive)
      operationId: delete_task_type_api_crm_task_types__task_type_id__delete
      parameters:
      - name: task_type_id
        in: path
        required: true
        schema:
          type: string
          title: Task Type Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/task-labels:
    get:
      tags:
      - CRM
      - CRM
      - Task Types
      summary: Get Task Labels
      description: Get all unique task labels used in the organization
      operationId: get_task_labels_api_crm_task_labels_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/crm/stages:
    post:
      tags:
      - CRM
      - CRM
      - Stages
      summary: Create Stage
      description: Create a new stage
      operationId: create_stage_api_crm_stages_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StageCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Stages
      summary: List Stages
      description: List all stages ordered by order_index
      operationId: list_stages_api_crm_stages_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/stages/{stage_id}:
    get:
      tags:
      - CRM
      - CRM
      - Stages
      summary: Get Stage
      description: Get a single stage
      operationId: get_stage_api_crm_stages__stage_id__get
      parameters:
      - name: stage_id
        in: path
        required: true
        schema:
          type: string
          title: Stage Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - CRM
      - CRM
      - Stages
      summary: Update Stage
      description: Update a stage
      operationId: update_stage_api_crm_stages__stage_id__put
      parameters:
      - name: stage_id
        in: path
        required: true
        schema:
          type: string
          title: Stage Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StageUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Stages
      summary: Delete Stage
      description: Delete a stage
      operationId: delete_stage_api_crm_stages__stage_id__delete
      parameters:
      - name: stage_id
        in: path
        required: true
        schema:
          type: string
          title: Stage Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/stages/reorder:
    post:
      tags:
      - CRM
      - CRM
      - Stages
      summary: Reorder Stages
      description: Reorder stages by updating their order_index
      operationId: reorder_stages_api_crm_stages_reorder_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
              title: Stage Ids
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/lifecycle-stages:
    post:
      tags:
      - CRM
      - CRM
      - Lifecycle Stages
      summary: Create Lifecycle Stage
      description: Create a new lifecycle stage
      operationId: create_lifecycle_stage_api_crm_lifecycle_stages_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LifecycleStageCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Lifecycle Stages
      summary: List Lifecycle Stages
      description: List all lifecycle stages ordered by order_index
      operationId: list_lifecycle_stages_api_crm_lifecycle_stages_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/lifecycle-stages/{stage_id}:
    get:
      tags:
      - CRM
      - CRM
      - Lifecycle Stages
      summary: Get Lifecycle Stage
      description: Get a single lifecycle stage
      operationId: get_lifecycle_stage_api_crm_lifecycle_stages__stage_id__get
      parameters:
      - name: stage_id
        in: path
        required: true
        schema:
          type: string
          title: Stage Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - CRM
      - CRM
      - Lifecycle Stages
      summary: Update Lifecycle Stage
      description: Update a lifecycle stage
      operationId: update_lifecycle_stage_api_crm_lifecycle_stages__stage_id__put
      parameters:
      - name: stage_id
        in: path
        required: true
        schema:
          type: string
          title: Stage Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LifecycleStageUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Lifecycle Stages
      summary: Delete Lifecycle Stage
      description: Delete a lifecycle stage
      operationId: delete_lifecycle_stage_api_crm_lifecycle_stages__stage_id__delete
      parameters:
      - name: stage_id
        in: path
        required: true
        schema:
          type: string
          title: Stage Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/lifecycle-stages/reorder:
    post:
      tags:
      - CRM
      - CRM
      - Lifecycle Stages
      summary: Reorder Lifecycle Stages
      description: Reorder lifecycle stages by updating their order_index
      operationId: reorder_lifecycle_stages_api_crm_lifecycle_stages_reorder_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
              title: Stage Ids
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/products:
    post:
      tags:
      - CRM
      - CRM
      - Products
      summary: Create Product
      description: Create a new product/service
      operationId: create_product_api_crm_products_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProductCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Product Api Crm Products Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Products
      summary: List Products
      description: List products with pagination and filters
      operationId: list_products_api_crm_products_get
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 1000
          minimum: 1
          default: 100
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          default: 0
          title: Offset
      - name: q
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Search query
          title: Q
        description: Search query
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by category
          title: Category
        description: Filter by category
      - name: is_service
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          description: Filter by service type
          title: Is Service
        description: Filter by service type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response List Products Api Crm Products Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/products/search:
    get:
      tags:
      - CRM
      - CRM
      - Products
      summary: Search Products
      description: Search products by name or SKU
      operationId: search_products_api_crm_products_search_get
      parameters:
      - name: q
        in: query
        required: true
        schema:
          type: string
          minLength: 1
          description: Search term
          title: Q
        description: Search term
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 50
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
                title: Response Search Products Api Crm Products Search Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/products/categories:
    get:
      tags:
      - CRM
      - CRM
      - Products
      summary: Get Product Categories
      description: Get list of unique product categories
      operationId: get_product_categories_api_crm_products_categories_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
                title: Response Get Product Categories Api Crm Products Categories
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/products/services:
    get:
      tags:
      - CRM
      - CRM
      - Products
      summary: Get Service Products
      description: Get all service-type products (for wellness/beauty businesses)
      operationId: get_service_products_api_crm_products_services_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
                title: Response Get Service Products Api Crm Products Services Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/products/{product_id}:
    get:
      tags:
      - CRM
      - CRM
      - Products
      summary: Get Product
      description: Get a specific product by ID
      operationId: get_product_api_crm_products__product_id__get
      parameters:
      - name: product_id
        in: path
        required: true
        schema:
          type: string
          title: Product Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Product Api Crm Products  Product Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - CRM
      - CRM
      - Products
      summary: Update Product
      description: Update a product
      operationId: update_product_api_crm_products__product_id__put
      parameters:
      - name: product_id
        in: path
        required: true
        schema:
          type: string
          title: Product Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProductUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Product Api Crm Products  Product Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Products
      summary: Delete Product
      description: Soft delete a product (deactivate)
      operationId: delete_product_api_crm_products__product_id__delete
      parameters:
      - name: product_id
        in: path
        required: true
        schema:
          type: string
          title: Product Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/products/bulk-update-prices:
    post:
      tags:
      - CRM
      - CRM
      - Products
      summary: Bulk Update Prices
      description: Bulk update product prices
      operationId: bulk_update_prices_api_crm_products_bulk_update_prices_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/BulkPriceUpdate'
              title: Updates
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Bulk Update Prices Api Crm Products Bulk Update Prices
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/products/bulk-import:
    post:
      tags:
      - CRM
      - CRM
      - Products
      summary: Bulk Import Products
      description: Bulk import products
      operationId: bulk_import_products_api_crm_products_bulk_import_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkImportRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Bulk Import Products Api Crm Products Bulk Import
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/products/by-sku/{sku}:
    get:
      tags:
      - CRM
      - CRM
      - Products
      summary: Get Product By Sku
      description: Get product by SKU
      operationId: get_product_by_sku_api_crm_products_by_sku__sku__get
      parameters:
      - name: sku
        in: path
        required: true
        schema:
          type: string
          title: Sku
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                anyOf:
                - type: object
                  additionalProperties: true
                - type: 'null'
                title: Response Get Product By Sku Api Crm Products By Sku  Sku  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/products/analytics/overview:
    get:
      tags:
      - CRM
      - CRM
      - Product Analytics
      summary: Get Products Overview
      description: Get overview metrics for products
      operationId: get_products_overview_api_crm_products_analytics_overview_get
      parameters:
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: End Date
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Products Overview Api Crm Products Analytics Overview
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/products/analytics/category-distribution:
    get:
      tags:
      - CRM
      - CRM
      - Product Analytics
      summary: Get Category Distribution
      description: Get product distribution by category
      operationId: get_category_distribution_api_crm_products_analytics_category_distribution_get
      parameters:
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: End Date
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Category Distribution Api Crm Products Analytics
                  Category Distribution Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/products/analytics/top-products:
    get:
      tags:
      - CRM
      - CRM
      - Product Analytics
      summary: Get Top Products
      description: Get top performing products by sales
      operationId: get_top_products_api_crm_products_analytics_top_products_get
      parameters:
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: End Date
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Top Products Api Crm Products Analytics Top Products
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/products/analytics/sales-trends:
    get:
      tags:
      - CRM
      - CRM
      - Product Analytics
      summary: Get Sales Trends
      description: Get product sales trends over time
      operationId: get_sales_trends_api_crm_products_analytics_sales_trends_get
      parameters:
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: End Date
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: interval
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: day
          title: Interval
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Sales Trends Api Crm Products Analytics Sales
                  Trends Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/products/analytics/performance-metrics:
    get:
      tags:
      - CRM
      - CRM
      - Product Analytics
      summary: Get Performance Metrics
      description: Get product performance metrics
      operationId: get_performance_metrics_api_crm_products_analytics_performance_metrics_get
      parameters:
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: End Date
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Performance Metrics Api Crm Products Analytics
                  Performance Metrics Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/products/analytics/price-distribution:
    get:
      tags:
      - CRM
      - CRM
      - Product Analytics
      summary: Get Price Distribution
      description: Get product distribution by price ranges
      operationId: get_price_distribution_api_crm_products_analytics_price_distribution_get
      parameters:
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Price Distribution Api Crm Products Analytics
                  Price Distribution Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/products/analytics/assigned-member-performance:
    get:
      tags:
      - CRM
      - CRM
      - Product Analytics
      summary: Get Assigned Member Performance
      description: Get performance metrics by assigned member
      operationId: get_assigned_member_performance_api_crm_products_analytics_assigned_member_performance_get
      parameters:
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: End Date
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Assigned Member Performance Api Crm Products Analytics
                  Assigned Member Performance Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/products/analytics/service-vs-product:
    get:
      tags:
      - CRM
      - CRM
      - Product Analytics
      summary: Get Service Vs Product Distribution
      description: Get distribution of services vs physical products
      operationId: get_service_vs_product_distribution_api_crm_products_analytics_service_vs_product_get
      parameters:
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Service Vs Product Distribution Api Crm Products
                  Analytics Service Vs Product Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/products/analytics/inventory-status:
    get:
      tags:
      - CRM
      - CRM
      - Product Analytics
      summary: Get Inventory Status
      description: Get inventory status summary (placeholder for future inventory
        tracking)
      operationId: get_inventory_status_api_crm_products_analytics_inventory_status_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Inventory Status Api Crm Products Analytics Inventory
                  Status Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/products/analytics/aggregated-table:
    get:
      tags:
      - CRM
      - CRM
      - Product Analytics
      summary: Get Aggregated Analytics Table
      description: Get aggregated product analytics data grouped by a dimension
      operationId: get_aggregated_analytics_table_api_crm_products_analytics_aggregated_table_get
      parameters:
      - name: group_by
        in: query
        required: false
        schema:
          type: string
          description: Dimension to group by
          default: category
          title: Group By
        description: Dimension to group by
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year, all'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year, all'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter configuration JSON
          title: Filters
        description: Filter configuration JSON
      - name: sort_by
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Field to sort by
          title: Sort By
        description: Field to sort by
      - name: sort_direction
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Sort direction: asc or desc'
          default: desc
          title: Sort Direction
        description: 'Sort direction: asc or desc'
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          description: Page number
          default: 1
          title: Page
        description: Page number
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          description: Items per page
          default: 20
          title: Limit
        description: Items per page
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Aggregated Analytics Table Api Crm Products Analytics
                  Aggregated Table Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/payments:
    post:
      tags:
      - CRM
      - CRM
      - Deal Payments
      summary: Record Payment
      description: Record a new payment for a deal
      operationId: record_payment_api_crm_deals__deal_id__payments_post
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Record Payment Api Crm Deals  Deal Id  Payments Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Deal Payments
      summary: Get Deal Payments
      description: Get all payments for a specific deal
      operationId: get_deal_payments_api_crm_deals__deal_id__payments_get
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Deal Payments Api Crm Deals  Deal Id  Payments
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/payments/{payment_id}:
    put:
      tags:
      - CRM
      - CRM
      - Deal Payments
      summary: Update Payment
      description: Update a payment
      operationId: update_payment_api_crm_deals__deal_id__payments__payment_id__put
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: payment_id
        in: path
        required: true
        schema:
          type: string
          title: Payment Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Payment Api Crm Deals  Deal Id  Payments  Payment
                  Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Deal Payments
      summary: Delete Payment
      description: Delete a payment from a deal
      operationId: delete_payment_api_crm_deals__deal_id__payments__payment_id__delete
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: payment_id
        in: path
        required: true
        schema:
          type: string
          title: Payment Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Payment Api Crm Deals  Deal Id  Payments  Payment
                  Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/payments/{payment_id}/receipt:
    post:
      tags:
      - CRM
      - CRM
      - Deal Payments
      summary: Generate Receipt
      description: Generate a receipt for a payment
      operationId: generate_receipt_api_crm_deals__deal_id__payments__payment_id__receipt_post
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: payment_id
        in: path
        required: true
        schema:
          type: string
          title: Payment Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Generate Receipt Api Crm Deals  Deal Id  Payments  Payment
                  Id  Receipt Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/payments/{payment_id}/refund:
    post:
      tags:
      - CRM
      - CRM
      - Deal Payments
      summary: Refund Payment
      description: Process a refund for a payment
      operationId: refund_payment_api_crm_deals__deal_id__payments__payment_id__refund_post
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: payment_id
        in: path
        required: true
        schema:
          type: string
          title: Payment Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RefundRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Refund Payment Api Crm Deals  Deal Id  Payments  Payment
                  Id  Refund Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/payments/{payment_id}/distribution:
    get:
      tags:
      - CRM
      - CRM
      - Deal Payments
      summary: Get Payment Distribution
      description: Get payment distribution details across schedules
      operationId: get_payment_distribution_api_crm_deals__deal_id__payments__payment_id__distribution_get
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: payment_id
        in: path
        required: true
        schema:
          type: string
          title: Payment Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Payment Distribution Api Crm Deals  Deal Id  Payments  Payment
                  Id  Distribution Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/payments/{payment_id}/validate:
    get:
      tags:
      - CRM
      - CRM
      - Deal Payments
      summary: Validate Payment Distribution
      description: Validate payment distribution
      operationId: validate_payment_distribution_api_crm_deals__deal_id__payments__payment_id__validate_get
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: payment_id
        in: path
        required: true
        schema:
          type: string
          title: Payment Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Validate Payment Distribution Api Crm Deals  Deal
                  Id  Payments  Payment Id  Validate Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/payment-schedules:
    get:
      tags:
      - CRM
      - CRM
      - Deal Payments
      summary: Get Deal Payment Schedules
      description: Get all payment schedules for a specific deal
      operationId: get_deal_payment_schedules_api_crm_deals__deal_id__payment_schedules_get
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
                title: Response Get Deal Payment Schedules Api Crm Deals  Deal Id  Payment
                  Schedules Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/payment-schedules/generate:
    post:
      tags:
      - CRM
      - CRM
      - Deal Payments
      summary: Generate Payment Schedules
      description: Generate payment schedules for a deal based on its payment frequency
        settings
      operationId: generate_payment_schedules_api_crm_deals__deal_id__payment_schedules_generate_post
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
                title: Response Generate Payment Schedules Api Crm Deals  Deal Id  Payment
                  Schedules Generate Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/payment-schedules/{schedule_id}/extend-grace:
    put:
      tags:
      - CRM
      - CRM
      - Deal Payments
      summary: Extend Payment Grace Period
      description: Extend grace period for a payment schedule
      operationId: extend_payment_grace_period_api_crm_deals__deal_id__payment_schedules__schedule_id__extend_grace_put
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: schedule_id
        in: path
        required: true
        schema:
          type: string
          title: Schedule Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExtendGracePeriod'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Extend Payment Grace Period Api Crm Deals  Deal Id  Payment
                  Schedules  Schedule Id  Extend Grace Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/payment-schedules/upcoming:
    get:
      tags:
      - CRM
      - CRM
      - Deal Payments
      summary: Get Upcoming Payment Schedules
      description: Get upcoming payment schedules within specified days for the organization
      operationId: get_upcoming_payment_schedules_api_crm_deals_payment_schedules_upcoming_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          description: Number of days to look ahead
          default: 30
          title: Days
        description: Number of days to look ahead
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
                title: Response Get Upcoming Payment Schedules Api Crm Deals Payment
                  Schedules Upcoming Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/payment-schedules/overdue:
    get:
      tags:
      - CRM
      - CRM
      - Deal Payments
      summary: Get Overdue Payment Schedules
      description: Get all overdue payment schedules for the organization
      operationId: get_overdue_payment_schedules_api_crm_deals_payment_schedules_overdue_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
                title: Response Get Overdue Payment Schedules Api Crm Deals Payment
                  Schedules Overdue Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/payment-schedules/update-overdue:
    post:
      tags:
      - CRM
      - CRM
      - Deal Payments
      summary: Update Overdue Statuses
      description: Update all overdue payment schedules for the organization
      operationId: update_overdue_statuses_api_crm_deals_payment_schedules_update_overdue_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Overdue Statuses Api Crm Deals Payment Schedules
                  Update Overdue Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/payments/:
    get:
      tags:
      - CRM
      - CRM
      - Payment List
      summary: List All Payments
      description: List all payments across all deals with filters
      operationId: list_all_payments_api_crm_payments__get
      parameters:
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
      - name: payment_method
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Payment Method
      - 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: min_amount
        in: query
        required: false
        schema:
          anyOf:
          - type: number
          - type: 'null'
          title: Min Amount
      - name: max_amount
        in: query
        required: false
        schema:
          anyOf:
          - type: number
          - type: 'null'
          title: Max Amount
      - name: sort_by
        in: query
        required: false
        schema:
          type: string
          default: date
          title: Sort By
      - name: sort_order
        in: query
        required: false
        schema:
          type: string
          default: desc
          title: Sort Order
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 50
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/payments/export:
    get:
      tags:
      - CRM
      - CRM
      - Payment List
      summary: Export Payments
      description: Export payments to CSV
      operationId: export_payments_api_crm_payments_export_get
      parameters:
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
      - name: payment_method
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Payment Method
      - 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: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/payments/analytics:
    get:
      tags:
      - CRM
      - CRM
      - Payment List
      summary: Get Payment Analytics
      description: Get payment analytics data
      operationId: get_payment_analytics_api_crm_payments_analytics_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year, all'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year, all'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter configuration JSON
          title: Filters
        description: Filter configuration JSON
      - name: interval
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Interval for trends: hour, day, week, month'
          default: day
          title: Interval
        description: 'Interval for trends: hour, day, week, month'
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/payments/analytics/aggregated-table:
    get:
      tags:
      - CRM
      - CRM
      - Payment List
      summary: Get Aggregated Payment Analytics Table
      description: Get aggregated payment analytics data grouped by a dimension
      operationId: get_aggregated_payment_analytics_table_api_crm_payments_analytics_aggregated_table_get
      parameters:
      - name: group_by
        in: query
        required: false
        schema:
          type: string
          description: Dimension to group by
          default: customer
          title: Group By
        description: Dimension to group by
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year, all'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year, all'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter configuration JSON
          title: Filters
        description: Filter configuration JSON
      - name: sort_by
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Field to sort by
          title: Sort By
        description: Field to sort by
      - name: sort_direction
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Sort direction: asc or desc'
          default: desc
          title: Sort Direction
        description: 'Sort direction: asc or desc'
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          description: Page number
          default: 1
          title: Page
        description: Page number
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          description: Items per page
          default: 20
          title: Limit
        description: Items per page
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Aggregated Payment Analytics Table Api Crm Payments
                  Analytics Aggregated Table Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/payments/analytics/member-revenue-salary:
    get:
      tags:
      - CRM
      - CRM
      - Payment List
      summary: Get Member Revenue Salary Analytics
      description: Get member revenue vs salary analytics
      operationId: get_member_revenue_salary_analytics_api_crm_payments_analytics_member_revenue_salary_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year, all'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year, all'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Member Revenue Salary Analytics Api Crm Payments
                  Analytics Member Revenue Salary Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/receipts/{filename}:
    get:
      tags:
      - CRM
      - CRM
      - Receipts
      summary: Get Receipt File
      description: Get a receipt file - view inline or download
      operationId: get_receipt_file_api_crm_receipts__filename__get
      parameters:
      - name: filename
        in: path
        required: true
        schema:
          type: string
          title: Filename
      - name: download
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Download
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/products:
    get:
      tags:
      - CRM
      - CRM
      - Deal Products
      summary: List Deal Products
      description: Get all products associated with a deal
      operationId: list_deal_products_api_crm_deals__deal_id__products_get
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - CRM
      - CRM
      - Deal Products
      summary: Add Product To Deal
      description: Add a product to a deal
      operationId: add_product_to_deal_api_crm_deals__deal_id__products_post
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DealProductCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/products/{product_id}:
    put:
      tags:
      - CRM
      - CRM
      - Deal Products
      summary: Update Product In Deal
      description: Update a product in a deal
      operationId: update_product_in_deal_api_crm_deals__deal_id__products__product_id__put
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Deal Id
      - name: product_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Product Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DealProductUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Deal Products
      summary: Remove Product From Deal
      description: Remove a product from a deal
      operationId: remove_product_from_deal_api_crm_deals__deal_id__products__product_id__delete
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Deal Id
      - name: product_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Product Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/{deal_id}/products/total:
    get:
      tags:
      - CRM
      - CRM
      - Deal Products
      summary: Get Products Total
      description: Get total value of all products in a deal
      operationId: get_products_total_api_crm_deals__deal_id__products_total_get
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deal-products/prepare-mapping:
    post:
      tags:
      - CRM
      - CRM
      - Deal Product Mapping
      summary: Prepare Deal Product Mapping
      description: 'Prepare deal-product mapping file for import


        Returns column information and sample data'
      operationId: prepare_deal_product_mapping_api_crm_deal_products_prepare_mapping_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_prepare_deal_product_mapping_api_crm_deal_products_prepare_mapping_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deal-products/execute-mapping:
    post:
      tags:
      - CRM
      - CRM
      - Deal Product Mapping
      summary: Execute Deal Product Mapping
      description: Execute deal-product mapping with field mappings
      operationId: execute_deal_product_mapping_api_crm_deal_products_execute_mapping_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Request Body
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deal-products/sample-template:
    get:
      tags:
      - CRM
      - CRM
      - Deal Product Mapping
      summary: Generate Sample Template
      description: Generate a sample CSV template with actual deal and product IDs
        from the database
      operationId: generate_sample_template_api_crm_deal_products_sample_template_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deal-products/test-mapping:
    post:
      tags:
      - CRM
      - CRM
      - Deal Product Mapping
      summary: Test Deal Product Mapping
      description: Test endpoint to verify deal-product mapping works
      operationId: test_deal_product_mapping_api_crm_deal_products_test_mapping_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deal-products/verify-mappings/{deal_id}:
    get:
      tags:
      - CRM
      - CRM
      - Deal Product Mapping
      summary: Verify Deal Product Mappings
      description: Verify what products are mapped to a deal in the database
      operationId: verify_deal_product_mappings_api_crm_deal_products_verify_mappings__deal_id__get
      parameters:
      - name: deal_id
        in: path
        required: true
        schema:
          type: string
          title: Deal Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/standard-fields/:
    get:
      tags:
      - CRM
      - CRM
      - Standard Fields
      summary: Get Standard Fields
      description: Get all standard dropdown fields with their current options
      operationId: get_standard_fields_api_crm_standard_fields__get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Standard Fields Api Crm Standard Fields  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/standard-fields/update-options:
    post:
      tags:
      - CRM
      - CRM
      - Standard Fields
      summary: Update Standard Field Options
      description: Update dropdown options for a standard field
      operationId: update_standard_field_options_api_crm_standard_fields_update_options_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StandardFieldUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Standard Field Options Api Crm Standard Fields
                  Update Options Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/standard-fields/reset-options:
    post:
      tags:
      - CRM
      - CRM
      - Standard Fields
      summary: Reset Standard Field Options
      description: Reset dropdown options to defaults for a standard field
      operationId: reset_standard_field_options_api_crm_standard_fields_reset_options_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties:
                type: string
              title: Reset Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Reset Standard Field Options Api Crm Standard Fields
                  Reset Options Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/field-layout/{entity_type}:
    get:
      tags:
      - CRM
      - CRM
      - Field Layout
      summary: Get Field Layout
      description: 'Get field layout configuration for an entity type.

        Returns custom layout if exists, otherwise returns default layout.'
      operationId: get_field_layout_api_crm_field_layout__entity_type__get
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: view_type
        in: query
        required: false
        schema:
          type: string
          default: detail
          title: View Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Field Layout Api Crm Field Layout  Entity Type  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - CRM
      - CRM
      - Field Layout
      summary: Save Field Layout
      description: 'Save field layout configuration (organization-wide).

        Only admins/owners should have access to this endpoint.'
      operationId: save_field_layout_api_crm_field_layout__entity_type__put
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: view_type
        in: query
        required: false
        schema:
          type: string
          default: detail
          title: View Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FieldLayoutUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Save Field Layout Api Crm Field Layout  Entity Type  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/field-layout/{entity_type}/reset:
    post:
      tags:
      - CRM
      - CRM
      - Field Layout
      summary: Reset Field Layout
      description: Reset field layout to defaults by removing custom configuration.
      operationId: reset_field_layout_api_crm_field_layout__entity_type__reset_post
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: view_type
        in: query
        required: false
        schema:
          type: string
          default: detail
          title: View Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Reset Field Layout Api Crm Field Layout  Entity Type  Reset
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/field-layout/{entity_type}/defaults:
    get:
      tags:
      - CRM
      - CRM
      - Field Layout
      summary: Get Default Layout
      description: 'Get the default layout configuration for an entity type.

        Useful for showing "Reset to Defaults" preview.'
      operationId: get_default_layout_api_crm_field_layout__entity_type__defaults_get
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Default Layout Api Crm Field Layout  Entity Type  Defaults
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/field-layout/{entity_type}/list-columns:
    get:
      tags:
      - CRM
      - CRM
      - Field Layout
      summary: Get List Columns
      description: 'Get list column configuration for an entity type.

        Returns custom layout if exists, otherwise returns default columns.'
      operationId: get_list_columns_api_crm_field_layout__entity_type__list_columns_get
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get List Columns Api Crm Field Layout  Entity Type  List
                  Columns Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - CRM
      - CRM
      - Field Layout
      summary: Save List Columns
      description: 'Save list column configuration (organization-wide).

        Called when user reorders, shows/hides, or resizes columns.'
      operationId: save_list_columns_api_crm_field_layout__entity_type__list_columns_put
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ListColumnsUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Save List Columns Api Crm Field Layout  Entity Type  List
                  Columns Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/field-layout/{entity_type}/list-columns/reset:
    post:
      tags:
      - CRM
      - CRM
      - Field Layout
      summary: Reset List Columns
      description: Reset list columns to defaults by removing custom configuration.
      operationId: reset_list_columns_api_crm_field_layout__entity_type__list_columns_reset_post
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Reset List Columns Api Crm Field Layout  Entity Type  List
                  Columns Reset Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/field-layout/{entity_type}/list-columns/fill-rates:
    get:
      tags:
      - CRM
      - CRM
      - Field Layout
      summary: Get Column Fill Rates
      description: 'Get data fill rates for each column.

        Used for smart column ordering - columns with more data appear first.

        Returns fill_rate as 0.0 to 1.0 for each column ID.'
      operationId: get_column_fill_rates_api_crm_field_layout__entity_type__list_columns_fill_rates_get
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Column Fill Rates Api Crm Field Layout  Entity
                  Type  List Columns Fill Rates Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/field-layout/{entity_type}/list-columns/smart-order:
    get:
      tags:
      - CRM
      - CRM
      - Field Layout
      summary: Get Smart Ordered Columns
      description: 'Get columns with smart ordering and visibility based on data fill
        rates.


        For NEW users (no custom layout):

        - Full smart ordering: locked → standard → data (by fill rate) → empty

        - Visibility: columns with data are shown, empty columns hidden


        For users WITH custom layout:

        - Preserve their ORDER (don''t reorder)

        - But UPDATE VISIBILITY based on fill rates (columns with data become visible)'
      operationId: get_smart_ordered_columns_api_crm_field_layout__entity_type__list_columns_smart_order_get
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Smart Ordered Columns Api Crm Field Layout  Entity
                  Type  List Columns Smart Order Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/custom-fields:
    post:
      tags:
      - CRM
      - CRM
      - Custom Fields
      summary: Create Custom Field
      description: Create a new custom field definition
      operationId: create_custom_field_api_crm_custom_fields_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomFieldCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Custom Fields
      summary: List Custom Fields
      description: List custom field definitions
      operationId: list_custom_fields_api_crm_custom_fields_get
      parameters:
      - name: entity_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by entity type
          title: Entity Type
        description: Filter by entity type
      - name: active_only
        in: query
        required: false
        schema:
          type: boolean
          description: Only return active fields
          default: true
          title: Active Only
        description: Only return active fields
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/custom-fields/fields:
    post:
      tags:
      - CRM
      - CRM
      - Custom Fields
      summary: Create Custom Field Legacy
      description: Create a new custom field definition (legacy endpoint)
      operationId: create_custom_field_legacy_api_crm_custom_fields_fields_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomFieldCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Custom Fields
      summary: List Custom Fields Legacy
      description: List custom field definitions (legacy endpoint)
      operationId: list_custom_fields_legacy_api_crm_custom_fields_fields_get
      parameters:
      - name: entity_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by entity type
          title: Entity Type
        description: Filter by entity type
      - name: active_only
        in: query
        required: false
        schema:
          type: boolean
          description: Only return active fields
          default: true
          title: Active Only
        description: Only return active fields
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/custom-fields/fields/{field_id}:
    get:
      tags:
      - CRM
      - CRM
      - Custom Fields
      summary: Get Custom Field
      description: Get a custom field definition
      operationId: get_custom_field_api_crm_custom_fields_fields__field_id__get
      parameters:
      - name: field_id
        in: path
        required: true
        schema:
          type: string
          title: Field Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - CRM
      - CRM
      - Custom Fields
      summary: Update Custom Field
      description: Update a custom field definition
      operationId: update_custom_field_api_crm_custom_fields_fields__field_id__put
      parameters:
      - name: field_id
        in: path
        required: true
        schema:
          type: string
          title: Field Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomFieldUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Custom Fields
      summary: Delete Custom Field Legacy
      description: Delete (deactivate) a custom field (legacy endpoint)
      operationId: delete_custom_field_legacy_api_crm_custom_fields_fields__field_id__delete
      parameters:
      - name: field_id
        in: path
        required: true
        schema:
          type: string
          title: Field Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/custom-fields/{field_id}:
    put:
      tags:
      - CRM
      - CRM
      - Custom Fields
      summary: Update Custom Field New
      description: Update a custom field definition
      operationId: update_custom_field_new_api_crm_custom_fields__field_id__put
      parameters:
      - name: field_id
        in: path
        required: true
        schema:
          type: string
          title: Field Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomFieldUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Custom Fields
      summary: Delete Custom Field
      description: Delete (deactivate) a custom field
      operationId: delete_custom_field_api_crm_custom_fields__field_id__delete
      parameters:
      - name: field_id
        in: path
        required: true
        schema:
          type: string
          title: Field Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/custom-fields/groups:
    post:
      tags:
      - CRM
      - CRM
      - Custom Fields
      summary: Create Field Group
      description: Create a new custom field group
      operationId: create_field_group_api_crm_custom_fields_groups_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomFieldGroupCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Custom Fields
      summary: List Field Groups
      description: List custom field groups
      operationId: list_field_groups_api_crm_custom_fields_groups_get
      parameters:
      - name: entity_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by entity type
          title: Entity Type
        description: Filter by entity type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/custom-fields/groups/{group_id}:
    put:
      tags:
      - CRM
      - CRM
      - Custom Fields
      summary: Update Field Group
      description: Update a field group
      operationId: update_field_group_api_crm_custom_fields_groups__group_id__put
      parameters:
      - name: group_id
        in: path
        required: true
        schema:
          type: string
          title: Group Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomFieldGroupUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Custom Fields
      summary: Delete Field Group
      description: Delete a field group
      operationId: delete_field_group_api_crm_custom_fields_groups__group_id__delete
      parameters:
      - name: group_id
        in: path
        required: true
        schema:
          type: string
          title: Group Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/custom-fields/all-fields:
    get:
      tags:
      - CRM
      - CRM
      - Custom Fields
      summary: Get All Fields
      description: Get all fields (standard + custom) for each entity type
      operationId: get_all_fields_api_crm_custom_fields_all_fields_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/custom-fields/field-types:
    get:
      tags:
      - CRM
      - CRM
      - Custom Fields
      summary: Get Field Types
      description: Get available field types and their configurations
      operationId: get_field_types_api_crm_custom_fields_field_types_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/crm/custom-fields/validate:
    post:
      tags:
      - CRM
      - CRM
      - Custom Fields
      summary: Validate Field Value
      description: Validate a value against a field definition
      operationId: validate_field_value_api_crm_custom_fields_validate_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Request
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/custom-field-values/{entity_type}/{entity_id}/values:
    get:
      tags:
      - CRM
      - CRM
      - Custom Field Values
      summary: Get Custom Field Values
      description: Get custom field definitions and values for a specific entity
      operationId: get_custom_field_values_api_crm_custom_field_values__entity_type___entity_id__values_get
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: entity_id
        in: path
        required: true
        schema:
          type: string
          title: Entity Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - CRM
      - CRM
      - Custom Field Values
      summary: Update Custom Field Values
      description: Update custom field values for a specific entity
      operationId: update_custom_field_values_api_crm_custom_field_values__entity_type___entity_id__values_put
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: entity_id
        in: path
        required: true
        schema:
          type: string
          title: Entity Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FieldValuesUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/activities:
    post:
      tags:
      - CRM
      - CRM
      - Activities
      summary: Create Activity
      description: Create a new activity
      operationId: create_activity_api_crm_activities_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActivityCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Activities
      summary: List Activities
      description: List activities with optional filters
      operationId: list_activities_api_crm_activities_get
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 50
          title: Limit
      - name: entity_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Entity Type
      - name: entity_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Entity Id
      - name: activity_types
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Comma-separated activity types
          title: Activity Types
        description: Comma-separated activity types
      - name: created_by
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Created By
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/activities/search:
    get:
      tags:
      - CRM
      - CRM
      - Activities
      summary: Search Activities
      description: Search activities using full-text search
      operationId: search_activities_api_crm_activities_search_get
      parameters:
      - name: q
        in: query
        required: true
        schema:
          type: string
          description: Search term
          title: Q
        description: Search term
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 50
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/activities/summary:
    get:
      tags:
      - CRM
      - CRM
      - Activities
      summary: Get Activity Summary
      description: Get activity summary statistics
      operationId: get_activity_summary_api_crm_activities_summary_get
      parameters:
      - name: entity_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Entity Type
      - name: days
        in: query
        required: false
        schema:
          type: integer
          maximum: 90
          minimum: 1
          default: 7
          title: Days
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/activities/{activity_id}:
    get:
      tags:
      - CRM
      - CRM
      - Activities
      summary: Get Activity
      description: Get a single activity
      operationId: get_activity_api_crm_activities__activity_id__get
      parameters:
      - name: activity_id
        in: path
        required: true
        schema:
          type: string
          title: Activity Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/schema/{entity_type}:
    get:
      tags:
      - CRM
      - CRM
      - Schema
      summary: Get Entity Schema
      description: Get the actual database schema for an entity including all fields
      operationId: get_entity_schema_api_crm_schema__entity_type__get
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/schema/field-values/{entity_type}/{entity_id}:
    get:
      tags:
      - CRM
      - CRM
      - Schema
      summary: Get All Field Values
      description: Get all field values for an entity (both standard and custom)
      operationId: get_all_field_values_api_crm_schema_field_values__entity_type___entity_id__get
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: entity_id
        in: path
        required: true
        schema:
          type: string
          title: Entity Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/discovery/fields/{entity_type}:
    get:
      tags:
      - CRM
      - CRM
      - Field Discovery
      summary: Get Entity Fields
      description: Get all available fields for an entity type (standard + custom)
      operationId: get_entity_fields_api_crm_discovery_fields__entity_type__get
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/segments:
    post:
      tags:
      - CRM
      - CRM
      - Segments
      summary: Create Segment
      description: Create a new segment and queue for async processing
      operationId: create_segment_api_crm_segments_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SegmentCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - CRM
      - CRM
      - Segments
      summary: List Segments
      description: List all segments in the organization
      operationId: list_segments_api_crm_segments_get
      parameters:
      - name: entity_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by entity type
          title: Entity Type
        description: Filter by entity type
      - name: tags
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          description: Filter by tags
          title: Tags
        description: Filter by tags
      - name: no_rules
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          description: Filter segments without filter rules (for workflow-driven campaigns)
          title: No Rules
        description: Filter segments without filter rules (for workflow-driven campaigns)
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/segments/{segment_id}:
    get:
      tags:
      - CRM
      - CRM
      - Segments
      summary: Get Segment
      description: Get a specific segment
      operationId: get_segment_api_crm_segments__segment_id__get
      parameters:
      - name: segment_id
        in: path
        required: true
        schema:
          type: string
          title: Segment Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - CRM
      - CRM
      - Segments
      summary: Update Segment
      description: Update a segment
      operationId: update_segment_api_crm_segments__segment_id__put
      parameters:
      - name: segment_id
        in: path
        required: true
        schema:
          type: string
          title: Segment Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SegmentUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Segments
      summary: Delete Segment
      description: Delete a segment
      operationId: delete_segment_api_crm_segments__segment_id__delete
      parameters:
      - name: segment_id
        in: path
        required: true
        schema:
          type: string
          title: Segment Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/segments/{segment_id}/members:
    get:
      tags:
      - CRM
      - CRM
      - Segments
      summary: Get Segment Members
      description: Get members of a segment
      operationId: get_segment_members_api_crm_segments__segment_id__members_get
      parameters:
      - name: segment_id
        in: path
        required: true
        schema:
          type: string
          title: Segment Id
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/segments/{segment_id}/evaluate:
    post:
      tags:
      - CRM
      - CRM
      - Segments
      summary: Evaluate Segment
      description: Force re-evaluation of a segment
      operationId: evaluate_segment_api_crm_segments__segment_id__evaluate_post
      parameters:
      - name: segment_id
        in: path
        required: true
        schema:
          type: string
          title: Segment Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/segments/{segment_id}/stats:
    get:
      tags:
      - CRM
      - CRM
      - Segments
      summary: Get Segment Stats
      description: Get segment statistics
      operationId: get_segment_stats_api_crm_segments__segment_id__stats_get
      parameters:
      - name: segment_id
        in: path
        required: true
        schema:
          type: string
          title: Segment Id
      - name: days
        in: query
        required: false
        schema:
          type: integer
          description: Number of days to retrieve stats for
          default: 30
          title: Days
        description: Number of days to retrieve stats for
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/segments/{segment_id}/progress:
    get:
      tags:
      - CRM
      - CRM
      - Segments
      summary: Get Segment Progress
      description: Get real-time processing progress for a segment
      operationId: get_segment_progress_api_crm_segments__segment_id__progress_get
      parameters:
      - name: segment_id
        in: path
        required: true
        schema:
          type: string
          title: Segment Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/segments/status/{status}:
    get:
      tags:
      - CRM
      - CRM
      - Segments
      summary: Get Segments By Status
      description: Get segments by processing status
      operationId: get_segments_by_status_api_crm_segments_status__status__get
      parameters:
      - name: status
        in: path
        required: true
        schema:
          type: string
          title: Status
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 50
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/segments/debug:
    post:
      tags:
      - CRM
      - CRM
      - Segments
      summary: Debug Segment
      description: Debug segment filter configuration and execution
      operationId: debug_segment_api_crm_segments_debug_post
      parameters:
      - name: entity_type
        in: query
        required: true
        schema:
          type: string
          description: Entity type to debug
          title: Entity Type
        description: Entity type to debug
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SegmentFilterConfig'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/segments/preview:
    post:
      tags:
      - CRM
      - CRM
      - Segments
      summary: Preview Segment
      description: Preview segment members without saving
      operationId: preview_segment_api_crm_segments_preview_post
      parameters:
      - name: entity_type
        in: query
        required: true
        schema:
          type: string
          description: Entity type to preview
          title: Entity Type
        description: Entity type to preview
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          description: Number of sample members to return
          default: 10
          title: Limit
        description: Number of sample members to return
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SegmentFilterConfig'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/segments/{segment_id}/members/add:
    post:
      tags:
      - CRM
      - CRM
      - Segments
      summary: Add Members To Segment
      description: Add members to a segment (only for static segments)
      operationId: add_members_to_segment_api_crm_segments__segment_id__members_add_post
      parameters:
      - name: segment_id
        in: path
        required: true
        schema:
          type: string
          title: Segment Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
              description: List of entity IDs to add
              title: Entity Ids
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/segments/{segment_id}/members/remove:
    post:
      tags:
      - CRM
      - CRM
      - Segments
      summary: Remove Members From Segment
      description: Remove members from a segment (only for static segments)
      operationId: remove_members_from_segment_api_crm_segments__segment_id__members_remove_post
      parameters:
      - name: segment_id
        in: path
        required: true
        schema:
          type: string
          title: Segment Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
              description: List of entity IDs to remove
              title: Entity Ids
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/actions:
    get:
      tags:
      - CRM
      - CRM
      - Actions
      summary: List Actions
      description: List all actions for the organization
      operationId: list_actions_api_crm_actions_get
      parameters:
      - name: include_inactive
        in: query
        required: false
        schema:
          type: boolean
          description: Include inactive actions
          default: false
          title: Include Inactive
        description: Include inactive actions
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Search by name
          title: Search
        description: Search by name
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 50
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          default: 0
          title: Offset
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - CRM
      - CRM
      - Actions
      summary: Create Action
      description: Create a new action
      operationId: create_action_api_crm_actions_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActionCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/actions/{action_id}:
    get:
      tags:
      - CRM
      - CRM
      - Actions
      summary: Get Action
      description: Get a single action by ID
      operationId: get_action_api_crm_actions__action_id__get
      parameters:
      - name: action_id
        in: path
        required: true
        schema:
          type: string
          title: Action Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - CRM
      - CRM
      - Actions
      summary: Update Action
      description: Update an existing action
      operationId: update_action_api_crm_actions__action_id__put
      parameters:
      - name: action_id
        in: path
        required: true
        schema:
          type: string
          title: Action Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActionUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Actions
      summary: Delete Action
      description: Delete an action
      operationId: delete_action_api_crm_actions__action_id__delete
      parameters:
      - name: action_id
        in: path
        required: true
        schema:
          type: string
          title: Action Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/actions/{action_id}/duplicate:
    post:
      tags:
      - CRM
      - CRM
      - Actions
      summary: Duplicate Action
      description: Duplicate an existing action
      operationId: duplicate_action_api_crm_actions__action_id__duplicate_post
      parameters:
      - name: action_id
        in: path
        required: true
        schema:
          type: string
          title: Action Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/actions/{action_id}/stats:
    get:
      tags:
      - CRM
      - CRM
      - Actions
      summary: Get Action Stats
      description: Get action match statistics over time
      operationId: get_action_stats_api_crm_actions__action_id__stats_get
      parameters:
      - name: action_id
        in: path
        required: true
        schema:
          type: string
          title: Action Id
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: 'Time period: 7d, 30d, 90d'
          default: 30d
          title: Period
        description: 'Time period: 7d, 30d, 90d'
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/actions/{action_id}/matches:
    get:
      tags:
      - CRM
      - CRM
      - Actions
      summary: Get Action Matches
      description: Get action matches with visitor and contact details
      operationId: get_action_matches_api_crm_actions__action_id__matches_get
      parameters:
      - name: action_id
        in: path
        required: true
        schema:
          type: string
          title: Action Id
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 200
          minimum: 1
          default: 50
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          default: 0
          title: Offset
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/actions/{action_id}/test:
    post:
      tags:
      - CRM
      - CRM
      - Actions
      summary: Test Action
      description: Test an action by finding matching events
      operationId: test_action_api_crm_actions__action_id__test_post
      parameters:
      - name: action_id
        in: path
        required: true
        schema:
          type: string
          title: Action Id
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 50
          minimum: 1
          default: 10
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/saved-filters:
    get:
      tags:
      - CRM
      - CRM
      - Saved Filters
      summary: List Saved Filters
      description: 'List saved filters for an entity type.


        Returns:

        - User''s private filters (is_public=false, created_by=user)

        - Team filters (is_public=true)


        Ordered by: is_default DESC, display_order ASC, name ASC'
      operationId: list_saved_filters_api_crm_saved_filters_get
      parameters:
      - name: entity_type
        in: query
        required: true
        schema:
          type: string
          description: 'Entity type: contacts, companies, deals, tasks'
          title: Entity Type
        description: 'Entity type: contacts, companies, deals, tasks'
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 50
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - CRM
      - CRM
      - Saved Filters
      summary: Create Saved Filter
      description: 'Create a new saved filter.


        - name: Filter name (required, unique per user per entity_type)

        - entity_type: ''contacts'', ''companies'', ''deals'', or ''tasks''

        - filter_config: The filter configuration object

        - is_public: false = "Only me", true = "Share with team"'
      operationId: create_saved_filter_api_crm_saved_filters_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SavedFilterCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/saved-filters/{filter_id}:
    get:
      tags:
      - CRM
      - CRM
      - Saved Filters
      summary: Get Saved Filter
      description: Get a saved filter by ID
      operationId: get_saved_filter_api_crm_saved_filters__filter_id__get
      parameters:
      - name: filter_id
        in: path
        required: true
        schema:
          type: string
          title: Filter Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - CRM
      - CRM
      - Saved Filters
      summary: Update Saved Filter
      description: 'Update a saved filter.


        Only the owner can update a filter.'
      operationId: update_saved_filter_api_crm_saved_filters__filter_id__put
      parameters:
      - name: filter_id
        in: path
        required: true
        schema:
          type: string
          title: Filter Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SavedFilterUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Saved Filters
      summary: Delete Saved Filter
      description: 'Delete a saved filter.


        Only the owner can delete a filter.'
      operationId: delete_saved_filter_api_crm_saved_filters__filter_id__delete
      parameters:
      - name: filter_id
        in: path
        required: true
        schema:
          type: string
          title: Filter Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/saved-filters/{filter_id}/set-default:
    post:
      tags:
      - CRM
      - CRM
      - Saved Filters
      summary: Set Default Filter
      description: 'Set a filter as the default for its entity type.


        Clears any existing default for that entity type first.

        Only the owner can set a filter as default.'
      operationId: set_default_filter_api_crm_saved_filters__filter_id__set_default_post
      parameters:
      - name: filter_id
        in: path
        required: true
        schema:
          type: string
          title: Filter Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/import/prepare:
    post:
      tags:
      - CRM Import
      summary: Prepare Import
      description: 'Prepare a file for CRM import


        Returns column information and suggested field mappings'
      operationId: prepare_import_api_crm_import_prepare_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_prepare_import_api_crm_import_prepare_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/import/execute:
    post:
      tags:
      - CRM Import
      summary: Execute Import
      description: 'Execute CRM import with field mappings


        If workflow_id is provided, the import will be processed through the workflow'
      operationId: execute_import_api_crm_import_execute_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Request Body
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/import/create-import-workflow:
    post:
      tags:
      - CRM Import
      summary: Create Import Workflow
      description: 'Create a workflow for importing CRM data


        This creates a pre-configured workflow with:

        1. LLM Parser node (with bulk parsing enabled)

        2. Entity Manager node (Contact/Company/Deal based on entity_type)'
      operationId: create_import_workflow_api_crm_import_create_import_workflow_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_create_import_workflow_api_crm_import_create_import_workflow_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/import/templates:
    get:
      tags:
      - CRM Import
      summary: Get Import Templates
      description: Get available import field templates for each entity type
      operationId: get_import_templates_api_crm_import_templates_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/export/async:
    post:
      tags:
      - CRM
      - CRM
      - Export
      summary: Trigger Async Export
      description: 'Trigger async CSV export. Download link will be sent to user''s
        email.


        Supported entity types: contacts, companies, deals, tasks, products'
      operationId: trigger_async_export_api_crm_export_async_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__crm__export_routes__AsyncExportRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/export/contacts/csv:
    get:
      tags:
      - CRM
      - CRM
      - Export
      summary: Export Contacts Csv
      description: Export contacts to CSV
      operationId: export_contacts_csv_api_crm_export_contacts_csv_get
      parameters:
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: lead_status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Lead Status
      - name: tags
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          title: Tags
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/export/companies/csv:
    get:
      tags:
      - CRM
      - CRM
      - Export
      summary: Export Companies Csv
      description: Export companies to CSV
      operationId: export_companies_csv_api_crm_export_companies_csv_get
      parameters:
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: industry
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Industry
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/export/tasks/csv:
    get:
      tags:
      - CRM
      - CRM
      - Export
      summary: Export Tasks Csv
      description: Export tasks to CSV
      operationId: export_tasks_csv_api_crm_export_tasks_csv_get
      parameters:
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
      - name: assigned_to
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Assigned To
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/export/deals/csv:
    get:
      tags:
      - CRM
      - CRM
      - Export
      summary: Export Deals Csv
      description: Export deals to CSV
      operationId: export_deals_csv_api_crm_export_deals_csv_get
      parameters:
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: stage_name
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Stage Name
      - name: project_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Project Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/export/products/csv:
    get:
      tags:
      - CRM
      - CRM
      - Export
      summary: Export Products Csv
      description: Export products to CSV
      operationId: export_products_csv_api_crm_export_products_csv_get
      parameters:
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
      - name: is_service
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Service
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/metadata/fields:
    get:
      tags:
      - CRM
      - CRM
      - Metadata
      summary: Get Crm Fields
      description: 'Get all available fields for CRM entities using REAL database
        schema introspection.

        NO MORE HARDCODED LIES!'
      operationId: get_crm_fields_api_crm_metadata_fields_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Crm Fields Api Crm Metadata Fields Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/metadata/fields/{entity_type}:
    get:
      tags:
      - CRM
      - CRM
      - Metadata
      summary: Get Entity Fields
      description: 'Get fields for a specific entity type.

        Optimized to only fetch the single entity''s schema, not all tables.'
      operationId: get_entity_fields_api_crm_metadata_fields__entity_type__get
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: include_related
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Include Related
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Entity Fields Api Crm Metadata Fields  Entity
                  Type  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/metadata/forms/list:
    get:
      tags:
      - CRM
      - CRM
      - Metadata
      summary: Get Forms For Filters
      description: 'Get list of forms for segment filtering.

        Returns all forms in the organization with their basic info.'
      operationId: get_forms_for_filters_api_crm_metadata_forms_list_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
                title: Response Get Forms For Filters Api Crm Metadata Forms List
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/metadata/operators:
    get:
      tags:
      - CRM
      - CRM
      - Metadata
      summary: Get Operators
      description: Get all available operators grouped by field type.
      operationId: get_operators_api_crm_metadata_operators_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: array
                  items:
                    type: object
                    additionalProperties:
                      type: string
                title: Response Get Operators Api Crm Metadata Operators Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/metadata/validate-field:
    post:
      tags:
      - CRM
      - CRM
      - Metadata
      summary: Validate Field Exists
      description: 'Validate if a field exists in the specified table.

        Used by database trigger configuration to prevent invalid field names.'
      operationId: validate_field_exists_api_crm_metadata_validate_field_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties:
                type: string
              title: Request
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Validate Field Exists Api Crm Metadata Validate Field
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/visitors:
    get:
      tags:
      - CRM
      - CRM
      - Visitor Tracking
      - Visitor Tracking
      summary: Get Visitors
      description: "Get list of visitors with filtering options\n\nArgs:\n    time_range:\
        \ today, yesterday, last7days, last30days\n    active_only: Only show currently\
        \ active visitors\n    limit: Number of results\n    offset: Pagination offset"
      operationId: get_visitors_api_crm_visitors_get
      parameters:
      - name: time_range
        in: query
        required: false
        schema:
          type: string
          default: today
          title: Time Range
      - name: active_only
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Active Only
      - name: action_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by visitors who performed a specific action
          title: Action Id
        description: Filter by visitors who performed a specific action
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 50
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          default: 0
          title: Offset
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/visitors/stats:
    get:
      tags:
      - CRM
      - CRM
      - Visitor Tracking
      - Visitor Tracking
      summary: Get Visitor Stats
      description: Get visitor statistics for the given time range
      operationId: get_visitor_stats_api_crm_visitors_stats_get
      parameters:
      - name: time_range
        in: query
        required: false
        schema:
          type: string
          default: today
          title: Time Range
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/visitors/{visitor_id}/journey:
    get:
      tags:
      - CRM
      - CRM
      - Visitor Tracking
      - Visitor Tracking
      summary: Get Visitor Journey
      description: Get complete journey for a specific visitor
      operationId: get_visitor_journey_api_crm_visitors__visitor_id__journey_get
      parameters:
      - name: visitor_id
        in: path
        required: true
        schema:
          type: string
          title: Visitor Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/visitors/active:
    get:
      tags:
      - CRM
      - CRM
      - Visitor Tracking
      - Visitor Tracking
      summary: Get Active Visitors
      description: Get currently active visitors
      operationId: get_active_visitors_api_crm_visitors_active_get
      parameters:
      - name: minutes
        in: query
        required: false
        schema:
          type: integer
          default: 5
          title: Minutes
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/visitors/{visitor_id}/link-contact:
    post:
      tags:
      - CRM
      - CRM
      - Visitor Tracking
      - Visitor Tracking
      summary: Link Visitor To Contact
      description: Manually link a visitor to a contact
      operationId: link_visitor_to_contact_api_crm_visitors__visitor_id__link_contact_post
      parameters:
      - name: visitor_id
        in: path
        required: true
        schema:
          type: string
          title: Visitor Id
      - name: contact_id
        in: query
        required: true
        schema:
          type: string
          title: Contact Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/visitors/top-pages:
    get:
      tags:
      - CRM
      - CRM
      - Visitor Tracking
      - Visitor Tracking
      summary: Get Top Pages
      description: Get most visited pages
      operationId: get_top_pages_api_crm_visitors_top_pages_get
      parameters:
      - name: time_range
        in: query
        required: false
        schema:
          type: string
          default: today
          title: Time Range
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 10
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/visitors/top-sources:
    get:
      tags:
      - CRM
      - CRM
      - Visitor Tracking
      - Visitor Tracking
      summary: Get Top Sources
      description: Get top traffic sources
      operationId: get_top_sources_api_crm_visitors_top_sources_get
      parameters:
      - name: time_range
        in: query
        required: false
        schema:
          type: string
          default: today
          title: Time Range
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 10
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/events:
    get:
      tags:
      - CRM
      - CRM
      - Events Explorer
      - Events Explorer
      summary: List Events
      description: "List all tracking events with filters.\n\nArgs:\n    category:\
        \ Filter by event category\n    action: Filter by event action\n    action_id:\
        \ Filter by matched action ID\n    include_actions: Include matched actions\
        \ in response\n    start_date: Filter from this date (ISO format)\n    end_date:\
        \ Filter to this date (ISO format)\n    visitor_id: Filter by visitor\n  \
        \  contact_id: Filter by contact\n    search: Search in event_label, element_text\n\
        \    time_range: Preset range (today, yesterday, last7days, last30days, all)\n\
        \    limit: Max results (default 50, max 200)\n    offset: Pagination offset"
      operationId: list_events_api_crm_events_get
      parameters:
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
      - name: action
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Action
      - name: action_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by matched action ID
          title: Action Id
        description: Filter by matched action ID
      - name: include_actions
        in: query
        required: false
        schema:
          type: boolean
          description: Include matched actions in response
          default: true
          title: Include Actions
        description: Include matched actions in response
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: visitor_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Visitor Id
      - name: contact_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Contact Id
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: time_range
        in: query
        required: false
        schema:
          type: string
          default: last7days
          title: Time Range
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 200
          default: 50
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          default: 0
          title: Offset
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/events/categories:
    get:
      tags:
      - CRM
      - CRM
      - Events Explorer
      - Events Explorer
      summary: Get Event Categories
      description: 'Get all unique event categories with counts.

        Useful for filter dropdowns.'
      operationId: get_event_categories_api_crm_events_categories_get
      parameters:
      - name: time_range
        in: query
        required: false
        schema:
          type: string
          default: last30days
          title: Time Range
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/events/actions:
    get:
      tags:
      - CRM
      - CRM
      - Events Explorer
      - Events Explorer
      summary: Get Event Actions
      description: Get unique event actions, optionally filtered by category.
      operationId: get_event_actions_api_crm_events_actions_get
      parameters:
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
      - name: time_range
        in: query
        required: false
        schema:
          type: string
          default: last30days
          title: Time Range
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/events/stats:
    get:
      tags:
      - CRM
      - CRM
      - Events Explorer
      - Events Explorer
      summary: Get Event Stats
      description: Get event statistics for the dashboard cards.
      operationId: get_event_stats_api_crm_events_stats_get
      parameters:
      - name: time_range
        in: query
        required: false
        schema:
          type: string
          default: last7days
          title: Time Range
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/analytics/overview:
    get:
      tags:
      - CRM
      - CRM
      - Contact Analytics
      summary: Get Contact Overview
      description: Get contact overview metrics including totals, growth rates, and
        key indicators
      operationId: get_contact_overview_api_crm_contacts_analytics_overview_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter configuration JSON
          title: Filters
        description: Filter configuration JSON
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Contact Overview Api Crm Contacts Analytics Overview
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/analytics/lead-status-distribution:
    get:
      tags:
      - CRM
      - CRM
      - Contact Analytics
      summary: Get Lead Status Distribution
      description: Get lead status distribution showing count and percentage for each
        status
      operationId: get_lead_status_distribution_api_crm_contacts_analytics_lead_status_distribution_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter configuration JSON
          title: Filters
        description: Filter configuration JSON
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Lead Status Distribution Api Crm Contacts Analytics
                  Lead Status Distribution Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/analytics/trends:
    get:
      tags:
      - CRM
      - CRM
      - Contact Analytics
      summary: Get Contact Trends
      description: Get contact creation trends over time
      operationId: get_contact_trends_api_crm_contacts_analytics_trends_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: week, month, quarter, year'
          default: month
          title: Period
        description: 'Time period: week, month, quarter, year'
      - name: interval
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Aggregation interval: hour, day, week, month'
          default: day
          title: Interval
        description: 'Aggregation interval: hour, day, week, month'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter configuration JSON
          title: Filters
        description: Filter configuration JSON
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Contact Trends Api Crm Contacts Analytics Trends
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/analytics/source-analytics:
    get:
      tags:
      - CRM
      - CRM
      - Contact Analytics
      summary: Get Source Analytics
      description: Get analytics on contact sources including distribution and performance
      operationId: get_source_analytics_api_crm_contacts_analytics_source_analytics_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter configuration JSON
          title: Filters
        description: Filter configuration JSON
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Source Analytics Api Crm Contacts Analytics Source
                  Analytics Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/analytics/lifecycle-stage-distribution:
    get:
      tags:
      - CRM
      - CRM
      - Contact Analytics
      summary: Get Lifecycle Stage Distribution
      description: Get lifecycle stage distribution showing count and percentage for
        each stage
      operationId: get_lifecycle_stage_distribution_api_crm_contacts_analytics_lifecycle_stage_distribution_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter configuration JSON
          title: Filters
        description: Filter configuration JSON
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Lifecycle Stage Distribution Api Crm Contacts
                  Analytics Lifecycle Stage Distribution Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/analytics/lead-score-distribution:
    get:
      tags:
      - CRM
      - CRM
      - Contact Analytics
      summary: Get Lead Score Distribution
      description: Get lead score distribution showing contacts grouped by score ranges
      operationId: get_lead_score_distribution_api_crm_contacts_analytics_lead_score_distribution_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter configuration JSON
          title: Filters
        description: Filter configuration JSON
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Lead Score Distribution Api Crm Contacts Analytics
                  Lead Score Distribution Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/analytics/channel-distribution:
    get:
      tags:
      - CRM
      - CRM
      - Contact Analytics
      summary: Get Channel Distribution
      description: Get channel distribution showing contacts grouped by channel
      operationId: get_channel_distribution_api_crm_contacts_analytics_channel_distribution_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter configuration JSON
          title: Filters
        description: Filter configuration JSON
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Channel Distribution Api Crm Contacts Analytics
                  Channel Distribution Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/analytics/lifecycle-stage-funnel:
    get:
      tags:
      - CRM
      - CRM
      - Contact Analytics
      summary: Get Lifecycle Stage Funnel
      description: Get lifecycle stage conversion funnel showing progression through
        stages
      operationId: get_lifecycle_stage_funnel_api_crm_contacts_analytics_lifecycle_stage_funnel_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter configuration JSON
          title: Filters
        description: Filter configuration JSON
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Lifecycle Stage Funnel Api Crm Contacts Analytics
                  Lifecycle Stage Funnel Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/analytics/engagement-metrics:
    get:
      tags:
      - CRM
      - CRM
      - Contact Analytics
      summary: Get Engagement Metrics
      description: Get contact engagement metrics based on activity data
      operationId: get_engagement_metrics_api_crm_contacts_analytics_engagement_metrics_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter configuration JSON
          title: Filters
        description: Filter configuration JSON
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Engagement Metrics Api Crm Contacts Analytics
                  Engagement Metrics Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/analytics/aggregated-table:
    get:
      tags:
      - CRM
      - CRM
      - Contact Analytics
      summary: Get Aggregated Analytics Table
      description: Get aggregated contact analytics data grouped by one or more dimensions
        (max 3)
      operationId: get_aggregated_analytics_table_api_crm_contacts_analytics_aggregated_table_get
      parameters:
      - name: group_by
        in: query
        required: false
        schema:
          type: string
          description: Comma-separated dimensions to group by (max 3)
          default: source
          title: Group By
        description: Comma-separated dimensions to group by (max 3)
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year, all'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year, all'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter configuration JSON
          title: Filters
        description: Filter configuration JSON
      - name: sort_by
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Field to sort by
          title: Sort By
        description: Field to sort by
      - name: sort_direction
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Sort direction: asc or desc'
          default: desc
          title: Sort Direction
        description: 'Sort direction: asc or desc'
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          description: Page number
          default: 1
          title: Page
        description: Page number
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          description: Items per page
          default: 20
          title: Limit
        description: Items per page
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Aggregated Analytics Table Api Crm Contacts Analytics
                  Aggregated Table Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/analytics/field-values:
    get:
      tags:
      - CRM
      - CRM
      - Contact Analytics
      summary: Get Field Values
      description: 'Get available values for a specific field with counts in the selected
        period

        Used for configurable metric card dropdowns'
      operationId: get_field_values_api_crm_contacts_analytics_field_values_get
      parameters:
      - name: field_name
        in: query
        required: true
        schema:
          type: string
          description: Field name to get values for
          title: Field Name
        description: Field name to get values for
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year, all'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year, all'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter configuration JSON
          title: Filters
        description: Filter configuration JSON
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Field Values Api Crm Contacts Analytics Field
                  Values Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/analytics/configurable-metric:
    get:
      tags:
      - CRM
      - CRM
      - Contact Analytics
      summary: Get Configurable Metric
      description: 'Calculate metric based on selected field values with growth comparison

        Used for configurable metric cards'
      operationId: get_configurable_metric_api_crm_contacts_analytics_configurable_metric_get
      parameters:
      - name: field_name
        in: query
        required: true
        schema:
          type: string
          description: Field name to calculate metric for
          title: Field Name
        description: Field name to calculate metric for
      - name: selected_values
        in: query
        required: true
        schema:
          type: string
          description: Comma-separated list of selected values
          title: Selected Values
        description: Comma-separated list of selected values
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year, all'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year, all'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter configuration JSON
          title: Filters
        description: Filter configuration JSON
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Configurable Metric Api Crm Contacts Analytics
                  Configurable Metric Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/analytics/available-columns:
    get:
      tags:
      - CRM
      - CRM
      - Contact Analytics
      summary: Get Available Columns
      description: Get all available contact columns (standard and custom) for grouping
      operationId: get_available_columns_api_crm_contacts_analytics_available_columns_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Available Columns Api Crm Contacts Analytics Available
                  Columns Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/lifecycle/analytics/overview:
    get:
      tags:
      - CRM
      - CRM
      - Contact Lifecycle Analytics
      summary: Get Lifecycle Overview
      description: Get lifecycle overview metrics for contacts
      operationId: get_lifecycle_overview_api_crm_contacts_lifecycle_analytics_overview_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Lifecycle Overview Api Crm Contacts Lifecycle
                  Analytics Overview Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/lifecycle/analytics/stage-analysis:
    get:
      tags:
      - CRM
      - CRM
      - Contact Lifecycle Analytics
      summary: Get Stage Analysis
      description: Get stage-by-stage analysis for contacts
      operationId: get_stage_analysis_api_crm_contacts_lifecycle_analytics_stage_analysis_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Stage Analysis Api Crm Contacts Lifecycle Analytics
                  Stage Analysis Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/lifecycle/analytics/conversion-funnel:
    get:
      tags:
      - CRM
      - CRM
      - Contact Lifecycle Analytics
      summary: Get Conversion Funnel
      description: Get conversion funnel data for contact lifecycle
      operationId: get_conversion_funnel_api_crm_contacts_lifecycle_analytics_conversion_funnel_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Conversion Funnel Api Crm Contacts Lifecycle Analytics
                  Conversion Funnel Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/lifecycle/analytics/velocity-metrics:
    get:
      tags:
      - CRM
      - CRM
      - Contact Lifecycle Analytics
      summary: Get Velocity Metrics
      description: Get contact velocity metrics through lifecycle stages
      operationId: get_velocity_metrics_api_crm_contacts_lifecycle_analytics_velocity_metrics_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Velocity Metrics Api Crm Contacts Lifecycle Analytics
                  Velocity Metrics Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/lifecycle/analytics/bottlenecks:
    get:
      tags:
      - CRM
      - CRM
      - Contact Lifecycle Analytics
      summary: Get Lifecycle Bottlenecks
      description: Identify lifecycle bottlenecks where contacts are stuck
      operationId: get_lifecycle_bottlenecks_api_crm_contacts_lifecycle_analytics_bottlenecks_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Lifecycle Bottlenecks Api Crm Contacts Lifecycle
                  Analytics Bottlenecks Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/contacts/lifecycle/analytics/health-score:
    get:
      tags:
      - CRM
      - CRM
      - Contact Lifecycle Analytics
      summary: Get Lifecycle Health Score
      description: Get lifecycle health score and metrics
      operationId: get_lifecycle_health_score_api_crm_contacts_lifecycle_analytics_health_score_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Lifecycle Health Score Api Crm Contacts Lifecycle
                  Analytics Health Score Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/companies/analytics/overview:
    get:
      tags:
      - CRM
      - CRM
      - Company Analytics
      summary: Get Company Overview
      description: Get company overview metrics including totals, growth rates, and
        key indicators
      operationId: get_company_overview_api_crm_companies_analytics_overview_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter configuration JSON
          title: Filters
        description: Filter configuration JSON
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Company Overview Api Crm Companies Analytics Overview
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/companies/analytics/industry-distribution:
    get:
      tags:
      - CRM
      - CRM
      - Company Analytics
      summary: Get Industry Distribution
      description: Get distribution of companies by industry
      operationId: get_industry_distribution_api_crm_companies_analytics_industry_distribution_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year, all'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year, all'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Industry Distribution Api Crm Companies Analytics
                  Industry Distribution Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/companies/analytics/company-size-distribution:
    get:
      tags:
      - CRM
      - CRM
      - Company Analytics
      summary: Get Company Size Distribution
      description: Get distribution of companies by size
      operationId: get_company_size_distribution_api_crm_companies_analytics_company_size_distribution_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year, all'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year, all'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Company Size Distribution Api Crm Companies Analytics
                  Company Size Distribution Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/companies/analytics/top-revenue-companies:
    get:
      tags:
      - CRM
      - CRM
      - Company Analytics
      summary: Get Top Revenue Companies
      description: Get top companies by revenue/deal value
      operationId: get_top_revenue_companies_api_crm_companies_analytics_top_revenue_companies_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year, all'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year, all'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 50
          minimum: 1
          default: 10
          title: Limit
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Top Revenue Companies Api Crm Companies Analytics
                  Top Revenue Companies Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/companies/analytics/engagement-score-distribution:
    get:
      tags:
      - CRM
      - CRM
      - Company Analytics
      summary: Get Engagement Score Distribution
      description: Get distribution of companies by engagement score
      operationId: get_engagement_score_distribution_api_crm_companies_analytics_engagement_score_distribution_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year, all'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year, all'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Engagement Score Distribution Api Crm Companies
                  Analytics Engagement Score Distribution Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/companies/analytics/trends:
    get:
      tags:
      - CRM
      - CRM
      - Company Analytics
      summary: Get Company Trends
      description: Get company creation and activity trends over time
      operationId: get_company_trends_api_crm_companies_analytics_trends_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: interval
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Grouping interval: hour, day, week, month'
          default: day
          title: Interval
        description: 'Grouping interval: hour, day, week, month'
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Company Trends Api Crm Companies Analytics Trends
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/companies/analytics/company-health:
    get:
      tags:
      - CRM
      - CRM
      - Company Analytics
      summary: Get Company Health Metrics
      description: Get company health metrics
      operationId: get_company_health_metrics_api_crm_companies_analytics_company_health_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Company Health Metrics Api Crm Companies Analytics
                  Company Health Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/companies/analytics/aggregated-table:
    get:
      tags:
      - CRM
      - CRM
      - Company Analytics
      summary: Get Aggregated Analytics Table
      description: Get aggregated company analytics table grouped by dimension
      operationId: get_aggregated_analytics_table_api_crm_companies_analytics_aggregated_table_get
      parameters:
      - name: group_by
        in: query
        required: false
        schema:
          type: string
          description: Dimension to group by
          default: industry
          title: Group By
        description: Dimension to group by
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: sort_by
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Field to sort by
          default: companies
          title: Sort By
        description: Field to sort by
      - name: sort_direction
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Sort direction: asc or desc'
          default: desc
          title: Sort Direction
        description: 'Sort direction: asc or desc'
      - name: page
        in: query
        required: false
        schema:
          type: integer
          description: Page number
          default: 1
          title: Page
        description: Page number
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          description: Items per page
          default: 20
          title: Limit
        description: Items per page
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Aggregated Analytics Table Api Crm Companies Analytics
                  Aggregated Table Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/analytics/stages:
    get:
      tags:
      - CRM
      - CRM
      - Deal Analytics
      summary: Get Pipeline Stages
      description: Get all available pipeline stages in order
      operationId: get_pipeline_stages_api_crm_deals_analytics_stages_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Pipeline Stages Api Crm Deals Analytics Stages
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/analytics/overview:
    get:
      tags:
      - CRM
      - CRM
      - Deal Analytics
      summary: Get Deal Overview
      description: Get deal overview metrics - matching contact analytics pattern
        exactly
      operationId: get_deal_overview_api_crm_deals_analytics_overview_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: today, week, month, quarter, year'
          default: month
          title: Period
        description: 'Time period: today, week, month, quarter, year'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (ISO format)
          title: Start Date
        description: Custom start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (ISO format)
          title: End Date
        description: Custom end date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter configuration JSON
          title: Filters
        description: Filter configuration JSON
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Deal Overview Api Crm Deals Analytics Overview
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/analytics/stage-distribution:
    get:
      tags:
      - CRM
      - CRM
      - Deal Analytics
      summary: Get Stage Distribution
      description: Get deal distribution by stage
      operationId: get_stage_distribution_api_crm_deals_analytics_stage_distribution_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Stage Distribution Api Crm Deals Analytics Stage
                  Distribution Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/analytics/top-deals:
    get:
      tags:
      - CRM
      - CRM
      - Deal Analytics
      summary: Get Top Deals
      description: Get top deals by value
      operationId: get_top_deals_api_crm_deals_analytics_top_deals_get
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 50
          minimum: 1
          default: 10
          title: Limit
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Top Deals Api Crm Deals Analytics Top Deals Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/analytics/trends:
    get:
      tags:
      - CRM
      - CRM
      - Deal Analytics
      summary: Get Deal Trends
      description: Get deal trends over time
      operationId: get_deal_trends_api_crm_deals_analytics_trends_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: interval
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Grouping interval: hour, day, week, month'
          default: day
          title: Interval
        description: 'Grouping interval: hour, day, week, month'
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Deal Trends Api Crm Deals Analytics Trends Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/analytics/conversion-funnel:
    get:
      tags:
      - CRM
      - CRM
      - Deal Analytics
      summary: Get Conversion Funnel
      description: Get conversion funnel data based on actual stages
      operationId: get_conversion_funnel_api_crm_deals_analytics_conversion_funnel_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Conversion Funnel Api Crm Deals Analytics Conversion
                  Funnel Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/analytics/value-distribution:
    get:
      tags:
      - CRM
      - CRM
      - Deal Analytics
      summary: Get Value Distribution
      description: Get distribution of deals by value ranges
      operationId: get_value_distribution_api_crm_deals_analytics_value_distribution_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Value Distribution Api Crm Deals Analytics Value
                  Distribution Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/analytics/owner-performance:
    get:
      tags:
      - CRM
      - CRM
      - Deal Analytics
      summary: Get Owner Performance
      description: Get sales performance metrics by deal owner
      operationId: get_owner_performance_api_crm_deals_analytics_owner_performance_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Owner Performance Api Crm Deals Analytics Owner
                  Performance Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/analytics/source-analytics:
    get:
      tags:
      - CRM
      - CRM
      - Deal Analytics
      summary: Get Source Analytics
      description: Get deal performance metrics by source
      operationId: get_source_analytics_api_crm_deals_analytics_source_analytics_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Source Analytics Api Crm Deals Analytics Source
                  Analytics Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/analytics/time-to-close:
    get:
      tags:
      - CRM
      - CRM
      - Deal Analytics
      summary: Get Time To Close
      description: Get average time to close by stage
      operationId: get_time_to_close_api_crm_deals_analytics_time_to_close_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Time To Close Api Crm Deals Analytics Time To
                  Close Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/deals/analytics/grouped:
    get:
      tags:
      - CRM
      - CRM
      - Deal Analytics
      summary: Get Grouped Analytics
      description: Get deal analytics grouped by specified dimension
      operationId: get_grouped_analytics_api_crm_deals_analytics_grouped_get
      parameters:
      - name: group_by
        in: query
        required: false
        schema:
          type: string
          description: Field to group by
          default: source
          title: Group By
        description: Field to group by
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Grouped Analytics Api Crm Deals Analytics Grouped
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/analytics/overview:
    get:
      tags:
      - CRM
      - CRM
      - Task Analytics
      summary: Get Task Overview
      description: Get task overview metrics
      operationId: get_task_overview_api_crm_tasks_analytics_overview_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Task Overview Api Crm Tasks Analytics Overview
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/analytics/status-distribution:
    get:
      tags:
      - CRM
      - CRM
      - Task Analytics
      summary: Get Status Distribution
      description: Get task distribution by status
      operationId: get_status_distribution_api_crm_tasks_analytics_status_distribution_get
      parameters:
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Status Distribution Api Crm Tasks Analytics Status
                  Distribution Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/analytics/priority-distribution:
    get:
      tags:
      - CRM
      - CRM
      - Task Analytics
      summary: Get Priority Distribution
      description: Get task distribution by priority
      operationId: get_priority_distribution_api_crm_tasks_analytics_priority_distribution_get
      parameters:
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Priority Distribution Api Crm Tasks Analytics
                  Priority Distribution Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/analytics/upcoming-tasks:
    get:
      tags:
      - CRM
      - CRM
      - Task Analytics
      summary: Get Upcoming Tasks
      description: Get upcoming tasks
      operationId: get_upcoming_tasks_api_crm_tasks_analytics_upcoming_tasks_get
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 50
          minimum: 1
          default: 10
          title: Limit
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Upcoming Tasks Api Crm Tasks Analytics Upcoming
                  Tasks Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/analytics/trends:
    get:
      tags:
      - CRM
      - CRM
      - Task Analytics
      summary: Get Task Trends
      description: Get task trends over time
      operationId: get_task_trends_api_crm_tasks_analytics_trends_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: interval
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: day
          title: Interval
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Task Trends Api Crm Tasks Analytics Trends Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/analytics/productivity-metrics:
    get:
      tags:
      - CRM
      - CRM
      - Task Analytics
      summary: Get Productivity Metrics
      description: Get team productivity metrics
      operationId: get_productivity_metrics_api_crm_tasks_analytics_productivity_metrics_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Productivity Metrics Api Crm Tasks Analytics Productivity
                  Metrics Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/analytics/task-categories:
    get:
      tags:
      - CRM
      - CRM
      - Task Analytics
      summary: Get Task Categories
      description: Get task distribution by category
      operationId: get_task_categories_api_crm_tasks_analytics_task_categories_get
      parameters:
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Task Categories Api Crm Tasks Analytics Task Categories
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/analytics/entity-distribution:
    get:
      tags:
      - CRM
      - CRM
      - Task Analytics
      summary: Get Entity Distribution
      description: Get task distribution by entity type
      operationId: get_entity_distribution_api_crm_tasks_analytics_entity_distribution_get
      parameters:
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Entity Distribution Api Crm Tasks Analytics Entity
                  Distribution Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/tasks/analytics/assignee-performance:
    get:
      tags:
      - CRM
      - CRM
      - Task Analytics
      summary: Get Assignee Performance
      description: Get assignee performance metrics
      operationId: get_assignee_performance_api_crm_tasks_analytics_assignee_performance_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Filters
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Assignee Performance Api Crm Tasks Analytics Assignee
                  Performance Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/pipeline/analytics/overview:
    get:
      tags:
      - CRM
      - CRM
      - Pipeline Analytics
      summary: Get Pipeline Overview
      description: Get pipeline overview metrics
      operationId: get_pipeline_overview_api_crm_pipeline_analytics_overview_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Pipeline Overview Api Crm Pipeline Analytics Overview
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/pipeline/analytics/performance:
    get:
      tags:
      - CRM
      - CRM
      - Pipeline Analytics
      summary: Get Pipeline Performance
      description: Get pipeline performance metrics
      operationId: get_pipeline_performance_api_crm_pipeline_analytics_performance_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Pipeline Performance Api Crm Pipeline Analytics
                  Performance Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/pipeline/analytics/stage-analysis:
    get:
      tags:
      - CRM
      - CRM
      - Pipeline Analytics
      summary: Get Stage Analysis
      description: Get stage-by-stage analysis
      operationId: get_stage_analysis_api_crm_pipeline_analytics_stage_analysis_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Stage Analysis Api Crm Pipeline Analytics Stage
                  Analysis Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/pipeline/analytics/conversion-funnel:
    get:
      tags:
      - CRM
      - CRM
      - Pipeline Analytics
      summary: Get Conversion Funnel
      description: Get conversion funnel data with cumulative counts and percentages
      operationId: get_conversion_funnel_api_crm_pipeline_analytics_conversion_funnel_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Conversion Funnel Api Crm Pipeline Analytics Conversion
                  Funnel Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/pipeline/analytics/velocity-metrics:
    get:
      tags:
      - CRM
      - CRM
      - Pipeline Analytics
      summary: Get Velocity Metrics
      description: Get deal velocity metrics
      operationId: get_velocity_metrics_api_crm_pipeline_analytics_velocity_metrics_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Velocity Metrics Api Crm Pipeline Analytics Velocity
                  Metrics Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/pipeline/analytics/bottlenecks:
    get:
      tags:
      - CRM
      - CRM
      - Pipeline Analytics
      summary: Get Pipeline Bottlenecks
      description: Identify pipeline bottlenecks
      operationId: get_pipeline_bottlenecks_api_crm_pipeline_analytics_bottlenecks_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Pipeline Bottlenecks Api Crm Pipeline Analytics
                  Bottlenecks Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/pipeline/analytics/forecast:
    get:
      tags:
      - CRM
      - CRM
      - Pipeline Analytics
      summary: Get Pipeline Forecast
      description: Get pipeline forecast metrics
      operationId: get_pipeline_forecast_api_crm_pipeline_analytics_forecast_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: quarter
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Pipeline Forecast Api Crm Pipeline Analytics Forecast
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/pipeline/analytics/health-score:
    get:
      tags:
      - CRM
      - CRM
      - Pipeline Analytics
      summary: Get Pipeline Health Score
      description: Get pipeline health score and metrics
      operationId: get_pipeline_health_score_api_crm_pipeline_analytics_health_score_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Pipeline Health Score Api Crm Pipeline Analytics
                  Health Score Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/segments/analytics/overview:
    get:
      tags:
      - CRM
      - CRM
      - Segment Analytics
      summary: Get Segment Overview
      description: Get segment overview metrics
      operationId: get_segment_overview_api_crm_segments_analytics_overview_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Segment Overview Api Crm Segments Analytics Overview
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/segments/analytics/distribution:
    get:
      tags:
      - CRM
      - CRM
      - Segment Analytics
      summary: Get Segment Distribution
      description: Get segment distribution by type and size
      operationId: get_segment_distribution_api_crm_segments_analytics_distribution_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Segment Distribution Api Crm Segments Analytics
                  Distribution Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/segments/analytics/performance:
    get:
      tags:
      - CRM
      - CRM
      - Segment Analytics
      summary: Get Segment Performance
      description: Get top performing segments
      operationId: get_segment_performance_api_crm_segments_analytics_performance_get
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 50
          minimum: 1
          default: 10
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Segment Performance Api Crm Segments Analytics
                  Performance Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/segments/analytics/growth-trends:
    get:
      tags:
      - CRM
      - CRM
      - Segment Analytics
      summary: Get Segment Growth Trends
      description: Get segment growth trends over time
      operationId: get_segment_growth_trends_api_crm_segments_analytics_growth_trends_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: interval
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: day
          title: Interval
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Segment Growth Trends Api Crm Segments Analytics
                  Growth Trends Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/segments/analytics/campaign-usage:
    get:
      tags:
      - CRM
      - CRM
      - Segment Analytics
      summary: Get Segment Campaign Usage
      description: Get segment usage in campaigns
      operationId: get_segment_campaign_usage_api_crm_segments_analytics_campaign_usage_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Segment Campaign Usage Api Crm Segments Analytics
                  Campaign Usage Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/segments/analytics/overlap-analysis:
    get:
      tags:
      - CRM
      - CRM
      - Segment Analytics
      summary: Get Segment Overlap Analysis
      description: Analyze overlap between segments
      operationId: get_segment_overlap_analysis_api_crm_segments_analytics_overlap_analysis_get
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 20
          minimum: 1
          default: 10
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Segment Overlap Analysis Api Crm Segments Analytics
                  Overlap Analysis Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/visitors/analytics/overview:
    get:
      tags:
      - CRM
      - CRM
      - Visitor Analytics
      summary: Get Visitor Overview
      description: Get visitor overview metrics
      operationId: get_visitor_overview_api_crm_visitors_analytics_overview_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Visitor Overview Api Crm Visitors Analytics Overview
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/visitors/analytics/traffic-sources:
    get:
      tags:
      - CRM
      - CRM
      - Visitor Analytics
      summary: Get Traffic Sources
      description: Get visitor traffic sources
      operationId: get_traffic_sources_api_crm_visitors_analytics_traffic_sources_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Traffic Sources Api Crm Visitors Analytics Traffic
                  Sources Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/visitors/analytics/device-breakdown:
    get:
      tags:
      - CRM
      - CRM
      - Visitor Analytics
      summary: Get Device Breakdown
      description: Get visitor device breakdown
      operationId: get_device_breakdown_api_crm_visitors_analytics_device_breakdown_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Device Breakdown Api Crm Visitors Analytics Device
                  Breakdown Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/visitors/analytics/visitor-flow:
    get:
      tags:
      - CRM
      - CRM
      - Visitor Analytics
      summary: Get Visitor Flow
      description: Get visitor flow through the site
      operationId: get_visitor_flow_api_crm_visitors_analytics_visitor_flow_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Visitor Flow Api Crm Visitors Analytics Visitor
                  Flow Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/visitors/analytics/geographic-distribution:
    get:
      tags:
      - CRM
      - CRM
      - Visitor Analytics
      summary: Get Geographic Distribution
      description: Get visitor geographic distribution
      operationId: get_geographic_distribution_api_crm_visitors_analytics_geographic_distribution_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Geographic Distribution Api Crm Visitors Analytics
                  Geographic Distribution Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/visitors/analytics/trends:
    get:
      tags:
      - CRM
      - CRM
      - Visitor Analytics
      summary: Get Visitor Trends
      description: Get visitor trends over time
      operationId: get_visitor_trends_api_crm_visitors_analytics_trends_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: interval
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: day
          title: Interval
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Visitor Trends Api Crm Visitors Analytics Trends
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/forms/analytics/overview:
    get:
      tags:
      - CRM
      - CRM
      - Form Analytics
      summary: Get Form Overview
      description: Get form overview metrics
      operationId: get_form_overview_api_crm_forms_analytics_overview_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Form Overview Api Crm Forms Analytics Overview
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/forms/analytics/top-performing-forms:
    get:
      tags:
      - CRM
      - CRM
      - Form Analytics
      summary: Get Top Performing Forms
      description: Get top performing forms by submission count
      operationId: get_top_performing_forms_api_crm_forms_analytics_top_performing_forms_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 50
          minimum: 1
          default: 10
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Top Performing Forms Api Crm Forms Analytics Top
                  Performing Forms Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/forms/analytics/submission-sources:
    get:
      tags:
      - CRM
      - CRM
      - Form Analytics
      summary: Get Submission Sources
      description: Get form submission sources
      operationId: get_submission_sources_api_crm_forms_analytics_submission_sources_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Submission Sources Api Crm Forms Analytics Submission
                  Sources Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/forms/analytics/field-completion-rates:
    get:
      tags:
      - CRM
      - CRM
      - Form Analytics
      summary: Get Field Completion Rates
      description: Get field completion rates across forms
      operationId: get_field_completion_rates_api_crm_forms_analytics_field_completion_rates_get
      parameters:
      - name: form_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Form Id
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Field Completion Rates Api Crm Forms Analytics
                  Field Completion Rates Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/forms/analytics/conversion-funnel:
    get:
      tags:
      - CRM
      - CRM
      - Form Analytics
      summary: Get Conversion Funnel
      description: Get form conversion funnel metrics
      operationId: get_conversion_funnel_api_crm_forms_analytics_conversion_funnel_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Conversion Funnel Api Crm Forms Analytics Conversion
                  Funnel Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/forms/analytics/trends:
    get:
      tags:
      - CRM
      - CRM
      - Form Analytics
      summary: Get Form Trends
      description: Get form submission trends over time
      operationId: get_form_trends_api_crm_forms_analytics_trends_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: interval
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: day
          title: Interval
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Form Trends Api Crm Forms Analytics Trends Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/forms/analytics/form-performance-comparison:
    get:
      tags:
      - CRM
      - CRM
      - Form Analytics
      summary: Get Form Performance Comparison
      description: Get performance comparison between forms
      operationId: get_form_performance_comparison_api_crm_forms_analytics_form_performance_comparison_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Form Performance Comparison Api Crm Forms Analytics
                  Form Performance Comparison Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/lead-scoring/jobs/{job_id}:
    get:
      tags:
      - CRM
      - CRM
      - Lead Scoring
      summary: Get Job Status
      description: Get the status and progress of a scoring job
      operationId: get_job_status_api_crm_lead_scoring_jobs__job_id__get
      parameters:
      - name: job_id
        in: path
        required: true
        schema:
          type: string
          title: Job Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/lead-scoring/jobs:
    get:
      tags:
      - CRM
      - CRM
      - Lead Scoring
      summary: List Jobs
      description: List recent scoring jobs
      operationId: list_jobs_api_crm_lead_scoring_jobs_get
      parameters:
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by status
          title: Status
        description: Filter by status
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 50
          minimum: 1
          default: 10
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/lead-scoring/budget:
    get:
      tags:
      - CRM
      - CRM
      - Lead Scoring
      summary: Get Budget
      description: Get current budget allocation (sum of all max_scores)
      operationId: get_budget_api_crm_lead_scoring_budget_get
      parameters:
      - name: exclude_rule_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Rule ID to exclude from calculation
          title: Exclude Rule Id
        description: Rule ID to exclude from calculation
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/lead-scoring/rules:
    get:
      tags:
      - CRM
      - CRM
      - Lead Scoring
      summary: List Rules
      description: List all lead scoring rules
      operationId: list_rules_api_crm_lead_scoring_rules_get
      parameters:
      - name: enabled_only
        in: query
        required: false
        schema:
          type: boolean
          description: Only return enabled rules
          default: false
          title: Enabled Only
        description: Only return enabled rules
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - CRM
      - CRM
      - Lead Scoring
      summary: Create Rule
      description: Create a new lead scoring rule
      operationId: create_rule_api_crm_lead_scoring_rules_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRuleRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/lead-scoring/rules/{rule_id}:
    get:
      tags:
      - CRM
      - CRM
      - Lead Scoring
      summary: Get Rule
      description: Get a single lead scoring rule
      operationId: get_rule_api_crm_lead_scoring_rules__rule_id__get
      parameters:
      - name: rule_id
        in: path
        required: true
        schema:
          type: string
          title: Rule Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - CRM
      - CRM
      - Lead Scoring
      summary: Update Rule
      description: Update a lead scoring rule
      operationId: update_rule_api_crm_lead_scoring_rules__rule_id__put
      parameters:
      - name: rule_id
        in: path
        required: true
        schema:
          type: string
          title: Rule Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateRuleRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - CRM
      - CRM
      - Lead Scoring
      summary: Delete Rule
      description: Delete a lead scoring rule
      operationId: delete_rule_api_crm_lead_scoring_rules__rule_id__delete
      parameters:
      - name: rule_id
        in: path
        required: true
        schema:
          type: string
          title: Rule Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/lead-scoring/rules/reorder:
    post:
      tags:
      - CRM
      - CRM
      - Lead Scoring
      summary: Reorder Rules
      description: Reorder rules by updating their priorities
      operationId: reorder_rules_api_crm_lead_scoring_rules_reorder_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReorderRulesRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/lead-scoring/rules/{rule_id}/toggle:
    patch:
      tags:
      - CRM
      - CRM
      - Lead Scoring
      summary: Toggle Rule
      description: Enable or disable a rule
      operationId: toggle_rule_api_crm_lead_scoring_rules__rule_id__toggle_patch
      parameters:
      - name: rule_id
        in: path
        required: true
        schema:
          type: string
          title: Rule Id
      - name: enabled
        in: query
        required: true
        schema:
          type: boolean
          description: Enable or disable the rule
          title: Enabled
        description: Enable or disable the rule
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/lead-scoring/calculate/{contact_id}:
    post:
      tags:
      - CRM
      - CRM
      - Lead Scoring
      summary: Calculate Score
      description: Calculate/recalculate lead score for a specific contact
      operationId: calculate_score_api_crm_lead_scoring_calculate__contact_id__post
      parameters:
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/lead-scoring/breakdown/{contact_id}:
    get:
      tags:
      - CRM
      - CRM
      - Lead Scoring
      summary: Get Score Breakdown
      description: Get detailed breakdown of a contact's lead score
      operationId: get_score_breakdown_api_crm_lead_scoring_breakdown__contact_id__get
      parameters:
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/lead-scoring/bulk-calculate:
    post:
      tags:
      - CRM
      - CRM
      - Lead Scoring
      summary: Bulk Calculate Scores
      description: Bulk recalculate scores for multiple contacts
      operationId: bulk_calculate_scores_api_crm_lead_scoring_bulk_calculate_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkCalculateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/lead-scoring/preview:
    post:
      tags:
      - CRM
      - CRM
      - Lead Scoring
      summary: Preview Rule
      description: Preview how many contacts would match a rule configuration
      operationId: preview_rule_api_crm_lead_scoring_preview_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreviewRuleRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/lead-scoring/history/{contact_id}:
    get:
      tags:
      - CRM
      - CRM
      - Lead Scoring
      summary: Get Score History
      description: Get score change history for a contact
      operationId: get_score_history_api_crm_lead_scoring_history__contact_id__get
      parameters:
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/lead-scoring/reset/{contact_id}:
    post:
      tags:
      - CRM
      - CRM
      - Lead Scoring
      summary: Reset Contact Score
      description: Reset a contact's score and clear all applied cumulative rules
        history
      operationId: reset_contact_score_api_crm_lead_scoring_reset__contact_id__post
      parameters:
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/crm/lead-scoring/rules/{rule_id}/apply:
    post:
      tags:
      - CRM
      - CRM
      - Lead Scoring
      summary: Apply Rule To Matching Contacts
      description: Apply a specific rule to all contacts that match its conditions
      operationId: apply_rule_to_matching_contacts_api_crm_lead_scoring_rules__rule_id__apply_post
      parameters:
      - name: rule_id
        in: path
        required: true
        schema:
          type: string
          title: Rule Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApplyRuleRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/custom-fields/templates:
    get:
      tags:
      - Custom Field Templates
      - Custom Field Templates
      summary: Get Available Templates
      description: Get all available custom field templates (both simple and enhanced)
      operationId: get_available_templates_api_custom_fields_templates_get
      parameters:
      - name: template_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Template Type
      - name: entity_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Entity Type
      - name: industry
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Industry
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/custom-fields/templates/{template_id}:
    get:
      tags:
      - Custom Field Templates
      - Custom Field Templates
      summary: Get Template Details
      description: Get detailed information about a specific template
      operationId: get_template_details_api_custom_fields_templates__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/custom-fields/templates/{template_id}/apply:
    post:
      tags:
      - Custom Field Templates
      - Custom Field Templates
      summary: Apply Template
      description: Apply a template by creating the selected custom fields
      operationId: apply_template_api_custom_fields_templates__template_id__apply_post
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkCreateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/custom-fields/bulk-create:
    post:
      tags:
      - Custom Field Templates
      - Custom Field Templates
      summary: Bulk Create Custom Fields
      description: Create multiple custom fields at once (for custom templates)
      operationId: bulk_create_custom_fields_api_custom_fields_bulk_create_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/FieldTemplate'
              title: Fields
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/custom-fields/templates/{template_id}/preview:
    get:
      tags:
      - Custom Field Templates
      - Custom Field Templates
      summary: Preview Template Application
      description: Preview what would happen if a template is applied (without actually
        creating fields)
      operationId: preview_template_application_api_custom_fields_templates__template_id__preview_get
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/custom-fields/enhanced-modules/apply:
    post:
      tags:
      - Custom Field Templates
      - Custom Field Templates
      summary: Apply Enhanced Module Template
      description: 'Apply an enhanced module template to create a schema

        Integrates with existing template system but creates enhanced custom field
        schemas'
      operationId: apply_enhanced_module_template_api_custom_fields_enhanced_modules_apply_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApplyEnhancedTemplateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/custom-fields/enhanced-modules:
    get:
      tags:
      - Custom Field Templates
      - Custom Field Templates
      summary: Get Enhanced Module Templates
      description: Get enhanced module templates (integrated with existing template
        system)
      operationId: get_enhanced_module_templates_api_custom_fields_enhanced_modules_get
      parameters:
      - name: industry
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Industry
      - name: entity_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Entity Type
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/custom-fields/enhanced-modules/{template_id}:
    get:
      tags:
      - Custom Field Templates
      - Custom Field Templates
      summary: Get Enhanced Module Details
      description: Get detailed information about a specific enhanced module template
      operationId: get_enhanced_module_details_api_custom_fields_enhanced_modules__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/analytics/schema/sources:
    get:
      tags:
      - Analytics Schema
      summary: Get Data Sources
      description: Get all available data sources for analytics including integrations
      operationId: get_data_sources_api_analytics_schema_sources_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/analytics/schema/tables:
    get:
      tags:
      - Analytics Schema
      summary: Get Organization Tables
      description: Get all available tables for analytics in this organization
      operationId: get_organization_tables_api_analytics_schema_tables_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/TableSchema'
                type: array
                title: Response Get Organization Tables Api Analytics Schema Tables
                  Get
  /api/analytics/schema/tables/{table_name}:
    get:
      tags:
      - Analytics Schema
      summary: Get Table Schema
      description: Get detailed schema for a specific table including custom fields
      operationId: get_table_schema_api_analytics_schema_tables__table_name__get
      parameters:
      - name: table_name
        in: path
        required: true
        schema:
          type: string
          title: Table Name
      - name: include_row_count
        in: query
        required: false
        schema:
          type: boolean
          description: Include row count (may be slow for large tables)
          default: true
          title: Include Row Count
        description: Include row count (may be slow for large tables)
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TableSchema'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/schema/field-values/{table_name}/{field_name}:
    get:
      tags:
      - Analytics Schema
      summary: Get Field Values
      description: Get distinct values for a field (for filter dropdowns)
      operationId: get_field_values_api_analytics_schema_field_values__table_name___field_name__get
      parameters:
      - name: table_name
        in: path
        required: true
        schema:
          type: string
          title: Table Name
      - name: field_name
        in: path
        required: true
        schema:
          type: string
          title: Field Name
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 1000
          default: 100
          title: Limit
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/query/execute:
    post:
      tags:
      - Analytics Query Execution
      summary: Execute Query
      description: Execute an analytics query (visual or SQL)
      operationId: execute_query_api_analytics_query_execute_post
      parameters:
      - name: fresh
        in: query
        required: false
        schema:
          type: boolean
          description: Bypass cache and execute fresh query
          default: false
          title: Fresh
        description: Bypass cache and execute fresh query
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QueryRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryResult'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/query/validate:
    post:
      tags:
      - Analytics Query Execution
      summary: Validate Query
      description: Validate a query without executing it
      operationId: validate_query_api_analytics_query_validate_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QueryRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/query/execute-for-chart:
    post:
      tags:
      - Analytics Query Execution
      summary: Execute Query For Chart
      description: 'Execute a query with server-side aggregation for chart rendering.


        Translates chart dimensions/metrics into SQL GROUP BY + aggregation functions,

        returning pre-aggregated data instead of raw rows.'
      operationId: execute_query_for_chart_api_analytics_query_execute_for_chart_post
      parameters:
      - name: fresh
        in: query
        required: false
        schema:
          type: boolean
          description: Bypass cache and execute fresh query
          default: false
          title: Fresh
        description: Bypass cache and execute fresh query
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChartQueryRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/query/preview/{table_name}:
    get:
      tags:
      - Analytics Query Execution
      summary: Preview Table Data
      description: Get a preview of table data
      operationId: preview_table_data_api_analytics_query_preview__table_name__get
      parameters:
      - name: table_name
        in: path
        required: true
        schema:
          type: string
          title: Table Name
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          default: 10
          title: Limit
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/query/export/download:
    post:
      tags:
      - Analytics Query Execution
      summary: Export Query Download
      description: 'Synchronous CSV export - returns CSV file directly for download.

        Use this for small/medium datasets (< 5000 rows).

        For very large datasets, use /export/async instead.'
      operationId: export_query_download_api_analytics_query_export_download_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExportRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/query/export/async:
    post:
      tags:
      - Analytics Query Execution
      summary: Trigger Async Export
      description: 'Trigger async CSV export of query results.

        Download link will be sent to user''s email.


        Use this for large exports (>1000 rows) to avoid blocking the UI.'
      operationId: trigger_async_export_api_analytics_query_export_async_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__analytics__query_routes__AsyncExportRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/queries/:
    get:
      tags:
      - Analytics Saved Queries
      summary: Get Saved Queries
      description: Get all accessible saved queries for the user
      operationId: get_saved_queries_api_analytics_queries__get
      parameters:
      - name: shared_only
        in: query
        required: false
        schema:
          type: boolean
          description: Get only shared queries
          default: false
          title: Shared Only
        description: Get only shared queries
      - name: my_queries_only
        in: query
        required: false
        schema:
          type: boolean
          description: Get only user's own queries
          default: false
          title: My Queries Only
        description: Get only user's own queries
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SavedQuery'
                title: Response Get Saved Queries Api Analytics Queries  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Analytics Saved Queries
      summary: Create Saved Query
      description: Create a new saved query
      operationId: create_saved_query_api_analytics_queries__post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SavedQueryCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SavedQuery'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/queries/{query_id}:
    get:
      tags:
      - Analytics Saved Queries
      summary: Get Saved Query
      description: Get a specific saved query by ID
      operationId: get_saved_query_api_analytics_queries__query_id__get
      parameters:
      - name: query_id
        in: path
        required: true
        schema:
          type: string
          title: Query Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SavedQuery'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Analytics Saved Queries
      summary: Update Saved Query
      description: Update an existing saved query
      operationId: update_saved_query_api_analytics_queries__query_id__put
      parameters:
      - name: query_id
        in: path
        required: true
        schema:
          type: string
          title: Query Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SavedQueryUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SavedQuery'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Analytics Saved Queries
      summary: Delete Saved Query
      description: Delete a saved query (and all its associated charts)
      operationId: delete_saved_query_api_analytics_queries__query_id__delete
      parameters:
      - name: query_id
        in: path
        required: true
        schema:
          type: string
          title: Query Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/queries/{query_id}/duplicate:
    post:
      tags:
      - Analytics Saved Queries
      summary: Duplicate Saved Query
      description: Duplicate an existing saved query
      operationId: duplicate_saved_query_api_analytics_queries__query_id__duplicate_post
      parameters:
      - name: query_id
        in: path
        required: true
        schema:
          type: string
          title: Query Id
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_duplicate_saved_query_api_analytics_queries__query_id__duplicate_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SavedQuery'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/charts/:
    get:
      tags:
      - Analytics Charts
      summary: Get Charts
      description: Get all accessible charts for the user
      operationId: get_charts_api_analytics_charts__get
      parameters:
      - name: query_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by specific query ID
          title: Query Id
        description: Filter by specific query ID
      - name: shared_only
        in: query
        required: false
        schema:
          type: boolean
          description: Get only shared charts
          default: false
          title: Shared Only
        description: Get only shared charts
      - name: my_charts_only
        in: query
        required: false
        schema:
          type: boolean
          description: Get only user's own charts
          default: false
          title: My Charts Only
        description: Get only user's own charts
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Chart'
                title: Response Get Charts Api Analytics Charts  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Analytics Charts
      summary: Create Chart
      description: Create a new chart from a saved query (query optional for text
        widgets)
      operationId: create_chart_api_analytics_charts__post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChartCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Chart'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/charts/{chart_id}:
    get:
      tags:
      - Analytics Charts
      summary: Get Chart
      description: Get a specific chart by ID with its source query
      operationId: get_chart_api_analytics_charts__chart_id__get
      parameters:
      - name: chart_id
        in: path
        required: true
        schema:
          type: string
          title: Chart Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Chart'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Analytics Charts
      summary: Update Chart
      description: Update an existing chart
      operationId: update_chart_api_analytics_charts__chart_id__put
      parameters:
      - name: chart_id
        in: path
        required: true
        schema:
          type: string
          title: Chart Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChartUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Chart'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Analytics Charts
      summary: Delete Chart
      description: Delete a chart
      operationId: delete_chart_api_analytics_charts__chart_id__delete
      parameters:
      - name: chart_id
        in: path
        required: true
        schema:
          type: string
          title: Chart Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/charts/by-query/{query_id}:
    get:
      tags:
      - Analytics Charts
      summary: Get Charts By Query
      description: Get all charts that visualize a specific query
      operationId: get_charts_by_query_api_analytics_charts_by_query__query_id__get
      parameters:
      - name: query_id
        in: path
        required: true
        schema:
          type: string
          title: Query Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Chart'
                title: Response Get Charts By Query Api Analytics Charts By Query  Query
                  Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/dashboards/:
    get:
      tags:
      - Analytics Dashboards
      summary: Get Dashboards
      description: Get all accessible dashboards for the user
      operationId: get_dashboards_api_analytics_dashboards__get
      parameters:
      - name: shared_only
        in: query
        required: false
        schema:
          type: boolean
          description: Get only shared dashboards
          default: false
          title: Shared Only
        description: Get only shared dashboards
      - name: my_dashboards_only
        in: query
        required: false
        schema:
          type: boolean
          description: Get only user's own dashboards
          default: false
          title: My Dashboards Only
        description: Get only user's own dashboards
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Dashboard'
                title: Response Get Dashboards Api Analytics Dashboards  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Analytics Dashboards
      summary: Create Dashboard
      description: Create a new analytics dashboard
      operationId: create_dashboard_api_analytics_dashboards__post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DashboardCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Dashboard'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/dashboards/{dashboard_id}:
    get:
      tags:
      - Analytics Dashboards
      summary: Get Dashboard
      description: Get a specific dashboard with its reports
      operationId: get_dashboard_api_analytics_dashboards__dashboard_id__get
      parameters:
      - name: dashboard_id
        in: path
        required: true
        schema:
          type: string
          title: Dashboard Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DashboardWithCharts'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Analytics Dashboards
      summary: Update Dashboard
      description: Update an existing dashboard
      operationId: update_dashboard_api_analytics_dashboards__dashboard_id__put
      parameters:
      - name: dashboard_id
        in: path
        required: true
        schema:
          type: string
          title: Dashboard Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DashboardUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Dashboard'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Analytics Dashboards
      summary: Delete Dashboard
      description: Delete a dashboard
      operationId: delete_dashboard_api_analytics_dashboards__dashboard_id__delete
      parameters:
      - name: dashboard_id
        in: path
        required: true
        schema:
          type: string
          title: Dashboard Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/dashboards/{dashboard_id}/with-data:
    get:
      tags:
      - Analytics Dashboards
      summary: Get Dashboard With Data
      description: 'Get a dashboard with pre-fetched chart data and optional filtering.


        Loads the dashboard, groups charts by query_id, executes each unique query

        once (with caching), applies each chart''s aggregation config server-side,

        and returns everything in a single response.


        Date filtering:

        - If date_preset is provided, it''s resolved to start/end dates

        - If date_start/date_end are provided, they''re used directly (for custom
        ranges)

        - Each chart''s filter_mappings in layout determines which date column to
        filter on

        - Charts without date column mappings are not affected by the date filter


        Generic filters:

        - If filters is provided, parse as JSON and apply to charts based on their
        control mappings

        - Each control in dashboard.filters.controls has an ID

        - Each chart''s filter_mappings[controlId].column specifies which column to
        filter'
      operationId: get_dashboard_with_data_api_analytics_dashboards__dashboard_id__with_data_get
      parameters:
      - name: dashboard_id
        in: path
        required: true
        schema:
          type: string
          title: Dashboard Id
      - name: fresh
        in: query
        required: false
        schema:
          type: boolean
          description: Bypass cache and execute fresh queries
          default: false
          title: Fresh
        description: Bypass cache and execute fresh queries
      - name: date_preset
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Date preset like 'last_30_days', 'this_month', etc.
          title: Date Preset
        description: Date preset like 'last_30_days', 'this_month', etc.
      - name: date_start
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom start date (YYYY-MM-DD)
          title: Date Start
        description: Custom start date (YYYY-MM-DD)
      - name: date_end
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Custom end date (YYYY-MM-DD)
          title: Date End
        description: Custom end date (YYYY-MM-DD)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Generic filter values as JSON: {controlId: value}'
          title: Filters
        description: 'Generic filter values as JSON: {controlId: value}'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/dashboards/{dashboard_id}/charts/{chart_id}:
    post:
      tags:
      - Analytics Dashboards
      summary: Add Chart To Dashboard
      description: 'Add a chart to a dashboard with optional filter mapping.


        Body parameters:

        - date_column: Column name to use for dashboard date filter (e.g., ''created_at'')

        - acknowledged_no_date: True if user acknowledged chart has no date column

        - position: Initial grid position {x, y}

        - size: Initial size {width, height}'
      operationId: add_chart_to_dashboard_api_analytics_dashboards__dashboard_id__charts__chart_id__post
      parameters:
      - name: dashboard_id
        in: path
        required: true
        schema:
          type: string
          title: Dashboard Id
      - name: chart_id
        in: path
        required: true
        schema:
          type: string
          title: Chart Id
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
              - $ref: '#/components/schemas/AddChartRequest'
              - type: 'null'
              title: Body
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Analytics Dashboards
      summary: Remove Chart From Dashboard
      description: Remove a chart from a dashboard (also removes its filter mapping)
      operationId: remove_chart_from_dashboard_api_analytics_dashboards__dashboard_id__charts__chart_id__delete
      parameters:
      - name: dashboard_id
        in: path
        required: true
        schema:
          type: string
          title: Dashboard Id
      - name: chart_id
        in: path
        required: true
        schema:
          type: string
          title: Chart Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/dashboards/{dashboard_id}/charts/{chart_id}/mapping:
    put:
      tags:
      - Analytics Dashboards
      summary: Update Chart Filter Mapping
      description: Update a chart's filter mapping in a dashboard
      operationId: update_chart_filter_mapping_api_analytics_dashboards__dashboard_id__charts__chart_id__mapping_put
      parameters:
      - name: dashboard_id
        in: path
        required: true
        schema:
          type: string
          title: Dashboard Id
      - name: chart_id
        in: path
        required: true
        schema:
          type: string
          title: Chart Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateChartMappingRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/dashboards/{dashboard_id}/filters:
    put:
      tags:
      - Analytics Dashboards
      summary: Update Dashboard Filters
      description: Update dashboard filter configuration
      operationId: update_dashboard_filters_api_analytics_dashboards__dashboard_id__filters_put
      parameters:
      - name: dashboard_id
        in: path
        required: true
        schema:
          type: string
          title: Dashboard Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DashboardFiltersUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/dashboards/{dashboard_id}/filter-options/{control_id}:
    get:
      tags:
      - Analytics Dashboards
      summary: Get Filter Control Options
      description: 'Get distinct values for a filter control.


        Fetches distinct values from all charts mapped to this control.

        Returns a sorted list of unique options.'
      operationId: get_filter_control_options_api_analytics_dashboards__dashboard_id__filter_options__control_id__get
      parameters:
      - name: dashboard_id
        in: path
        required: true
        schema:
          type: string
          title: Dashboard Id
      - name: control_id
        in: path
        required: true
        schema:
          type: string
          title: Control Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/upload-file:
    post:
      tags:
      - Analytics File Upload
      summary: Upload Analytics File
      description: "Upload Excel/CSV file and create queryable analytics table\n\n\
        Args:\n    file: Excel or CSV file (max 5MB, 1000 rows)\n    display_name:\
        \ User-friendly name for the table\n    expires_days: Days until table expires\
        \ (7-30, default 7)\n    sheet_name: Excel sheet name (optional)\n    \nReturns:\n\
        \    Table creation result with metadata"
      operationId: upload_analytics_file_api_analytics_upload_file_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_analytics_file_api_analytics_upload_file_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/temp-tables:
    get:
      tags:
      - Analytics File Upload
      summary: Get Temp Tables
      description: Get all temporary analytics tables for the current user
      operationId: get_temp_tables_api_analytics_temp_tables_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/temp-tables/{table_id}:
    delete:
      tags:
      - Analytics File Upload
      summary: Delete Temp Table
      description: Delete a temporary analytics table
      operationId: delete_temp_table_api_analytics_temp_tables__table_id__delete
      parameters:
      - name: table_id
        in: path
        required: true
        schema:
          type: string
          title: Table Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/temp-tables/{table_id}/promote:
    put:
      tags:
      - Analytics File Upload
      summary: Promote Temp Table
      description: Promote temporary table to permanent (remove expiry)
      operationId: promote_temp_table_api_analytics_temp_tables__table_id__promote_put
      parameters:
      - name: table_id
        in: path
        required: true
        schema:
          type: string
          title: Table Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/temp-tables/{table_id}/preview:
    get:
      tags:
      - Analytics File Upload
      summary: Get Table Preview
      description: Get preview of temporary table data
      operationId: get_table_preview_api_analytics_temp_tables__table_id__preview_get
      parameters:
      - name: table_id
        in: path
        required: true
        schema:
          type: string
          title: Table Id
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 10
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/cleanup-expired:
    post:
      tags:
      - Analytics File Upload
      summary: Cleanup Expired Tables
      description: 'Manually trigger cleanup of expired analytics tables

        (Normally handled by scheduled job)'
      operationId: cleanup_expired_tables_api_analytics_cleanup_expired_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/google-sheets/list:
    get:
      tags:
      - Analytics File Upload
      summary: List Google Sheets
      description: List available Google Sheets for import
      operationId: list_google_sheets_api_analytics_google_sheets_list_get
      parameters:
      - name: integration_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/google-sheets/{spreadsheet_id}/sheets:
    get:
      tags:
      - Analytics File Upload
      summary: Get Spreadsheet Sheets
      description: Get list of sheets in a Google Spreadsheet
      operationId: get_spreadsheet_sheets_api_analytics_google_sheets__spreadsheet_id__sheets_get
      parameters:
      - name: spreadsheet_id
        in: path
        required: true
        schema:
          type: string
          title: Spreadsheet Id
      - name: integration_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/google-sheets/{spreadsheet_id}/preview:
    get:
      tags:
      - Analytics File Upload
      summary: Preview Google Sheet
      description: Preview Google Sheet data before import
      operationId: preview_google_sheet_api_analytics_google_sheets__spreadsheet_id__preview_get
      parameters:
      - name: spreadsheet_id
        in: path
        required: true
        schema:
          type: string
          title: Spreadsheet Id
      - name: sheet_name
        in: query
        required: false
        schema:
          type: string
          default: Sheet1
          title: Sheet Name
      - name: range_name
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Range Name
      - name: integration_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/google-sheets/import:
    post:
      tags:
      - Analytics File Upload
      summary: Import Google Sheet
      description: Import Google Sheet data into an analytics table
      operationId: import_google_sheet_api_analytics_google_sheets_import_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GoogleSheetImportRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/temp-tables/{table_id}/refresh:
    post:
      tags:
      - Analytics File Upload
      summary: Refresh From Google Sheet
      description: Refresh analytics table from its Google Sheets source
      operationId: refresh_from_google_sheet_api_analytics_temp_tables__table_id__refresh_post
      parameters:
      - name: table_id
        in: path
        required: true
        schema:
          type: string
          title: Table Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/transform/preview-with-transforms:
    post:
      tags:
      - Analytics Transformations
      summary: Preview With Transforms
      description: 'Execute a query with transformations applied.


        Merges the transformation filters into the base query config and executes.

        Returns the filtered results along with metadata.'
      operationId: preview_with_transforms_api_analytics_transform_preview_with_transforms_post
      parameters:
      - name: fresh
        in: query
        required: false
        schema:
          type: boolean
          description: Bypass cache and execute fresh query
          default: false
          title: Fresh
        description: Bypass cache and execute fresh query
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreviewWithTransformsRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/transform/merge-to-query/{query_id}:
    post:
      tags:
      - Analytics Transformations
      summary: Merge Transforms To Query
      description: 'Merge transformations into a saved query.


        Can either update the existing query or create a new one (if create_copy=True).

        Transforms are baked into the query_config''s filters array.'
      operationId: merge_transforms_to_query_api_analytics_transform_merge_to_query__query_id__post
      parameters:
      - name: query_id
        in: path
        required: true
        schema:
          type: string
          title: Query Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MergeToQueryRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/transform/validate-transform:
    post:
      tags:
      - Analytics Transformations
      summary: Validate Transformation
      description: 'Validate a transformation against available columns.


        Checks if the column exists and the operator is valid for the operation.'
      operationId: validate_transformation_api_analytics_transform_validate_transform_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ValidateTransformRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/transform/build-where-clause:
    post:
      tags:
      - Analytics Transformations
      summary: Build Where Clause
      description: 'Build a SQL WHERE clause from filter configuration.


        Useful for debugging and understanding how filters translate to SQL.

        Returns the clause and parameters (without executing).'
      operationId: build_where_clause_api_analytics_transform_build_where_clause_post
      parameters:
      - name: table_alias
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Table alias to prefix column names
          title: Table Alias
        description: Table alias to prefix column names
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransformFilterConfig'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/schemas/:
    get:
      tags:
      - My Space
      - my-space
      - schemas
      summary: Get Schemas
      description: Get all custom field schemas for the organization, optionally filtered
        by entity type
      operationId: get_schemas_api_my_space_schemas__get
      parameters:
      - name: entity_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            pattern: ^(contacts|deals|companies|tasks)$
          - type: 'null'
          title: Entity Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SchemaResponse'
                title: Response Get Schemas Api My Space Schemas  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - My Space
      - my-space
      - schemas
      summary: Create Schema
      description: Create a new custom field schema
      operationId: create_schema_api_my_space_schemas__post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSchemaRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SchemaResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/schemas/{schema_id}:
    get:
      tags:
      - My Space
      - my-space
      - schemas
      summary: Get Schema Details
      description: Get detailed information about a specific schema including fields
      operationId: get_schema_details_api_my_space_schemas__schema_id__get
      parameters:
      - name: schema_id
        in: path
        required: true
        schema:
          type: string
          title: Schema Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - My Space
      - my-space
      - schemas
      summary: Update Schema
      description: Update a custom field schema
      operationId: update_schema_api_my_space_schemas__schema_id__put
      parameters:
      - name: schema_id
        in: path
        required: true
        schema:
          type: string
          title: Schema Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSchemaRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SchemaResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - My Space
      - my-space
      - schemas
      summary: Delete Schema
      description: Delete a custom field schema
      operationId: delete_schema_api_my_space_schemas__schema_id__delete
      parameters:
      - name: schema_id
        in: path
        required: true
        schema:
          type: string
          title: Schema Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/schemas/analytics/overview:
    get:
      tags:
      - My Space
      - my-space
      - schemas
      summary: Get Analytics Overview
      description: Get usage analytics overview for My Space
      operationId: get_analytics_overview_api_my_space_schemas_analytics_overview_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/schemas/field-types:
    get:
      tags:
      - My Space
      - my-space
      - schemas
      summary: Get Field Types
      description: Get available field types for schema creation
      operationId: get_field_types_api_my_space_schemas_field_types_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/my-space/schemas/entity-types:
    get:
      tags:
      - My Space
      - my-space
      - schemas
      summary: Get Entity Types
      description: Get available entity types for schema creation
      operationId: get_entity_types_api_my_space_schemas_entity_types_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/my-space/schemas/suggestions:
    get:
      tags:
      - My Space
      - my-space
      - schemas
      summary: Get Schema Suggestions
      description: Get schema suggestions based on partial name input
      operationId: get_schema_suggestions_api_my_space_schemas_suggestions_get
      parameters:
      - name: name
        in: query
        required: true
        schema:
          type: string
          minLength: 2
          title: Name
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/schemas/validate-name:
    post:
      tags:
      - My Space
      - my-space
      - schemas
      summary: Validate Schema Name
      description: Validate a schema name for uniqueness and format
      operationId: validate_schema_name_api_my_space_schemas_validate_name_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties:
                type: string
              title: Name Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/schemas/{schema_id}/fields:
    put:
      tags:
      - My Space
      - my-space
      - schemas
      summary: Update Schema Fields
      description: Update fields for an existing schema
      operationId: update_schema_fields_api_my_space_schemas__schema_id__fields_put
      parameters:
      - name: schema_id
        in: path
        required: true
        schema:
          type: string
          title: Schema Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/FieldDefinition'
              title: Fields Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/data/{schema_name}:
    get:
      tags:
      - My Space
      - my-space
      - schema-data
      summary: Get Schema Data
      description: Get paginated data for a specific schema with filtering and search
      operationId: get_schema_data_api_my_space_data__schema_name__get
      parameters:
      - name: schema_name
        in: path
        required: true
        schema:
          type: string
          title: Schema Name
      - name: entity_type
        in: query
        required: true
        schema:
          type: string
          pattern: ^(contacts|deals|companies|tasks)$
          title: Entity Type
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          default: 0
          title: Offset
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 1000
          minimum: 1
          default: 50
          title: Limit
      - name: sort_by
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Sort By
      - name: sort_order
        in: query
        required: false
        schema:
          type: string
          pattern: ^(asc|desc)$
          default: desc
          title: Sort Order
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - My Space
      - my-space
      - schema-data
      summary: Create Schema Record
      description: Create a new record in an enhanced custom field
      operationId: create_schema_record_api_my_space_data__schema_name__post
      parameters:
      - name: schema_name
        in: path
        required: true
        schema:
          type: string
          title: Schema Name
      - name: entity_type
        in: query
        required: true
        schema:
          type: string
          pattern: ^(contacts|deals|companies|tasks)$
          title: Entity Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRecordRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/data/{schema_name}/{record_id}:
    put:
      tags:
      - My Space
      - my-space
      - schema-data
      summary: Update Schema Record
      description: Update a record in an enhanced custom field
      operationId: update_schema_record_api_my_space_data__schema_name___record_id__put
      parameters:
      - name: schema_name
        in: path
        required: true
        schema:
          type: string
          title: Schema Name
      - name: record_id
        in: path
        required: true
        schema:
          type: string
          title: Record Id
      - name: entity_type
        in: query
        required: true
        schema:
          type: string
          pattern: ^(contacts|deals|companies|tasks)$
          title: Entity Type
      - name: entity_id
        in: query
        required: true
        schema:
          type: string
          description: ID of the entity containing the record
          title: Entity Id
        description: ID of the entity containing the record
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateRecordRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - My Space
      - my-space
      - schema-data
      summary: Delete Schema Record
      description: Delete a record from an enhanced custom field
      operationId: delete_schema_record_api_my_space_data__schema_name___record_id__delete
      parameters:
      - name: schema_name
        in: path
        required: true
        schema:
          type: string
          title: Schema Name
      - name: record_id
        in: path
        required: true
        schema:
          type: string
          title: Record Id
      - name: entity_type
        in: query
        required: true
        schema:
          type: string
          pattern: ^(contacts|deals|companies|tasks)$
          title: Entity Type
      - name: entity_id
        in: query
        required: true
        schema:
          type: string
          description: ID of the entity containing the record
          title: Entity Id
        description: ID of the entity containing the record
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/data/{schema_name}/bulk:
    post:
      tags:
      - My Space
      - my-space
      - schema-data
      summary: Create Bulk Records
      description: Create multiple records in an enhanced custom field
      operationId: create_bulk_records_api_my_space_data__schema_name__bulk_post
      parameters:
      - name: schema_name
        in: path
        required: true
        schema:
          type: string
          title: Schema Name
      - name: entity_type
        in: query
        required: true
        schema:
          type: string
          pattern: ^(contacts|deals|companies|tasks)$
          title: Entity Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkRecordRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/data/{schema_name}/export:
    get:
      tags:
      - My Space
      - my-space
      - schema-data
      summary: Export Schema Data
      description: Export all data for a schema
      operationId: export_schema_data_api_my_space_data__schema_name__export_get
      parameters:
      - name: schema_name
        in: path
        required: true
        schema:
          type: string
          title: Schema Name
      - name: entity_type
        in: query
        required: true
        schema:
          type: string
          pattern: ^(contacts|deals|companies|tasks)$
          title: Entity Type
      - name: format
        in: query
        required: false
        schema:
          type: string
          pattern: ^(csv|json)$
          default: csv
          title: Format
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/data/entity/{entity_id}:
    get:
      tags:
      - My Space
      - my-space
      - schema-data
      summary: Get Entity Enhanced Fields
      description: Get all enhanced custom fields for a specific entity
      operationId: get_entity_enhanced_fields_api_my_space_data_entity__entity_id__get
      parameters:
      - name: entity_id
        in: path
        required: true
        schema:
          type: string
          title: Entity Id
      - name: entity_type
        in: query
        required: true
        schema:
          type: string
          pattern: ^(contacts|deals|companies|tasks)$
          title: Entity Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/data/validate-record:
    post:
      tags:
      - My Space
      - my-space
      - schema-data
      summary: Validate Record Data
      description: Validate record data against a schema without creating it
      operationId: validate_record_data_api_my_space_data_validate_record_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Validation Request
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/templates/:
    get:
      tags:
      - My Space
      - my-space
      - templates
      summary: Get Templates
      description: Get available templates for schema creation
      operationId: get_templates_api_my_space_templates__get
      parameters:
      - name: industry
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by industry
          title: Industry
        description: Filter by industry
      - name: entity_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            pattern: ^(contacts|deals|companies|tasks)$
          - type: 'null'
          title: Entity Type
      - name: popular_only
        in: query
        required: false
        schema:
          type: boolean
          description: Only return popular templates
          default: false
          title: Popular Only
        description: Only return popular templates
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/routes__my_space__template_routes__TemplateResponse'
                title: Response Get Templates Api My Space Templates  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/templates/{template_id}:
    get:
      tags:
      - My Space
      - my-space
      - templates
      summary: Get Template Details
      description: Get detailed information about a specific template including fields
      operationId: get_template_details_api_my_space_templates__template_id__get
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/templates/apply:
    post:
      tags:
      - My Space
      - my-space
      - templates
      summary: Apply Template
      description: Apply a template to create a new schema for the organization
      operationId: apply_template_api_my_space_templates_apply_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__my_space__template_routes__ApplyTemplateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/templates/industries/list:
    get:
      tags:
      - My Space
      - my-space
      - templates
      summary: Get Industries
      description: Get all available industries with template counts
      operationId: get_industries_api_my_space_templates_industries_list_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/templates/search:
    get:
      tags:
      - My Space
      - my-space
      - templates
      summary: Search Templates
      description: Search templates by name or description
      operationId: search_templates_api_my_space_templates_search_get
      parameters:
      - name: q
        in: query
        required: true
        schema:
          type: string
          minLength: 2
          description: Search term
          title: Q
        description: Search term
      - name: industry
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by industry
          title: Industry
        description: Filter by industry
      - name: entity_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            pattern: ^(contacts|deals|companies|tasks)$
          - type: 'null'
          title: Entity Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/templates/preview/{template_id}:
    get:
      tags:
      - My Space
      - my-space
      - templates
      summary: Preview Template
      description: Get a preview of what a template will create
      operationId: preview_template_api_my_space_templates_preview__template_id__get
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/templates/recommendations/{entity_type}:
    get:
      tags:
      - My Space
      - my-space
      - templates
      summary: Get Template Recommendations
      description: Get recommended templates for a specific entity type
      operationId: get_template_recommendations_api_my_space_templates_recommendations__entity_type__get
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: industry
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: User's industry for better recommendations
          title: Industry
        description: User's industry for better recommendations
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/my-space/templates/quick-start/{industry}:
    get:
      tags:
      - My Space
      - my-space
      - templates
      summary: Get Quick Start Bundle
      description: Get a quick start bundle of recommended templates for an industry
      operationId: get_quick_start_bundle_api_my_space_templates_quick_start__industry__get
      parameters:
      - name: industry
        in: path
        required: true
        schema:
          type: string
          title: Industry
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/permissions:
    get:
      tags:
      - Integrations
      summary: Get Integration Permissions
      description: 'Get the org''s custom integration permissions.

        Returns which categories the org can add custom integrations for.'
      operationId: get_integration_permissions_api_integrations_permissions_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/types:
    get:
      tags:
      - Integrations
      summary: Get Supported Integration Types
      description: Get list of supported integration types
      operationId: get_supported_integration_types_api_integrations_types_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/integrations/types/{integration_type}/template:
    get:
      tags:
      - Integrations
      summary: Get Integration Template
      description: Get configuration template for a specific integration type
      operationId: get_integration_template_api_integrations_types__integration_type__template_get
      parameters:
      - name: integration_type
        in: path
        required: true
        schema:
          type: string
          title: Integration Type
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/templates:
    get:
      tags:
      - Integrations
      summary: Get All Integration Templates
      description: Get all integration templates grouped by category
      operationId: get_all_integration_templates_api_integrations_templates_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/integrations:
    get:
      tags:
      - Integrations
      summary: List Integrations
      description: List all integrations for the organization (sensitive fields are
        masked)
      operationId: list_integrations_api_integrations_get
      parameters:
      - name: integration_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by integration type
          title: Integration Type
        description: Filter by integration type
      - name: active_only
        in: query
        required: false
        schema:
          type: boolean
          description: Only return active integrations
          default: true
          title: Active Only
        description: Only return active integrations
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Integrations
      summary: Create Integration
      description: Create a new integration
      operationId: create_integration_api_integrations_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IntegrationCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/by-category:
    get:
      tags:
      - Integrations
      summary: List Integrations By Category
      description: List all integrations grouped by category with default behavior
        info (sensitive fields are masked)
      operationId: list_integrations_by_category_api_integrations_by_category_get
      parameters:
      - name: active_only
        in: query
        required: false
        schema:
          type: boolean
          description: Only return active integrations
          default: true
          title: Active Only
        description: Only return active integrations
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/{integration_id}:
    get:
      tags:
      - Integrations
      summary: Get Integration
      description: Get a specific integration (sensitive fields are masked)
      operationId: get_integration_api_integrations__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: for_edit
        in: query
        required: false
        schema:
          type: boolean
          description: If true, returns full config for editing (sensitive fields
            still masked but non-sensitive preserved)
          default: false
          title: For Edit
        description: If true, returns full config for editing (sensitive fields still
          masked but non-sensitive preserved)
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Integrations
      summary: Update Integration
      description: Update an existing integration
      operationId: update_integration_api_integrations__integration_id__put
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__integrations__integration_routes__IntegrationUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Integrations
      summary: Delete Integration
      description: Delete an integration
      operationId: delete_integration_api_integrations__integration_id__delete
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/{integration_id}/set-default:
    post:
      tags:
      - Integrations
      summary: Set Default Integration
      description: Set an integration as the default for its type
      operationId: set_default_integration_api_integrations__integration_id__set_default_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/{integration_id}/test-connection:
    post:
      tags:
      - Integrations
      summary: Test Integration Connection
      description: Test the connection for an integration
      operationId: test_integration_connection_api_integrations__integration_id__test_connection_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/{integration_id}/test-call:
    post:
      tags:
      - Integrations
      summary: Test Integration Call
      description: Make a test call using a voice integration
      operationId: test_integration_call_api_integrations__integration_id__test_call_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestCallRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/{integration_id}/activate:
    post:
      tags:
      - Integrations
      summary: Activate Integration
      description: Activate an integration
      operationId: activate_integration_api_integrations__integration_id__activate_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/{integration_id}/deactivate:
    post:
      tags:
      - Integrations
      summary: Deactivate Integration
      description: Deactivate an integration
      operationId: deactivate_integration_api_integrations__integration_id__deactivate_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/default/{integration_type}:
    get:
      tags:
      - Integrations
      summary: Get Default Integration
      description: Get the default integration of a specific type (sensitive fields
        are masked)
      operationId: get_default_integration_api_integrations_default__integration_type__get
      parameters:
      - name: integration_type
        in: path
        required: true
        schema:
          type: string
          title: Integration Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/credentials/{integration_type}:
    get:
      tags:
      - Integrations
      summary: Get Integration Credentials
      description: Get credentials for a specific integration type (for internal use)
      operationId: get_integration_credentials_api_integrations_credentials__integration_type__get
      parameters:
      - name: integration_type
        in: path
        required: true
        schema:
          type: string
          title: Integration Type
      - name: use_default
        in: query
        required: false
        schema:
          type: boolean
          description: Use default integration for this type
          default: true
          title: Use Default
        description: Use default integration for this type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/{integration_id}/sync-templates:
    post:
      tags:
      - Integrations
      summary: Sync Integration Templates
      description: Sync templates from external integration (supports WhatsApp, WATI,
        Gupshup)
      operationId: sync_integration_templates_api_integrations__integration_id__sync_templates_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/{integration_id}/tableau/datasources:
    get:
      tags:
      - Integrations
      summary: Get Tableau Datasources
      description: Get available datasources from a Tableau integration
      operationId: get_tableau_datasources_api_integrations__integration_id__tableau_datasources_get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/{integration_id}/tableau/datasource/{datasource_id}/schema:
    get:
      tags:
      - Integrations
      summary: Get Tableau Datasource Schema
      description: Get schema information for a Tableau datasource
      operationId: get_tableau_datasource_schema_api_integrations__integration_id__tableau_datasource__datasource_id__schema_get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: datasource_id
        in: path
        required: true
        schema:
          type: string
          title: Datasource Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/{integration_id}/tableau/datasource/{datasource_id}/test-query:
    post:
      tags:
      - Integrations
      summary: Test Tableau Query
      description: Test a SQL query against Tableau datasource (without VizQL execution)
      operationId: test_tableau_query_api_integrations__integration_id__tableau_datasource__datasource_id__test_query_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: datasource_id
        in: path
        required: true
        schema:
          type: string
          title: Datasource Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/debug/tableau/test-query:
    post:
      tags:
      - Integrations
      summary: Debug Test Tableau Query
      description: Debug endpoint to test Tableau queries without authentication (for
        development only)
      operationId: debug_test_tableau_query_api_integrations_debug_tableau_test_query_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/integrations/debug/tableau/test-vizql:
    post:
      tags:
      - Integrations
      summary: Debug Test Vizql Query
      description: Debug endpoint to test VizQL queries and capture exact errors for
        Tableau team
      operationId: debug_test_vizql_query_api_integrations_debug_tableau_test_vizql_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/integrations/{integration_id}/domains:
    get:
      tags:
      - Integrations
      summary: Get Resend Domains
      description: Get all domains configured for a Resend integration from database
      operationId: get_resend_domains_api_integrations__integration_id__domains_get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Integrations
      summary: Add Resend Domain
      description: Add a new domain to a Resend integration
      operationId: add_resend_domain_api_integrations__integration_id__domains_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddDomainRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/{integration_id}/domains/{domain_id}/verify:
    post:
      tags:
      - Integrations
      summary: Verify Resend Domain
      description: Verify DNS records for a Resend domain
      operationId: verify_resend_domain_api_integrations__integration_id__domains__domain_id__verify_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: domain_id
        in: path
        required: true
        schema:
          type: string
          title: Domain Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/{integration_id}/domains/{domain_id}:
    delete:
      tags:
      - Integrations
      summary: Delete Resend Domain
      description: Delete a domain from both Resend API and database
      operationId: delete_resend_domain_api_integrations__integration_id__domains__domain_id__delete
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: domain_id
        in: path
        required: true
        schema:
          type: string
          title: Domain Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/{integration_id}/from-name:
    put:
      tags:
      - Integrations
      summary: Update From Name
      description: Update from_name for a Resend integration. Uses raw SQL for managed
        integrations to bypass trigger.
      operationId: update_from_name_api_integrations__integration_id__from_name_put
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FromNameUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/{integration_id}/domains/{domain}/emails:
    get:
      tags:
      - Integrations
      summary: Get Domain Emails
      description: Get all email addresses configured for a domain
      operationId: get_domain_emails_api_integrations__integration_id__domains__domain__emails_get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: domain
        in: path
        required: true
        schema:
          type: string
          title: Domain
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Integrations
      summary: Add Domain Email
      description: Add a new email address for a domain
      operationId: add_domain_email_api_integrations__integration_id__domains__domain__emails_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: domain
        in: path
        required: true
        schema:
          type: string
          title: Domain
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DomainEmailAddress'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/{integration_id}/domains/{domain}/emails/{email_id}:
    put:
      tags:
      - Integrations
      summary: Update Domain Email
      description: Update an email address (mainly for setting default)
      operationId: update_domain_email_api_integrations__integration_id__domains__domain__emails__email_id__put
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: domain
        in: path
        required: true
        schema:
          type: string
          title: Domain
      - name: email_id
        in: path
        required: true
        schema:
          type: string
          title: Email Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DomainEmailAddress'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Integrations
      summary: Delete Domain Email
      description: Delete an email address
      operationId: delete_domain_email_api_integrations__integration_id__domains__domain__emails__email_id__delete
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: domain
        in: path
        required: true
        schema:
          type: string
          title: Domain
      - name: email_id
        in: path
        required: true
        schema:
          type: string
          title: Email Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/image-generation/models:
    get:
      tags:
      - Integrations
      summary: Get Image Generation Models
      description: 'Get available image generation models from provider_models table.


        Used by ImageGenerationNode to populate the model dropdown dynamically.'
      operationId: get_image_generation_models_api_integrations_image_generation_models_get
      parameters:
      - name: provider
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by provider (OpenAI, Google)
          title: Provider
        description: Filter by provider (OpenAI, Google)
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/vision/models:
    get:
      tags:
      - Integrations
      summary: Get Vision Models
      description: 'Get available vision-capable LLM models from provider_models table.


        Used by ImageAnalysisNode to populate the model dropdown dynamically.

        Filters LLM models to only return those with vision capabilities.'
      operationId: get_vision_models_api_integrations_vision_models_get
      parameters:
      - name: provider
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by provider (OpenAI, Google)
          title: Provider
        description: Filter by provider (OpenAI, Google)
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/slack/test-connection:
    post:
      tags:
      - Slack
      summary: Test Slack Connection
      description: Test Slack connection using stored integration credentials
      operationId: test_slack_connection_api_slack_test_connection_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SlackTestConnectionRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Test Slack Connection Api Slack Test Connection Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/slack/send-message:
    post:
      tags:
      - Slack
      summary: Send Slack Message
      description: Send a message to a Slack channel
      operationId: send_slack_message_api_slack_send_message_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SlackSendMessageRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Send Slack Message Api Slack Send Message Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/slack/list-channels:
    post:
      tags:
      - Slack
      summary: List Slack Channels
      description: List available Slack channels
      operationId: list_slack_channels_api_slack_list_channels_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SlackListChannelsRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response List Slack Channels Api Slack List Channels Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/slack/webhook/{integration_id}:
    post:
      tags:
      - Slack
      summary: Slack Webhook
      description: Handle incoming Slack webhooks for message events
      operationId: slack_webhook_api_slack_webhook__integration_id__post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: integer
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Slack Webhook Api Slack Webhook  Integration Id  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/email/integrations:
    get:
      tags:
      - Email Integration
      summary: Get Email Integrations
      description: Get all email integrations for the organization
      operationId: get_email_integrations_api_email_integrations_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
    post:
      tags:
      - Email Integration
      summary: Create Email Integration
      description: Create a new email integration
      operationId: create_email_integration_api_email_integrations_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailIntegrationCreate'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/email/integrations/test:
    post:
      tags:
      - Email Integration
      summary: Test Email Integration
      description: Test an email integration configuration
      operationId: test_email_integration_api_email_integrations_test_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailIntegrationTestRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/email/send:
    post:
      tags:
      - Email Integration
      summary: Send Email
      description: Send a single email
      operationId: send_email_api_email_send_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailSendRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/email/test:
    post:
      tags:
      - Email Integration
      summary: Send Test Email
      description: Send a test email from the email builder
      operationId: send_test_email_api_email_test_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailTestRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/email/send-bulk:
    post:
      tags:
      - Email Integration
      summary: Send Bulk Email
      description: Send bulk emails
      operationId: send_bulk_email_api_email_send_bulk_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkEmailSendRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/email/organization-accounts:
    get:
      tags:
      - Email Integration
      summary: Get Organization Email Accounts
      description: Get all email accounts for the organization from default email
        integration
      operationId: get_organization_email_accounts_api_email_organization_accounts_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/email/analytics/{message_id}:
    get:
      tags:
      - Email Integration
      summary: Get Email Analytics
      description: Get analytics for a specific email message
      operationId: get_email_analytics_api_email_analytics__message_id__get
      parameters:
      - name: message_id
        in: path
        required: true
        schema:
          type: string
          title: Message Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/email/webhooks/{provider_type}:
    post:
      tags:
      - Email Integration
      summary: Handle Email Webhook
      description: Handle webhook events from email providers
      operationId: handle_email_webhook_api_email_webhooks__provider_type__post
      parameters:
      - name: provider_type
        in: path
        required: true
        schema:
          type: string
          title: Provider Type
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Webhook Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/email/templates:
    get:
      tags:
      - Email Integration
      summary: List Email Templates
      description: List email templates for the organization
      operationId: list_email_templates_api_email_templates_get
      parameters:
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
      - name: is_active
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Email Integration
      summary: Create Email Template
      description: Create a new email template
      operationId: create_email_template_api_email_templates_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailTemplateCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/email/templates/{template_id}:
    put:
      tags:
      - Email Integration
      summary: Update Email Template
      description: Update an email template
      operationId: update_email_template_api_email_templates__template_id__put
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailTemplateUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Email Integration
      summary: Delete Email Template
      description: Delete an email template
      operationId: delete_email_template_api_email_templates__template_id__delete
      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/email/templates/test:
    post:
      tags:
      - Email Integration
      summary: Test Email Template
      description: Send a test email with template
      operationId: test_email_template_api_email_templates_test_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Test Data
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/user-email/:
    get:
      tags:
      - User Email Integration
      summary: Get User Email Integrations
      description: Get all email integrations for the current user
      operationId: get_user_email_integrations_api_user_email__get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/EmailIntegrationResponse'
                type: array
                title: Response Get User Email Integrations Api User Email  Get
  /api/user-email/oauth/gmail/authorize:
    get:
      tags:
      - User Email Integration
      summary: Gmail Oauth Authorize
      description: Initiate Gmail OAuth flow
      operationId: gmail_oauth_authorize_api_user_email_oauth_gmail_authorize_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/user-email/oauth/gmail/callback:
    get:
      tags:
      - User Email Integration
      summary: Gmail Oauth Callback
      description: Handle Gmail OAuth callback
      operationId: gmail_oauth_callback_api_user_email_oauth_gmail_callback_get
      parameters:
      - name: code
        in: query
        required: true
        schema:
          type: string
          title: Code
      - name: state
        in: query
        required: true
        schema:
          type: string
          title: State
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/user-email/oauth/outlook/authorize:
    get:
      tags:
      - User Email Integration
      summary: Outlook Oauth Authorize
      description: Initiate Outlook/Microsoft 365 OAuth flow
      operationId: outlook_oauth_authorize_api_user_email_oauth_outlook_authorize_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/user-email/oauth/outlook/callback:
    get:
      tags:
      - User Email Integration
      summary: Outlook Oauth Callback
      description: Handle Outlook/Microsoft 365 OAuth callback
      operationId: outlook_oauth_callback_api_user_email_oauth_outlook_callback_get
      parameters:
      - name: code
        in: query
        required: true
        schema:
          type: string
          title: Code
      - name: state
        in: query
        required: true
        schema:
          type: string
          title: State
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/user-email/send:
    post:
      tags:
      - User Email Integration
      summary: Send Email
      description: 'Send an email using the user''s connected email account


        This endpoint now uses the UnifiedEmailService for consistency,

        but maintains backward compatibility with the existing API.'
      operationId: send_email_api_user_email_send_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailComposeRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/user-email/{integration_id}:
    delete:
      tags:
      - User Email Integration
      summary: Delete Email Integration
      description: Delete an email integration
      operationId: delete_email_integration_api_user_email__integration_id__delete
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/user-email/{integration_id}/default:
    put:
      tags:
      - User Email Integration
      summary: Set Default Email Integration
      description: Set an email integration as default
      operationId: set_default_email_integration_api_user_email__integration_id__default_put
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/user-email/{integration_id}/signature:
    put:
      tags:
      - User Email Integration
      summary: Update Email Signature
      description: Update email signature for an integration
      operationId: update_email_signature_api_user_email__integration_id__signature_put
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailSignatureUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/user-email/{integration_id}/tracking:
    put:
      tags:
      - User Email Integration
      summary: Update Email Tracking
      description: Update email tracking preferences for an integration
      operationId: update_email_tracking_api_user_email__integration_id__tracking_put
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailTrackingUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/user-email/inbox/messages:
    get:
      tags:
      - User Email Integration
      summary: Get Inbox Messages
      description: Get Gmail inbox messages for the user's connected Gmail account
      operationId: get_inbox_messages_api_user_email_inbox_messages_get
      parameters:
      - name: max_results
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 50
          title: Max Results
      - name: page_token
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Page Token
      - name: query
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Query
      - name: account_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Account Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/user-email/inbox/messages/{message_id}:
    get:
      tags:
      - User Email Integration
      summary: Get Inbox Message Detail
      description: Get detailed information about a specific Gmail message
      operationId: get_inbox_message_detail_api_user_email_inbox_messages__message_id__get
      parameters:
      - name: message_id
        in: path
        required: true
        schema:
          type: string
          title: Message Id
      - name: account_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Account Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/user-email/outlook/inbox/messages:
    get:
      tags:
      - User Email Integration
      summary: Get Outlook Inbox Messages
      description: Get Outlook inbox messages for the user's connected Outlook account
      operationId: get_outlook_inbox_messages_api_user_email_outlook_inbox_messages_get
      parameters:
      - name: max_results
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 50
          title: Max Results
      - name: page_token
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Page Token
      - name: query
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Query
      - name: account_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Account Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/user-email/outlook/inbox/messages/{message_id}:
    get:
      tags:
      - User Email Integration
      summary: Get Outlook Message Detail
      description: Get detailed information about a specific Outlook message
      operationId: get_outlook_message_detail_api_user_email_outlook_inbox_messages__message_id__get
      parameters:
      - name: message_id
        in: path
        required: true
        schema:
          type: string
          title: Message Id
      - name: account_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Account Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/user-email/inbox/proxy-image:
    get:
      tags:
      - User Email Integration
      summary: Proxy Email Image
      description: 'Proxy external images to bypass CORS restrictions in email viewing


        This endpoint fetches images from external servers and serves them through
        our backend,

        allowing them to be displayed in email iframes without CORS issues.'
      operationId: proxy_email_image_api_user_email_inbox_proxy_image_get
      parameters:
      - name: url
        in: query
        required: true
        schema:
          type: string
          description: Image URL to proxy
          title: Url
        description: Image URL to proxy
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/meta-lead-forms/oauth/start:
    post:
      tags:
      - Meta Lead Forms
      summary: Start Oauth Flow
      description: Start the Meta OAuth flow for lead forms access
      operationId: start_oauth_flow_api_integrations_meta_lead_forms_oauth_start_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OAuthStartRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/meta-lead-forms/oauth/callback:
    post:
      tags:
      - Meta Lead Forms
      summary: Handle Oauth Callback
      description: Handle OAuth callback - supports both redirect flow (code) and
        popup flow (access_token)
      operationId: handle_oauth_callback_api_integrations_meta_lead_forms_oauth_callback_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OAuthCallbackRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/meta-lead-forms/ad-accounts/{integration_id}:
    get:
      tags:
      - Meta Lead Forms
      summary: Get Ad Accounts
      description: Get available ad accounts for the authenticated user
      operationId: get_ad_accounts_api_integrations_meta_lead_forms_ad_accounts__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/meta-lead-forms/ad-accounts/select:
    post:
      tags:
      - Meta Lead Forms
      summary: Select Ad Accounts
      description: Save selected ad accounts for lead syncing
      operationId: select_ad_accounts_api_integrations_meta_lead_forms_ad_accounts_select_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AdAccountSelectionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/meta-lead-forms/pages/{integration_id}:
    get:
      tags:
      - Meta Lead Forms
      summary: Get Pages
      description: Get available Facebook pages for the authenticated user
      operationId: get_pages_api_integrations_meta_lead_forms_pages__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/meta-lead-forms/pages/select:
    post:
      tags:
      - Meta Lead Forms
      summary: Select Pages
      description: Save selected pages for lead syncing and auto-subscribe to webhooks
      operationId: select_pages_api_integrations_meta_lead_forms_pages_select_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PageSelectionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/meta-lead-forms/lead-forms/{integration_id}:
    get:
      tags:
      - Meta Lead Forms
      summary: Get Lead Forms
      description: Get lead forms from selected pages
      operationId: get_lead_forms_api_integrations_meta_lead_forms_lead_forms__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: page_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by specific page
          title: Page Id
        description: Filter by specific page
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/meta-lead-forms/leads/{integration_id}:
    get:
      tags:
      - Meta Lead Forms
      summary: Get Leads
      description: Get leads from lead forms
      operationId: get_leads_api_integrations_meta_lead_forms_leads__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: form_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by specific form
          title: Form Id
        description: Filter by specific form
      - name: page_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by specific page
          title: Page Id
        description: Filter by specific page
      - name: since
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Get leads since this date (ISO format)
          title: Since
        description: Get leads since this date (ISO format)
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/meta-lead-forms/sync/{integration_id}:
    post:
      tags:
      - Meta Lead Forms
      summary: Manual Sync Leads
      description: 'Manually trigger lead sync for a specific integration or specific
        form


        NEW: Uses Celery queue to avoid database pool connection issues

        Returns immediately with task ID for tracking'
      operationId: manual_sync_leads_api_integrations_meta_lead_forms_sync__integration_id__post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: form_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Form Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/meta-lead-forms/sync-status/{integration_id}:
    get:
      tags:
      - Meta Lead Forms
      summary: Get Sync Status
      description: Get last sync status and statistics for an integration
      operationId: get_sync_status_api_integrations_meta_lead_forms_sync_status__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/meta-lead-forms/verify-webhook/{integration_id}:
    post:
      tags:
      - Meta Lead Forms
      summary: Verify Webhook Subscription
      description: 'Verify webhook subscriptions for all selected pages

        Checks if webhooks are actually subscribed on Meta''s side'
      operationId: verify_webhook_subscription_api_integrations_meta_lead_forms_verify_webhook__integration_id__post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/meta-lead-forms/webhook:
    get:
      tags:
      - Meta Lead Forms
      summary: Meta Webhook Verification App Level
      description: 'App-level Meta webhook verification (GET request).

        Called by Facebook when you configure the webhook URL in Developer Dashboard.'
      operationId: meta_webhook_verification_app_level_api_integrations_meta_lead_forms_webhook_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
    post:
      tags:
      - Meta Lead Forms
      summary: Meta Webhook Handler App Level
      description: 'App-level Meta webhook handler (POST request).

        Receives ALL leadgen webhooks from Meta for ALL pages/orgs.

        Routes to correct org by looking up page_id + form_id in master DB registry.'
      operationId: meta_webhook_handler_app_level_api_integrations_meta_lead_forms_webhook_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/integrations/meta-lead-forms/webhook/{org_id}/{integration_id}:
    get:
      tags:
      - Meta Lead Forms
      summary: Meta Webhook Verification With Org
      description: 'Meta webhook verification endpoint with org_id (GET request)

        Meta sends this to verify webhook ownership'
      operationId: meta_webhook_verification_with_org_api_integrations_meta_lead_forms_webhook__org_id___integration_id__get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Meta Lead Forms
      summary: Meta Webhook Handler With Org
      description: 'Meta webhook endpoint with org_id for real-time lead notifications
        (POST request)

        Meta calls this when a new lead is created

        Only processes leads from forms that are selected in integration config'
      operationId: meta_webhook_handler_with_org_api_integrations_meta_lead_forms_webhook__org_id___integration_id__post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/meta-lead-forms/webhook/{integration_id}:
    get:
      tags:
      - Meta Lead Forms
      summary: Meta Webhook Verification
      description: Meta webhook verification endpoint (LEGACY - for backward compatibility)
      operationId: meta_webhook_verification_api_integrations_meta_lead_forms_webhook__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Meta Lead Forms
      summary: Meta Webhook Handler
      description: 'Meta webhook endpoint (LEGACY - for backward compatibility)

        Requires master DB lookup to find org_id'
      operationId: meta_webhook_handler_api_integrations_meta_lead_forms_webhook__integration_id__post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google-sheets/google-sheets/spreadsheets:
    get:
      tags:
      - Google Sheets
      - google-sheets
      summary: List Spreadsheets
      description: 'List all spreadsheets accessible by the integration.


        Returns list of spreadsheets with id, name, and metadata.'
      operationId: list_spreadsheets_api_integrations_google_sheets_google_sheets_spreadsheets_get
      parameters:
      - name: integration_id
        in: query
        required: true
        schema:
          type: string
          description: Google Sheets integration ID
          title: Integration Id
        description: Google Sheets integration ID
      - name: query
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Search query for spreadsheet name
          title: Query
        description: Search query for spreadsheet name
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google-sheets/google-sheets/spreadsheets/{spreadsheet_id}/sheets:
    get:
      tags:
      - Google Sheets
      - google-sheets
      summary: List Sheets
      description: 'List all sheets (tabs) in a spreadsheet.


        Returns list of sheet names and properties.'
      operationId: list_sheets_api_integrations_google_sheets_google_sheets_spreadsheets__spreadsheet_id__sheets_get
      parameters:
      - name: spreadsheet_id
        in: path
        required: true
        schema:
          type: string
          title: Spreadsheet Id
      - name: integration_id
        in: query
        required: true
        schema:
          type: string
          description: Google Sheets integration ID
          title: Integration Id
        description: Google Sheets integration ID
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google-sheets/google-sheets/spreadsheets/{spreadsheet_id}/columns:
    get:
      tags:
      - Google Sheets
      - google-sheets
      summary: Get Columns
      description: 'Get column headers from a sheet.


        Returns the first row as column headers for use in filters.'
      operationId: get_columns_api_integrations_google_sheets_google_sheets_spreadsheets__spreadsheet_id__columns_get
      parameters:
      - name: spreadsheet_id
        in: path
        required: true
        schema:
          type: string
          title: Spreadsheet Id
      - name: sheet_name
        in: query
        required: false
        schema:
          type: string
          description: Sheet name to get columns from
          default: Sheet1
          title: Sheet Name
        description: Sheet name to get columns from
      - name: integration_id
        in: query
        required: true
        schema:
          type: string
          description: Google Sheets integration ID
          title: Integration Id
        description: Google Sheets integration ID
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google-forms/forms/{integration_id}:
    get:
      tags:
      - Google Forms
      - Google Forms
      summary: List Forms
      description: 'List all forms accessible by the connected Google account


        Note: Google Forms API doesn''t have a "list all forms" endpoint.

        Users must provide form IDs from their Google Drive or Forms URL.

        This endpoint verifies access to forms already added.'
      operationId: list_forms_api_integrations_google_forms_forms__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google-forms/forms/{integration_id}/add:
    post:
      tags:
      - Google Forms
      - Google Forms
      summary: Add Form
      description: 'Add a form to the integration by its ID


        The form ID can be found in the Google Forms URL:

        https://docs.google.com/forms/d/{FORM_ID}/edit'
      operationId: add_form_api_integrations_google_forms_forms__integration_id__add_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: form_id
        in: query
        required: true
        schema:
          type: string
          description: Google Form ID (from URL)
          title: Form Id
        description: Google Form ID (from URL)
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google-forms/forms/{integration_id}/{form_id}:
    delete:
      tags:
      - Google Forms
      - Google Forms
      summary: Remove Form
      description: Remove a form from the integration
      operationId: remove_form_api_integrations_google_forms_forms__integration_id___form_id__delete
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: form_id
        in: path
        required: true
        schema:
          type: string
          title: Form Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Google Forms
      - Google Forms
      summary: Get Form Details
      description: Get form details including questions and auto-detected field mappings
      operationId: get_form_details_api_integrations_google_forms_forms__integration_id___form_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: form_id
        in: path
        required: true
        schema:
          type: string
          title: Form Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google-forms/responses/{integration_id}/{form_id}:
    get:
      tags:
      - Google Forms
      - Google Forms
      summary: Get Form Responses
      description: Get responses for a specific form (for preview/debugging)
      operationId: get_form_responses_api_integrations_google_forms_responses__integration_id___form_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: form_id
        in: path
        required: true
        schema:
          type: string
          title: Form Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google-forms/sync/{integration_id}:
    post:
      tags:
      - Google Forms
      - Google Forms
      summary: Sync Form Responses
      description: 'Manually sync form responses to CRM contacts


        This will:

        1. Fetch all new responses since the last sync

        2. Create or update contacts based on the field mapping

        3. Store unmapped fields in custom_fields'
      operationId: sync_form_responses_api_integrations_google_forms_sync__integration_id__post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SyncRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google-forms/sync-status/{integration_id}:
    get:
      tags:
      - Google Forms
      - Google Forms
      summary: Get Sync Status
      description: Get the sync status for an integration
      operationId: get_sync_status_api_integrations_google_forms_sync_status__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google-forms/config/{integration_id}:
    put:
      tags:
      - Google Forms
      - Google Forms
      summary: Update Integration Config
      description: Update integration configuration (auto-sync, field mapping, etc.)
      operationId: update_integration_config_api_integrations_google_forms_config__integration_id__put
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConfigUpdateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google-forms/field-mapping/{integration_id}:
    put:
      tags:
      - Google Forms
      - Google Forms
      summary: Update Field Mapping
      description: 'Update field mapping for a specific integration


        Field mapping maps form question titles to CRM contact fields.

        Example: {"Email Address": "email", "Full Name": "full_name"}'
      operationId: update_field_mapping_api_integrations_google_forms_field_mapping__integration_id__put
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FieldMappingRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google-forms/auto-detect-mappings:
    get:
      tags:
      - Google Forms
      - Google Forms
      summary: Get Auto Detect Mappings
      description: 'Get the list of auto-detected field mappings


        Returns the default patterns used to automatically map form questions to CRM
        fields.'
      operationId: get_auto_detect_mappings_api_integrations_google_forms_auto_detect_mappings_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/expedify-tele/init/{org_id}/{integration_id}:
    post:
      tags:
      - Asterisk Integration
      - Expedify Tele Integration
      summary: Asterisk Init
      description: 'Initialize a voice chat session.


        Called by Asterisk when a call starts that needs AI handling.

        Returns session ID and first message to speak.'
      operationId: asterisk_init_api_expedify_tele_init__org_id___integration_id__post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AsteriskInitRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsteriskInitResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/expedify-tele/chat/{org_id}/{integration_id}:
    post:
      tags:
      - Asterisk Integration
      - Expedify Tele Integration
      summary: Asterisk Chat
      description: 'Get LLM response for transcribed user speech.


        Called by Asterisk after STT converts speech to text.

        Returns AI response text for TTS.'
      operationId: asterisk_chat_api_expedify_tele_chat__org_id___integration_id__post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AsteriskChatRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsteriskChatResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/expedify-tele/end/{org_id}/{integration_id}:
    post:
      tags:
      - Asterisk Integration
      - Expedify Tele Integration
      summary: Asterisk End
      description: 'End a voice chat session.


        Called by Asterisk when call ends.

        Saves transcript and cleans up session.'
      operationId: asterisk_end_api_expedify_tele_end__org_id___integration_id__post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AsteriskEndRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsteriskEndResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/expedify-tele/health/{org_id}/{integration_id}:
    get:
      tags:
      - Asterisk Integration
      - Expedify Tele Integration
      summary: Asterisk Health
      description: 'Health check for Asterisk integration.


        Verifies integration is active and properly configured.'
      operationId: asterisk_health_api_expedify_tele_health__org_id___integration_id__get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsteriskHealthResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/expedify-tele/webhook/{org_id}/{integration_id}:
    post:
      tags:
      - Asterisk Integration
      - Expedify Tele Integration
      summary: Asterisk Webhook
      description: "Unified event-based webhook for Asterisk integration.\n\nSingle\
        \ endpoint that handles all event types:\n- init: Initialize a new voice session\n\
        - chat: Get LLM response for user message\n- end: End session and save transcript\n\
        - health: Health check\n\nExample request:\n{\n    \"event\": \"chat\",\n\
        \    \"session_id\": \"ast-12345\",\n    \"user_message\": \"I'd like to schedule\
        \ an appointment\"\n}"
      operationId: asterisk_webhook_api_expedify_tele_webhook__org_id___integration_id__post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AsteriskWebhookRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/expedify-tele/integration/create:
    post:
      tags:
      - Asterisk Integration
      - Expedify Tele Integration
      summary: Create Asterisk Integration
      description: 'Create a new Asterisk integration for the authenticated organization.


        This is an authenticated endpoint - requires valid session.

        Returns a single event-based webhook URL.'
      operationId: create_asterisk_integration_api_expedify_tele_integration_create_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAsteriskIntegrationRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/expedify-tele/integration/{integration_id}:
    get:
      tags:
      - Asterisk Integration
      - Expedify Tele Integration
      summary: Get Asterisk Integration
      description: Get Asterisk integration details including webhook URLs.
      operationId: get_asterisk_integration_api_expedify_tele_integration__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Asterisk Integration
      - Expedify Tele Integration
      summary: Update Asterisk Integration
      description: 'Update an existing Asterisk integration.

        Accepts configuration as nested object.'
      operationId: update_asterisk_integration_api_expedify_tele_integration__integration_id__put
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAsteriskIntegrationRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Asterisk Integration
      - Expedify Tele Integration
      summary: Delete Asterisk Integration
      description: Delete an Asterisk integration.
      operationId: delete_asterisk_integration_api_expedify_tele_integration__integration_id__delete
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/mcp/servers:
    get:
      tags:
      - MCP Integration
      - MCP
      summary: List Mcp Servers
      description: 'List all configured MCP servers for the organization.


        Returns servers with their connection status and capability counts.'
      operationId: list_mcp_servers_api_mcp_servers_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/mcp/servers/{integration_id}/status:
    get:
      tags:
      - MCP Integration
      - MCP
      summary: Get Server Status
      description: Get detailed status of a specific MCP server
      operationId: get_server_status_api_mcp_servers__integration_id__status_get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/mcp/servers/{integration_id}/connect:
    post:
      tags:
      - MCP Integration
      - MCP
      summary: Connect Server
      description: Connect to an MCP server
      operationId: connect_server_api_mcp_servers__integration_id__connect_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/mcp/servers/{integration_id}/disconnect:
    post:
      tags:
      - MCP Integration
      - MCP
      summary: Disconnect Server
      description: Disconnect from an MCP server
      operationId: disconnect_server_api_mcp_servers__integration_id__disconnect_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/mcp/servers/{integration_id}/tools:
    get:
      tags:
      - MCP Integration
      - MCP
      summary: List Tools
      description: List all tools available from an MCP server
      operationId: list_tools_api_mcp_servers__integration_id__tools_get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/mcp/servers/{integration_id}/resources:
    get:
      tags:
      - MCP Integration
      - MCP
      summary: List Resources
      description: List all resources available from an MCP server
      operationId: list_resources_api_mcp_servers__integration_id__resources_get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/mcp/servers/{integration_id}/prompts:
    get:
      tags:
      - MCP Integration
      - MCP
      summary: List Prompts
      description: List all prompts available from an MCP server
      operationId: list_prompts_api_mcp_servers__integration_id__prompts_get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/mcp/servers/{integration_id}/tools/call:
    post:
      tags:
      - MCP Integration
      - MCP
      summary: Call Tool
      description: Execute a tool on an MCP server
      operationId: call_tool_api_mcp_servers__integration_id__tools_call_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MCPToolCallRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/mcp/servers/{integration_id}/resources/read:
    post:
      tags:
      - MCP Integration
      - MCP
      summary: Read Resource
      description: Read a resource from an MCP server
      operationId: read_resource_api_mcp_servers__integration_id__resources_read_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MCPResourceReadRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/mcp/servers/{integration_id}/prompts/get:
    post:
      tags:
      - MCP Integration
      - MCP
      summary: Get Prompt
      description: Get a prompt template from an MCP server
      operationId: get_prompt_api_mcp_servers__integration_id__prompts_get_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MCPPromptGetRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/mcp/skills:
    get:
      tags:
      - MCP Integration
      - MCP
      summary: Get All Mcp Skills
      description: "Get all MCP tools as Expedify skills.\n\nThis endpoint is used\
        \ by the SkillRegistry to include\nMCP tools alongside native Expedify skills.\n\
        \nArgs:\n    format: \"light\" for system prompt format, \"full\" for complete\
        \ schema"
      operationId: get_all_mcp_skills_api_mcp_skills_get
      parameters:
      - name: format
        in: query
        required: false
        schema:
          type: string
          default: light
          title: Format
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/mcp/skills/execute:
    post:
      tags:
      - MCP Integration
      - MCP
      summary: Execute Mcp Skill
      description: 'Execute an MCP skill by name.


        This endpoint is used by the orchestrator agent to execute

        MCP skills dynamically.'
      operationId: execute_mcp_skill_api_mcp_skills_execute_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MCPSkillExecuteRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/mcp/test/connect:
    post:
      tags:
      - MCP Integration
      - MCP
      summary: Test Mcp Connection
      description: 'Test MCP server connection without saving integration.


        Useful for validating connection settings before saving.'
      operationId: test_mcp_connection_api_mcp_test_connect_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Config
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google/connect:
    post:
      tags:
      - Google Simple OAuth
      - Google Simple OAuth
      summary: Connect Google Service
      description: 'Initiate Google OAuth flow for Calendar or Sheets


        Returns authorization URL that frontend should redirect user to'
      operationId: connect_google_service_api_integrations_google_connect_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConnectRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google/connect-custom:
    post:
      tags:
      - Google Simple OAuth
      - Google Simple OAuth
      summary: Connect Google Service Custom
      description: 'Initiate Google OAuth flow with custom OAuth credentials


        Returns authorization URL that frontend should redirect user to'
      operationId: connect_google_service_custom_api_integrations_google_connect_custom_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomConnectRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google/callback:
    get:
      tags:
      - Google Simple OAuth
      - Google Simple OAuth
      summary: Google Oauth Callback
      description: 'Handle Google OAuth callback


        This endpoint receives the authorization code from Google and exchanges it

        for access tokens, then creates the appropriate integration.'
      operationId: google_oauth_callback_api_integrations_google_callback_get
      parameters:
      - name: code
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Code
      - name: state
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: State
      - name: error
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Error
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google/connect/{service}:
    get:
      tags:
      - Google Simple OAuth
      - Google Simple OAuth
      summary: Connect Google Service Direct
      description: 'Direct connect endpoint that immediately redirects to Google OAuth


        This can be used for simple "Connect Google Calendar" buttons that

        directly redirect without needing frontend JavaScript.'
      operationId: connect_google_service_direct_api_integrations_google_connect__service__get
      parameters:
      - name: service
        in: path
        required: true
        schema:
          enum:
          - calendar
          - sheets
          - forms
          type: string
          title: Service
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google/disconnect/{integration_id}:
    post:
      tags:
      - Google Simple OAuth
      - Google Simple OAuth
      summary: Disconnect Google Integration
      description: 'Disconnect a Google integration


        This revokes the OAuth tokens and deletes the integration.'
      operationId: disconnect_google_integration_api_integrations_google_disconnect__integration_id__post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google/refresh/{integration_id}:
    post:
      tags:
      - Google Simple OAuth
      - Google Simple OAuth
      summary: Refresh Integration Token
      description: 'Manually refresh an integration''s access token


        This is typically called automatically, but can be used for testing

        or troubleshooting token refresh issues.'
      operationId: refresh_integration_token_api_integrations_google_refresh__integration_id__post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google/test/{integration_id}:
    get:
      tags:
      - Google Simple OAuth
      - Google Simple OAuth
      summary: Test Google Integration
      description: 'Test a Google integration connection


        This verifies that the integration is properly configured and can

        connect to the Google service.'
      operationId: test_google_integration_api_integrations_google_test__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/google/status:
    get:
      tags:
      - Google Simple OAuth
      - Google Simple OAuth
      summary: Get Google Oauth Status
      description: 'Get status of Google OAuth configuration


        This returns information about whether Google OAuth is properly configured

        and which services are available.'
      operationId: get_google_oauth_status_api_integrations_google_status_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/integrations/slack/connect:
    post:
      tags:
      - Slack Simple OAuth
      - Slack Simple OAuth
      summary: Connect Slack
      description: 'Initiate Slack OAuth flow


        Returns authorization URL that frontend should redirect user to'
      operationId: connect_slack_api_integrations_slack_connect_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SlackConnectRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/slack/connect-custom:
    post:
      tags:
      - Slack Simple OAuth
      - Slack Simple OAuth
      summary: Connect Slack Custom
      description: 'Initiate Slack OAuth flow with custom OAuth credentials


        Returns authorization URL that frontend should redirect user to'
      operationId: connect_slack_custom_api_integrations_slack_connect_custom_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SlackCustomConnectRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/slack/callback:
    get:
      tags:
      - Slack Simple OAuth
      - Slack Simple OAuth
      summary: Slack Oauth Callback
      description: 'Handle Slack OAuth callback


        This endpoint receives the authorization code from Slack and exchanges it

        for access tokens, then creates the integration.'
      operationId: slack_oauth_callback_api_integrations_slack_callback_get
      parameters:
      - name: code
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Code
      - name: state
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: State
      - name: error
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Error
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/slack/connect-direct:
    get:
      tags:
      - Slack Simple OAuth
      - Slack Simple OAuth
      summary: Connect Slack Direct
      description: 'Direct connect endpoint that immediately redirects to Slack OAuth


        This can be used for simple "Connect Slack" buttons that

        directly redirect without needing frontend JavaScript.'
      operationId: connect_slack_direct_api_integrations_slack_connect_direct_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/slack/disconnect/{integration_id}:
    post:
      tags:
      - Slack Simple OAuth
      - Slack Simple OAuth
      summary: Disconnect Slack Integration
      description: 'Disconnect a Slack integration


        This revokes the OAuth tokens and deletes the integration.'
      operationId: disconnect_slack_integration_api_integrations_slack_disconnect__integration_id__post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/slack/test/{integration_id}:
    get:
      tags:
      - Slack Simple OAuth
      - Slack Simple OAuth
      summary: Test Slack Integration
      description: 'Test a Slack integration connection


        This verifies that the integration is properly configured and can

        connect to the Slack workspace.'
      operationId: test_slack_integration_api_integrations_slack_test__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/slack/status:
    get:
      tags:
      - Slack Simple OAuth
      - Slack Simple OAuth
      summary: Get Slack Oauth Status
      description: 'Get status of Slack OAuth configuration


        This returns information about whether Slack OAuth is properly configured.'
      operationId: get_slack_oauth_status_api_integrations_slack_status_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/integrations/shopify/connect:
    post:
      tags:
      - Shopify OAuth
      - Shopify OAuth
      summary: Connect Shopify Store
      description: "Initiate Shopify OAuth flow\n\nArgs:\n    request: Contains shop_domain\
        \ (e.g., mystore.myshopify.com)\n    org_context: Organization context with\
        \ org_id and user info\n\nReturns:\n    Authorization URL to redirect user\
        \ to Shopify"
      operationId: connect_shopify_store_api_integrations_shopify_connect_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ShopifyConnectRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/shopify/callback:
    get:
      tags:
      - Shopify OAuth
      - Shopify OAuth
      summary: Shopify Oauth Callback
      description: "Handle Shopify OAuth callback\n\nArgs:\n    code: Authorization\
        \ code from Shopify\n    state: State parameter for CSRF protection\n    shop:\
        \ Shop domain\n    hmac: HMAC signature (optional)\n\nReturns:\n    Redirect\
        \ to integrations page with success/error status"
      operationId: shopify_oauth_callback_api_integrations_shopify_callback_get
      parameters:
      - name: code
        in: query
        required: true
        schema:
          type: string
          title: Code
      - name: state
        in: query
        required: true
        schema:
          type: string
          title: State
      - name: shop
        in: query
        required: true
        schema:
          type: string
          title: Shop
      - name: hmac
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Hmac
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/shopify/test:
    post:
      tags:
      - Shopify OAuth
      - Shopify OAuth
      summary: Test Shopify Connection
      description: 'Test Shopify connection for an existing integration


        Expects integration_id in request body'
      operationId: test_shopify_connection_api_integrations_shopify_test_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/integrations/shopify/sync:
    post:
      tags:
      - Shopify OAuth
      - Shopify OAuth
      summary: Trigger Shopify Sync
      description: 'Trigger manual sync for a Shopify integration


        Expects integration_id and optional sync_type in request body'
      operationId: trigger_shopify_sync_api_integrations_shopify_sync_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/integrations/shopify/sync-status/{integration_id}:
    get:
      tags:
      - Shopify OAuth
      - Shopify OAuth
      summary: Get Sync Status
      description: Get sync status for a Shopify integration
      operationId: get_sync_status_api_integrations_shopify_sync_status__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/shopify/register-webhooks:
    post:
      tags:
      - Shopify OAuth
      - Shopify OAuth
      summary: Register Webhooks
      description: 'Register webhooks for an existing Shopify integration


        Use this if webhooks were not registered during OAuth flow

        (e.g., when app was installed via direct link)'
      operationId: register_webhooks_api_integrations_shopify_register_webhooks_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/integrations/shopify/webhooks/{integration_id}:
    get:
      tags:
      - Shopify OAuth
      - Shopify OAuth
      summary: List Webhooks
      description: List all registered webhooks for a Shopify integration
      operationId: list_webhooks_api_integrations_shopify_webhooks__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/webhook/shopify/{org_id}/{integration_id}:
    post:
      tags:
      - Shopify Webhooks
      - Shopify Webhooks
      summary: Handle Shopify Webhook
      description: "Handle incoming Shopify webhook\n\nArgs:\n    org_id: Organization\
        \ ID\n    integration_id: Integration ID\n    request: Raw request object\n\
        \    x_shopify_topic: Webhook topic (e.g., orders/create)\n    x_shopify_hmac_sha256:\
        \ HMAC signature for verification\n    x_shopify_shop_domain: Shop domain\n\
        \    x_shopify_api_version: API version\n    x_shopify_webhook_id: Webhook\
        \ subscription ID\n    x_shopify_event_id: Unique event ID for deduplication\n\
        \nReturns:\n    Success response"
      operationId: handle_shopify_webhook_api_webhook_shopify__org_id___integration_id__post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Shopify-Topic
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Shopify-Topic
      - name: X-Shopify-Hmac-Sha256
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Shopify-Hmac-Sha256
      - name: X-Shopify-Shop-Domain
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Shopify-Shop-Domain
      - name: X-Shopify-API-Version
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Shopify-Api-Version
      - name: X-Shopify-Webhook-Id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Shopify-Webhook-Id
      - name: X-Shopify-Event-Id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Shopify-Event-Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/integrations/synthesizer/fetch-voices:
    get:
      tags:
      - Synthesizer Voices
      - integrations
      summary: Fetch Synthesizer Voices
      description: 'Fetch available voices from synthesizer provider for integration
        configuration.


        This is used by the integration configuration UI to populate the voice dropdown.'
      operationId: fetch_synthesizer_voices_api_integrations_synthesizer_fetch_voices_get
      parameters:
      - name: provider
        in: query
        required: true
        schema:
          type: string
          description: Provider type (cartesia_tts or elevenlabs_tts)
          title: Provider
        description: Provider type (cartesia_tts or elevenlabs_tts)
      - name: api_key
        in: query
        required: true
        schema:
          type: string
          description: API key to use for fetching voices
          title: Api Key
        description: API key to use for fetching voices
      - name: language
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Optional language filter
          title: Language
        description: Optional language filter
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/email/unified/accounts:
    get:
      tags:
      - Unified Email
      summary: Get Email Accounts
      description: Get all available email accounts for the current user
      operationId: get_email_accounts_api_email_unified_accounts_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Email Accounts Api Email Unified Accounts Get
  /api/email/unified/send:
    post:
      tags:
      - Unified Email
      summary: Send Unified Email
      description: Send email through unified system
      operationId: send_unified_email_api_email_unified_send_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UnifiedEmailSendRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Send Unified Email Api Email Unified Send Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/email/unified/broadcast:
    post:
      tags:
      - Unified Email
      summary: Send Broadcast Email
      description: Send broadcast email to multiple recipients
      operationId: send_broadcast_email_api_email_unified_broadcast_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BroadcastEmailRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Send Broadcast Email Api Email Unified Broadcast Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/email/unified/analytics:
    get:
      tags:
      - Unified Email
      summary: Get Email Analytics
      description: Get unified email analytics
      operationId: get_email_analytics_api_email_unified_analytics_get
      parameters:
      - name: account_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Account Id
      - name: email_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Email Type
      - 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:
                type: object
                additionalProperties: true
                title: Response Get Email Analytics Api Email Unified Analytics Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/domains/list:
    get:
      tags:
      - Domain Management
      - domains
      summary: List Domains
      description: "List all available domains for the current user.\n\nArgs:\n  \
        \  domain_type: Filter by domain type ('database', 'voice', etc.)"
      operationId: list_domains_api_domains_list_get
      parameters:
      - name: domain_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Domain Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainListResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/domains/database:
    get:
      tags:
      - Domain Management
      - domains
      summary: List Database Domains
      description: List all database domains (table mappings)
      operationId: list_database_domains_api_domains_database_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Domain'
                title: Response List Database Domains Api Domains Database Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/domains/{domain_id}:
    get:
      tags:
      - Domain Management
      - domains
      summary: Get Domain Details
      description: Get detailed information about a specific domain
      operationId: get_domain_details_api_domains__domain_id__get
      parameters:
      - name: domain_id
        in: path
        required: true
        schema:
          type: string
          title: Domain Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/domains/validate:
    post:
      tags:
      - Domain Management
      - domains
      summary: Validate Domains
      description: Validate that the given domain IDs exist and are accessible
      operationId: validate_domains_api_domains_validate_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
              title: Domain Ids
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat/sessions:
    get:
      tags:
      - Chat History
      summary: Get Chat Sessions
      description: 'Get all chat sessions for the current user


        Enhanced to include both active (Redis) and historical (PostgreSQL) sessions'
      operationId: get_chat_sessions_api_chat_sessions_get
      parameters:
      - name: include_archived
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Include Archived
      - name: include_active
        in: query
        required: false
        schema:
          type: boolean
          default: true
          title: Include Active
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ChatSessionResponse'
                title: Response Get Chat Sessions Api Chat Sessions Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Chat History
      summary: Create Chat Session
      description: 'Create a new chat session


        Enhanced to create in Redis for real-time performance'
      operationId: create_chat_session_api_chat_sessions_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateChatSessionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatSessionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat/sessions/{session_id}:
    get:
      tags:
      - Chat History
      summary: Get Chat Session
      description: 'Get a specific chat session


        Enhanced to check Redis first, then PostgreSQL'
      operationId: get_chat_session_api_chat_sessions__session_id__get
      parameters:
      - name: session_id
        in: path
        required: true
        schema:
          type: string
          title: Session Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatSessionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Chat History
      summary: Update Chat Session
      description: 'Update a chat session


        Enhanced to update both Redis and PostgreSQL'
      operationId: update_chat_session_api_chat_sessions__session_id__put
      parameters:
      - name: session_id
        in: path
        required: true
        schema:
          type: string
          title: Session Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateChatSessionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Chat History
      summary: Delete Chat Session
      description: 'Delete a chat session


        Enhanced to delete from both Redis and PostgreSQL'
      operationId: delete_chat_session_api_chat_sessions__session_id__delete
      parameters:
      - name: session_id
        in: path
        required: true
        schema:
          type: string
          title: Session Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat/sessions/{session_id}/messages:
    get:
      tags:
      - Chat History
      summary: Get Chat Messages
      description: 'Get all messages for a chat session


        Enhanced to prioritize Redis for active sessions'
      operationId: get_chat_messages_api_chat_sessions__session_id__messages_get
      parameters:
      - name: session_id
        in: path
        required: true
        schema:
          type: string
          title: Session Id
      - name: include_active
        in: query
        required: false
        schema:
          type: boolean
          default: true
          title: Include Active
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ChatMessageResponse'
                title: Response Get Chat Messages Api Chat Sessions  Session Id  Messages
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Chat History
      summary: Save Chat Message
      description: 'Save a message to a chat session


        Enhanced to save to Redis for real-time performance'
      operationId: save_chat_message_api_chat_sessions__session_id__messages_post
      parameters:
      - name: session_id
        in: path
        required: true
        schema:
          type: string
          title: Session Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SaveChatMessageRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatMessageResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat/sessions/{session_id}/context:
    post:
      tags:
      - Chat History
      summary: Get Chat Context
      description: 'Get intelligent context for AI response generation


        NEW: Provides ChatGPT/Claude-like context window management'
      operationId: get_chat_context_api_chat_sessions__session_id__context_post
      parameters:
      - name: session_id
        in: path
        required: true
        schema:
          type: string
          title: Session Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetContextRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ChatMessageResponse'
                title: Response Get Chat Context Api Chat Sessions  Session Id  Context
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat/sessions/{session_id}/end:
    post:
      tags:
      - Chat History
      summary: End Chat Session
      description: 'End a chat session


        NEW: Flushes Redis data to PostgreSQL and generates title'
      operationId: end_chat_session_api_chat_sessions__session_id__end_post
      parameters:
      - name: session_id
        in: path
        required: true
        schema:
          type: string
          title: Session Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat/sessions/flush:
    post:
      tags:
      - Chat History
      summary: Flush Sessions To Database
      description: 'Flush chat sessions from Redis to PostgreSQL


        NEW: Batch operation for data persistence'
      operationId: flush_sessions_to_database_api_chat_sessions_flush_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FlushSessionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchOperationResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat/sessions/{session_id}/generate-title:
    post:
      tags:
      - Chat History
      summary: Generate Chat Title
      description: Generate a title for a chat session based on the first user message
      operationId: generate_chat_title_api_chat_sessions__session_id__generate_title_post
      parameters:
      - name: session_id
        in: path
        required: true
        schema:
          type: string
          title: Session Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat/sessions/search/{search_query}:
    get:
      tags:
      - Chat History
      summary: Search Chat Sessions
      description: Search chat sessions by title or content (PostgreSQL only)
      operationId: search_chat_sessions_api_chat_sessions_search__search_query__get
      parameters:
      - name: search_query
        in: path
        required: true
        schema:
          type: string
          title: Search Query
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ChatSessionResponse'
                title: Response Search Chat Sessions Api Chat Sessions Search  Search
                  Query  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat/health:
    get:
      tags:
      - Chat History
      summary: Chat Service Health
      description: 'Check health of chat service components


        NEW: Monitors both Redis and PostgreSQL health'
      operationId: chat_service_health_api_chat_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/chat/sessions/{session_id}/stats:
    get:
      tags:
      - Chat History
      summary: Get Session Stats
      description: 'Get session statistics


        NEW: Provides insights into message count, tokens, etc.'
      operationId: get_session_stats_api_chat_sessions__session_id__stats_get
      parameters:
      - name: session_id
        in: path
        required: true
        schema:
          type: string
          title: Session Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat/sessions/{session_id}/analyze-context:
    post:
      tags:
      - Chat History
      summary: Analyze Session Context
      description: 'Analyze context selection for debugging


        NEW: Helps understand how context is selected'
      operationId: analyze_session_context_api_chat_sessions__session_id__analyze_context_post
      parameters:
      - name: session_id
        in: path
        required: true
        schema:
          type: string
          title: Session Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetContextRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat/sessions/{session_id}/messages/{message_id}/feedback:
    put:
      tags:
      - Chat History
      summary: Update Message Feedback
      description: 'Update feedback for a specific message


        Stores user feedback (like/dislike) for assistant messages

        to help analyze response quality.'
      operationId: update_message_feedback_api_chat_sessions__session_id__messages__message_id__feedback_put
      parameters:
      - name: session_id
        in: path
        required: true
        schema:
          type: string
          title: Session Id
      - name: message_id
        in: path
        required: true
        schema:
          type: string
          title: Message Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateMessageFeedbackRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat-widget-configs:
    post:
      tags:
      - Chat Widget Configs
      - Chat Widget Configs
      summary: Create Chat Widget Config
      description: Create a new chat widget configuration
      operationId: create_chat_widget_config_api_chat_widget_configs_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatWidgetConfigCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatWidgetConfigResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Chat Widget Configs
      - Chat Widget Configs
      summary: List Chat Widget Configs
      description: List all chat widget configurations for the organization
      operationId: list_chat_widget_configs_api_chat_widget_configs_get
      parameters:
      - name: include_inactive
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Include Inactive
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ChatWidgetConfigResponse'
                title: Response List Chat Widget Configs Api Chat Widget Configs Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat-widget-configs/{config_id}:
    get:
      tags:
      - Chat Widget Configs
      - Chat Widget Configs
      summary: Get Chat Widget Config
      description: Get a specific chat widget configuration
      operationId: get_chat_widget_config_api_chat_widget_configs__config_id__get
      parameters:
      - name: config_id
        in: path
        required: true
        schema:
          type: string
          title: Config Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatWidgetConfigResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Chat Widget Configs
      - Chat Widget Configs
      summary: Update Chat Widget Config
      description: Update a chat widget configuration
      operationId: update_chat_widget_config_api_chat_widget_configs__config_id__put
      parameters:
      - name: config_id
        in: path
        required: true
        schema:
          type: string
          title: Config Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatWidgetConfigUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatWidgetConfigResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Chat Widget Configs
      - Chat Widget Configs
      summary: Delete Chat Widget Config
      description: Delete a chat widget configuration
      operationId: delete_chat_widget_config_api_chat_widget_configs__config_id__delete
      parameters:
      - name: config_id
        in: path
        required: true
        schema:
          type: string
          title: Config Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat-widget-configs/by-api-key/{api_key_id}:
    get:
      tags:
      - Chat Widget Configs
      - Chat Widget Configs
      summary: Get Chat Widget Config By Api Key
      description: Get chat widget configuration by API key ID
      operationId: get_chat_widget_config_by_api_key_api_chat_widget_configs_by_api_key__api_key_id__get
      parameters:
      - name: api_key_id
        in: path
        required: true
        schema:
          type: string
          title: Api Key Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatWidgetConfigResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat-widget-configs/{config_id}/deactivate:
    post:
      tags:
      - Chat Widget Configs
      - Chat Widget Configs
      summary: Deactivate Chat Widget Config
      description: Soft delete - deactivate a chat widget configuration
      operationId: deactivate_chat_widget_config_api_chat_widget_configs__config_id__deactivate_post
      parameters:
      - name: config_id
        in: path
        required: true
        schema:
          type: string
          title: Config Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat-widget-configs/{config_id}/activate:
    post:
      tags:
      - Chat Widget Configs
      - Chat Widget Configs
      summary: Activate Chat Widget Config
      description: Reactivate a deactivated chat widget configuration
      operationId: activate_chat_widget_config_api_chat_widget_configs__config_id__activate_post
      parameters:
      - name: config_id
        in: path
        required: true
        schema:
          type: string
          title: Config Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat-widget-configs/{config_id}/duplicate:
    post:
      tags:
      - Chat Widget Configs
      - Chat Widget Configs
      summary: Duplicate Chat Widget Config
      description: Duplicate a chat widget configuration
      operationId: duplicate_chat_widget_config_api_chat_widget_configs__config_id__duplicate_post
      parameters:
      - name: config_id
        in: path
        required: true
        schema:
          type: string
          title: Config Id
      - name: new_name
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: New Name
      - name: new_api_key_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: New Api Key Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatWidgetConfigResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat/feedback/submit:
    post:
      tags:
      - Chat Feedback
      - feedback
      summary: Submit Feedback
      description: 'Submit user feedback on an AI response.

        This creates a score in the native LLM evaluation system.'
      operationId: submit_feedback_api_chat_feedback_submit_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FeedbackRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeedbackResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat/feedback/thumbs:
    post:
      tags:
      - Chat Feedback
      - feedback
      summary: Submit Thumbs Feedback
      description: 'Submit thumbs up/down feedback on an AI response.

        Simpler endpoint for quick feedback.'
      operationId: submit_thumbs_feedback_api_chat_feedback_thumbs_post
      parameters:
      - name: trace_id
        in: query
        required: true
        schema:
          type: string
          title: Trace Id
      - name: is_positive
        in: query
        required: true
        schema:
          type: boolean
          title: Is Positive
      - name: comment
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Comment
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeedbackResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/agentic/chat/stream:
    post:
      tags:
      - Agentic Chat
      summary: Stream Agentic Chat
      description: 'Stream agentic chat responses via Server-Sent Events (SSE).


        The orchestrator agent will:

        1. Analyze the user''s message

        2. Identify required skills

        3. Execute skills in the appropriate order

        4. Stream progress and results in real-time


        Event Types:

        - execution_start: Agent started processing

        - text: Text content being streamed

        - thinking: Agent reasoning (optional display)

        - skill_start: Starting a skill execution

        - skill_result: Skill execution result

        - ask_user: Agent needs clarification

        - done: Execution complete

        - error: Error occurred'
      operationId: stream_agentic_chat_api_agentic_chat_stream_post
      parameters:
      - name: token
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgenticChatStreamRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/agentic/chat:
    post:
      tags:
      - Agentic Chat
      summary: Agentic Chat
      description: 'Non-streaming agentic chat endpoint.


        For clients that don''t support SSE, this endpoint runs the full

        agentic loop and returns the complete result.'
      operationId: agentic_chat_api_agentic_chat_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgenticChatRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/agentic/skills:
    get:
      tags:
      - Agentic Chat
      summary: List Available Skills
      description: 'List all available skills for the agentic mode.


        Returns skill metadata in light mode (~100 tokens per skill).

        Use this to understand what capabilities are available.'
      operationId: list_available_skills_api_agentic_skills_get
      parameters:
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/agentic/skills/{skill_name}:
    get:
      tags:
      - Agentic Chat
      summary: Get Skill Details
      description: 'Get full details for a specific skill.


        Returns the complete config_schema and output_info (~500 tokens).

        Use this when you need to understand a skill''s parameters.'
      operationId: get_skill_details_api_agentic_skills__skill_name__get
      parameters:
      - name: skill_name
        in: path
        required: true
        schema:
          type: string
          title: Skill Name
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/agentic/skills/search:
    post:
      tags:
      - Agentic Chat
      summary: Search Skills
      description: Search available skills by name, description, or tags.
      operationId: search_skills_api_agentic_skills_search_post
      parameters:
      - name: query
        in: query
        required: false
        schema:
          type: string
          default: ''
          title: Query
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/agentic/plan/{plan_id}:
    get:
      tags:
      - Agentic Chat
      summary: Get Plan Status
      description: Get the current status of an execution plan.
      operationId: get_plan_status_api_agentic_plan__plan_id__get
      parameters:
      - name: plan_id
        in: path
        required: true
        schema:
          type: string
          title: Plan Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/agentic/plan/{plan_id}/execute:
    post:
      tags:
      - Agentic Chat
      summary: Execute Plan
      description: 'Start executing a plan with the specified mode.

        Returns an SSE stream with execution events.


        Modes:

        - execute_all: Execute all steps, pausing only for approvals

        - step_by_step: Execute one step at a time, waiting for continue'
      operationId: execute_plan_api_agentic_plan__plan_id__execute_post
      parameters:
      - name: plan_id
        in: path
        required: true
        schema:
          type: string
          title: Plan Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlanExecuteRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/agentic/plan/{plan_id}/step/{step_id}/approve:
    post:
      tags:
      - Agentic Chat
      summary: Approve Plan Step
      description: 'Approve a step that requires approval.


        Optionally include modified_inputs to change the step''s inputs

        before execution.'
      operationId: approve_plan_step_api_agentic_plan__plan_id__step__step_id__approve_post
      parameters:
      - name: plan_id
        in: path
        required: true
        schema:
          type: string
          title: Plan Id
      - name: step_id
        in: path
        required: true
        schema:
          type: string
          title: Step Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StepApprovalRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/agentic/plan/{plan_id}/step/{step_id}/skip:
    post:
      tags:
      - Agentic Chat
      summary: Skip Plan Step
      description: Skip a step in the execution plan.
      operationId: skip_plan_step_api_agentic_plan__plan_id__step__step_id__skip_post
      parameters:
      - name: plan_id
        in: path
        required: true
        schema:
          type: string
          title: Plan Id
      - name: step_id
        in: path
        required: true
        schema:
          type: string
          title: Step Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/agentic/plan/{plan_id}/continue:
    post:
      tags:
      - Agentic Chat
      summary: Continue Plan Execution
      description: 'Continue plan execution (after approval or in step-by-step mode).

        Returns an SSE stream with execution events.'
      operationId: continue_plan_execution_api_agentic_plan__plan_id__continue_post
      parameters:
      - name: plan_id
        in: path
        required: true
        schema:
          type: string
          title: Plan Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/agentic/plan/{plan_id}/cancel:
    post:
      tags:
      - Agentic Chat
      summary: Cancel Plan
      description: Cancel an active execution plan.
      operationId: cancel_plan_api_agentic_plan__plan_id__cancel_post
      parameters:
      - name: plan_id
        in: path
        required: true
        schema:
          type: string
          title: Plan Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/agents/skills:
    get:
      tags:
      - Agent Skills
      summary: List Skills
      description: 'List all available skills with their configurations.


        - **category**: Filter by category (optional)

        - **search**: Search by name/description (optional)

        - **include_disabled**: Include disabled skills (default: true)'
      operationId: list_skills_api_agents_skills_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: include_disabled
        in: query
        required: false
        schema:
          type: boolean
          default: true
          title: Include Disabled
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SkillListResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/agents/skills/{skill_name}:
    get:
      tags:
      - Agent Skills
      summary: Get Skill
      description: 'Get configuration for a specific skill.


        - **skill_name**: The skill name (node type)'
      operationId: get_skill_api_agents_skills__skill_name__get
      parameters:
      - name: skill_name
        in: path
        required: true
        schema:
          type: string
          title: Skill Name
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SkillConfigResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Agent Skills
      summary: Update Skill
      description: 'Update configuration for a specific skill.


        - **skill_name**: The skill name (node type)'
      operationId: update_skill_api_agents_skills__skill_name__put
      parameters:
      - name: skill_name
        in: path
        required: true
        schema:
          type: string
          title: Skill Name
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SkillUpdateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SkillConfigResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/agents/skills/bulk:
    post:
      tags:
      - Agent Skills
      summary: Bulk Update Skills
      description: 'Update multiple skills with the same settings.


        Useful for enabling/disabling multiple skills at once.'
      operationId: bulk_update_skills_api_agents_skills_bulk_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkSkillUpdateRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkUpdateResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/agents/skills/categories/list:
    get:
      tags:
      - Agent Skills
      summary: List Categories
      description: Get list of all skill categories.
      operationId: list_categories_api_agents_skills_categories_list_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/agents/skills/approval-required:
    get:
      tags:
      - Agent Skills
      summary: Get Approval Required Skills
      description: Get list of skills that require approval.
      operationId: get_approval_required_skills_api_agents_skills_approval_required_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /workflow-chat/{workflow_id}/chat:
    post:
      tags:
      - Workflow Chat Integration
      summary: Process Chat Message
      description: Process a chat message through a workflow
      operationId: process_chat_message_workflow_chat__workflow_id__chat_post
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatMessageInput'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatWorkflowResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /workflow-chat/match:
    post:
      tags:
      - Workflow Chat Integration
      summary: Find Matching Workflows
      description: Find workflows that could handle a given message
      operationId: find_matching_workflows_workflow_chat_match_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatMessageInput'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/WorkflowMatchResult'
                title: Response Find Matching Workflows Workflow Chat Match Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /workflow-chat/{workflow_id}/executions:
    get:
      tags:
      - Workflow Chat Integration
      summary: Get Workflow Executions
      description: Get recent executions for a specific workflow
      operationId: get_workflow_executions_workflow_chat__workflow_id__executions_get
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 20
          title: Limit
      - name: hours_back
        in: query
        required: false
        schema:
          type: integer
          default: 2
          title: Hours Back
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/WorkflowExecutionResult'
                title: Response Get Workflow Executions Workflow Chat  Workflow Id  Executions
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /workflow-chat/all:
    get:
      tags:
      - Workflow Chat Integration
      summary: Get All Executions
      description: Get recent executions for all workflows in organization - resilient
        to missing workflows
      operationId: get_all_executions_workflow_chat_all_get
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 50
          title: Limit
      - name: hours_back
        in: query
        required: false
        schema:
          type: integer
          default: 24
          title: Hours Back
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/WorkflowExecutionResult'
                title: Response Get All Executions Workflow Chat All Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /workflow-chat/executions/{execution_id}:
    get:
      tags:
      - Workflow Chat Integration
      summary: Get Execution Details
      description: 'Get full details for a single execution including node_results,
        inputs, outputs.

        This endpoint fetches directly from the database - no snapshot required.'
      operationId: get_execution_details_workflow_chat_executions__execution_id__get
      parameters:
      - name: execution_id
        in: path
        required: true
        schema:
          type: string
          title: Execution Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /workflow-chat/executions/{execution_id}/snapshot:
    get:
      tags:
      - Workflow Chat Integration
      summary: Get Execution Snapshot
      description: "Get execution details along with the workflow snapshot.\nUsed\
        \ for loading a past execution into the workflow canvas.\n\nReturns:\n   \
        \ - execution: Full execution data including node_results\n    - workflow_snapshot:\
        \ The workflow definition as it was when executed\n    - snapshot_available:\
        \ Whether a snapshot exists for this execution\n    - is_workflow_modified:\
        \ Whether the current workflow differs from the snapshot"
      operationId: get_execution_snapshot_workflow_chat_executions__execution_id__snapshot_get
      parameters:
      - name: execution_id
        in: path
        required: true
        schema:
          type: string
          title: Execution Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecutionSnapshotResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /workflow-chat/executions/{execution_id}/rerun:
    post:
      tags:
      - Workflow Chat Integration
      summary: Rerun Execution
      description: 'Re-run an execution with the same trigger inputs.

        Uses the CURRENT workflow definition (which may have been edited).


        This allows users to:

        1. Load an old execution to see what happened

        2. Optionally edit the workflow

        3. Re-run with the same inputs to test fixes'
      operationId: rerun_execution_workflow_chat_executions__execution_id__rerun_post
      parameters:
      - name: execution_id
        in: path
        required: true
        schema:
          type: string
          title: Execution Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RerunExecutionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/workflow/cross-table-filter/tables:
    get:
      tags:
      - Cross Table Filter
      - Cross Table Filter
      summary: Get Available Tables
      description: Get list of available tables for Database Trigger and SQL Builder
        nodes.
      operationId: get_available_tables_api_workflow_cross_table_filter_tables_get
      parameters:
      - name: integration_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Database integration ID (optional, uses org DB if not provided)
          title: Integration Id
        description: Database integration ID (optional, uses org DB if not provided)
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/workflow/cross-table-filter/columns:
    get:
      tags:
      - Cross Table Filter
      - Cross Table Filter
      summary: Get Table Columns
      description: Get columns for specified tables for Database Trigger and SQL Builder
        nodes.
      operationId: get_table_columns_api_workflow_cross_table_filter_columns_get
      parameters:
      - name: tables
        in: query
        required: true
        schema:
          type: string
          description: Comma-separated list of table names
          title: Tables
        description: Comma-separated list of table names
      - name: integration_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Database integration ID
          title: Integration Id
        description: Database integration ID
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/workflow/cross-table-filter/custom-field-keys:
    get:
      tags:
      - Cross Table Filter
      - Cross Table Filter
      summary: Get Custom Field Keys
      description: Get available custom field keys for a specific table.
      operationId: get_custom_field_keys_api_workflow_cross_table_filter_custom_field_keys_get
      parameters:
      - name: table
        in: query
        required: true
        schema:
          type: string
          description: Table name to get custom field keys for
          title: Table
        description: Table name to get custom field keys for
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/workflow-streaming/workflow/{workflow_id}/stream:
    get:
      tags:
      - Workflow Streaming
      summary: Stream Workflow Events
      description: 'Stream workflow execution events via Server-Sent Events (SSE).


        This endpoint provides real-time updates as the workflow executes,

        including node progress, output messages, and human input requests.'
      operationId: stream_workflow_events_api_workflow_streaming_workflow__workflow_id__stream_get
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      - name: execution_id
        in: query
        required: true
        schema:
          type: string
          title: Execution Id
      - name: debug
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Debug
      - name: token
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Token
      - name: db_name
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Db Name
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/workflow-streaming/workflow/{workflow_id}/execute:
    post:
      tags:
      - Workflow Streaming
      summary: Execute Workflow With Stream
      description: 'Execute a workflow with streaming support.


        This starts the workflow execution and returns an execution ID

        that can be used to connect to the SSE stream.'
      operationId: execute_workflow_with_stream_api_workflow_streaming_workflow__workflow_id__execute_post
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      - name: debug
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Debug
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkflowStreamRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/workflow-streaming/workflow/{workflow_id}/input:
    post:
      tags:
      - Workflow Streaming
      summary: Submit Workflow Input
      description: 'Submit human input for a paused workflow execution.


        This endpoint is called when a workflow is waiting for human input

        via a Human Input node.'
      operationId: submit_workflow_input_api_workflow_streaming_workflow__workflow_id__input_post
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkflowInputRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/workflow-streaming/workflow/{workflow_id}/status/{execution_id}:
    get:
      tags:
      - Workflow Streaming
      summary: Get Workflow Execution Status
      description: 'Get the current status of a workflow execution.


        Useful for checking if a workflow is still running, waiting for input,

        or has completed.'
      operationId: get_workflow_execution_status_api_workflow_streaming_workflow__workflow_id__status__execution_id__get
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      - name: execution_id
        in: path
        required: true
        schema:
          type: string
          title: Execution Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/workflow-streaming/input/submit:
    post:
      tags:
      - Workflow Streaming
      summary: Submit Workflow Input
      description: 'Submit human input response for a workflow.


        This endpoint is called when a user responds to a Human-in-Loop node

        via the HumanApprovalCard in the chat interface.'
      operationId: submit_workflow_input_api_workflow_streaming_input_submit_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InputSubmissionRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Submit Workflow Input Api Workflow Streaming Input
                  Submit Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/workflow-streaming/session/{session_id}/waiting-for-input:
    get:
      tags:
      - Workflow Streaming
      summary: Check Waiting For Input By Execution
      description: Check if a workflow execution is waiting for user input.
      operationId: check_waiting_for_input_by_execution_api_workflow_streaming_session__session_id__waiting_for_input_get
      parameters:
      - name: session_id
        in: path
        required: true
        schema:
          type: string
          title: Session Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Check Waiting For Input By Execution Api Workflow
                  Streaming Session  Session Id  Waiting For Input Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/workflow-streaming/session/{session_id}/resume-with-input:
    post:
      tags:
      - Workflow Streaming
      summary: Resume Workflow With Input
      description: "Resume a waiting workflow with user input.\n\nExpected request\
        \ body:\n{\n    \"message\": \"user typed this\"\n}"
      operationId: resume_workflow_with_input_api_workflow_streaming_session__session_id__resume_with_input_post
      parameters:
      - name: session_id
        in: path
        required: true
        schema:
          type: string
          title: Session Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Request
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Resume Workflow With Input Api Workflow Streaming
                  Session  Session Id  Resume With Input Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/workflow-streaming/test-simple-input:
    post:
      tags:
      - Workflow Streaming
      summary: Test Simple Input Storage
      description: Test endpoint to manually store user input for waiting workflows
      operationId: test_simple_input_storage_api_workflow_streaming_test_simple_input_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Request
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/workflow-streaming/test-redis-check/{session_id}:
    get:
      tags:
      - Workflow Streaming
      summary: Test Redis Check
      description: Test endpoint to check what's in Redis for a session
      operationId: test_redis_check_api_workflow_streaming_test_redis_check__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'
  /api/workflow-streaming/execution/{execution_id}/continue:
    post:
      tags:
      - Workflow Streaming
      summary: Continue Existing Execution
      description: Continue an existing execution with new user message instead of
        creating new execution
      operationId: continue_existing_execution_api_workflow_streaming_execution__execution_id__continue_post
      parameters:
      - name: execution_id
        in: path
        required: true
        schema:
          type: string
          title: Execution Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Request Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/workflow-streaming/store-human-input:
    post:
      tags:
      - Workflow Streaming
      summary: Store Human Input For Waiting Node
      description: Store human input in Redis using the EXACT same format as backend
        simulation
      operationId: store_human_input_for_waiting_node_api_workflow_streaming_store_human_input_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Request Data
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/workflow-streaming/workflow/{workflow_id}/listen:
    get:
      tags:
      - Workflow Streaming
      summary: Listen To Workflow Events
      description: "SSE endpoint for listening to ALL executions of a workflow.\n\n\
        Used by the workflow builder to show real-time updates from any trigger type\n\
        (database, webhook, scheduler, click). This enables n8n-style live execution\n\
        visualization regardless of how the workflow was triggered.\n\nThe endpoint\
        \ subscribes to Redis pub/sub channel: workflow:listen:{workflow_id}\nEvents\
        \ are published by workflow_service.py via redis_event_publisher.py\n\nArgs:\n\
        \    workflow_id: The workflow to listen to\n    request: FastAPI request\
        \ object\n    token: Optional auth token (EventSource doesn't support headers)"
      operationId: listen_to_workflow_events_api_workflow_streaming_workflow__workflow_id__listen_get
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      - name: token
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /triggers/test:
    post:
      tags:
      - Click Triggers
      summary: Test Trigger
      description: Test a click trigger by executing workflows that listen to it
      operationId: test_trigger_triggers_test_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TriggerTestRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TriggerResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /triggers/execute:
    post:
      tags:
      - Click Triggers
      summary: Execute Trigger
      description: Execute workflows triggered by a frontend button click
      operationId: execute_trigger_triggers_execute_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TriggerExecuteRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TriggerResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/workflow/executions/{execution_id}/human-input:
    post:
      tags:
      - Human Input
      summary: Submit Human Input
      description: 'Submit human input for a paused workflow.


        This resumes the workflow with the user''s selection/input.

        The workflow must be paused at a human_in_loop node.'
      operationId: submit_human_input_api_workflow_executions__execution_id__human_input_post
      parameters:
      - name: execution_id
        in: path
        required: true
        schema:
          type: string
          title: Execution Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HumanInputSubmission'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HumanInputResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Human Input
      summary: Get Pending Human Input
      description: 'Get details of pending human input for an execution.


        Returns the prompt, options, and other configuration needed to display

        the human input UI.'
      operationId: get_pending_human_input_api_workflow_executions__execution_id__human_input_get
      parameters:
      - name: execution_id
        in: path
        required: true
        schema:
          type: string
          title: Execution Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Pending Human Input Api Workflow Executions  Execution
                  Id  Human Input Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /blueprints/{workflow_id}/generate:
    post:
      tags:
      - Workflow Blueprints
      summary: Generate Workflow From Blueprint
      description: 'Generate workflow nodes from a blueprint using AI.


        This endpoint:

        1. Gets the workflow''s blueprint_definition

        2. Triggers the AI workflow generator via click trigger

        3. Returns execution IDs and stream URLs for tracking progress


        The actual workflow generation happens asynchronously via SSE.'
      operationId: generate_workflow_from_blueprint_blueprints__workflow_id__generate_post
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BlueprintGenerateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /webhooks/vapi/webhook:
    post:
      tags:
      - Webhooks
      summary: Vapi Webhook
      description: 'Receive VAPI call events via webhook and trigger matching workflows


        This endpoint is designed to receive webhooks from VAPI about call events.

        When a call event is received (such as call.started or call.completed),

        it finds workflows with matching trigger nodes and executes them.


        The processing happens in the background to quickly return a response

        to the webhook sender.'
      operationId: vapi_webhook_webhooks_vapi_webhook_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VAPIWebhookEvent'
        required: true
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/webhook/trigger/{workflow_id}/{node_id}:
    patch:
      tags:
      - Workflow Webhooks
      summary: Legacy Webhook Endpoint
      description: "Webhook endpoint that triggers a workflow\n\nArgs:\n    workflow_id:\
        \ The ID of the workflow to trigger\n    node_id: The ID of the webhook trigger\
        \ node\n    request: Request object\n\nReturns:\n    JSON response with execution\
        \ result"
      operationId: legacy_webhook_endpoint_api_webhook_trigger__workflow_id___node_id__patch
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      - name: node_id
        in: path
        required: true
        schema:
          type: string
          title: Node Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Workflow Webhooks
      summary: Legacy Webhook Endpoint
      description: "Webhook endpoint that triggers a workflow\n\nArgs:\n    workflow_id:\
        \ The ID of the workflow to trigger\n    node_id: The ID of the webhook trigger\
        \ node\n    request: Request object\n\nReturns:\n    JSON response with execution\
        \ result"
      operationId: legacy_webhook_endpoint_api_webhook_trigger__workflow_id___node_id__delete
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      - name: node_id
        in: path
        required: true
        schema:
          type: string
          title: Node Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Workflow Webhooks
      summary: Legacy Webhook Endpoint
      description: "Webhook endpoint that triggers a workflow\n\nArgs:\n    workflow_id:\
        \ The ID of the workflow to trigger\n    node_id: The ID of the webhook trigger\
        \ node\n    request: Request object\n\nReturns:\n    JSON response with execution\
        \ result"
      operationId: legacy_webhook_endpoint_api_webhook_trigger__workflow_id___node_id__put
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      - name: node_id
        in: path
        required: true
        schema:
          type: string
          title: Node Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Workflow Webhooks
      summary: Legacy Webhook Endpoint
      description: "Webhook endpoint that triggers a workflow\n\nArgs:\n    workflow_id:\
        \ The ID of the workflow to trigger\n    node_id: The ID of the webhook trigger\
        \ node\n    request: Request object\n\nReturns:\n    JSON response with execution\
        \ result"
      operationId: legacy_webhook_endpoint_api_webhook_trigger__workflow_id___node_id__get
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      - name: node_id
        in: path
        required: true
        schema:
          type: string
          title: Node Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Workflow Webhooks
      summary: Legacy Webhook Endpoint
      description: "Webhook endpoint that triggers a workflow\n\nArgs:\n    workflow_id:\
        \ The ID of the workflow to trigger\n    node_id: The ID of the webhook trigger\
        \ node\n    request: Request object\n\nReturns:\n    JSON response with execution\
        \ result"
      operationId: legacy_webhook_endpoint_api_webhook_trigger__workflow_id___node_id__post
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      - name: node_id
        in: path
        required: true
        schema:
          type: string
          title: Node Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/webhook/health:
    get:
      tags:
      - Workflow Webhooks
      summary: Webhook Health
      description: Health check endpoint for webhook service
      operationId: webhook_health_api_webhook_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/webhook/ngrok-url:
    get:
      tags:
      - Workflow Webhooks
      summary: Get Ngrok Url
      description: Get the current ngrok URL if available
      operationId: get_ngrok_url_api_webhook_ngrok_url_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/webhook/executions/all:
    get:
      tags:
      - Workflow Webhooks
      summary: Get All Webhook Executions
      description: Get all webhook executions for debugging
      operationId: get_all_webhook_executions_api_webhook_executions_all_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/webhook/executions/{workflow_id}:
    get:
      tags:
      - Workflow Webhooks
      summary: Get Webhook Executions
      description: Get recent webhook executions for a workflow
      operationId: get_webhook_executions_api_webhook_executions__workflow_id__get
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/accounts:
    get:
      tags:
      - WhatsApp Integration
      summary: Get Whatsapp Accounts
      description: Get all WhatsApp accounts for a user
      operationId: get_whatsapp_accounts_api_whatsapp_accounts_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
    post:
      tags:
      - WhatsApp Integration
      summary: Create Whatsapp Account
      description: Create or update WhatsApp account configuration
      operationId: create_whatsapp_account_api_whatsapp_accounts_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WhatsAppAccountCreate'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/templates:
    get:
      tags:
      - WhatsApp Integration
      summary: Get Templates
      description: Get all message templates
      operationId: get_templates_api_whatsapp_templates_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
    post:
      tags:
      - WhatsApp Integration
      summary: Create Template
      description: Create a new message template
      operationId: create_template_api_whatsapp_templates_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageTemplateCreate'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/send/text:
    post:
      tags:
      - WhatsApp Integration
      summary: Send Text Message
      description: Send a text message via WhatsApp
      operationId: send_text_message_api_whatsapp_send_text_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendTextMessage'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/send/template:
    post:
      tags:
      - WhatsApp Integration
      summary: Send Template Message
      description: Send a template message via WhatsApp
      operationId: send_template_message_api_whatsapp_send_template_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendTemplateMessage'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/conversations_old:
    get:
      tags:
      - WhatsApp Integration
      summary: Get Conversations Old
      description: Get WhatsApp conversations (OLD - DEPRECATED)
      operationId: get_conversations_old_api_whatsapp_conversations_old_get
      parameters:
      - name: status
        in: query
        required: false
        schema:
          type: string
          default: open
          title: Status
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 50
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          default: 0
          title: Offset
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/messages_old/{conversation_id}:
    get:
      tags:
      - WhatsApp Integration
      summary: Get Conversation Messages Old
      description: Get messages for a specific conversation
      operationId: get_conversation_messages_old_api_whatsapp_messages_old__conversation_id__get
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          title: Conversation Id
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 50
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          default: 0
          title: Offset
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /webhook/whatsapp/{org_id}/{integration_id}:
    get:
      tags:
      - WhatsApp Integration
      summary: Whatsapp Webhook Verify With Ids
      description: Handle WhatsApp webhook verification with org and integration IDs
      operationId: whatsapp_webhook_verify_with_ids_webhook_whatsapp__org_id___integration_id__get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - WhatsApp Integration
      summary: Whatsapp Webhook With Ids
      description: Handle WhatsApp webhooks with org and integration IDs
      operationId: whatsapp_webhook_with_ids_webhook_whatsapp__org_id___integration_id__post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /webhook/whatsapp:
    get:
      tags:
      - WhatsApp Integration
      summary: Whatsapp Webhook Verify
      description: Handle WhatsApp webhook verification (legacy)
      operationId: whatsapp_webhook_verify_webhook_whatsapp_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
    post:
      tags:
      - WhatsApp Integration
      summary: Whatsapp Webhook
      description: Handle WhatsApp webhooks (legacy)
      operationId: whatsapp_webhook_webhook_whatsapp_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /coexistence/sync/{integration_id}:
    post:
      tags:
      - WhatsApp Integration
      summary: Initiate Coexistence Sync
      description: 'Initiate coexistence synchronization for WhatsApp Business app
        users


        This endpoint triggers both contacts and message history synchronization

        via Facebook''s smb_app_data API. Can only be called ONCE per integration.'
      operationId: initiate_coexistence_sync_coexistence_sync__integration_id__post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /coexistence/sync/{integration_id}/status:
    get:
      tags:
      - WhatsApp Integration
      summary: Get Coexistence Sync Status
      description: Get coexistence synchronization status for an integration
      operationId: get_coexistence_sync_status_coexistence_sync__integration_id__status_get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /coexistence/status/{integration_id}:
    get:
      tags:
      - WhatsApp Integration
      summary: Check Coexistence Onboarding Status
      description: 'Check if business phone number is ready for coexistence


        Verifies that the phone number is connected to both Cloud API and WhatsApp
        Business app'
      operationId: check_coexistence_onboarding_status_coexistence_status__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /webhook/wati/{org_id}/{integration_id}:
    get:
      tags:
      - WhatsApp Integration
      summary: Wati Webhook Verify
      description: 'Handle WATI webhook verification


        WATI may send a verification request when configuring webhooks.

        Configure this URL in your WATI Dashboard: https://app.wati.io/'
      operationId: wati_webhook_verify_webhook_wati__org_id___integration_id__get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - WhatsApp Integration
      summary: Wati Webhook
      description: "Handle incoming WATI WhatsApp webhooks\n\nWATI webhook events:\n\
        - message:in:new - New incoming message\n- message:update:status - Message\
        \ status update (sent, delivered, read, failed)\n\nWATI Webhook Payload Format:\n\
        {\n    \"eventType\": \"message:in:new\" | \"message:update:status\",\n  \
        \  \"whatsappNumber\": \"919876543210\",\n    \"id\": \"message_id\",\n  \
        \  \"messageId\": \"message_id\",\n    \"status\": \"SENT\" | \"DELIVERED\"\
        \ | \"READ\" | \"FAILED\",\n    \"type\": \"text\" | \"image\" | \"document\"\
        ,\n    \"text\": \"message content\",\n    \"timestamp\": \"2024-01-15T10:30:00Z\"\
        ,\n    \"replyToMessageId\": \"original_message_id\"\n}"
      operationId: wati_webhook_webhook_wati__org_id___integration_id__post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /webhook/gupshup/{org_id}/{integration_id}:
    get:
      tags:
      - WhatsApp Integration
      summary: Gupshup Webhook Verify
      description: Handle Gupshup webhook verification
      operationId: gupshup_webhook_verify_webhook_gupshup__org_id___integration_id__get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - WhatsApp Integration
      summary: Gupshup Webhook
      description: "Handle incoming Gupshup WhatsApp webhooks\n\nGupshup webhook events:\n\
        - message-event - Incoming message\n- message-status - Status update\n\nGupshup\
        \ Webhook Payload Format:\n{\n    \"app\": \"app_name\",\n    \"timestamp\"\
        : 1234567890,\n    \"version\": 2,\n    \"type\": \"message\" | \"message-event\"\
        ,\n    \"payload\": {\n        \"id\": \"message_id\",\n        \"source\"\
        : \"919876543210\",\n        \"type\": \"text\" | \"image\" | \"document\"\
        ,\n        \"payload\": {\n            \"text\": \"message content\"\n   \
        \     }\n    }\n}"
      operationId: gupshup_webhook_webhook_gupshup__org_id___integration_id__post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /webhook/pinnacle/{org_id}/{integration_id}:
    get:
      tags:
      - WhatsApp Integration
      summary: Pinnacle Webhook Verify
      description: 'Handle Pinnacle WhatsApp webhook verification


        Pinnacle may send a verification request with a challenge token.

        Configure this URL in your PinBot Dashboard: https://console.pinbot.ai/'
      operationId: pinnacle_webhook_verify_webhook_pinnacle__org_id___integration_id__get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - WhatsApp Integration
      summary: Pinnacle Webhook
      description: "Handle incoming Pinnacle WhatsApp webhooks\n\nReceives:\n- Incoming\
        \ messages from users\n- Message delivery status updates (sent, delivered,\
        \ read, failed)\n- Message replies\n\nPinnacle Webhook Payload Format (typical):\n\
        {\n    \"event\": \"message\" | \"status\",\n    \"from\": \"919876543210\"\
        ,\n    \"to\": \"918765432109\",\n    \"message_id\": \"wamid.xxx\",\n   \
        \ \"timestamp\": \"1234567890\",\n    \"type\": \"text\" | \"image\" | \"\
        document\" | \"video\" | \"audio\",\n    \"text\": {\"body\": \"message content\"\
        },  // for text messages\n    \"status\": \"sent\" | \"delivered\" | \"read\"\
        \ | \"failed\",  // for status updates\n    \"error\": {...}  // if failed\n\
        }"
      operationId: pinnacle_webhook_webhook_pinnacle__org_id___integration_id__post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /webhook/aisensy/{org_id}/{integration_id}:
    get:
      tags:
      - WhatsApp Integration
      summary: Aisensy Webhook Verify
      description: Handle AISensy webhook verification
      operationId: aisensy_webhook_verify_webhook_aisensy__org_id___integration_id__get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - WhatsApp Integration
      summary: Aisensy Webhook
      description: 'Handle incoming AISensy WhatsApp webhooks


        AISensy sends webhooks for:

        - Incoming messages

        - Delivery status updates'
      operationId: aisensy_webhook_webhook_aisensy__org_id___integration_id__post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/conversations:
    get:
      tags:
      - WhatsApp Conversations
      summary: Get Conversations
      description: Get list of conversations with optional filters and pagination
      operationId: get_conversations_api_whatsapp_conversations_get
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: page_size
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 50
          title: Page Size
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
      - name: assigned_to
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Assigned To
      - name: unread
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Unread
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: phone_number
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter conversations by customer phone number
          title: Phone Number
        description: Filter conversations by customer phone number
      - name: contact_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter conversations by contact ID
          title: Contact Id
        description: Filter conversations by contact ID
      - name: sort_by
        in: query
        required: false
        schema:
          type: string
          default: last_message_at
          title: Sort By
      - name: sort_order
        in: query
        required: false
        schema:
          type: string
          default: desc
          title: Sort Order
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/conversations/{conversation_id}:
    get:
      tags:
      - WhatsApp Conversations
      summary: Get Conversation
      description: Get a specific conversation by ID with detailed information
      operationId: get_conversation_api_whatsapp_conversations__conversation_id__get
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          description: Conversation ID
          title: Conversation Id
        description: Conversation ID
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - WhatsApp Conversations
      summary: Update Conversation
      description: "Update conversation properties\n\nBody:\n{\n    \"status\": \"\
        active\", // optional: active, paused, closed, archived\n    \"assigned_to\"\
        : \"agent@example.com\", // optional\n    \"tags\": [\"support\", \"vip\"\
        ], // optional\n    \"contact_name\": \"Updated Name\", // optional\n    \"\
        metadata\": {} // optional: additional metadata\n}"
      operationId: update_conversation_api_whatsapp_conversations__conversation_id__put
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          description: Conversation ID
          title: Conversation Id
        description: Conversation ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/conversations/{conversation_id}/messages:
    get:
      tags:
      - WhatsApp Conversations
      summary: Get Messages
      description: 'Get messages for a conversation with pagination


        Query Parameters:

        - page: Page number (default: 1)

        - page_size: Number of messages per page (default: 50, max: 100)

        - before: Get messages before this timestamp (ISO format)

        - after: Get messages after this timestamp (ISO format)

        - message_type: Filter by message type (text, image, document, audio, video)

        - direction: Filter by direction (inbound, outbound)'
      operationId: get_messages_api_whatsapp_conversations__conversation_id__messages_get
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          description: Conversation ID
          title: Conversation Id
        description: Conversation ID
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: page_size
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 50
          title: Page Size
      - name: before
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Before
      - name: after
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: After
      - name: message_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Message Type
      - name: direction
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Direction
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - WhatsApp Conversations
      summary: Send Message
      description: "Send a message in a conversation\n\nBody:\n{\n    \"content\"\
        : \"Message content\",\n    \"message_type\": \"text\", // optional: text,\
        \ image, document, audio, video\n    \"media_url\": \"...\", // optional:\
        \ URL for media messages\n    \"media_caption\": \"...\", // optional: caption\
        \ for media\n    \"is_automated\": false, // optional: default false\n   \
        \ \"workflow_id\": \"...\", // optional: workflow that sent this message\n\
        \    \"workflow_node_id\": \"...\" // optional: specific node in workflow\n\
        }"
      operationId: send_message_api_whatsapp_conversations__conversation_id__messages_post
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          description: Conversation ID
          title: Conversation Id
        description: Conversation ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/conversations/{conversation_id}/send-template:
    post:
      tags:
      - WhatsApp Conversations
      summary: Send Template Message
      description: "Send a WhatsApp template message in a conversation\n\nBody:\n\
        {\n    \"template_id\": \"template_uuid\", // optional: template from database\n\
        \    \"template_name\": \"template_name\", // WhatsApp template name\n   \
        \ \"language\": \"en\", // optional: default 'en'\n    \"variables\": {...},\
        \ // optional: template variables as key-value pairs\n    \"components\":\
        \ [...], // optional: template parameters (auto-generated from variables)\n\
        \    \"phone_number\": \"919876543210\", // optional: phone number for new\
        \ conversations\n    \"contact_name\": \"John Doe\" // optional: contact name\
        \ for new conversations\n}\n\nIf conversation doesn't exist and phone_number\
        \ is provided, a new conversation will be created."
      operationId: send_template_message_api_whatsapp_conversations__conversation_id__send_template_post
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          description: Conversation ID
          title: Conversation Id
        description: Conversation ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/conversations/{conversation_id}/send-media:
    post:
      tags:
      - WhatsApp Conversations
      summary: Send Media Message
      description: Send a media file (image, video, audio, document) in a WhatsApp
        conversation
      operationId: send_media_message_api_whatsapp_conversations__conversation_id__send_media_post
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          description: Conversation ID
          title: Conversation Id
        description: Conversation ID
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_send_media_message_api_whatsapp_conversations__conversation_id__send_media_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/conversations/{conversation_id}/send-asset:
    post:
      tags:
      - WhatsApp Conversations
      summary: Send Asset Message
      description: "Send a selected asset from the asset library in a WhatsApp conversation\n\
        \nBody:\n{\n    \"asset_id\": \"asset_uuid\",\n    \"asset_url\": \"https://...\"\
        ,\n    \"asset_type\": \"image\",\n    \"asset_name\": \"filename.png\",\n\
        \    \"caption\": \"optional caption\"\n}"
      operationId: send_asset_message_api_whatsapp_conversations__conversation_id__send_asset_post
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          description: Conversation ID
          title: Conversation Id
        description: Conversation ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/conversations/{conversation_id}/assign:
    post:
      tags:
      - WhatsApp Conversations
      summary: Assign Conversation
      description: "Assign conversation to an agent\n\nBody:\n{\n    \"agent_email\"\
        : \"agent@example.com\",\n    \"reason\": \"Customer request\" // optional\n\
        }"
      operationId: assign_conversation_api_whatsapp_conversations__conversation_id__assign_post
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          description: Conversation ID
          title: Conversation Id
        description: Conversation ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/conversations/{conversation_id}/tags:
    post:
      tags:
      - WhatsApp Conversations
      summary: Add Tags
      description: "Add tags to a conversation\n\nBody:\n{\n    \"tags\": [\"support\"\
        , \"urgent\", \"vip\"]\n}"
      operationId: add_tags_api_whatsapp_conversations__conversation_id__tags_post
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          description: Conversation ID
          title: Conversation Id
        description: Conversation ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/conversations/{conversation_id}/read:
    post:
      tags:
      - WhatsApp Conversations
      summary: Mark As Read
      description: Mark conversation as read (clear unread count)
      operationId: mark_as_read_api_whatsapp_conversations__conversation_id__read_post
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          description: Conversation ID
          title: Conversation Id
        description: Conversation ID
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/conversations/{conversation_id}/switch-workflow:
    post:
      tags:
      - WhatsApp Conversations
      summary: Switch Workflow
      description: "Switch to a different workflow\n\nBody:\n{\n    \"workflow_id\"\
        : \"new_workflow_id\",\n    \"reason\": \"User requested billing help\" //\
        \ optional\n}"
      operationId: switch_workflow_api_whatsapp_conversations__conversation_id__switch_workflow_post
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          description: Conversation ID
          title: Conversation Id
        description: Conversation ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/conversations/{conversation_id}/export:
    get:
      tags:
      - WhatsApp Conversations
      summary: Export Conversation
      description: 'Export conversation history


        Query Parameters:

        - format: Export format (json, csv, pdf) - default: json'
      operationId: export_conversation_api_whatsapp_conversations__conversation_id__export_get
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          description: Conversation ID
          title: Conversation Id
        description: Conversation ID
      - name: format
        in: query
        required: false
        schema:
          type: string
          description: Export format (json, csv, pdf)
          default: json
          title: Format
        description: Export format (json, csv, pdf)
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/conversations/{conversation_id}/stats:
    get:
      tags:
      - WhatsApp Conversations
      summary: Get Conversation Stats
      description: Get conversation statistics
      operationId: get_conversation_stats_api_whatsapp_conversations__conversation_id__stats_get
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          description: Conversation ID
          title: Conversation Id
        description: Conversation ID
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/messages/search:
    get:
      tags:
      - WhatsApp Conversations
      summary: Search Messages
      description: 'Search messages across conversations


        Query Parameters:

        - q: Search query (required)

        - conversation_id: Limit search to specific conversation (optional)

        - limit: Maximum results (default: 50, max: 200)

        - message_type: Filter by message type (optional)

        - direction: Filter by direction (optional)

        - date_from: Search from date (ISO format, optional)

        - date_to: Search to date (ISO format, optional)'
      operationId: search_messages_api_whatsapp_messages_search_get
      parameters:
      - name: q
        in: query
        required: true
        schema:
          type: string
          description: Search query
          title: Q
        description: Search query
      - name: conversation_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Conversation Id
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 200
          minimum: 1
          default: 50
          title: Limit
      - name: message_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Message Type
      - name: direction
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Direction
      - 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: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/conversations/{conversation_id}/toggle-agent-mode:
    post:
      tags:
      - WhatsApp Conversations
      summary: Toggle Agent Mode
      description: "Toggle between AI and Human agent modes for a conversation\n\n\
        Body:\n{\n    \"agent_mode\": \"human\", // \"ai\" or \"human\"\n    \"reason\"\
        : \"Customer needs human assistance\", // optional\n    \"pause_workflow\"\
        : true // optional: whether to pause current workflow when switching to human\
        \ mode\n}"
      operationId: toggle_agent_mode_api_whatsapp_conversations__conversation_id__toggle_agent_mode_post
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          description: Conversation ID
          title: Conversation Id
        description: Conversation ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/conversations/{conversation_id}/agent-mode:
    get:
      tags:
      - WhatsApp Conversations
      summary: Get Agent Mode
      description: Get current agent mode for a conversation
      operationId: get_agent_mode_api_whatsapp_conversations__conversation_id__agent_mode_get
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          description: Conversation ID
          title: Conversation Id
        description: Conversation ID
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/agent-mode-transitions/{conversation_id}:
    get:
      tags:
      - WhatsApp Conversations
      summary: Get Agent Mode Transitions
      description: Get agent mode transition history for a conversation
      operationId: get_agent_mode_transitions_api_whatsapp_agent_mode_transitions__conversation_id__get
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          description: Conversation ID
          title: Conversation Id
        description: Conversation ID
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 50
          minimum: 1
          default: 10
          title: Limit
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/quick-replies:
    get:
      tags:
      - WhatsApp Conversations
      summary: Get Quick Replies
      description: 'Get quick reply templates


        Query Parameters:

        - category: Filter by category (optional)'
      operationId: get_quick_replies_api_whatsapp_quick_replies_get
      parameters:
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by category
          title: Category
        description: Filter by category
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/oauth/callback:
    post:
      tags:
      - WhatsApp Conversations
      summary: Whatsapp Oauth Callback
      description: Handle WhatsApp OAuth callback and exchange code for access token
      operationId: whatsapp_oauth_callback_api_whatsapp_oauth_callback_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WhatsAppOAuthCallbackRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/webhook-subscribe/{integration_id}:
    post:
      tags:
      - WhatsApp Conversations
      summary: Subscribe Webhook
      description: Subscribe to WhatsApp webhooks for the integration
      operationId: subscribe_webhook_api_whatsapp_webhook_subscribe__integration_id__post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/coexistence/sync/{integration_id}:
    post:
      tags:
      - WhatsApp Conversations
      summary: Initiate Coexistence Sync
      description: 'Initiate coexistence synchronization for WhatsApp Business app
        users


        This endpoint triggers both contacts and message history synchronization

        via Facebook''s smb_app_data API. Can only be called ONCE per integration.'
      operationId: initiate_coexistence_sync_api_whatsapp_coexistence_sync__integration_id__post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/coexistence/status/{integration_id}:
    get:
      tags:
      - WhatsApp Conversations
      summary: Check Coexistence Onboarding Status
      description: 'Check if business phone number is ready for coexistence


        Verifies that the phone number is connected to both Cloud API and WhatsApp
        Business app'
      operationId: check_coexistence_onboarding_status_api_whatsapp_coexistence_status__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/conversations/by-phone/{phone_number}:
    get:
      tags:
      - WhatsApp Conversations
      summary: Get Conversations By Phone
      description: 'Get conversation history for a specific phone number

        Useful for customer service to see complete interaction history'
      operationId: get_conversations_by_phone_api_whatsapp_conversations_by_phone__phone_number__get
      parameters:
      - name: phone_number
        in: path
        required: true
        schema:
          type: string
          description: Customer phone number
          title: Phone Number
        description: Customer phone number
      - name: include_messages
        in: query
        required: false
        schema:
          type: boolean
          description: Include recent messages in response
          default: false
          title: Include Messages
        description: Include recent messages in response
      - name: message_limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 50
          minimum: 1
          description: Number of recent messages to include
          default: 10
          title: Message Limit
        description: Number of recent messages to include
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/messages/by-phone/{phone_number}:
    get:
      tags:
      - WhatsApp Conversations
      summary: Get Messages By Phone
      description: 'Get all message history for a specific phone number across all
        conversations

        Useful for complete customer communication timeline'
      operationId: get_messages_by_phone_api_whatsapp_messages_by_phone__phone_number__get
      parameters:
      - name: phone_number
        in: path
        required: true
        schema:
          type: string
          description: Customer phone number
          title: Phone Number
        description: Customer phone number
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: page_size
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 50
          title: Page Size
      - name: days
        in: query
        required: false
        schema:
          anyOf:
          - type: integer
            maximum: 365
            minimum: 1
          - type: 'null'
          description: Limit to messages from last N days
          title: Days
        description: Limit to messages from last N days
      - name: direction
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Message direction: inbound, outbound'
          title: Direction
        description: 'Message direction: inbound, outbound'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/integration-status:
    get:
      tags:
      - WhatsApp Conversations
      summary: Get Whatsapp Integration Status
      description: "Check WhatsApp integration status - whether it's configured and\
        \ the token is valid.\nThis helps users understand why messages might not\
        \ be sending/receiving.\n\nSupports all WhatsApp BSPs:\n- Meta WhatsApp Business\
        \ API (meta_whatsapp, whatsapp)\n- WATI (wati)\n- Gupshup (gupshup)\n- Pinnacle\
        \ (pinnacle_whatsapp)\n- AISensy (aisensy)\n\nReturns:\n    - status: 'connected',\
        \ 'disconnected', 'error', 'not_configured'\n    - message: Human-readable\
        \ status message\n    - details: Additional details about the integration"
      operationId: get_whatsapp_integration_status_api_whatsapp_integration_status_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/whatsapp/catalog/create:
    post:
      tags:
      - WhatsApp Product Catalog
      summary: Create Catalog
      description: 'Create or get WhatsApp product catalog for an integration


        This endpoint:

        - Creates a new Meta Commerce Manager catalog

        - Connects it to your WhatsApp Business Account (WABA)

        - Sets commerce settings for your phone number

        - Returns catalog details'
      operationId: create_catalog_api_whatsapp_catalog_create_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CatalogCreate'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/catalog/sync:
    post:
      tags:
      - WhatsApp Product Catalog
      summary: Sync Products To Catalog
      description: 'Sync Expedify products to WhatsApp catalog


        If whatsapp_catalog_id is not provided, uses the default catalog.

        If product_ids is provided, sync only those products.

        Otherwise, sync all active products.


        This operation may take a while for large catalogs.'
      operationId: sync_products_to_catalog_api_whatsapp_catalog_sync_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProductSyncRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/catalog/send-product:
    post:
      tags:
      - WhatsApp Product Catalog
      summary: Send Product Message
      description: 'Send product message to customer via WhatsApp


        Message types:

        - single: Send one product (requires exactly 1 product_id)

        - multi: Send up to 30 products in a list'
      operationId: send_product_message_api_whatsapp_catalog_send_product_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendProductMessage'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/catalog/send-by-category:
    post:
      tags:
      - WhatsApp Product Catalog
      summary: Send Categorized Products
      description: 'Send products organized by categories


        This endpoint:

        - Gets products from specified categories

        - Organizes them into sections

        - Sends as a multi-product message with categories'
      operationId: send_categorized_products_api_whatsapp_catalog_send_by_category_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendCategorizedProductMessage'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/catalog/status/{integration_id}:
    get:
      tags:
      - WhatsApp Product Catalog
      summary: Get Catalog Status
      description: 'Get catalog configuration and sync status


        Returns:

        - Whether catalog is configured

        - All catalogs for this integration

        - Default catalog info

        - WABA and phone number details'
      operationId: get_catalog_status_api_whatsapp_catalog_status__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/catalog/list/{integration_id}:
    get:
      tags:
      - WhatsApp Product Catalog
      summary: List Existing Catalogs
      description: 'List all existing catalogs connected to the WABA


        This is useful when a catalog was created manually via WhatsApp Business Manager

        and you want to use it instead of creating a new one'
      operationId: list_existing_catalogs_api_whatsapp_catalog_list__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/catalog/import:
    post:
      tags:
      - WhatsApp Product Catalog
      summary: Import Products From Catalog
      description: 'Import products from Meta catalog to Expedify


        This is the REVERSE sync - fetches products from your existing WhatsApp catalog

        and creates them in Expedify.


        If whatsapp_catalog_id is not provided, uses the default catalog.


        Useful when:

        - You already have products in WhatsApp Business Manager

        - You want to migrate your WhatsApp catalog to Expedify

        - You need to sync product inventory from Meta to Expedify


        Parameters:

        - whatsapp_catalog_id: Specific catalog to import from (optional)

        - overwrite_existing: If True, updates existing products. If False, skips
        duplicates.'
      operationId: import_products_from_catalog_api_whatsapp_catalog_import_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImportProductsRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/catalog/sync-logs/{integration_id}:
    get:
      tags:
      - WhatsApp Product Catalog
      summary: Get Sync Logs
      description: 'Get catalog synchronization logs


        Returns recent sync operations with success/failure counts'
      operationId: get_sync_logs_api_whatsapp_catalog_sync_logs__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 10
          title: Limit
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/catalog/{whatsapp_catalog_id}/available-products:
    get:
      tags:
      - WhatsApp Product Catalog
      summary: Get Available Products For Catalog
      description: 'Get products available for syncing to a specific catalog


        Returns:

        - Products not synced to any catalog (new)

        - Products already synced to THIS catalog (can re-sync/update)


        Excludes:

        - Products synced to OTHER catalogs (can''t be in multiple catalogs)'
      operationId: get_available_products_for_catalog_api_whatsapp_catalog__whatsapp_catalog_id__available_products_get
      parameters:
      - name: whatsapp_catalog_id
        in: path
        required: true
        schema:
          type: string
          title: Whatsapp Catalog Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/catalog/product-mappings/{integration_id}:
    get:
      tags:
      - WhatsApp Product Catalog
      summary: Get Product Mappings
      description: 'Get product-to-catalog mappings


        Shows which Expedify products are synced to the catalog'
      operationId: get_product_mappings_api_whatsapp_catalog_product_mappings__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by sync status
          title: Status
        description: Filter by sync status
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 500
          minimum: 1
          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/whatsapp/catalog/all/{integration_id}:
    get:
      tags:
      - WhatsApp Product Catalog
      summary: List All Catalogs
      description: 'List all catalogs associated with an integration


        Returns both Meta catalogs and locally registered catalogs'
      operationId: list_all_catalogs_api_whatsapp_catalog_all__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/catalog/create-new:
    post:
      tags:
      - WhatsApp Product Catalog
      summary: Create New Catalog
      description: 'Create a brand new catalog in Meta Commerce Manager


        This always creates a new catalog, unlike /catalog/create which returns existing
        ones'
      operationId: create_new_catalog_api_whatsapp_catalog_create_new_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateNewCatalogRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/catalog/set-default/{whatsapp_catalog_id}:
    put:
      tags:
      - WhatsApp Product Catalog
      summary: Set Default Catalog
      description: 'Set a catalog as the default for its integration and switch the
        WABA catalog


        **Important**: Only ONE catalog can be connected to a WhatsApp Business Account
        at a time.


        This endpoint will:

        1. Get the currently connected catalog from WABA

        2. Disconnect the old catalog from WABA (DELETE /{waba_id}/product_catalogs)

        3. Connect the new catalog to WABA (POST /{waba_id}/product_catalogs)

        4. Update Expedify database to mark catalog as default


        The catalog change will be immediately visible in Meta Business Manager.'
      operationId: set_default_catalog_api_whatsapp_catalog_set_default__whatsapp_catalog_id__put
      parameters:
      - name: whatsapp_catalog_id
        in: path
        required: true
        schema:
          type: string
          title: Whatsapp Catalog Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/whatsapp/catalog/{whatsapp_catalog_id}:
    delete:
      tags:
      - WhatsApp Product Catalog
      summary: Delete Catalog
      description: 'Remove catalog from Expedify database


        WARNING: This only removes the catalog reference from Expedify.

        The catalog will remain in Meta Commerce Manager.

        Products synced to this catalog will remain in Meta.'
      operationId: delete_catalog_api_whatsapp_catalog__whatsapp_catalog_id__delete
      parameters:
      - name: whatsapp_catalog_id
        in: path
        required: true
        schema:
          type: string
          title: Whatsapp Catalog Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat/embed/:
    post:
      tags:
      - Embed Chat
      - embed
      summary: Process Embed Chat
      description: 'Process chat message from embedded widget


        This endpoint is designed for external websites to embed the chat widget'
      operationId: process_embed_chat_api_chat_embed__post
      parameters:
      - name: x-api-key
        in: header
        required: false
        schema:
          type: string
          title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmbedChatRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmbedChatResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/chat/embed/health:
    get:
      tags:
      - Embed Chat
      - embed
      summary: Embed Health Check
      description: Health check endpoint for embedded chat
      operationId: embed_health_check_api_chat_embed_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /webhooks/twilio/voice:
    post:
      tags:
      - Phone Webhooks
      summary: Twilio Voice Webhook Legacy
      description: 'Legacy Twilio webhook endpoint - redirects to new inbound handler.

        Kept for backward compatibility.'
      operationId: twilio_voice_webhook_legacy_webhooks_twilio_voice_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /webhooks/twilio/status:
    post:
      tags:
      - Phone Webhooks
      summary: Twilio Status Callback Legacy
      description: Legacy Twilio status callback - redirects to new handler.
      operationId: twilio_status_callback_legacy_webhooks_twilio_status_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/voice-analytics/overview:
    get:
      tags:
      - Voice Analytics
      summary: Get Voice Analytics
      description: "Get voice call analytics including metrics and stats.\n\nReturns:\n\
        \    - total_calls: Total number of calls\n    - completed_calls: Successfully\
        \ completed calls\n    - no_answer_calls: Calls with no answer\n    - failed_calls:\
        \ Failed calls\n    - avg_duration_seconds: Average call duration\n    - total_duration_seconds:\
        \ Total call duration\n    - total_cost: Total cost across all calls\n   \
        \ - avg_cost_per_call: Average cost per call\n    - success_rate: Percentage\
        \ of successful calls"
      operationId: get_voice_analytics_api_voice_analytics_overview_get
      parameters:
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Start date (ISO format)
          title: Start Date
        description: Start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: End date (ISO format)
          title: End Date
        description: End date (ISO format)
      - name: campaign_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by campaign
          title: Campaign Id
        description: Filter by campaign
      - name: workflow_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by workflow
          title: Workflow Id
        description: Filter by workflow
      - name: user_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by user
          title: User Id
        description: Filter by user
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Advanced filters JSON
          title: Filters
        description: Advanced filters JSON
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/voice-analytics/calls:
    get:
      tags:
      - Voice Analytics
      summary: Get Voice Calls
      description: "Get paginated list of voice calls with filtering and sorting.\n\
        \nQuery Parameters:\n    - page: Page number (default: 1)\n    - per_page:\
        \ Items per page (default: 50, max: 100)\n    - campaign_id: Filter by campaign\n\
        \    - workflow_id: Filter by workflow\n    - contact_id: Filter by contact\n\
        \    - call_status: Filter by status (completed, no-answer, failed, etc.)\n\
        \    - search: Search by contact name or phone number\n    - sort_by: Field\
        \ to sort by (default: start_time)\n    - sort_direction: Sort direction -\
        \ asc or desc (default: desc)\n    - start_date: Start date (ISO format)\n\
        \    - end_date: End date (ISO format)\n    - filters: Advanced filters JSON\
        \ string\n\nReturns:\n    - calls: List of voice call records\n    - pagination:\
        \ Pagination info (page, per_page, total, pages)"
      operationId: get_voice_calls_api_voice_analytics_calls_get
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          description: Page number
          default: 1
          title: Page
        description: Page number
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          description: Items per page
          default: 50
          title: Per Page
        description: Items per page
      - name: campaign_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by campaign
          title: Campaign Id
        description: Filter by campaign
      - name: workflow_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by workflow
          title: Workflow Id
        description: Filter by workflow
      - name: contact_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by contact
          title: Contact Id
        description: Filter by contact
      - name: call_status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by status
          title: Call Status
        description: Filter by status
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Search by contact name or number
          title: Search
        description: Search by contact name or number
      - name: sort_by
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Field to sort by
          default: start_time
          title: Sort By
        description: Field to sort by
      - name: sort_direction
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Sort direction: asc or desc'
          default: desc
          title: Sort Direction
        description: 'Sort direction: asc or desc'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Start date (ISO format)
          title: Start Date
        description: Start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: End date (ISO format)
          title: End Date
        description: End date (ISO format)
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Advanced filters JSON
          title: Filters
        description: Advanced filters JSON
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/voice-analytics/calls/{call_id}:
    get:
      tags:
      - Voice Analytics
      summary: Get Voice Call Details
      description: 'Get detailed information about a specific voice call.


        Returns full call details including metadata, transcription, and recording
        URLs.'
      operationId: get_voice_call_details_api_voice_analytics_calls__call_id__get
      parameters:
      - name: call_id
        in: path
        required: true
        schema:
          type: string
          title: Call Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/voice-analytics/trends:
    get:
      tags:
      - Voice Analytics
      summary: Get Voice Call Trends
      description: 'Get voice call trends over time.


        Returns time-series data for:

        - Call volume

        - Average duration

        - Success rate

        - Cost'
      operationId: get_voice_call_trends_api_voice_analytics_trends_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: 'Time period: 7d, 30d, 90d, 1y'
          default: 7d
          title: Period
        description: 'Time period: 7d, 30d, 90d, 1y'
      - name: group_by
        in: query
        required: false
        schema:
          type: string
          description: 'Group by: hour, day, week, month'
          default: day
          title: Group By
        description: 'Group by: hour, day, week, month'
      - name: campaign_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by campaign
          title: Campaign Id
        description: Filter by campaign
      - name: workflow_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by workflow
          title: Workflow Id
        description: Filter by workflow
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/voice-analytics/end-reasons:
    get:
      tags:
      - Voice Analytics
      summary: Get Call End Reasons Stats
      description: 'Get distribution of call end reasons (for pie chart).


        Returns counts grouped by call status.'
      operationId: get_call_end_reasons_stats_api_voice_analytics_end_reasons_get
      parameters:
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Start date (ISO format)
          title: Start Date
        description: Start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: End date (ISO format)
          title: End Date
        description: End date (ISO format)
      - name: campaign_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by campaign
          title: Campaign Id
        description: Filter by campaign
      - name: workflow_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by workflow
          title: Workflow Id
        description: Filter by workflow
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Advanced filters JSON
          title: Filters
        description: Advanced filters JSON
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/voice-analytics/direction-breakdown:
    get:
      tags:
      - Voice Analytics
      summary: Get Call Direction Breakdown
      description: 'Get distribution of call directions (inbound vs outbound).


        Returns counts grouped by direction for pie chart display.'
      operationId: get_call_direction_breakdown_api_voice_analytics_direction_breakdown_get
      parameters:
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Start date (ISO format)
          title: Start Date
        description: Start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: End date (ISO format)
          title: End Date
        description: End date (ISO format)
      - name: campaign_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by campaign
          title: Campaign Id
        description: Filter by campaign
      - name: workflow_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by workflow
          title: Workflow Id
        description: Filter by workflow
      - name: filters
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Advanced filters JSON
          title: Filters
        description: Advanced filters JSON
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/voice-analytics/aggregated-table:
    get:
      tags:
      - Voice Analytics
      summary: Get Voice Analytics Aggregated Table
      description: 'Get aggregated voice analytics data grouped by a dimension.


        Similar to contact analytics aggregated table.

        Supports grouping by:

        - call_status: Completed, No Answer, Failed, etc.

        - direction: Inbound, Outbound

        - provider: Exotel, Twilio, VAPI, etc.

        - call_type: AI, Human, etc.

        - contact_name: Group by contact name (joined from contacts table, falls back
        to phone number)

        - contact_number: Group by phone number (to_number or from_number)

        - user_name: Group by user (uses user_email or from_number as identifier)

        - start_date: Group by date'
      operationId: get_voice_analytics_aggregated_table_api_voice_analytics_aggregated_table_get
      parameters:
      - name: group_by
        in: query
        required: false
        schema:
          type: string
          description: 'Dimensions to group by (comma-separated, max 3): call_status,
            direction, provider, call_type, contact_name, contact_number, user_name,
            start_date'
          default: call_status
          title: Group By
        description: 'Dimensions to group by (comma-separated, max 3): call_status,
          direction, provider, call_type, contact_name, contact_number, user_name,
          start_date'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Start date (ISO format)
          title: Start Date
        description: Start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: End date (ISO format)
          title: End Date
        description: End date (ISO format)
      - name: campaign_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by campaign
          title: Campaign Id
        description: Filter by campaign
      - name: workflow_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by workflow
          title: Workflow Id
        description: Filter by workflow
      - name: sort_by
        in: query
        required: false
        schema:
          type: string
          description: Sort by field
          default: total_calls
          title: Sort By
        description: Sort by field
      - name: sort_direction
        in: query
        required: false
        schema:
          type: string
          description: 'Sort direction: asc, desc'
          default: desc
          title: Sort Direction
        description: 'Sort direction: asc, desc'
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          description: Page number
          default: 1
          title: Page
        description: Page number
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          description: Items per page
          default: 20
          title: Limit
        description: Items per page
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Search term to filter dimension values
          title: Search
        description: Search term to filter dimension values
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/voice-analytics/available-columns:
    get:
      tags:
      - Voice Analytics
      summary: Get Voice Analytics Available Columns
      description: Get available columns for grouping in the analytics table.
      operationId: get_voice_analytics_available_columns_api_voice_analytics_available_columns_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/voice-analytics/calls/export/csv:
    get:
      tags:
      - Voice Analytics
      summary: Export Voice Calls Csv
      description: "Export voice calls to CSV with filtering.\n\nAll filters from\
        \ the list view are supported:\n    - campaign_id: Filter by campaign\n  \
        \  - workflow_id: Filter by workflow\n    - contact_id: Filter by contact\n\
        \    - call_status: Filter by status (completed, no-answer, failed, etc.)\n\
        \    - search: Search by contact name or phone number\n    - start_date: Filter\
        \ by start date\n    - end_date: Filter by end date\n\nReturns:\n    CSV file\
        \ download with all call records matching the filters."
      operationId: export_voice_calls_csv_api_voice_analytics_calls_export_csv_get
      parameters:
      - name: campaign_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by campaign
          title: Campaign Id
        description: Filter by campaign
      - name: workflow_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by workflow
          title: Workflow Id
        description: Filter by workflow
      - name: contact_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by contact
          title: Contact Id
        description: Filter by contact
      - name: call_status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by status
          title: Call Status
        description: Filter by status
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Search by contact name or number
          title: Search
        description: Search by contact name or number
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Start date (ISO format)
          title: Start Date
        description: Start date (ISO format)
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: End date (ISO format)
          title: End Date
        description: End date (ISO format)
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/voice-analytics/debug/sessions:
    get:
      tags:
      - Voice Analytics
      summary: Get Recent Debug Sessions
      description: "Get recent voice call debug sessions.\n\nReturns a list of recent\
        \ voice call sessions with debug data available.\nDebug data is available\
        \ for 24 hours after the call ends.\n\nReturns:\n    - sessions: List of session\
        \ summaries"
      operationId: get_recent_debug_sessions_api_voice_analytics_debug_sessions_get
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          description: Number of sessions to return
          default: 20
          title: Limit
        description: Number of sessions to return
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/voice-analytics/debug/sessions/{session_id}:
    get:
      tags:
      - Voice Analytics
      summary: Get Debug Session Details
      description: 'Get detailed debug data for a specific voice call session.


        Returns full debug data including:

        - Trigger source and context

        - LLM iterations

        - Tool calls

        - Voice history (user/assistant exchanges)

        - Transcript

        - Performance metrics


        This endpoint returns data formatted for the frontend debug panel.'
      operationId: get_debug_session_details_api_voice_analytics_debug_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: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/transcriber/transcribe:
    post:
      tags:
      - Transcriber
      - transcriber
      summary: Transcribe Audio
      description: "Convert speech to text\n\nArgs:\n    file: Audio file to transcribe\n\
        \    integration_id: Optional specific integration to use\n    language: Optional\
        \ language code (e.g., 'en-US')\n    model: Optional model to use (provider-specific)\n\
        \    enable_timestamps: Include word-level timestamps\n    enable_diarization:\
        \ Enable speaker diarization\n\nReturns:\n    Transcription result with text\
        \ and metadata"
      operationId: transcribe_audio_api_transcriber_transcribe_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_transcribe_audio_api_transcriber_transcribe_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/transcriber/languages:
    get:
      tags:
      - Transcriber
      - transcriber
      summary: Get Supported Languages
      description: Get list of supported languages for transcription
      operationId: get_supported_languages_api_transcriber_languages_get
      parameters:
      - name: integration_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/transcriber/formats:
    get:
      tags:
      - Transcriber
      - transcriber
      summary: Get Supported Formats
      description: Get list of supported audio formats
      operationId: get_supported_formats_api_transcriber_formats_get
      parameters:
      - name: integration_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/transcriber/capabilities:
    get:
      tags:
      - Transcriber
      - transcriber
      summary: Get Capabilities
      description: Get transcriber capabilities for the configured provider
      operationId: get_capabilities_api_transcriber_capabilities_get
      parameters:
      - name: integration_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/transcriber/integrations:
    get:
      tags:
      - Transcriber
      - transcriber
      summary: Get Transcriber Integrations
      description: Get available transcriber integrations for the organization
      operationId: get_transcriber_integrations_api_transcriber_integrations_get
      parameters:
      - name: active_only
        in: query
        required: false
        schema:
          type: boolean
          default: true
          title: Active Only
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/synthesizer/synthesize:
    post:
      tags:
      - Synthesizer
      - synthesizer
      summary: Synthesize Speech
      description: "Convert text to speech\n\nArgs:\n    text: Text to synthesize\n\
        \    voice_id: Optional voice ID to use\n    language: Optional language code\n\
        \    format: Output audio format (mp3, wav, ogg, etc.)\n    speed: Speech\
        \ speed (0.5 to 2.0)\n    pitch: Voice pitch adjustment (-20 to 20)\n    integration_id:\
        \ Optional specific integration to use\n    stream: Whether to stream the\
        \ response\n\nReturns:\n    Audio file stream"
      operationId: synthesize_speech_api_synthesizer_synthesize_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/Body_synthesize_speech_api_synthesizer_synthesize_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/synthesizer/voices:
    get:
      tags:
      - Synthesizer
      - synthesizer
      summary: Get Available Voices
      description: "Get list of available voices\n\nArgs:\n    integration_id: Optional\
        \ specific integration to query\n    language: Optional language filter\n\n\
        Returns:\n    List of available voices with metadata"
      operationId: get_available_voices_api_synthesizer_voices_get
      parameters:
      - name: integration_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Id
      - name: language
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Language
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/synthesizer/voice-sample:
    post:
      tags:
      - Synthesizer
      - synthesizer
      summary: Get Voice Sample
      description: "Get a sample of a specific voice with all voice settings\n\nArgs:\n\
        \    voice_id: Voice ID to sample\n    text: Optional sample text (uses default\
        \ if not provided)\n    integration_id: Optional specific integration to use\n\
        \    format: Audio format\n    speed: Speech speed (0.5 to 2.0)\n    pitch:\
        \ Voice pitch (-50 to 50 Hz)\n    volume: Voice volume level\n    style: Speaking\
        \ style (for Azure TTS)\n    temperature: Voice variation (Sarvam V3, 0.01\
        \ to 1.0)\n\nReturns:\n    Audio sample of the voice"
      operationId: get_voice_sample_api_synthesizer_voice_sample_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/Body_get_voice_sample_api_synthesizer_voice_sample_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/synthesizer/languages:
    get:
      tags:
      - Synthesizer
      - synthesizer
      summary: Get Supported Languages
      description: Get list of supported languages for synthesis
      operationId: get_supported_languages_api_synthesizer_languages_get
      parameters:
      - name: integration_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/synthesizer/formats:
    get:
      tags:
      - Synthesizer
      - synthesizer
      summary: Get Supported Formats
      description: Get list of supported audio formats
      operationId: get_supported_formats_api_synthesizer_formats_get
      parameters:
      - name: integration_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/synthesizer/capabilities:
    get:
      tags:
      - Synthesizer
      - synthesizer
      summary: Get Capabilities
      description: Get synthesizer capabilities for the configured provider
      operationId: get_capabilities_api_synthesizer_capabilities_get
      parameters:
      - name: integration_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/synthesizer/integrations:
    get:
      tags:
      - Synthesizer
      - synthesizer
      summary: Get Synthesizer Integrations
      description: Get available synthesizer integrations for the organization
      operationId: get_synthesizer_integrations_api_synthesizer_integrations_get
      parameters:
      - name: active_only
        in: query
        required: false
        schema:
          type: boolean
          default: true
          title: Active Only
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/synthesizer/debug-cartesia:
    get:
      tags:
      - Synthesizer
      - synthesizer
      summary: Debug Cartesia Voices
      description: Debug endpoint to test Cartesia voice fetching
      operationId: debug_cartesia_voices_api_synthesizer_debug_cartesia_get
      parameters:
      - name: integration_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/synthesizer/batch-synthesize:
    post:
      tags:
      - Synthesizer
      - synthesizer
      summary: Batch Synthesize
      description: "Synthesize multiple texts in batch\n\nArgs:\n    texts: List of\
        \ texts to synthesize\n    voice_id: Optional voice ID to use\n    format:\
        \ Output audio format\n    integration_id: Optional specific integration to\
        \ use\n\nReturns:\n    List of audio URLs or base64 encoded audio"
      operationId: batch_synthesize_api_synthesizer_batch_synthesize_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/Body_batch_synthesize_api_synthesizer_batch_synthesize_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/notifications/register-token:
    post:
      tags:
      - Push Notifications
      - notifications
      summary: Register Fcm Token
      description: 'Register FCM token for a user device


        MASTER DB ONLY: Saves token to MASTER database only (not org database)

        - Master database: Single source of truth for all FCM tokens

        - Works for multi-org users regardless of which org they''re in

        - Handles in-app org switching without requiring app restart


        Called automatically when mobile app starts up and gets FCM token'
      operationId: register_fcm_token_api_notifications_register_token_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RegisterTokenRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/notifications/deactivate-token:
    post:
      tags:
      - Push Notifications
      - notifications
      summary: Deactivate Fcm Token
      description: 'Deactivate FCM token (called on logout or when user wants to stop
        notifications on a device)


        IMPORTANT: Immediately marks token as inactive to prevent further notifications

        This is called by frontend on logout to ensure clean session separation'
      operationId: deactivate_fcm_token_api_notifications_deactivate_token_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeactivateTokenRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/notifications/tokens:
    get:
      tags:
      - Push Notifications
      - notifications
      summary: Get User Tokens
      description: 'Get all FCM tokens for current user from MASTER database


        Returns all active tokens across all organizations for this user'
      operationId: get_user_tokens_api_notifications_tokens_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/notifications/send:
    post:
      tags:
      - Push Notifications
      - notifications
      summary: Send Notification
      description: "Send push notification via FCM\n\nExamples:\n    - Send to single\
        \ user: {\"user_id\": \"...\", \"title\": \"Order Delivered!\", \"body\":\
        \ \"...\"}\n    - Send to multiple: {\"user_ids\": [\"...\", \"...\"], \"\
        title\": \"Flash Sale!\", \"body\": \"...\"}\n    - Broadcast to topic: {\"\
        topic\": \"all_users\", \"title\": \"Update Available\", \"body\": \"...\"\
        }"
      operationId: send_notification_api_notifications_send_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NotificationRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/notifications/test-send:
    post:
      tags:
      - Push Notifications
      - notifications
      summary: Test Send Notification
      description: 'Test endpoint to send notification without auth

        Sends to user: sumith@expedify.io (ab644cd0-eab1-40e4-b4d5-6240255b4fa9)'
      operationId: test_send_notification_api_notifications_test_send_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/notifications/history:
    get:
      tags:
      - Push Notifications
      - notifications
      summary: Get Notification History
      description: Get notification history for current user
      operationId: get_notification_history_api_notifications_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: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/notifications/expedify/send:
    post:
      tags:
      - Push Notifications
      - notifications
      summary: Expedify Send Notification
      description: "Expedify Admin Endpoint: Send notifications to SaaS customers\n\
        \nThis endpoint allows Expedify to send notifications across all organizations.\n\
        Supports flexible filtering:\n\nExamples:\n    - Single user: {\"user_id\"\
        : \"uuid\", \"title\": \"...\", \"body\": \"...\"}\n    - Single org: {\"\
        org_id\": \"uuid\", \"title\": \"...\", \"body\": \"...\"}\n    - All users:\
        \ {\"broadcast\": \"all\", \"title\": \"...\", \"body\": \"...\"}\n    - Platform-specific:\
        \ {\"platform\": \"android\", \"title\": \"...\", \"body\": \"...\"}\n   \
        \ - Multiple filters: {\"org_id\": \"uuid\", \"platform\": \"ios\", \"title\"\
        : \"...\", \"body\": \"...\"}"
      operationId: expedify_send_notification_api_notifications_expedify_send_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExpedifyNotificationRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/notifications/preferences:
    get:
      tags:
      - Notification Preferences
      - notification-preferences
      summary: Get My Preferences
      description: 'Get current user''s notification preferences


        Returns all notification preferences for the logged-in user'
      operationId: get_my_preferences_api_notifications_preferences_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
    put:
      tags:
      - Notification Preferences
      - notification-preferences
      summary: Update My Preferences
      description: "Update notification preferences for current user\n\nRequest body:\
        \ Any fields from notification_preferences table\nExample:\n{\n    \"notify_on_deal_updated\"\
        : true,\n    \"notify_on_workflow_failed\": true,\n    \"quiet_hours_enabled\"\
        : true,\n    \"quiet_hours_start\": \"22:00:00\",\n    \"quiet_hours_end\"\
        : \"08:00:00\"\n}"
      operationId: update_my_preferences_api_notifications_preferences_put
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Preferences
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/notifications/preferences/defaults:
    get:
      tags:
      - Notification Preferences
      - notification-preferences
      summary: Get Default Preferences
      description: Get default notification preferences (for reference)
      operationId: get_default_preferences_api_notifications_preferences_defaults_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/notifications/in-app:
    get:
      tags:
      - In-App Notifications
      - in-app-notifications
      summary: Get My Notifications
      description: "Get notifications for current user\n\nQuery params:\n    - limit:\
        \ Max notifications to return (default 50, max 100)\n    - unread_only: Only\
        \ return unread notifications\n    - category: Filter by category (crm, workflow,\
        \ campaign, etc.)\n\nReturns notifications in reverse chronological order"
      operationId: get_my_notifications_api_notifications_in_app_get
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 50
          title: Limit
      - name: unread_only
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Unread Only
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/notifications/in-app/{notification_id}/read:
    put:
      tags:
      - In-App Notifications
      - in-app-notifications
      summary: Mark As Read
      description: Mark notification as read
      operationId: mark_as_read_api_notifications_in_app__notification_id__read_put
      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/notifications/in-app/read-all:
    put:
      tags:
      - In-App Notifications
      - in-app-notifications
      summary: Mark All As Read
      description: Mark all notifications as read for current user
      operationId: mark_all_as_read_api_notifications_in_app_read_all_put
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/notifications/in-app/{notification_id}:
    delete:
      tags:
      - In-App Notifications
      - in-app-notifications
      summary: Delete Notification
      description: Delete a notification
      operationId: delete_notification_api_notifications_in_app__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/notifications/watchers/{entity_type}/{entity_id}/watch:
    post:
      tags:
      - Notification Watchers
      - notification-watchers
      summary: Watch Entity
      description: Subscribe to entity updates (manually watch)
      operationId: watch_entity_api_notifications_watchers__entity_type___entity_id__watch_post
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: entity_id
        in: path
        required: true
        schema:
          type: string
          title: Entity Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Notification Watchers
      - notification-watchers
      summary: Unwatch Entity
      description: Unsubscribe from entity updates
      operationId: unwatch_entity_api_notifications_watchers__entity_type___entity_id__watch_delete
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: entity_id
        in: path
        required: true
        schema:
          type: string
          title: Entity Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/notifications/watchers/{entity_type}/{entity_id}/watchers:
    get:
      tags:
      - Notification Watchers
      - notification-watchers
      summary: Get Entity Watchers
      description: Get all watchers for an entity
      operationId: get_entity_watchers_api_notifications_watchers__entity_type___entity_id__watchers_get
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: entity_id
        in: path
        required: true
        schema:
          type: string
          title: Entity Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/notifications/watchers/{entity_type}/{entity_id}/is-watching:
    get:
      tags:
      - Notification Watchers
      - notification-watchers
      summary: Check If Watching
      description: Check if current user is watching this entity
      operationId: check_if_watching_api_notifications_watchers__entity_type___entity_id__is_watching_get
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: entity_id
        in: path
        required: true
        schema:
          type: string
          title: Entity Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/notifications/test/check-tables:
    get:
      tags:
      - Notification Testing
      - notification-testing
      summary: Check Notification Tables
      description: Check if notification tables exist in org database
      operationId: check_notification_tables_api_notifications_test_check_tables_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/notifications/test/check-preferences:
    get:
      tags:
      - Notification Testing
      - notification-testing
      summary: Check Preferences Table
      description: Check if preferences table works
      operationId: check_preferences_table_api_notifications_test_check_preferences_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/notifications/test/check-events:
    get:
      tags:
      - Notification Testing
      - notification-testing
      summary: Check Events Table
      description: Check if events table works
      operationId: check_events_table_api_notifications_test_check_events_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/notifications/sse/stream:
    get:
      tags:
      - Notification SSE
      - notification-sse
      summary: Stream Notifications
      description: "SSE endpoint for real-time notification streaming.\n\nOpens a\
        \ persistent connection that receives notifications in real-time\nvia Redis\
        \ Pub/Sub. The browser's EventSource API automatically handles\nreconnection\
        \ if the connection is lost.\n\nEvents:\n    - connected: Initial connection\
        \ established\n    - notification: New notification received\n    - keepalive:\
        \ Connection heartbeat (every 30s)\n    - error: Error occurred\n\nUsage (JavaScript):\n\
        \    const eventSource = new EventSource('/api/notifications/sse/stream',\
        \ {\n        withCredentials: true\n    });\n\n    eventSource.addEventListener('notification',\
        \ (event) => {\n        const notification = JSON.parse(event.data);\n   \
        \     // Handle notification\n    });"
      operationId: stream_notifications_api_notifications_sse_stream_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/notifications/sse/health:
    get:
      tags:
      - Notification SSE
      - notification-sse
      summary: Sse Health
      description: "Health check endpoint for SSE notification service.\n\nReturns:\n\
        \    - Status of the service\n    - Number of active connections\n    - Number\
        \ of unique users connected"
      operationId: sse_health_api_notifications_sse_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/notifications/sse/test:
    post:
      tags:
      - Notification SSE
      - notification-sse
      summary: Send Test Notification
      description: 'Send a test notification to the current user via SSE.


        Useful for testing the SSE connection and verifying

        notifications are being delivered correctly.'
      operationId: send_test_notification_api_notifications_sse_test_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /test/health:
    get:
      tags:
      - Testing
      summary: Test Health
      description: Simple health check to verify the test routes are working
      operationId: test_health_test_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleResponse'
  /test/execute-workflow:
    post:
      tags:
      - Testing
      summary: Test Execute Workflow
      description: 'Universal test endpoint for any workflow type


        This endpoint leverages the generic workflow engine to execute

        any type of workflow, without hardcoding node-specific logic.'
      operationId: test_execute_workflow_test_execute_workflow_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestWorkflowExecute'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/cache/health:
    get:
      tags:
      - Cache Management
      - cache
      summary: Get Cache Health
      description: Get cache backend health and statistics
      operationId: get_cache_health_api_cache_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/cache/invalidate/{entity_type}:
    post:
      tags:
      - Cache Management
      - cache
      summary: Invalidate Entity Cache
      description: 'Manually invalidate cache for a specific entity type


        Useful for debugging or forcing cache refresh'
      operationId: invalidate_entity_cache_api_cache_invalidate__entity_type__post
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/cache/invalidate:
    post:
      tags:
      - Cache Management
      - cache
      summary: Invalidate Org Cache
      description: 'Invalidate all cache for the organization


        Use with caution - this will clear all cached data'
      operationId: invalidate_org_cache_api_cache_invalidate_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/cache/invalidate/schema/{entity_type}:
    post:
      tags:
      - Cache Management
      - cache
      summary: Invalidate Schema Cache
      description: 'Invalidate schema cache for a specific entity type


        Forces fresh schema data to be returned for the next request'
      operationId: invalidate_schema_cache_api_cache_invalidate_schema__entity_type__post
      parameters:
      - name: entity_type
        in: path
        required: true
        schema:
          type: string
          title: Entity Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/cache/stats:
    get:
      tags:
      - Cache Management
      - cache
      summary: Get Cache Stats
      description: Get detailed cache statistics
      operationId: get_cache_stats_api_cache_stats_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /org-test/context:
    get:
      tags:
      - Organization Test
      - Organization Test
      summary: Test Context
      description: Test endpoint to check organization context
      operationId: test_context_org_test_context_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /org-test/context-with-deps:
    get:
      tags:
      - Organization Test
      - Organization Test
      summary: Test Context With Dependencies
      description: Test endpoint using dependency injection
      operationId: test_context_with_dependencies_org_test_context_with_deps_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /org-test/database-connection:
    get:
      tags:
      - Organization Test
      - Organization Test
      summary: Test Database Connection
      description: Test database connection for organization
      operationId: test_database_connection_org_test_database_connection_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /org-test/project-test:
    get:
      tags:
      - Organization Test
      - Organization Test
      summary: Test Default Project
      description: Test getting default project
      operationId: test_default_project_org_test_project_test_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/users:
    get:
      tags:
      - Admin Management
      - Admin - User Management
      summary: List Organization Users
      description: List all users in the organization (Admin only)
      operationId: list_organization_users_admin_users_get
      parameters:
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Filter by status: active, inactive, all'
          title: Status
        description: 'Filter by status: active, inactive, all'
      - name: role
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by role
          title: Role
        description: Filter by role
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response List Organization Users Admin Users Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Admin Management
      - Admin - User Management
      summary: Add User
      description: Add a new user to the organization (Admin only)
      operationId: add_user_admin_users_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Add User Admin Users Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/users/{user_id}:
    get:
      tags:
      - Admin Management
      - Admin - User Management
      summary: Get User Details
      description: Get detailed information about a specific user (Admin only)
      operationId: get_user_details_admin_users__user_id__get
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: string
          title: User Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get User Details Admin Users  User Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Admin Management
      - Admin - User Management
      summary: Update User
      description: Update user details (Admin only)
      operationId: update_user_admin_users__user_id__put
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: string
          title: User Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update User Admin Users  User Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Admin Management
      - Admin - User Management
      summary: Delete User
      description: Permanently delete a user from the organization (Admin only)
      operationId: delete_user_admin_users__user_id__delete
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: string
          title: User Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete User Admin Users  User Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/users/{user_id}/role:
    put:
      tags:
      - Admin Management
      - Admin - User Management
      summary: Update User Role
      description: Update user's role (Admin only, Owner required for admin roles)
      operationId: update_user_role_admin_users__user_id__role_put
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: string
          title: User Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserRoleUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update User Role Admin Users  User Id  Role Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/users/{user_id}/status:
    put:
      tags:
      - Admin Management
      - Admin - User Management
      summary: Update User Status
      description: Activate or deactivate a user (Admin only)
      operationId: update_user_status_admin_users__user_id__status_put
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: string
          title: User Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserStatusUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update User Status Admin Users  User Id  Status Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/users/stats/summary:
    get:
      tags:
      - Admin Management
      - Admin - User Management
      summary: Get Organization Stats
      description: Get organization usage statistics (Admin only)
      operationId: get_organization_stats_admin_users_stats_summary_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Organization Stats Admin Users Stats Summary Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/billing/rates:
    get:
      tags:
      - Admin Billing
      - admin-billing
      summary: Get Pricing Rates
      description: Get all active pricing rates
      operationId: get_pricing_rates_admin_billing_rates_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Admin Billing
      - admin-billing
      summary: Update Pricing Rate
      description: Update pricing for a specific resource
      operationId: update_pricing_rate_admin_billing_rates_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateRateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/billing/rates/bulk:
    post:
      tags:
      - Admin Billing
      - admin-billing
      summary: Bulk Update Rates
      description: Bulk update multiple pricing rates
      operationId: bulk_update_rates_admin_billing_rates_bulk_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkRatesRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/billing/credits/add:
    post:
      tags:
      - Admin Billing
      - admin-billing
      summary: Add Credits
      description: Manually add credits to an organization
      operationId: add_credits_admin_billing_credits_add_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddCreditsRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/billing/usage/{org_id}:
    get:
      tags:
      - Admin Billing
      - admin-billing
      summary: Get Org Usage
      description: Get usage statistics for a specific organization
      operationId: get_org_usage_admin_billing_usage__org_id__get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: days
        in: query
        required: false
        schema:
          type: integer
          default: 30
          title: Days
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/billing/balance/{org_id}:
    get:
      tags:
      - Admin Billing
      - admin-billing
      summary: Get Org Balance
      description: Get current balance and billing info for an organization
      operationId: get_org_balance_admin_billing_balance__org_id__get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/billing/plans:
    get:
      tags:
      - Admin Billing
      - admin-billing
      summary: Get All Plans
      description: Get all billing plans
      operationId: get_all_plans_admin_billing_plans_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/billing/plans/{plan_name}:
    post:
      tags:
      - Admin Billing
      - admin-billing
      summary: Update Plan
      description: Update a billing plan
      operationId: update_plan_admin_billing_plans__plan_name__post
      parameters:
      - name: plan_name
        in: path
        required: true
        schema:
          type: string
          title: Plan Name
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePlanRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/billing/upgrade/{org_id}:
    post:
      tags:
      - Admin Billing
      - admin-billing
      summary: Upgrade Org Plan
      description: Upgrade an organization to a new plan
      operationId: upgrade_org_plan_admin_billing_upgrade__org_id__post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: new_plan
        in: query
        required: true
        schema:
          type: string
          title: New Plan
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/billing/pricing/summary:
    get:
      tags:
      - Admin Billing
      - admin-billing
      summary: Get Pricing Summary
      description: Get complete pricing summary (public endpoint for pricing page)
      operationId: get_pricing_summary_admin_billing_pricing_summary_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/super-admin/billing/check-access:
    get:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Check Super Admin Access
      description: Check if current user has super admin access
      operationId: check_super_admin_access_api_super_admin_billing_check_access_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/dashboard-data:
    get:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Get Dashboard Data
      description: Get dashboard data for super admin
      operationId: get_dashboard_data_api_super_admin_billing_dashboard_data_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/plans:
    get:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Get All Plans
      description: Get all subscription plans
      operationId: get_all_plans_api_super_admin_billing_plans_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Create Or Update Plan
      description: Create or update a subscription plan
      operationId: create_or_update_plan_api_super_admin_billing_plans_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlanUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/plans/{plan_name}:
    delete:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Deactivate Plan
      description: Deactivate a plan (soft delete)
      operationId: deactivate_plan_api_super_admin_billing_plans__plan_name__delete
      parameters:
      - name: plan_name
        in: path
        required: true
        schema:
          type: string
          title: Plan Name
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/rates:
    get:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Get All Rates
      description: 'Get all pricing rates for internal features (workflow, document,
        lead).

        Now reads from provider_models table instead of billing_rates.'
      operationId: get_all_rates_api_super_admin_billing_rates_get
      parameters:
      - name: resource_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Resource Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Create Or Update Rate
      description: 'Create or update a pricing rate for internal features.

        Now writes to provider_models table instead of billing_rates.'
      operationId: create_or_update_rate_api_super_admin_billing_rates_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RateUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/rates/{resource_type}/{resource_subtype}:
    delete:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Delete Rate
      description: Delete a pricing rate (supports plan-specific deletion). Now uses
        provider_models.
      operationId: delete_rate_api_super_admin_billing_rates__resource_type___resource_subtype__delete
      parameters:
      - name: resource_type
        in: path
        required: true
        schema:
          type: string
          title: Resource Type
      - name: resource_subtype
        in: path
        required: true
        schema:
          type: string
          title: Resource Subtype
      - name: plan_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Plan Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/rates/{rate_id}:
    delete:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Delete Rate By Id
      description: Delete a pricing rate by its ID. Now uses provider_models.
      operationId: delete_rate_by_id_api_super_admin_billing_rates__rate_id__delete
      parameters:
      - name: rate_id
        in: path
        required: true
        schema:
          type: string
          title: Rate Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/rates/bulk:
    post:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Bulk Update Rates
      description: Bulk create or update rates in provider_models table
      operationId: bulk_update_rates_api_super_admin_billing_rates_bulk_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/RateUpdate'
              title: Rates
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/plans/features:
    post:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Update Plan Features
      description: Update features for a plan
      operationId: update_plan_features_api_super_admin_billing_plans_features_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlanFeatureUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/features:
    get:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Get All Features
      description: Get all unique features across all plans
      operationId: get_all_features_api_super_admin_billing_features_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/features/{feature_key}:
    patch:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Update Feature Label
      description: Update feature label across all plans
      operationId: update_feature_label_api_super_admin_billing_features__feature_key__patch
      parameters:
      - name: feature_key
        in: path
        required: true
        schema:
          type: string
          title: Feature Key
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties:
                type: string
              title: Update
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Delete Feature
      description: Delete a feature from all plans
      operationId: delete_feature_api_super_admin_billing_features__feature_key__delete
      parameters:
      - name: feature_key
        in: path
        required: true
        schema:
          type: string
          title: Feature Key
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/templates/llm-models:
    get:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Get Llm Model Templates
      description: Get LLM model templates from unified provider_models table
      operationId: get_llm_model_templates_api_super_admin_billing_templates_llm_models_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Create Llm Template
      description: Create or update an LLM model template in unified provider_models
        table
      operationId: create_llm_template_api_super_admin_billing_templates_llm_models_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LLMTemplateUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/templates/llm-models/{provider}/{model}:
    delete:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Delete Llm Template
      description: Deactivate an LLM model (soft delete) from unified provider_models
        table
      operationId: delete_llm_template_api_super_admin_billing_templates_llm_models__provider___model__delete
      parameters:
      - name: provider
        in: path
        required: true
        schema:
          type: string
          title: Provider
      - name: model
        in: path
        required: true
        schema:
          type: string
          title: Model
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/templates/llm-models/refresh-cache:
    post:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Refresh Llm Models Cache
      description: 'Manually refresh the LLM models cache.

        Use this if models were added directly to the database and need to appear
        in dropdowns.'
      operationId: refresh_llm_models_cache_api_super_admin_billing_templates_llm_models_refresh_cache_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/templates/synthesizer-models:
    get:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Get Synthesizer Models
      description: Get Voice Synthesizer models from unified provider_models table
      operationId: get_synthesizer_models_api_super_admin_billing_templates_synthesizer_models_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Create Synthesizer Model
      description: Create or update a Voice Synthesizer model
      operationId: create_synthesizer_model_api_super_admin_billing_templates_synthesizer_models_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Template
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/templates/synthesizer-models/{provider}/{model}:
    delete:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Delete Synthesizer Model
      description: Deactivate a Voice Synthesizer model
      operationId: delete_synthesizer_model_api_super_admin_billing_templates_synthesizer_models__provider___model__delete
      parameters:
      - name: provider
        in: path
        required: true
        schema:
          type: string
          title: Provider
      - name: model
        in: path
        required: true
        schema:
          type: string
          title: Model
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/templates/transcriber-models:
    get:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Get Transcriber Models
      description: Get Voice Transcriber models from unified provider_models table
      operationId: get_transcriber_models_api_super_admin_billing_templates_transcriber_models_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Create Transcriber Model
      description: Create or update a Voice Transcriber model
      operationId: create_transcriber_model_api_super_admin_billing_templates_transcriber_models_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Template
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/templates/transcriber-models/{provider}/{model}:
    delete:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Delete Transcriber Model
      description: Deactivate a Voice Transcriber model
      operationId: delete_transcriber_model_api_super_admin_billing_templates_transcriber_models__provider___model__delete
      parameters:
      - name: provider
        in: path
        required: true
        schema:
          type: string
          title: Provider
      - name: model
        in: path
        required: true
        schema:
          type: string
          title: Model
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/dashboard/summary:
    get:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Get Billing Dashboard Summary
      description: Get comprehensive billing dashboard summary
      operationId: get_billing_dashboard_summary_api_super_admin_billing_dashboard_summary_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/dashboard/analytics:
    get:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Get System Analytics
      description: Get comprehensive system analytics with actual cost tracking
      operationId: get_system_analytics_api_super_admin_billing_dashboard_analytics_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          default: 30
          title: Days
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/organizations/{org_id}/billing-details:
    get:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Get Organization Billing Details
      description: Get detailed billing information for a specific organization
      operationId: get_organization_billing_details_api_super_admin_billing_organizations__org_id__billing_details_get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/emergency-credit-grant:
    post:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Emergency Credit Grant
      description: Grant emergency credits to an organization
      operationId: emergency_credit_grant_api_super_admin_billing_emergency_credit_grant_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmergencyCredit'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/system-health:
    get:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Get System Health
      description: Get system health status including billing issues
      operationId: get_system_health_api_super_admin_billing_system_health_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/analytics/system:
    get:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Get System Analytics
      description: Get system-wide analytics for organization dashboard
      operationId: get_system_analytics_api_super_admin_billing_analytics_system_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          default: 30
          title: Days
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/analytics/organizations:
    get:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Get Organizations Analytics
      description: Get analytics for all organizations
      operationId: get_organizations_analytics_api_super_admin_billing_analytics_organizations_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/analytics/usage-breakdown:
    get:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Get Usage Breakdown Analytics
      description: Get usage breakdown by resource type
      operationId: get_usage_breakdown_analytics_api_super_admin_billing_analytics_usage_breakdown_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          default: 30
          title: Days
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/analytics/organizations/{org_id}/details:
    get:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Get Organization Details
      description: Get detailed analytics for a specific organization
      operationId: get_organization_details_api_super_admin_billing_analytics_organizations__org_id__details_get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/cost-analysis:
    get:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Get Cost Analysis
      description: Get comprehensive 3-tier cost analysis for all organizations
      operationId: get_cost_analysis_api_super_admin_billing_cost_analysis_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          default: 7
          title: Days
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/reconciliation-status:
    get:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Get Reconciliation Status
      description: Get daily reconciliation status and history
      operationId: get_reconciliation_status_api_super_admin_billing_reconciliation_status_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          default: 7
          title: Days
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/billing/manual-reconciliation:
    post:
      tags:
      - Super Admin Billing
      - super-admin-billing
      summary: Manual Reconciliation
      description: Manually trigger cost reconciliation for a specific date
      operationId: manual_reconciliation_api_super_admin_billing_manual_reconciliation_post
      parameters:
      - name: target_date
        in: query
        required: true
        schema:
          type: string
          title: Target Date
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/provider-models/:
    get:
      tags:
      - Super Admin Provider Models
      - super-admin-provider-models
      summary: List All Models
      description: List all provider models, optionally filtered by category or provider
      operationId: list_all_models_api_super_admin_provider_models__get
      parameters:
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by category (llm, synthesizer, transcriber)
          title: Category
        description: Filter by category (llm, synthesizer, transcriber)
      - name: provider
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by provider
          title: Provider
        description: Filter by provider
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Super Admin Provider Models
      - super-admin-provider-models
      summary: Create Model
      description: Create or update a provider model
      operationId: create_model_api_super_admin_provider_models__post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProviderModelCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/provider-models/categories:
    get:
      tags:
      - Super Admin Provider Models
      - super-admin-provider-models
      summary: List Categories
      description: List all unique categories
      operationId: list_categories_api_super_admin_provider_models_categories_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/provider-models/providers:
    get:
      tags:
      - Super Admin Provider Models
      - super-admin-provider-models
      summary: List Providers
      description: List all unique providers, optionally filtered by category
      operationId: list_providers_api_super_admin_provider_models_providers_get
      parameters:
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by category
          title: Category
        description: Filter by category
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/provider-models/{model_id}:
    patch:
      tags:
      - Super Admin Provider Models
      - super-admin-provider-models
      summary: Update Model
      description: Update specific fields of a provider model
      operationId: update_model_api_super_admin_provider_models__model_id__patch
      parameters:
      - name: model_id
        in: path
        required: true
        schema:
          type: string
          title: Model Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProviderModelUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Super Admin Provider Models
      - super-admin-provider-models
      summary: Delete Model
      description: Delete (deactivate) a provider model
      operationId: delete_model_api_super_admin_provider_models__model_id__delete
      parameters:
      - name: model_id
        in: path
        required: true
        schema:
          type: string
          title: Model Id
      - name: hard_delete
        in: query
        required: false
        schema:
          type: boolean
          description: Permanently delete instead of soft delete
          default: false
          title: Hard Delete
        description: Permanently delete instead of soft delete
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/provider-models/bulk:
    post:
      tags:
      - Super Admin Provider Models
      - super-admin-provider-models
      summary: Bulk Create Models
      description: Bulk create or update provider models
      operationId: bulk_create_models_api_super_admin_provider_models_bulk_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/ProviderModelCreate'
              title: Models
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/provider-models/refresh-cache:
    post:
      tags:
      - Super Admin Provider Models
      - super-admin-provider-models
      summary: Refresh Cache
      description: Clear all provider model caches
      operationId: refresh_cache_api_super_admin_provider_models_refresh_cache_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/publishing/queue/{queue_id}:
    patch:
      tags:
      - Super Admin Publishing
      - super-admin-publishing
      summary: Update Queue Item Super Admin
      description: Update queue item properties (super admin only)
      operationId: update_queue_item_super_admin_api_super_admin_publishing_queue__queue_id__patch
      parameters:
      - name: queue_id
        in: path
        required: true
        schema:
          type: string
          title: Queue Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Updates
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/publishing/queue/{queue_id}/workflow:
    get:
      tags:
      - Super Admin Publishing
      - super-admin-publishing
      summary: Get Workflow From Queue
      description: Get workflow definition from publishing queue entry (super admin
        only)
      operationId: get_workflow_from_queue_api_super_admin_publishing_queue__queue_id__workflow_get
      parameters:
      - name: queue_id
        in: path
        required: true
        schema:
          type: string
          title: Queue Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/publishing/queue:
    get:
      tags:
      - Super Admin Publishing
      - super-admin-publishing
      summary: Get Publishing Queue Super Admin
      description: Get publishing queue entries from agent_marketplace (super admin
        access)
      operationId: get_publishing_queue_super_admin_api_super_admin_publishing_queue_get
      parameters:
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
      - name: page
        in: query
        required: false
        schema:
          type: integer
          default: 1
          title: Page
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          default: 20
          title: Per Page
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/publishing/queue/{queue_id}/review:
    post:
      tags:
      - Super Admin Publishing
      - super-admin-publishing
      summary: Review Submission Super Admin
      description: Review and approve/reject a workflow submission (super admin only)
      operationId: review_submission_super_admin_api_super_admin_publishing_queue__queue_id__review_post
      parameters:
      - name: queue_id
        in: path
        required: true
        schema:
          type: string
          title: Queue Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__admin__super_admin_publishing__PublishingReview'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/publishing/install-to-org:
    post:
      tags:
      - Super Admin Publishing
      - super-admin-publishing
      summary: Install Workflow To Org
      description: Install a workflow from publishing queue to a specific organization
        for testing (super admin only)
      operationId: install_workflow_to_org_api_super_admin_publishing_install_to_org_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Request
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/prompt-publishing/queue:
    get:
      tags:
      - Super Admin Prompt Publishing
      - super-admin-prompt-publishing
      summary: Get Prompt Publishing Queue
      description: Get all prompt submissions in the publishing queue
      operationId: get_prompt_publishing_queue_api_super_admin_prompt_publishing_queue_get
      parameters:
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
      - name: page
        in: query
        required: false
        schema:
          type: integer
          default: 1
          title: Page
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          default: 20
          title: Per Page
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/prompt-publishing/queue/{queue_id}/review:
    post:
      tags:
      - Super Admin Prompt Publishing
      - super-admin-prompt-publishing
      summary: Review Prompt Submission
      description: Review and approve/reject a prompt submission
      operationId: review_prompt_submission_api_super_admin_prompt_publishing_queue__queue_id__review_post
      parameters:
      - name: queue_id
        in: path
        required: true
        schema:
          type: string
          title: Queue Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromptReview'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/prompt-publishing/marketplace:
    get:
      tags:
      - Super Admin Prompt Publishing
      - super-admin-prompt-publishing
      summary: Get Prompt Marketplace
      description: Get all prompts in the marketplace
      operationId: get_prompt_marketplace_api_super_admin_prompt_publishing_marketplace_get
      parameters:
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
      - 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: page
        in: query
        required: false
        schema:
          type: integer
          default: 1
          title: Page
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          default: 20
          title: Per Page
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/prompt-publishing/install-to-org:
    post:
      tags:
      - Super Admin Prompt Publishing
      - super-admin-prompt-publishing
      summary: Install Prompt To Org
      description: Install a prompt from queue or marketplace to a specific organization
      operationId: install_prompt_to_org_api_super_admin_prompt_publishing_install_to_org_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__admin__prompt_publishing_routes__PromptInstallRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/prompt-publishing/promote-to-system/{queue_id}:
    post:
      tags:
      - Super Admin Prompt Publishing
      - super-admin-prompt-publishing
      summary: Promote Prompt To System
      description: Promote an approved prompt from marketplace to system-level prompt
      operationId: promote_prompt_to_system_api_super_admin_prompt_publishing_promote_to_system__queue_id__post
      parameters:
      - name: queue_id
        in: path
        required: true
        schema:
          type: string
          title: Queue Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromptPromoteRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/prompt-publishing/submit:
    post:
      tags:
      - Super Admin Prompt Publishing
      - super-admin-prompt-publishing
      summary: Submit Prompt For Review
      description: Submit a prompt from an organization for marketplace review
      operationId: submit_prompt_for_review_api_super_admin_prompt_publishing_submit_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromptSubmission'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/organizations/stats:
    get:
      tags:
      - Super Admin Organizations
      - super-admin-organizations
      summary: Get Statistics
      description: Get organization statistics for dashboard
      operationId: get_statistics_api_super_admin_organizations_stats_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/organizations:
    get:
      tags:
      - Super Admin Organizations
      - super-admin-organizations
      summary: Get Organizations
      description: Get list of organizations with filters and pagination
      operationId: get_organizations_api_super_admin_organizations_get
      parameters:
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: database_status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Database Status
      - name: plan_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Plan Type
      - name: trial_status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Trial Status
      - name: trial_end_from
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Trial End From
      - name: trial_end_to
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Trial End To
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 25
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          default: 0
          title: Offset
      - name: sort_by
        in: query
        required: false
        schema:
          type: string
          default: created_at
          title: Sort By
      - name: sort_order
        in: query
        required: false
        schema:
          type: string
          default: DESC
          title: Sort Order
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/organizations/{org_id}:
    get:
      tags:
      - Super Admin Organizations
      - super-admin-organizations
      summary: Get Organization Details
      description: Get detailed information about a specific organization
      operationId: get_organization_details_api_super_admin_organizations__org_id__get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/organizations/{org_id}/users:
    get:
      tags:
      - Super Admin Organizations
      - super-admin-organizations
      summary: Get Organization Users
      description: Get all users in an organization
      operationId: get_organization_users_api_super_admin_organizations__org_id__users_get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/organizations/{org_id}/status:
    put:
      tags:
      - Super Admin Organizations
      - super-admin-organizations
      summary: Update Organization Status
      description: Update organization database status
      operationId: update_organization_status_api_super_admin_organizations__org_id__status_put
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StatusUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/organizations/{org_id}/trial:
    put:
      tags:
      - Super Admin Organizations
      - super-admin-organizations
      summary: Extend Trial
      description: Extend organization trial period
      operationId: extend_trial_api_super_admin_organizations__org_id__trial_put
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TrialExtension'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/organizations/{org_id}/plan:
    put:
      tags:
      - Super Admin Organizations
      - super-admin-organizations
      summary: Change Plan
      description: Change organization plan (e.g., from Free Trial to Paid Plan)
      operationId: change_plan_api_super_admin_organizations__org_id__plan_put
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlanChange'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/organizations/{org_id}/credits:
    post:
      tags:
      - Super Admin Organizations
      - super-admin-organizations
      summary: Adjust Credits
      description: Adjust organization credits
      operationId: adjust_credits_api_super_admin_organizations__org_id__credits_post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreditAdjustment'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/organizations/{org_id}/database:
    delete:
      tags:
      - Super Admin Organizations
      - super-admin-organizations
      summary: Mark Database For Removal
      description: Backup and mark organization database for removal
      operationId: mark_database_for_removal_api_super_admin_organizations__org_id__database_delete
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DatabaseRemoval'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/organizations/{org_id}/database/hard-delete:
    post:
      tags:
      - Super Admin Organizations
      - super-admin-organizations
      summary: Hard Delete Database
      description: Permanently delete an organization's database (IRREVERSIBLE)
      operationId: hard_delete_database_api_super_admin_organizations__org_id__database_hard_delete_post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/organizations/{org_id}/transfer-ownership:
    post:
      tags:
      - Super Admin Organizations
      - super-admin-organizations
      summary: Force Transfer Ownership
      description: Force-transfer organization ownership (super admin only)
      operationId: force_transfer_ownership_api_super_admin_organizations__org_id__transfer_ownership_post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OwnershipTransferRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/organizations/{org_id}/audit-logs:
    get:
      tags:
      - Super Admin Organizations
      - super-admin-organizations
      summary: Get Organization Audit Logs
      description: Get audit logs for a specific organization
      operationId: get_organization_audit_logs_api_super_admin_organizations__org_id__audit_logs_get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 20
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/organizations/{org_id}/integration-permissions:
    get:
      tags:
      - Super Admin Organizations
      - super-admin-organizations
      summary: Get Integration Permissions
      description: Get organization's custom integration permissions
      operationId: get_integration_permissions_api_super_admin_organizations__org_id__integration_permissions_get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Super Admin Organizations
      - super-admin-organizations
      summary: Update Integration Permissions
      description: Update organization's custom integration permissions
      operationId: update_integration_permissions_api_super_admin_organizations__org_id__integration_permissions_put
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IntegrationPermissionsUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/audit-logs/:
    get:
      tags:
      - Super Admin Audit
      - super-admin-audit
      summary: Get Audit Logs
      description: Get audit logs with filters and pagination
      operationId: get_audit_logs_api_super_admin_audit_logs__get
      parameters:
      - name: org_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Org Id
      - name: user_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: User Id
      - name: action
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Action
      - name: entity_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Entity Type
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 100
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          default: 0
          title: Offset
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integrations/unified:
    get:
      tags:
      - Super Admin Integrations
      summary: List Unified Integrations
      description: "List all master integrations with their models/rates in a unified\
        \ format.\n\nFor AI providers (LLM, TTS, STT): includes models from provider_models\
        \ table\nFor non-AI providers (Email, Voice, etc.): includes flat rate from\
        \ provider_models\n\nReturns:\n    List of integrations with unified data\
        \ for the modern UI"
      operationId: list_unified_integrations_api_super_admin_integrations_unified_get
      parameters:
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by UI category (LLM, STT, TTS, Email, Voice, etc.)
          title: Category
        description: Filter by UI category (LLM, STT, TTS, Email, Voice, etc.)
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
                title: Response List Unified Integrations Api Super Admin Integrations
                  Unified Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integrations/internal-features:
    get:
      tags:
      - Super Admin Integrations
      summary: List Internal Feature Rates
      description: "List internal feature rates with plan-based pricing.\n\nInternal\
        \ features (workflow, document, lead) can have different rates per billing\
        \ plan.\nThis endpoint returns all rates grouped by category, including plan\
        \ information.\n\nReturns:\n    Dictionary with internal feature rates grouped\
        \ by category"
      operationId: list_internal_feature_rates_api_super_admin_integrations_internal_features_get
      parameters:
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by category (workflow, document, lead)
          title: Category
        description: Filter by category (workflow, document, lead)
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response List Internal Feature Rates Api Super Admin Integrations
                  Internal Features Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Super Admin Integrations
      summary: Create Internal Feature Rate
      description: 'Create or update an internal feature rate.


        Can create plan-specific rates by providing plan_id.

        If plan_id is NULL, creates the default rate for all plans.'
      operationId: create_internal_feature_rate_api_super_admin_integrations_internal_features_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InternalFeatureRateCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Internal Feature Rate Api Super Admin Integrations
                  Internal Features Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integrations/internal-features/{rate_id}:
    delete:
      tags:
      - Super Admin Integrations
      summary: Delete Internal Feature Rate
      description: Delete (deactivate) an internal feature rate.
      operationId: delete_internal_feature_rate_api_super_admin_integrations_internal_features__rate_id__delete
      parameters:
      - name: rate_id
        in: path
        required: true
        schema:
          type: string
          title: Rate Id
      - name: hard_delete
        in: query
        required: false
        schema:
          type: boolean
          description: Permanently delete instead of deactivate
          default: false
          title: Hard Delete
        description: Permanently delete instead of deactivate
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Internal Feature Rate Api Super Admin Integrations
                  Internal Features  Rate Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integrations/{integration_type}/models:
    get:
      tags:
      - Super Admin Integrations
      summary: Get Integration Models
      description: "Get all models for an AI integration type.\n\nArgs:\n    integration_type:\
        \ Integration type (e.g., 'openai', 'deepgram_stt')\n\nReturns:\n    List\
        \ of models with rates"
      operationId: get_integration_models_api_super_admin_integrations__integration_type__models_get
      parameters:
      - name: integration_type
        in: path
        required: true
        schema:
          type: string
          title: Integration Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
                title: Response Get Integration Models Api Super Admin Integrations  Integration
                  Type  Models Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integrations/{integration_type}/rate:
    get:
      tags:
      - Super Admin Integrations
      summary: Get Integration Flat Rate
      description: "Get flat rate for a non-AI integration type.\n\nArgs:\n    integration_type:\
        \ Integration type (e.g., 'resend', 'twilio')\n\nReturns:\n    Rate info or\
        \ None"
      operationId: get_integration_flat_rate_api_super_admin_integrations__integration_type__rate_get
      parameters:
      - name: integration_type
        in: path
        required: true
        schema:
          type: string
          title: Integration Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                anyOf:
                - type: object
                  additionalProperties: true
                - type: 'null'
                title: Response Get Integration Flat Rate Api Super Admin Integrations  Integration
                  Type  Rate Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Super Admin Integrations
      summary: Update Integration Flat Rate
      description: "Update or create flat rate for a non-AI integration type.\n\n\
        Args:\n    integration_type: Integration type (e.g., 'resend', 'twilio')\n\
        \    data: Rate update data\n\nReturns:\n    Updated rate info"
      operationId: update_integration_flat_rate_api_super_admin_integrations__integration_type__rate_put
      parameters:
      - name: integration_type
        in: path
        required: true
        schema:
          type: string
          title: Integration Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FlatRateUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Integration Flat Rate Api Super Admin Integrations  Integration
                  Type  Rate Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integrations:
    get:
      tags:
      - Super Admin Integrations
      summary: List Master Integrations
      description: "List all master integrations with optional filters\n\nReturns:\n\
        \    List of master integrations"
      operationId: list_master_integrations_api_super_admin_integrations_get
      parameters:
      - name: include_stats
        in: query
        required: false
        schema:
          type: boolean
          description: Include deployment statistics
          default: true
          title: Include Stats
        description: Include deployment statistics
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by category
          title: Category
        description: Filter by category
      - name: is_active
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          description: Filter by active status
          title: Is Active
        description: Filter by active status
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
                title: Response List Master Integrations Api Super Admin Integrations
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Super Admin Integrations
      summary: Create Master Integration
      description: "Create a new master integration\n\nArgs:\n    data: Integration\
        \ configuration\n    \nReturns:\n    Created integration details"
      operationId: create_master_integration_api_super_admin_integrations_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IntegrationConfig'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Master Integration Api Super Admin Integrations
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integrations/{integration_id}:
    get:
      tags:
      - Super Admin Integrations
      summary: Get Integration Details
      description: "Get details of a specific master integration\n\nArgs:\n    integration_id:\
        \ UUID of the integration\n    include_config: Whether to include decrypted\
        \ configuration\n    \nReturns:\n    Integration details"
      operationId: get_integration_details_api_super_admin_integrations__integration_id__get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: include_config
        in: query
        required: false
        schema:
          type: boolean
          description: Include decrypted configuration
          default: false
          title: Include Config
        description: Include decrypted configuration
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Integration Details Api Super Admin Integrations  Integration
                  Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Super Admin Integrations
      summary: Update Master Integration
      description: "Update an existing master integration\n\nArgs:\n    integration_id:\
        \ UUID of the integration\n    data: Fields to update\n    \nReturns:\n  \
        \  Updated integration details"
      operationId: update_master_integration_api_super_admin_integrations__integration_id__put
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__admin__super_admin_integrations__IntegrationUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Master Integration Api Super Admin Integrations  Integration
                  Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Super Admin Integrations
      summary: Delete Integration
      description: "Delete a master integration and remove from all organizations\n\
        \nArgs:\n    integration_id: ID of the integration to delete\n\nReturns:\n\
        \    Delete status"
      operationId: delete_integration_api_super_admin_integrations__integration_id__delete
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Integration Api Super Admin Integrations  Integration
                  Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    patch:
      tags:
      - Super Admin Integrations
      summary: Patch Master Integration
      description: "Partially update a master integration (PATCH method).\n\nUnlike\
        \ PUT, this allows updating just specific fields like configuration.\n\nArgs:\n\
        \    integration_id: UUID of the integration\n    data: Fields to update (only\
        \ non-null fields are applied)\n\nReturns:\n    Updated integration details"
      operationId: patch_master_integration_api_super_admin_integrations__integration_id__patch
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__admin__super_admin_integrations__IntegrationUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Patch Master Integration Api Super Admin Integrations  Integration
                  Id  Patch
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integrations/{integration_id}/deployment-status:
    get:
      tags:
      - Super Admin Integrations
      summary: Get Integration Deployment Status
      description: "Get deployment status of an integration across all organizations\n\
        \nArgs:\n    integration_id: UUID of the integration\n    \nReturns:\n   \
        \ Deployment status information"
      operationId: get_integration_deployment_status_api_super_admin_integrations__integration_id__deployment_status_get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Integration Deployment Status Api Super Admin
                  Integrations  Integration Id  Deployment Status Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integrations/{integration_id}/org/{org_id}/local-id:
    get:
      tags:
      - Super Admin Integrations
      summary: Get Org Integration Id
      description: 'Get the org-level integration ID for a deployed master integration.

        Used to construct webhook URLs for voice integrations.'
      operationId: get_org_integration_id_api_super_admin_integrations__integration_id__org__org_id__local_id_get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Org Integration Id Api Super Admin Integrations  Integration
                  Id  Org  Org Id  Local Id Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integrations/{integration_id}/deploy:
    post:
      tags:
      - Super Admin Integrations
      summary: Deploy To Organizations
      description: "Deploy integration to specified organizations\n\nArgs:\n    integration_id:\
        \ UUID of the integration\n    request: List of organization IDs\n    \nReturns:\n\
        \    Deployment results"
      operationId: deploy_to_organizations_api_super_admin_integrations__integration_id__deploy_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeploymentRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Deploy To Organizations Api Super Admin Integrations  Integration
                  Id  Deploy Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integrations/{integration_id}/deploy-all:
    post:
      tags:
      - Super Admin Integrations
      summary: Deploy To All Organizations
      description: "Deploy integration to all active organizations\n\nArgs:\n    integration_id:\
        \ UUID of the integration\n    \nReturns:\n    Deployment results"
      operationId: deploy_to_all_organizations_api_super_admin_integrations__integration_id__deploy_all_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Deploy To All Organizations Api Super Admin Integrations  Integration
                  Id  Deploy All Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integrations/{integration_id}/revoke/{org_id}:
    delete:
      tags:
      - Super Admin Integrations
      summary: Revoke From Organization
      description: "Remove integration from an organization\n\nArgs:\n    integration_id:\
        \ UUID of the integration\n    org_id: Organization ID\n    \nReturns:\n \
        \   Revocation result"
      operationId: revoke_from_organization_api_super_admin_integrations__integration_id__revoke__org_id__delete
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Revoke From Organization Api Super Admin Integrations  Integration
                  Id  Revoke  Org Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integrations/{integration_id}/deployments:
    get:
      tags:
      - Super Admin Integrations
      summary: Get Deployment Status
      description: "Get deployment status for an integration across all organizations\n\
        \nArgs:\n    integration_id: UUID of the integration\n    \nReturns:\n   \
        \ List of deployment statuses"
      operationId: get_deployment_status_api_super_admin_integrations__integration_id__deployments_get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
                title: Response Get Deployment Status Api Super Admin Integrations  Integration
                  Id  Deployments Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integrations/bulk-deploy:
    post:
      tags:
      - Super Admin Integrations
      summary: Bulk Deploy Integrations
      description: "Deploy multiple integrations to multiple organizations\n\nArgs:\n\
        \    request: Bulk deployment request with integration and org IDs\n    \n\
        Returns:\n    Bulk deployment results"
      operationId: bulk_deploy_integrations_api_super_admin_integrations_bulk_deploy_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkDeploymentRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Bulk Deploy Integrations Api Super Admin Integrations
                  Bulk Deploy Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integration-types:
    get:
      tags:
      - Super Admin Integrations
      summary: Get Integration Types
      description: "Get list of supported integration types\n\nReturns:\n    Dictionary\
        \ of integration types and their display names"
      operationId: get_integration_types_api_super_admin_integration_types_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
                title: Response Get Integration Types Api Super Admin Integration
                  Types Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integration-categories:
    get:
      tags:
      - Super Admin Integrations
      summary: Get Integration Categories
      description: "Get list of integration categories\n\nReturns:\n    List of category\
        \ names"
      operationId: get_integration_categories_api_super_admin_integration_categories_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
                title: Response Get Integration Categories Api Super Admin Integration
                  Categories Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integrations/{integration_id}/toggle-status:
    patch:
      tags:
      - Super Admin Integrations
      summary: Toggle Integration Status
      description: "Toggle the active status of a master integration\n\nArgs:\n  \
        \  integration_id: ID of the integration to toggle\n    \nReturns:\n    Updated\
        \ status information"
      operationId: toggle_integration_status_api_super_admin_integrations__integration_id__toggle_status_patch
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Toggle Integration Status Api Super Admin Integrations  Integration
                  Id  Toggle Status Patch
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integrations/{integration_id}/test:
    post:
      tags:
      - Super Admin Integrations
      summary: Test Integration Connection
      description: "Test the connection/API key for a master integration.\n\nArgs:\n\
        \    integration_id: ID of the integration to test\n\nReturns:\n    Test result\
        \ with success status and message"
      operationId: test_integration_connection_api_super_admin_integrations__integration_id__test_post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Test Integration Connection Api Super Admin Integrations  Integration
                  Id  Test Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integrations/{integration_id}/toggle-auto-deploy:
    patch:
      tags:
      - Super Admin Integrations
      summary: Toggle Auto Deploy
      description: "Toggle the auto-deploy on signup flag for a master integration\n\
        \nWhen enabled, this integration will be automatically deployed to new organizations\n\
        during the onboarding process.\n\nArgs:\n    integration_id: ID of the integration\n\
        \nReturns:\n    Updated auto-deploy status"
      operationId: toggle_auto_deploy_api_super_admin_integrations__integration_id__toggle_auto_deploy_patch
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Toggle Auto Deploy Api Super Admin Integrations  Integration
                  Id  Toggle Auto Deploy Patch
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/integrations/auto-deploy/list:
    get:
      tags:
      - Super Admin Integrations
      summary: Get Auto Deploy Integrations
      description: "Get list of all integrations marked for auto-deployment\n\nReturns:\n\
        \    List of integrations with auto_deploy_on_signup = true"
      operationId: get_auto_deploy_integrations_api_super_admin_integrations_auto_deploy_list_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
                title: Response Get Auto Deploy Integrations Api Super Admin Integrations
                  Auto Deploy List Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/kb-sync/publish:
    post:
      tags:
      - Super Admin KB Sync
      - super-admin-kb-sync
      summary: Publish Kb To Master
      description: 'Publish a knowledge base from a source org to master database


        This makes the KB available for deployment to template and other orgs.'
      operationId: publish_kb_to_master_api_super_admin_kb_sync_publish_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublishKBRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Publish Kb To Master Api Super Admin Kb Sync Publish
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/kb-sync/deploy:
    post:
      tags:
      - Super Admin KB Sync
      - super-admin-kb-sync
      summary: Deploy Master Kb
      description: 'Deploy a master KB to selected organizations


        If target_org_ids is null or empty, deploys to ALL active organizations.'
      operationId: deploy_master_kb_api_super_admin_kb_sync_deploy_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeployKBRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Deploy Master Kb Api Super Admin Kb Sync Deploy Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/kb-sync/master-kbs:
    get:
      tags:
      - Super Admin KB Sync
      - super-admin-kb-sync
      summary: List Master Kbs
      description: List all master knowledge bases with deployment statistics
      operationId: list_master_kbs_api_super_admin_kb_sync_master_kbs_get
      parameters:
      - name: include_deployment_stats
        in: query
        required: false
        schema:
          type: boolean
          description: Include deployment statistics
          default: true
          title: Include Deployment Stats
        description: Include deployment statistics
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response List Master Kbs Api Super Admin Kb Sync Master Kbs
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/kb-sync/master-kbs/{master_kb_id}/deployments:
    get:
      tags:
      - Super Admin KB Sync
      - super-admin-kb-sync
      summary: Get Deployment Status
      description: Get deployment status for a specific master KB
      operationId: get_deployment_status_api_super_admin_kb_sync_master_kbs__master_kb_id__deployments_get
      parameters:
      - name: master_kb_id
        in: path
        required: true
        schema:
          type: string
          title: Master Kb Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Deployment Status Api Super Admin Kb Sync Master
                  Kbs  Master Kb Id  Deployments Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/kb-sync/master-kbs/{master_kb_id}/unpublish:
    post:
      tags:
      - Super Admin KB Sync
      - super-admin-kb-sync
      summary: Unpublish Master Kb
      description: Mark a master KB as unpublished (removes from available KBs)
      operationId: unpublish_master_kb_api_super_admin_kb_sync_master_kbs__master_kb_id__unpublish_post
      parameters:
      - name: master_kb_id
        in: path
        required: true
        schema:
          type: string
          title: Master Kb Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Unpublish Master Kb Api Super Admin Kb Sync Master
                  Kbs  Master Kb Id  Unpublish Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/kb-sync/master-kbs/{master_kb_id}/deploy-to-template:
    post:
      tags:
      - Super Admin KB Sync
      - super-admin-kb-sync
      summary: Deploy To Template
      description: Deploy a master KB specifically to the template database
      operationId: deploy_to_template_api_super_admin_kb_sync_master_kbs__master_kb_id__deploy_to_template_post
      parameters:
      - name: master_kb_id
        in: path
        required: true
        schema:
          type: string
          title: Master Kb Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Deploy To Template Api Super Admin Kb Sync Master
                  Kbs  Master Kb Id  Deploy To Template Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/kb-sync/deployment-history/{master_kb_id}:
    get:
      tags:
      - Super Admin KB Sync
      - super-admin-kb-sync
      summary: Get Deployment History
      description: Get deployment history for a specific master KB
      operationId: get_deployment_history_api_super_admin_kb_sync_deployment_history__master_kb_id__get
      parameters:
      - name: master_kb_id
        in: path
        required: true
        schema:
          type: string
          title: Master Kb Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Deployment History Api Super Admin Kb Sync Deployment
                  History  Master Kb Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/kb-sync/source-kbs/{org_id}:
    get:
      tags:
      - Super Admin KB Sync
      - super-admin-kb-sync
      summary: Get Source Org Kbs
      description: 'Get all knowledge bases from a specific organization (for publishing
        selection)


        This is used by the hardcoded sync button in the KB UI.'
      operationId: get_source_org_kbs_api_super_admin_kb_sync_source_kbs__org_id__get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Source Org Kbs Api Super Admin Kb Sync Source
                  Kbs  Org Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/workflow-failure-stats:
    get:
      tags:
      - Super Admin Workflow Monitoring
      summary: Get Workflow Failure Stats
      description: "Get aggregated statistics about workflow failures from the centralized\
        \ master database\n\nReturns:\n    Statistics about workflow failures across\
        \ organizations"
      operationId: get_workflow_failure_stats_api_super_admin_workflow_failure_stats_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          description: Number of days to look back
          default: 30
          title: Days
        description: Number of days to look back
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/workflow-details/{workflow_id}:
    get:
      tags:
      - Super Admin Workflow Monitoring
      summary: Get Workflow Details
      description: "Get detailed information about a specific workflow and its recent\
        \ failures\n\nArgs:\n    workflow_id: The workflow ID\n    org_database: The\
        \ organization database name\n\nReturns:\n    Detailed workflow information\
        \ and recent execution history"
      operationId: get_workflow_details_api_super_admin_workflow_details__workflow_id__get
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      - name: org_database
        in: query
        required: true
        schema:
          type: string
          description: Organization database name
          title: Org Database
        description: Organization database name
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/auth/impersonate/{org_id}:
    post:
      tags:
      - Super Admin Auth
      summary: Impersonate Organization
      description: "Allow super admin to auto-login to any organization for debugging\n\
        \nThis creates a temporary session for the super admin in the target organization,\n\
        allowing them to access the org as if they were a member.\n\nArgs:\n    org_id:\
        \ The organization ID to access\n    current_user_email: The super admin's\
        \ email (from auth)\n\nReturns:\n    Session token and redirect URL for the\
        \ organization"
      operationId: impersonate_organization_api_super_admin_auth_impersonate__org_id__post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/auth/end-impersonation:
    post:
      tags:
      - Super Admin Auth
      summary: End Impersonation
      description: "End an active impersonation session\n\nArgs:\n    session_token:\
        \ The session token to invalidate\n    current_user_email: The super admin's\
        \ email\n\nReturns:\n    Success status"
      operationId: end_impersonation_api_super_admin_auth_end_impersonation_post
      parameters:
      - name: session_token
        in: query
        required: true
        schema:
          type: string
          title: Session Token
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/auth/impersonation-history:
    get:
      tags:
      - Super Admin Auth
      summary: Get Impersonation History
      description: "Get history of all super admin impersonations for audit purposes\n\
        \nReturns:\n    List of impersonation sessions with details"
      operationId: get_impersonation_history_api_super_admin_auth_impersonation_history_get
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 100
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          default: 0
          title: Offset
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/auth/login-history:
    get:
      tags:
      - Super Admin Auth
      summary: Get Login History
      description: "Get history of all super admin login attempts\n\nReturns:\n  \
        \  List of login attempts with details"
      operationId: get_login_history_api_super_admin_auth_login_history_get
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 100
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          default: 0
          title: Offset
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/login/request-otp:
    post:
      tags:
      - Super Admin Login
      summary: Request Super Admin Otp
      description: 'Step 1: Check if email is super admin and send OTP'
      operationId: request_super_admin_otp_api_super_admin_login_request_otp_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SuperAdminLoginRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Request Super Admin Otp Api Super Admin Login Request
                  Otp Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/login/verify-otp:
    post:
      tags:
      - Super Admin Login
      summary: Verify Super Admin Otp
      description: 'Step 2: Verify OTP and create super admin session'
      operationId: verify_super_admin_otp_api_super_admin_login_verify_otp_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__admin__super_admin_login_routes__VerifyOTPRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Verify Super Admin Otp Api Super Admin Login Verify
                  Otp Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/login/resend-otp:
    post:
      tags:
      - Super Admin Login
      summary: Resend Super Admin Otp
      description: Resend OTP for super admin login
      operationId: resend_super_admin_otp_api_super_admin_login_resend_otp_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SuperAdminLoginRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Resend Super Admin Otp Api Super Admin Login Resend
                  Otp Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/login/session-check:
    get:
      tags:
      - Super Admin Login
      summary: Check Super Admin Session
      description: Check if a super admin session is valid
      operationId: check_super_admin_session_api_super_admin_login_session_check_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Check Super Admin Session Api Super Admin Login Session
                  Check Get
  /api/super-admin/login/logout:
    post:
      tags:
      - Super Admin Login
      summary: Logout Super Admin
      description: Logout super admin by clearing session
      operationId: logout_super_admin_api_super_admin_login_logout_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Logout Super Admin Api Super Admin Login Logout Post
  /api/super-admin/login/login-history:
    get:
      tags:
      - Super Admin Login
      summary: Get Super Admin Login History
      description: Get super admin login history from audit log
      operationId: get_super_admin_login_history_api_super_admin_login_login_history_get
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 50
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          default: 0
          title: Offset
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Super Admin Login History Api Super Admin Login
                  Login History Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/debug/connection-pools:
    get:
      tags:
      - Debug
      summary: Check Connection Pools
      description: 'Monitor database connection pool health


        CRITICAL: Use this endpoint to debug connection exhaustion issues

        Requires super admin access.'
      operationId: check_connection_pools_api_admin_debug_connection_pools_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Check Connection Pools Api Admin Debug Connection
                  Pools Get
  /api/admin/debug/cleanup-pools:
    post:
      tags:
      - Debug
      summary: Force Cleanup Pools
      description: Force cleanup of idle connection pools. Requires super admin access.
      operationId: force_cleanup_pools_api_admin_debug_cleanup_pools_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Force Cleanup Pools Api Admin Debug Cleanup Pools
                  Post
  /api/admin/debug/reset-org-pool/{org_id}:
    post:
      tags:
      - Debug
      summary: Reset Org Connection Pool
      description: 'Reset connection pool and circuit breaker for a specific organization.


        Use this when:

        - An org is experiencing connection pool issues

        - Circuit breaker has been triggered (org is blocked)

        - Connection pool is exhausted


        Requires super admin access.'
      operationId: reset_org_connection_pool_api_admin_debug_reset_org_pool__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:
                type: object
                additionalProperties: true
                title: Response Reset Org Connection Pool Api Admin Debug Reset Org
                  Pool  Org Id  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/debug/reset-all-pools:
    post:
      tags:
      - Debug
      summary: Reset All Connection Pools
      description: 'Reset ALL connection pools and circuit breakers.


        WARNING: This will close all database connections. Use only in emergencies.


        Requires super admin access.'
      operationId: reset_all_connection_pools_api_admin_debug_reset_all_pools_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Reset All Connection Pools Api Admin Debug Reset All
                  Pools Post
  /api/admin/debug/azure-env:
    get:
      tags:
      - Debug
      summary: Check Azure Env
      description: Check Azure environment variables. Requires super admin access.
      operationId: check_azure_env_api_admin_debug_azure_env_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties:
                  type: string
                type: object
                title: Response Check Azure Env Api Admin Debug Azure Env Get
  /api/admin/debug/system-metrics:
    get:
      tags:
      - Debug
      summary: Get System Metrics
      description: Get current system resource usage. Requires super admin access.
      operationId: get_system_metrics_api_admin_debug_system_metrics_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get System Metrics Api Admin Debug System Metrics
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/debug/cpu-intensive-operations:
    get:
      tags:
      - Debug
      summary: Get Cpu Intensive Ops
      description: 'Analyze logs for CPU-intensive operations in the last N hours.

        Requires super admin access.'
      operationId: get_cpu_intensive_ops_api_admin_debug_cpu_intensive_operations_get
      parameters:
      - name: hours
        in: query
        required: false
        schema:
          type: integer
          default: 1
          title: Hours
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Cpu Intensive Ops Api Admin Debug Cpu Intensive
                  Operations Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/debug/database-connections:
    get:
      tags:
      - Debug
      summary: Get Database Connections
      description: 'Check database connection pool status.

        High connection counts can cause CPU spikes.'
      operationId: get_database_connections_api_admin_debug_database_connections_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Database Connections Api Admin Debug Database
                  Connections Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/debug/celery-queue-depth:
    get:
      tags:
      - Debug
      summary: Get Celery Queue Depth
      description: 'Check Celery queue depths. High queue depth can cause CPU spikes

        as workers try to process backlog.'
      operationId: get_celery_queue_depth_api_admin_debug_celery_queue_depth_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Celery Queue Depth Api Admin Debug Celery Queue
                  Depth Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/debug/trigger-master-webhook-event:
    post:
      tags:
      - Debug
      summary: Trigger Master Webhook Event
      description: "Manually trigger ANY master webhook event for testing.\n\nPOST\
        \ body:\n{\n    \"event_type\": \"trial.expired\",  // or any event type\n\
        \    \"event_data\": {\n        \"org_id\": \"test-123\",\n        \"org_name\"\
        : \"Test Organization\",\n        \"trial_end_date\": \"2026-02-18\"\n   \
        \ }\n}\n\nThis will queue the event to all master webhooks that listen for\
        \ this event type."
      operationId: trigger_master_webhook_event_api_admin_debug_trigger_master_webhook_event_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Trigger Master Webhook Event Api Admin Debug Trigger
                  Master Webhook Event Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/debug/trigger-org-tracking:
    post:
      tags:
      - Debug
      summary: Trigger Org Tracking Webhook
      description: 'Manually trigger the org.tracking webhook event.


        This endpoint:

        1. Queries all active organizations

        2. Calculates usage stats (plan, credits, trial expiry)

        3. Triggers org.tracking webhook for each org

        4. Queues webhooks in master_webhook_queue table


        Use this when the scheduled daily task (8 AM IST) doesn''t run or for testing.

        Requires super admin access.'
      operationId: trigger_org_tracking_webhook_api_admin_debug_trigger_org_tracking_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Trigger Org Tracking Webhook Api Admin Debug Trigger
                  Org Tracking Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/v3-system/dashboard:
    get:
      tags:
      - Super Admin V3 Health
      - super-admin-v3-health
      summary: Get V3 System Dashboard
      description: Get comprehensive V3 system dashboard data
      operationId: get_v3_system_dashboard_api_super_admin_v3_system_dashboard_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/v3-system/health/overview:
    get:
      tags:
      - Super Admin V3 Health
      - super-admin-v3-health
      summary: Get System Health Overview
      description: Get high-level system health overview
      operationId: get_system_health_overview_api_super_admin_v3_system_health_overview_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/v3-system/metrics/realtime:
    get:
      tags:
      - Super Admin V3 Health
      - super-admin-v3-health
      summary: Get Realtime Metrics
      description: Get real-time V3 system metrics
      operationId: get_realtime_metrics_api_super_admin_v3_system_metrics_realtime_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/v3-system/alerts/active:
    get:
      tags:
      - Super Admin V3 Health
      - super-admin-v3-health
      summary: Get Active Alerts
      description: Get all active V3 system alerts
      operationId: get_active_alerts_api_super_admin_v3_system_alerts_active_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/v3-system/performance/history:
    get:
      tags:
      - Super Admin V3 Health
      - super-admin-v3-health
      summary: Get Performance History
      description: Get V3 system performance history
      operationId: get_performance_history_api_super_admin_v3_system_performance_history_get
      parameters:
      - name: hours
        in: query
        required: false
        schema:
          type: integer
          default: 24
          title: Hours
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/v3-system/control/restart-listener:
    post:
      tags:
      - Super Admin V3 Health
      - super-admin-v3-health
      summary: Restart Listener
      description: Restart a specific V3 listener
      operationId: restart_listener_api_super_admin_v3_system_control_restart_listener_post
      parameters:
      - name: listener_name
        in: query
        required: true
        schema:
          type: string
          title: Listener Name
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/v3-system/organizations/v3-health:
    get:
      tags:
      - Super Admin V3 Health
      - super-admin-v3-health
      summary: Get Organizations V3 Health
      description: Get V3 system health for all organizations
      operationId: get_organizations_v3_health_api_super_admin_v3_system_organizations_v3_health_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/v3-system/deployment/status:
    get:
      tags:
      - Super Admin V3 Health
      - super-admin-v3-health
      summary: Get Deployment Status
      description: Get V3 deployment status across the system
      operationId: get_deployment_status_api_super_admin_v3_system_deployment_status_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/marketplace/pending:
    get:
      tags:
      - Admin Marketplace
      summary: Get Pending Items
      description: Get marketplace items pending approval
      operationId: get_pending_items_admin_marketplace_pending_get
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          default: 50
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          default: 0
          title: Offset
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Pending Items Admin Marketplace Pending Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/marketplace/{item_id}/approve:
    post:
      tags:
      - Admin Marketplace
      summary: Approve Item
      description: Approve a marketplace item
      operationId: approve_item_admin_marketplace__item_id__approve_post
      parameters:
      - name: item_id
        in: path
        required: true
        schema:
          type: string
          title: Item Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Approve Item Admin Marketplace  Item Id  Approve Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/marketplace/{item_id}/reject:
    post:
      tags:
      - Admin Marketplace
      summary: Reject Item
      description: Reject a marketplace item
      operationId: reject_item_admin_marketplace__item_id__reject_post
      parameters:
      - name: item_id
        in: path
        required: true
        schema:
          type: string
          title: Item Id
      - name: reason
        in: query
        required: true
        schema:
          type: string
          title: Reason
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Reject Item Admin Marketplace  Item Id  Reject Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/marketplace/{item_id}/feature:
    put:
      tags:
      - Admin Marketplace
      summary: Toggle Featured
      description: Toggle featured status for a marketplace item
      operationId: toggle_featured_admin_marketplace__item_id__feature_put
      parameters:
      - name: item_id
        in: path
        required: true
        schema:
          type: string
          title: Item Id
      - name: is_featured
        in: query
        required: true
        schema:
          type: boolean
          title: Is Featured
      - name: featured_until
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Featured Until
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Toggle Featured Admin Marketplace  Item Id  Feature
                  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/marketplace/stats:
    get:
      tags:
      - Admin Marketplace
      summary: Get Marketplace Stats
      description: Get marketplace statistics
      operationId: get_marketplace_stats_admin_marketplace_stats_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Marketplace Stats Admin Marketplace Stats Get
  /api/users:
    get:
      tags:
      - Users
      summary: Get Organization Users
      description: Get all users in the organization for dropdowns and assignments
      operationId: get_organization_users_api_users_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/users/{user_id}:
    get:
      tags:
      - Users
      summary: Get User Details
      description: Get details for a specific user in the organization
      operationId: get_user_details_api_users__user_id__get
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: string
          title: User Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/test/email-tracking/send:
    post:
      tags:
      - Email Tracking Test
      - Email Tracking Test
      summary: Send Test Tracking Email
      description: 'Send a test email with tracking enabled


        This endpoint is for testing email tracking functionality.'
      operationId: send_test_tracking_email_api_test_email_tracking_send_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestEmailRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Send Test Tracking Email Api Test Email Tracking Send
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/test/email-tracking/stats/{email_activity_id}:
    get:
      tags:
      - Email Tracking Test
      - Email Tracking Test
      summary: Get Email Tracking Stats
      description: Get tracking statistics for a specific email
      operationId: get_email_tracking_stats_api_test_email_tracking_stats__email_activity_id__get
      parameters:
      - name: email_activity_id
        in: path
        required: true
        schema:
          type: string
          title: Email Activity Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Email Tracking Stats Api Test Email Tracking Stats  Email
                  Activity Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/vector-sync/status:
    get:
      tags:
      - Vector Sync Management
      summary: Get Vector Sync Status
      description: Get vector sync status for the user's organization
      operationId: get_vector_sync_status_api_admin_vector_sync_status_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Vector Sync Status Api Admin Vector Sync Status
                  Get
  /api/admin/vector-sync/process-batch:
    post:
      tags:
      - Vector Sync Management
      summary: Trigger Batch Processing
      description: Manually trigger batch processing for the organization
      operationId: trigger_batch_processing_api_admin_vector_sync_process_batch_post
      parameters:
      - name: batch_size
        in: query
        required: false
        schema:
          anyOf:
          - type: integer
          - type: 'null'
          default: 50
          title: Batch Size
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Trigger Batch Processing Api Admin Vector Sync Process
                  Batch Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/vector-sync/process-visitors:
    post:
      tags:
      - Vector Sync Management
      summary: Trigger Visitor Processing
      description: Manually trigger visitor intelligence processing
      operationId: trigger_visitor_processing_api_admin_vector_sync_process_visitors_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Trigger Visitor Processing Api Admin Vector Sync Process
                  Visitors Post
  /api/admin/vector-sync/clear-failed:
    delete:
      tags:
      - Vector Sync Management
      summary: Clear Failed Items
      description: Clear failed items from the sync queue
      operationId: clear_failed_items_api_admin_vector_sync_clear_failed_delete
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Clear Failed Items Api Admin Vector Sync Clear Failed
                  Delete
  /api/admin/vector-sync/recent-activity:
    get:
      tags:
      - Vector Sync Management
      summary: Get Recent Activity
      description: Get recent vector sync activity
      operationId: get_recent_activity_api_admin_vector_sync_recent_activity_get
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 20
          title: Limit
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Recent Activity Api Admin Vector Sync Recent Activity
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/vector-sync/dashboard:
    get:
      tags:
      - Vector Sync Management
      summary: Get Dashboard Metrics
      description: Get comprehensive dashboard metrics for vector sync administration
      operationId: get_dashboard_metrics_api_admin_vector_sync_dashboard_get
      parameters:
      - name: days_back
        in: query
        required: false
        schema:
          anyOf:
          - type: integer
          - type: 'null'
          description: Filter metrics to last N days
          title: Days Back
        description: Filter metrics to last N days
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Dashboard Metrics Api Admin Vector Sync Dashboard
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/vector-sync/detect-missing:
    post:
      tags:
      - Vector Sync Management
      summary: Detect Missing
      description: Detect and queue missing items in Knowledge Bases
      operationId: detect_missing_api_admin_vector_sync_detect_missing_post
      parameters:
      - name: kb_name
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Kb Name
      - name: max_items
        in: query
        required: false
        schema:
          type: integer
          description: Maximum items to queue per KB
          default: 100
          title: Max Items
        description: Maximum items to queue per KB
      - name: days_back
        in: query
        required: false
        schema:
          anyOf:
          - type: integer
          - type: 'null'
          description: Only sync items from last N days
          title: Days Back
        description: Only sync items from last N days
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Detect Missing Api Admin Vector Sync Detect Missing
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/vector-sync/sync-all:
    post:
      tags:
      - Vector Sync Management
      summary: Sync All Pending
      description: Manually trigger sync for all pending items across all Knowledge
        Bases
      operationId: sync_all_pending_api_admin_vector_sync_sync_all_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Sync All Pending Api Admin Vector Sync Sync All Post
  /api/admin/vector-sync/sync-selective:
    post:
      tags:
      - Vector Sync Management
      summary: Sync Selective
      description: Selective sync based on filters (entity types, KBs, date range)
      operationId: sync_selective_api_admin_vector_sync_sync_selective_post
      parameters:
      - name: entity_types
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Entity Types
      - name: kb_ids
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Kb Ids
      - name: date_range_start
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Date Range Start
      - name: date_range_end
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Date Range End
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Sync Selective Api Admin Vector Sync Sync Selective
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/vector-sync/kb/{kb_id}/status:
    get:
      tags:
      - Vector Sync Management
      summary: Get Kb Specific Status
      description: Get detailed sync status for a specific Knowledge Base
      operationId: get_kb_specific_status_api_admin_vector_sync_kb__kb_id__status_get
      parameters:
      - name: kb_id
        in: path
        required: true
        schema:
          type: string
          title: Kb Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Kb Specific Status Api Admin Vector Sync Kb  Kb
                  Id  Status Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/vector-sync/retry-failed:
    post:
      tags:
      - Vector Sync Management
      summary: Retry Failed Items
      description: Retry failed sync items (optionally filtered by KB)
      operationId: retry_failed_items_api_admin_vector_sync_retry_failed_post
      parameters:
      - name: kb_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Kb Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Retry Failed Items Api Admin Vector Sync Retry Failed
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/vector-sync/analytics:
    get:
      tags:
      - Vector Sync Management
      summary: Get Sync Analytics
      description: Get detailed sync analytics and performance metrics
      operationId: get_sync_analytics_api_admin_vector_sync_analytics_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          default: 24h
          title: Period
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Sync Analytics Api Admin Vector Sync Analytics
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/vector-sync/cleanup:
    post:
      tags:
      - Vector Sync Management
      summary: Cleanup Sync Queue
      description: Cleanup old items from sync queue
      operationId: cleanup_sync_queue_api_admin_vector_sync_cleanup_post
      parameters:
      - name: older_than_hours
        in: query
        required: false
        schema:
          type: integer
          default: 24
          title: Older Than Hours
      - name: status_filter
        in: query
        required: false
        schema:
          type: string
          default: completed
          title: Status Filter
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Cleanup Sync Queue Api Admin Vector Sync Cleanup Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/business-profile/:
    get:
      tags:
      - Business Profile Management
      summary: Get Business Profile
      description: Get all business profile sections
      operationId: get_business_profile_api_admin_business_profile__get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Business Profile Api Admin Business Profile  Get
    post:
      tags:
      - Business Profile Management
      summary: Create Business Profile Section
      description: Create a new business profile section
      operationId: create_business_profile_section_api_admin_business_profile__post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BusinessProfileSection'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Create Business Profile Section Api Admin Business
                  Profile  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/business-profile/{section_id}:
    put:
      tags:
      - Business Profile Management
      summary: Update Business Profile Section
      description: Update a business profile section
      operationId: update_business_profile_section_api_admin_business_profile__section_id__put
      parameters:
      - name: section_id
        in: path
        required: true
        schema:
          type: string
          title: Section Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BusinessProfileUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Business Profile Section Api Admin Business
                  Profile  Section Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Business Profile Management
      summary: Delete Business Profile Section
      description: Delete a business profile section
      operationId: delete_business_profile_section_api_admin_business_profile__section_id__delete
      parameters:
      - name: section_id
        in: path
        required: true
        schema:
          type: string
          title: Section Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Business Profile Section Api Admin Business
                  Profile  Section Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/business-profile/templates:
    get:
      tags:
      - Business Profile Management
      summary: Get Section Templates
      description: Get business profile section templates
      operationId: get_section_templates_api_admin_business_profile_templates_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Section Templates Api Admin Business Profile Templates
                  Get
  /api/admin/business-profile/sync-status:
    get:
      tags:
      - Business Profile Management
      summary: Get Business Profile Sync Status
      description: Get sync status for business profile sections
      operationId: get_business_profile_sync_status_api_admin_business_profile_sync_status_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Business Profile Sync Status Api Admin Business
                  Profile Sync Status Get
  /api/admin/business-profile/{section_id}/faq-items:
    get:
      tags:
      - Business Profile Management
      summary: Get Faq Items
      description: Get FAQ items for a specific section
      operationId: get_faq_items_api_admin_business_profile__section_id__faq_items_get
      parameters:
      - name: section_id
        in: path
        required: true
        schema:
          type: string
          title: Section Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Faq Items Api Admin Business Profile  Section
                  Id  Faq Items Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Business Profile Management
      summary: Create Faq Item
      description: Create a new FAQ item for a section
      operationId: create_faq_item_api_admin_business_profile__section_id__faq_items_post
      parameters:
      - name: section_id
        in: path
        required: true
        schema:
          type: string
          title: Section Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FAQItem'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Faq Item Api Admin Business Profile  Section
                  Id  Faq Items Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/business-profile/faq-items/{faq_id}:
    put:
      tags:
      - Business Profile Management
      summary: Update Faq Item
      description: Update an FAQ item
      operationId: update_faq_item_api_admin_business_profile_faq_items__faq_id__put
      parameters:
      - name: faq_id
        in: path
        required: true
        schema:
          type: string
          title: Faq Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FAQItemUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Faq Item Api Admin Business Profile Faq Items  Faq
                  Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Business Profile Management
      summary: Delete Faq Item
      description: Delete an FAQ item
      operationId: delete_faq_item_api_admin_business_profile_faq_items__faq_id__delete
      parameters:
      - name: faq_id
        in: path
        required: true
        schema:
          type: string
          title: Faq Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Faq Item Api Admin Business Profile Faq Items  Faq
                  Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/business-profile/categories:
    get:
      tags:
      - Business Profile Management
      summary: Get Section Categories
      description: Get available section categories
      operationId: get_section_categories_api_admin_business_profile_categories_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Section Categories Api Admin Business Profile
                  Categories Get
  /api/admin/business-profile/process-document:
    post:
      tags:
      - Business Profile Management
      summary: Process Document Upload
      description: Process uploaded document and extract content for business profile
        section
      operationId: process_document_upload_api_admin_business_profile_process_document_post
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_process_document_upload_api_admin_business_profile_process_document_post'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Process Document Upload Api Admin Business Profile
                  Process Document Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/business-profile/process-text:
    post:
      tags:
      - Business Profile Management
      summary: Process Text Content
      description: Process text content and structure it for business profile section
      operationId: process_text_content_api_admin_business_profile_process_text_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProcessTextRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Process Text Content Api Admin Business Profile Process
                  Text Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/prompts/:
    get:
      tags:
      - Prompt Library Management
      summary: Get Prompts
      description: Get all prompts with optional search and filtering
      operationId: get_prompts_api_admin_prompts__get
      parameters:
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Search prompts by heading, description, or content
          title: Search
        description: Search prompts by heading, description, or content
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by category
          title: Category
        description: Filter by category
      - name: tags
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by tags (comma-separated)
          title: Tags
        description: Filter by tags (comma-separated)
      - name: is_system
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          description: Filter system vs user prompts
          title: Is System
        description: Filter system vs user prompts
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Prompts Api Admin Prompts  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Prompt Library Management
      summary: Create Prompt
      description: Create a new prompt
      operationId: create_prompt_api_admin_prompts__post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Prompt'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Prompt Api Admin Prompts  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/prompts/list:
    get:
      tags:
      - Prompt Library Management
      summary: Get Prompts List
      description: 'Get lightweight prompt list for dropdown selection.

        Returns only metadata (no prompt_content) for better performance.

        Use GET /prompts/{id}/with-metadata to fetch full content after selection.'
      operationId: get_prompts_list_api_admin_prompts_list_get
      parameters:
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Search prompts by heading or description
          title: Search
        description: Search prompts by heading or description
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by category
          title: Category
        description: Filter by category
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Prompts List Api Admin Prompts List Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/prompts/{prompt_id}:
    put:
      tags:
      - Prompt Library Management
      summary: Update Prompt
      description: Update a prompt
      operationId: update_prompt_api_admin_prompts__prompt_id__put
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromptUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Prompt Api Admin Prompts  Prompt Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Prompt Library Management
      summary: Delete Prompt
      description: Delete a prompt
      operationId: delete_prompt_api_admin_prompts__prompt_id__delete
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Prompt Api Admin Prompts  Prompt Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/prompts/categories:
    get:
      tags:
      - Prompt Library Management
      summary: Get Prompt Categories
      description: Get available prompt categories
      operationId: get_prompt_categories_api_admin_prompts_categories_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Prompt Categories Api Admin Prompts Categories
                  Get
  /api/admin/prompts/{prompt_id}/increment-usage:
    post:
      tags:
      - Prompt Library Management
      summary: Increment Prompt Usage
      description: Increment usage count when prompt is used in workflows
      operationId: increment_prompt_usage_api_admin_prompts__prompt_id__increment_usage_post
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Increment Prompt Usage Api Admin Prompts  Prompt Id  Increment
                  Usage Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/prompts/search:
    get:
      tags:
      - Prompt Library Management
      summary: Search Prompts
      description: Advanced search for prompts (for workflow node integration)
      operationId: search_prompts_api_admin_prompts_search_get
      parameters:
      - name: q
        in: query
        required: true
        schema:
          type: string
          description: Search query
          title: Q
        description: Search query
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          description: Maximum results to return
          default: 10
          title: Limit
        description: Maximum results to return
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Search Prompts Api Admin Prompts Search Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/prompts/sync-status:
    get:
      tags:
      - Prompt Library Management
      summary: Get Prompt Sync Status
      description: Get sync status for prompt library
      operationId: get_prompt_sync_status_api_admin_prompts_sync_status_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Prompt Sync Status Api Admin Prompts Sync Status
                  Get
  /api/admin/prompts/{prompt_id}/versions:
    get:
      tags:
      - Prompt Library Management
      summary: Get Prompt Versions
      description: Get all versions of a prompt
      operationId: get_prompt_versions_api_admin_prompts__prompt_id__versions_get
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Prompt Versions Api Admin Prompts  Prompt Id  Versions
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Prompt Library Management
      summary: Create Prompt Version
      description: Create a new version of a prompt
      operationId: create_prompt_version_api_admin_prompts__prompt_id__versions_post
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromptVersionCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Prompt Version Api Admin Prompts  Prompt Id  Versions
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/prompts/{prompt_id}/versions/{version_number}:
    get:
      tags:
      - Prompt Library Management
      summary: Get Prompt Version
      description: Get a specific version of a prompt
      operationId: get_prompt_version_api_admin_prompts__prompt_id__versions__version_number__get
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      - name: version_number
        in: path
        required: true
        schema:
          type: integer
          title: Version Number
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Prompt Version Api Admin Prompts  Prompt Id  Versions  Version
                  Number  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Prompt Library Management
      summary: Update Prompt Version
      description: Update an existing version of a prompt in place
      operationId: update_prompt_version_api_admin_prompts__prompt_id__versions__version_number__put
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      - name: version_number
        in: path
        required: true
        schema:
          type: integer
          title: Version Number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromptVersionUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Prompt Version Api Admin Prompts  Prompt Id  Versions  Version
                  Number  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/prompts/{prompt_id}/restore-version/{version_number}:
    post:
      tags:
      - Prompt Library Management
      summary: Restore Prompt Version
      description: Restore a previous version of a prompt (creates a new version)
      operationId: restore_prompt_version_api_admin_prompts__prompt_id__restore_version__version_number__post
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      - name: version_number
        in: path
        required: true
        schema:
          type: integer
          title: Version Number
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Restore Prompt Version Api Admin Prompts  Prompt Id  Restore
                  Version  Version Number  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/prompts/save-from-workflow:
    post:
      tags:
      - Prompt Library Management
      summary: Save Prompt From Workflow
      description: 'Save a prompt from workflow editor.

        Supports three modes:

        - new_version: Update existing prompt with new version

        - new_prompt: Create entirely new prompt

        - workflow_only: Don''t save to library (return signal only)'
      operationId: save_prompt_from_workflow_api_admin_prompts_save_from_workflow_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SaveFromWorkflowRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Save Prompt From Workflow Api Admin Prompts Save From
                  Workflow Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/prompts/{prompt_id}/with-metadata:
    get:
      tags:
      - Prompt Library Management
      summary: Get Prompt With Metadata
      description: Get a prompt with full metadata for workflow nodes
      operationId: get_prompt_with_metadata_api_admin_prompts__prompt_id__with_metadata_get
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Prompt With Metadata Api Admin Prompts  Prompt
                  Id  With Metadata Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/master-webhooks:
    post:
      tags:
      - Master Webhooks
      - master-webhooks
      summary: Create Master Webhook
      description: Create a new master webhook (super admin only)
      operationId: create_master_webhook_api_admin_master_webhooks_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MasterWebhookCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Master Webhooks
      - master-webhooks
      summary: List Master Webhooks
      description: List all master webhooks (super admin only)
      operationId: list_master_webhooks_api_admin_master_webhooks_get
      parameters:
      - name: is_active
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/master-webhooks/{webhook_id}:
    get:
      tags:
      - Master Webhooks
      - master-webhooks
      summary: Get Master Webhook
      description: Get master webhook details (super admin only)
      operationId: get_master_webhook_api_admin_master_webhooks__webhook_id__get
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Master Webhooks
      - master-webhooks
      summary: Update Master Webhook
      description: Update master webhook configuration (super admin only)
      operationId: update_master_webhook_api_admin_master_webhooks__webhook_id__put
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MasterWebhookUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Master Webhooks
      - master-webhooks
      summary: Delete Master Webhook
      description: Delete a master webhook (super admin only)
      operationId: delete_master_webhook_api_admin_master_webhooks__webhook_id__delete
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/master-webhooks/{webhook_id}/test:
    post:
      tags:
      - Master Webhooks
      - master-webhooks
      summary: Test Master Webhook
      description: Send a test event to master webhook (super admin only)
      operationId: test_master_webhook_api_admin_master_webhooks__webhook_id__test_post
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestWebhookPayload'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/master-webhooks/{webhook_id}/regenerate-secret:
    post:
      tags:
      - Master Webhooks
      - master-webhooks
      summary: Regenerate Master Webhook Secret
      description: Regenerate master webhook secret key (super admin only)
      operationId: regenerate_master_webhook_secret_api_admin_master_webhooks__webhook_id__regenerate_secret_post
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/master-webhooks/{webhook_id}/deliveries:
    get:
      tags:
      - Master Webhooks
      - master-webhooks
      summary: Get Master Webhook Deliveries
      description: Get master webhook delivery logs (super admin only)
      operationId: get_master_webhook_deliveries_api_admin_master_webhooks__webhook_id__deliveries_get
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 50
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          default: 0
          title: Offset
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/master-webhooks/{webhook_id}/stats:
    get:
      tags:
      - Master Webhooks
      - master-webhooks
      summary: Get Master Webhook Stats
      description: Get master webhook statistics (super admin only)
      operationId: get_master_webhook_stats_api_admin_master_webhooks__webhook_id__stats_get
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/master-webhooks/meta/event-types:
    get:
      tags:
      - Master Webhooks
      - master-webhooks
      summary: Get Platform Event Types
      description: 'Get list of available platform event types (super admin only)


        Events are organized by HOW they''re triggered:

        1. Database Triggers (automatic) - fire when rows change in master DB tables

        2. Scheduled Events (Celery) - fire based on time conditions

        3. Application Events (code) - fire on specific business logic'
      operationId: get_platform_event_types_api_admin_master_webhooks_meta_event_types_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /outgoing-webhooks/:
    post:
      tags:
      - Outgoing Webhooks
      - outgoing-webhooks
      summary: Create Webhook
      description: Create a new outgoing webhook
      operationId: create_webhook_outgoing_webhooks__post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Outgoing Webhooks
      - outgoing-webhooks
      summary: List Webhooks
      description: List all outgoing webhooks
      operationId: list_webhooks_outgoing_webhooks__get
      parameters:
      - name: webhook_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            pattern: ^(automatic|manual)$
          - type: 'null'
          title: Webhook Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /outgoing-webhooks/{webhook_id}:
    get:
      tags:
      - Outgoing Webhooks
      - outgoing-webhooks
      summary: Get Webhook
      description: Get webhook details
      operationId: get_webhook_outgoing_webhooks__webhook_id__get
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Outgoing Webhooks
      - outgoing-webhooks
      summary: Update Webhook
      description: Update webhook configuration
      operationId: update_webhook_outgoing_webhooks__webhook_id__put
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Outgoing Webhooks
      - outgoing-webhooks
      summary: Delete Webhook
      description: Delete a webhook
      operationId: delete_webhook_outgoing_webhooks__webhook_id__delete
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /outgoing-webhooks/{webhook_id}/test:
    post:
      tags:
      - Outgoing Webhooks
      - outgoing-webhooks
      summary: Test Webhook
      description: Send a test webhook
      operationId: test_webhook_outgoing_webhooks__webhook_id__test_post
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestWebhookPayload'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /outgoing-webhooks/{webhook_id}/regenerate-secret:
    post:
      tags:
      - Outgoing Webhooks
      - outgoing-webhooks
      summary: Regenerate Secret
      description: Regenerate webhook secret key
      operationId: regenerate_secret_outgoing_webhooks__webhook_id__regenerate_secret_post
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /outgoing-webhooks/{webhook_id}/deliveries:
    get:
      tags:
      - Outgoing Webhooks
      - outgoing-webhooks
      summary: Get Webhook Deliveries
      description: Get webhook delivery logs
      operationId: get_webhook_deliveries_outgoing_webhooks__webhook_id__deliveries_get
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 50
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          default: 0
          title: Offset
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /outgoing-webhooks/{webhook_id}/stats:
    get:
      tags:
      - Outgoing Webhooks
      - outgoing-webhooks
      summary: Get Webhook Stats
      description: Get webhook statistics
      operationId: get_webhook_stats_outgoing_webhooks__webhook_id__stats_get
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /outgoing-webhooks/meta/event-types:
    get:
      tags:
      - Outgoing Webhooks
      - outgoing-webhooks
      summary: Get Event Types
      description: Get list of available webhook event types
      operationId: get_event_types_outgoing_webhooks_meta_event_types_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /incoming-webhooks/:
    post:
      tags:
      - Incoming Webhooks
      - incoming-webhooks
      summary: Create Incoming Webhook
      description: Create a new incoming webhook with stable URL
      operationId: create_incoming_webhook_incoming_webhooks__post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IncomingWebhookCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Incoming Webhooks
      - incoming-webhooks
      summary: List Incoming Webhooks
      description: List all incoming webhooks
      operationId: list_incoming_webhooks_incoming_webhooks__get
      parameters:
      - name: include_orphans
        in: query
        required: false
        schema:
          type: boolean
          description: Include webhooks not connected to workflows
          default: true
          title: Include Orphans
        description: Include webhooks not connected to workflows
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /incoming-webhooks/orphans:
    get:
      tags:
      - Incoming Webhooks
      - incoming-webhooks
      summary: List Orphan Webhooks
      description: List webhooks not connected to any workflow
      operationId: list_orphan_webhooks_incoming_webhooks_orphans_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /incoming-webhooks/by-slug/{slug}:
    get:
      tags:
      - Incoming Webhooks
      - incoming-webhooks
      summary: Get Webhook By Slug
      description: Get webhook details by slug
      operationId: get_webhook_by_slug_incoming_webhooks_by_slug__slug__get
      parameters:
      - name: slug
        in: path
        required: true
        schema:
          type: string
          title: Slug
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /incoming-webhooks/{webhook_id}:
    get:
      tags:
      - Incoming Webhooks
      - incoming-webhooks
      summary: Get Incoming Webhook
      description: Get webhook details
      operationId: get_incoming_webhook_incoming_webhooks__webhook_id__get
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Incoming Webhooks
      - incoming-webhooks
      summary: Update Incoming Webhook
      description: Update webhook configuration
      operationId: update_incoming_webhook_incoming_webhooks__webhook_id__put
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IncomingWebhookUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Incoming Webhooks
      - incoming-webhooks
      summary: Delete Incoming Webhook
      description: 'Delete a webhook.


        If permanent=False (default), only disconnects from workflow but keeps the
        URL.

        If permanent=True, completely removes the webhook and URL.'
      operationId: delete_incoming_webhook_incoming_webhooks__webhook_id__delete
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: permanent
        in: query
        required: false
        schema:
          type: boolean
          description: Permanently delete (True) or just disconnect from workflow
            (False)
          default: false
          title: Permanent
        description: Permanently delete (True) or just disconnect from workflow (False)
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /incoming-webhooks/{webhook_id}/connect:
    post:
      tags:
      - Incoming Webhooks
      - incoming-webhooks
      summary: Connect To Workflow
      description: Connect webhook to a workflow
      operationId: connect_to_workflow_incoming_webhooks__webhook_id__connect_post
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConnectWorkflowRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /incoming-webhooks/{webhook_id}/disconnect:
    post:
      tags:
      - Incoming Webhooks
      - incoming-webhooks
      summary: Disconnect From Workflow
      description: Disconnect webhook from workflow (keeps URL active)
      operationId: disconnect_from_workflow_incoming_webhooks__webhook_id__disconnect_post
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /incoming-webhooks/{webhook_id}/regenerate-secret:
    post:
      tags:
      - Incoming Webhooks
      - incoming-webhooks
      summary: Regenerate Secret
      description: Regenerate webhook secret key
      operationId: regenerate_secret_incoming_webhooks__webhook_id__regenerate_secret_post
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /incoming-webhooks/{webhook_id}/logs:
    get:
      tags:
      - Incoming Webhooks
      - incoming-webhooks
      summary: Get Webhook Logs
      description: Get webhook request logs
      operationId: get_webhook_logs_incoming_webhooks__webhook_id__logs_get
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            pattern: ^(received|processed|failed|ignored)$
          - type: 'null'
          title: Status
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 50
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          default: 0
          title: Offset
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /incoming-webhooks/{webhook_id}/stats:
    get:
      tags:
      - Incoming Webhooks
      - incoming-webhooks
      summary: Get Webhook Stats
      description: Get webhook statistics
      operationId: get_webhook_stats_incoming_webhooks__webhook_id__stats_get
      parameters:
      - name: webhook_id
        in: path
        required: true
        schema:
          type: string
          title: Webhook Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /hooks/{org_id}/{slug}:
    patch:
      tags:
      - Incoming Webhook Receiver
      - incoming-webhook-receiver
      summary: Receive Incoming Webhook
      description: "Public endpoint to receive incoming webhook requests.\n\nURL format:\
        \ /hooks/{org_id}/{slug}\n\nThis endpoint:\n1. Looks up the webhook by slug\
        \ in the organization's registry\n2. Logs the incoming request\n3. Triggers\
        \ the connected workflow (if any)\n4. Returns the result\n\nArgs:\n    org_id:\
        \ Organization ID\n    slug: Unique webhook identifier\n    request: Incoming\
        \ HTTP request\n\nReturns:\n    JSON response with status and optional workflow\
        \ result"
      operationId: receive_incoming_webhook_hooks__org_id___slug__patch
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: slug
        in: path
        required: true
        schema:
          type: string
          title: Slug
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Incoming Webhook Receiver
      - incoming-webhook-receiver
      summary: Receive Incoming Webhook
      description: "Public endpoint to receive incoming webhook requests.\n\nURL format:\
        \ /hooks/{org_id}/{slug}\n\nThis endpoint:\n1. Looks up the webhook by slug\
        \ in the organization's registry\n2. Logs the incoming request\n3. Triggers\
        \ the connected workflow (if any)\n4. Returns the result\n\nArgs:\n    org_id:\
        \ Organization ID\n    slug: Unique webhook identifier\n    request: Incoming\
        \ HTTP request\n\nReturns:\n    JSON response with status and optional workflow\
        \ result"
      operationId: receive_incoming_webhook_hooks__org_id___slug__put
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: slug
        in: path
        required: true
        schema:
          type: string
          title: Slug
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Incoming Webhook Receiver
      - incoming-webhook-receiver
      summary: Receive Incoming Webhook
      description: "Public endpoint to receive incoming webhook requests.\n\nURL format:\
        \ /hooks/{org_id}/{slug}\n\nThis endpoint:\n1. Looks up the webhook by slug\
        \ in the organization's registry\n2. Logs the incoming request\n3. Triggers\
        \ the connected workflow (if any)\n4. Returns the result\n\nArgs:\n    org_id:\
        \ Organization ID\n    slug: Unique webhook identifier\n    request: Incoming\
        \ HTTP request\n\nReturns:\n    JSON response with status and optional workflow\
        \ result"
      operationId: receive_incoming_webhook_hooks__org_id___slug__post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: slug
        in: path
        required: true
        schema:
          type: string
          title: Slug
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /hooks/health:
    get:
      tags:
      - Incoming Webhook Receiver
      - incoming-webhook-receiver
      summary: Webhook Receiver Health
      description: Health check for incoming webhook receiver
      operationId: webhook_receiver_health_hooks_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /admin/queue/health:
    get:
      tags:
      - Queue Health
      - Queue Health
      summary: Get Queue Health
      description: "Get comprehensive health status of the queue system\n\nReturns:\n\
        \    Dict with health status of Redis, Celery workers, and task queues"
      operationId: get_queue_health_admin_queue_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Queue Health Admin Queue Health Get
  /admin/queue/workers:
    get:
      tags:
      - Queue Health
      - Queue Health
      summary: Get Worker Details
      description: "Get detailed information about Celery workers\n\nReturns:\n  \
        \  Dict with detailed worker information"
      operationId: get_worker_details_admin_queue_workers_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Worker Details Admin Queue Workers Get
  /admin/queue/queues:
    get:
      tags:
      - Queue Health
      - Queue Health
      summary: Get Queue Status
      description: "Get status of all task queues\n\nReturns:\n    Dict with queue\
        \ status information"
      operationId: get_queue_status_admin_queue_queues_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Queue Status Admin Queue Queues Get
  /admin/queue/test-task:
    post:
      tags:
      - Queue Health
      - Queue Health
      summary: Run Test Task
      description: "Run a test task to verify queue system is working\n\nReturns:\n\
        \    Dict with test task results"
      operationId: run_test_task_admin_queue_test_task_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Run Test Task Admin Queue Test Task Post
  /admin/queue/debug/redis:
    get:
      tags:
      - Queue Health
      - Queue Health
      summary: Debug Redis Connection
      description: "Debug Redis connection from backend\n\nReturns:\n    Dict with\
        \ Redis connection details and test results"
      operationId: debug_redis_connection_admin_queue_debug_redis_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Debug Redis Connection Admin Queue Debug Redis Get
  /admin/queue/email-waits:
    get:
      tags:
      - Queue Health
      - Queue Health
      summary: Get Email Wait Status
      description: "Get status of email activity waits in the system\n\nReturns:\n\
        \    Dict with email wait statistics"
      operationId: get_email_wait_status_admin_queue_email_waits_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Email Wait Status Admin Queue Email Waits Get
  /admin/queue/cleanup-expired-waits:
    post:
      tags:
      - Queue Health
      - Queue Health
      summary: Trigger Cleanup Expired Waits
      description: "Manually trigger cleanup of expired email waits\n\nReturns:\n\
        \    Dict with cleanup task information"
      operationId: trigger_cleanup_expired_waits_admin_queue_cleanup_expired_waits_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Trigger Cleanup Expired Waits Admin Queue Cleanup
                  Expired Waits Post
  /admin/queue/tasks/active:
    get:
      tags:
      - Queue Health
      - Queue Health
      summary: Get Active Tasks
      description: "Get details of currently active tasks\n\nReturns:\n    Dict with\
        \ active task details including name, ID, timestamp, and arguments"
      operationId: get_active_tasks_admin_queue_tasks_active_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Active Tasks Admin Queue Tasks Active Get
  /admin/queue/tasks/reserved:
    get:
      tags:
      - Queue Health
      - Queue Health
      summary: Get Reserved Tasks
      description: "Get details of reserved (queued) tasks\n\nReturns:\n    Dict with\
        \ reserved task details"
      operationId: get_reserved_tasks_admin_queue_tasks_reserved_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Reserved Tasks Admin Queue Tasks Reserved Get
  /admin/queue/tasks/scheduled:
    get:
      tags:
      - Queue Health
      - Queue Health
      summary: Get Scheduled Tasks
      description: "Get details of scheduled tasks\n\nReturns:\n    Dict with scheduled\
        \ task details"
      operationId: get_scheduled_tasks_admin_queue_tasks_scheduled_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Scheduled Tasks Admin Queue Tasks Scheduled Get
  /admin/queue/tasks/stats:
    get:
      tags:
      - Queue Health
      - Queue Health
      summary: Get Task Stats
      description: "Get task execution statistics per worker\n\nReturns:\n    Dict\
        \ with task execution stats including success/failure counts"
      operationId: get_task_stats_admin_queue_tasks_stats_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Task Stats Admin Queue Tasks Stats Get
  /admin/queue/tasks/{task_id}/revoke:
    post:
      tags:
      - Queue Health
      - Queue Health
      summary: Revoke Task
      description: "Revoke a task by ID\n\nArgs:\n    task_id: The task ID to revoke\n\
        \    terminate: Whether to terminate the task if it's currently running\n\n\
        Returns:\n    Dict with revocation status"
      operationId: revoke_task_admin_queue_tasks__task_id__revoke_post
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      - name: terminate
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Terminate
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Revoke Task Admin Queue Tasks  Task Id  Revoke Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/queue/tasks/{task_id}/result:
    get:
      tags:
      - Queue Health
      - Queue Health
      summary: Get Task Result
      description: "Get task result by ID\n\nArgs:\n    task_id: The task ID to get\
        \ result for\n\nReturns:\n    Dict with task result and status"
      operationId: get_task_result_admin_queue_tasks__task_id__result_get
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Task Result Admin Queue Tasks  Task Id  Result
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/queue/segments/processing:
    get:
      tags:
      - Queue Health
      - Queue Health
      summary: Get Segment Processing Status
      description: "Get status of all segment processing tasks\n\nReturns:\n    Dict\
        \ with segment processing statistics and active tasks"
      operationId: get_segment_processing_status_admin_queue_segments_processing_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Segment Processing Status Admin Queue Segments
                  Processing Get
  /admin/queue/segments/failed:
    get:
      tags:
      - Queue Health
      - Queue Health
      summary: Get Failed Segments
      description: "Get details of failed segment processing tasks for debugging\n\
        \nArgs:\n    limit: Maximum number of failed segments to return\n\nReturns:\n\
        \    Dict with failed segment details including error messages"
      operationId: get_failed_segments_admin_queue_segments_failed_get
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 50
          title: Limit
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Failed Segments Admin Queue Segments Failed Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/queue/segments/{org_id}/{segment_id}/retry:
    post:
      tags:
      - Queue Health
      - Queue Health
      summary: Retry Failed Segment
      description: "Retry processing for a failed segment\n\nArgs:\n    org_id: Organization\
        \ ID\n    segment_id: Segment ID to retry\n\nReturns:\n    Dict with retry\
        \ task information"
      operationId: retry_failed_segment_admin_queue_segments__org_id___segment_id__retry_post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: segment_id
        in: path
        required: true
        schema:
          type: string
          title: Segment Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Retry Failed Segment Admin Queue Segments  Org Id   Segment
                  Id  Retry Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/queue/segments/performance:
    get:
      tags:
      - Queue Health
      - Queue Health
      summary: Get Segment Performance Metrics
      description: "Get performance metrics for segment processing\n\nReturns:\n \
        \   Dict with performance statistics and trends"
      operationId: get_segment_performance_metrics_admin_queue_segments_performance_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Segment Performance Metrics Admin Queue Segments
                  Performance Get
  /admin/notification-connections/health:
    get:
      tags:
      - Notification Monitoring
      summary: Get Notification Connection Health
      description: Get overall health status of notification connection system
      operationId: get_notification_connection_health_admin_notification_connections_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /admin/notification-connections/stats:
    get:
      tags:
      - Notification Monitoring
      summary: Get Notification Connection Stats
      description: Get detailed connection pool statistics
      operationId: get_notification_connection_stats_admin_notification_connections_stats_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /admin/notification-connections/cleanup:
    post:
      tags:
      - Notification Monitoring
      summary: Force Connection Cleanup
      description: Force immediate cleanup of expired connections
      operationId: force_connection_cleanup_admin_notification_connections_cleanup_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /admin/notification-connections/close-org/{org_id}:
    post:
      tags:
      - Notification Monitoring
      summary: Close Org Connection
      description: Manually close connection for specific organization
      operationId: close_org_connection_admin_notification_connections_close_org__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: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/notification-listeners/status:
    get:
      tags:
      - Notification Monitoring
      summary: Get Listeners Status
      description: Get status of all notification listeners
      operationId: get_listeners_status_admin_notification_listeners_status_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /admin/notification-listeners/refresh-orgs:
    post:
      tags:
      - Notification Monitoring
      summary: Refresh Listener Orgs
      description: Force refresh of organization cache for all listeners
      operationId: refresh_listener_orgs_admin_notification_listeners_refresh_orgs_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /admin/notification-connections/connection-details/{org_id}:
    get:
      tags:
      - Notification Monitoring
      summary: Get Org Connection Details
      description: Get detailed connection information for specific organization
      operationId: get_org_connection_details_admin_notification_connections_connection_details__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: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/fcm-tokens/statistics:
    get:
      tags:
      - Notification Monitoring
      summary: Get Fcm Token Statistics
      description: 'Get comprehensive FCM token statistics


        Super Admin endpoint for monitoring FCM token health

        Shows:

        - Total active/inactive tokens

        - Platform breakdown

        - Token age distribution

        - Users over device limit

        - Average devices per user'
      operationId: get_fcm_token_statistics_admin_fcm_tokens_statistics_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /admin/fcm-tokens/user/{user_id}:
    get:
      tags:
      - Notification Monitoring
      summary: Get User Fcm Tokens
      description: 'Get detailed FCM token information for a specific user


        Shows all tokens with:

        - Platform

        - Device info

        - Active status

        - Last used date

        - Days inactive'
      operationId: get_user_fcm_tokens_admin_fcm_tokens_user__user_id__get
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: string
          title: User Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/fcm-tokens/cleanup:
    post:
      tags:
      - Notification Monitoring
      summary: Manual Fcm Token Cleanup
      description: 'Manually trigger FCM token cleanup (normally runs daily at 3 AM)


        Performs:

        - Remove stale tokens (60+ days inactive)

        - Enforce device limit (5 per user)

        - Remove invalid tokens


        Returns detailed statistics about cleanup operations'
      operationId: manual_fcm_token_cleanup_admin_fcm_tokens_cleanup_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /admin/fcm-tokens/health:
    get:
      tags:
      - Notification Monitoring
      summary: Get Fcm Token Health
      description: 'Get FCM token system health status


        Provides quick overview of:

        - Total active tokens

        - Users over device limit

        - Tokens needing cleanup (stale)

        - Health status (healthy/warning)'
      operationId: get_fcm_token_health_admin_fcm_tokens_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/super-admin/queue-monitoring/metrics:
    get:
      tags:
      - Queue Monitoring
      summary: Get Queue Metrics
      description: "Get current org_pending_work table metrics\n\nReturns:\n    -\
        \ Total entries in tracking table\n    - Breakdown by queue type (total orgs,\
        \ orgs with work, pending items)\n    - Sample of recent entries"
      operationId: get_queue_metrics_api_super_admin_queue_monitoring_metrics_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Queue Metrics Api Super Admin Queue Monitoring
                  Metrics Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/queue-monitoring/stats/{queue_type}:
    get:
      tags:
      - Queue Monitoring
      summary: Get Queue Type Stats
      description: "Get detailed stats for a specific queue type\n\nArgs:\n    queue_type:\
        \ Queue type to get stats for (universal_triggers, campaign_triggers, etc.)\n\
        \nReturns:\n    Detailed breakdown of orgs for the specified queue type"
      operationId: get_queue_type_stats_api_super_admin_queue_monitoring_stats__queue_type__get
      parameters:
      - name: queue_type
        in: path
        required: true
        schema:
          type: string
          title: Queue Type
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Queue Type Stats Api Super Admin Queue Monitoring
                  Stats  Queue Type  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/queue-monitoring/health:
    get:
      tags:
      - Queue Monitoring
      summary: Check Tracking Health
      description: "Check health of the tracking table system\n\nReturns:\n    - Whether\
        \ tracking table exists\n    - Whether update function exists\n    - Stale\
        \ entries (not updated in 10+ minutes)\n    - Overall health status"
      operationId: check_tracking_health_api_super_admin_queue_monitoring_health_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Check Tracking Health Api Super Admin Queue Monitoring
                  Health Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/queue/trigger-org-processing:
    post:
      tags:
      - Queue Health Internal
      - Queue Health Internal
      summary: Trigger Org Processing
      description: "Trigger organization-specific realtime segment processing\n\n\
        This endpoint is called by the notification listener to trigger processing\n\
        from within the FastAPI context where Celery is properly configured.\n\nArgs:\n\
        \    request: Dict containing org_id\n\nReturns:\n    Dict with task information"
      operationId: trigger_org_processing_admin_queue_trigger_org_processing_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Request
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Trigger Org Processing Admin Queue Trigger Org Processing
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/queue/trigger-org-campaign-processing:
    post:
      tags:
      - Queue Health Internal
      - Queue Health Internal
      summary: Trigger Org Campaign Processing
      description: "Trigger organization-specific campaign trigger processing\n\n\
        This endpoint is called by the campaign trigger notification listener to trigger\
        \ processing\nfrom within the FastAPI context where Celery is properly configured.\n\
        \nArgs:\n    request: Dict containing org_id\n\nReturns:\n    Dict with task\
        \ information"
      operationId: trigger_org_campaign_processing_admin_queue_trigger_org_campaign_processing_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Request
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Trigger Org Campaign Processing Admin Queue Trigger
                  Org Campaign Processing Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /admin/queue/trigger-org-analytics-processing:
    post:
      tags:
      - Queue Health Internal
      - Queue Health Internal
      summary: Trigger Org Analytics Processing
      description: "Trigger organization-specific analytics processing\n\nThis endpoint\
        \ is called by the analytics notification listener to process email activity\
        \ changes\nfrom within the FastAPI context where Celery is properly configured.\n\
        \nArgs:\n    request: Dict containing org_id\n\nReturns:\n    Dict with task\
        \ information"
      operationId: trigger_org_analytics_processing_admin_queue_trigger_org_analytics_processing_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Request
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Trigger Org Analytics Processing Admin Queue Trigger
                  Org Analytics Processing Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/campaigns/:
    get:
      tags:
      - Campaign Management
      - campaigns
      summary: Get Campaigns Endpoint
      description: Get all campaigns with optional filters
      operationId: get_campaigns_endpoint_api_campaigns__get
      parameters:
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
      - name: channel
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Channel
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CampaignListResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Campaign Management
      - campaigns
      summary: Create Campaign Endpoint
      description: Create a new campaign
      operationId: create_campaign_endpoint_api_campaigns__post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CampaignCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/campaigns/{campaign_id}:
    get:
      tags:
      - Campaign Management
      - campaigns
      summary: Get Campaign Endpoint
      description: Get a specific campaign by ID
      operationId: get_campaign_endpoint_api_campaigns__campaign_id__get
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: integer
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Campaign Management
      - campaigns
      summary: Update Campaign Endpoint
      description: Update an existing campaign
      operationId: update_campaign_endpoint_api_campaigns__campaign_id__put
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: integer
          title: Campaign Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CampaignUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Campaign Management
      - campaigns
      summary: Delete Campaign Endpoint
      description: Delete a campaign
      operationId: delete_campaign_endpoint_api_campaigns__campaign_id__delete
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: integer
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/campaigns/{campaign_id}/launch:
    post:
      tags:
      - Campaign Management
      - campaigns
      summary: Launch Campaign Endpoint
      description: Launch a campaign
      operationId: launch_campaign_endpoint_api_campaigns__campaign_id__launch_post
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: integer
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/campaigns/{campaign_id}/pause:
    post:
      tags:
      - Campaign Management
      - campaigns
      summary: Pause Campaign Endpoint
      description: Pause an active campaign
      operationId: pause_campaign_endpoint_api_campaigns__campaign_id__pause_post
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: integer
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/campaigns/{campaign_id}/duplicate:
    post:
      tags:
      - Campaign Management
      - campaigns
      summary: Duplicate Campaign Endpoint
      description: Duplicate an existing campaign
      operationId: duplicate_campaign_endpoint_api_campaigns__campaign_id__duplicate_post
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: integer
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/campaigns/{campaign_id}/analytics:
    get:
      tags:
      - Campaign Management
      - campaigns
      summary: Get Campaign Analytics Endpoint
      description: Get campaign analytics
      operationId: get_campaign_analytics_endpoint_api_campaigns__campaign_id__analytics_get
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: integer
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CampaignAnalytics'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/campaigns/{campaign_id}/test:
    post:
      tags:
      - Campaign Management
      - campaigns
      summary: Test Campaign Endpoint
      description: Send test campaign to specific recipients
      operationId: test_campaign_endpoint_api_campaigns__campaign_id__test_post
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: integer
          title: Campaign Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
              title: Recipients
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/campaigns/estimate-cost:
    post:
      tags:
      - Campaign Management
      - campaigns
      summary: Estimate Campaign Cost Endpoint
      description: Estimate the cost of running a campaign
      operationId: estimate_campaign_cost_endpoint_api_campaigns_estimate_cost_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CampaignCreate'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/campaigns/validate-audience:
    post:
      tags:
      - Campaign Management
      - campaigns
      summary: Validate Audience Endpoint
      description: Validate audience definition and get count
      operationId: validate_audience_endpoint_api_campaigns_validate_audience_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AudienceDefinition'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/forms:
    post:
      tags:
      - Forms
      - Forms
      summary: Create Form
      description: Create a new form
      operationId: create_form_api_forms_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FormCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Forms
      - Forms
      summary: List Forms
      description: List all forms for the organization with optional filters
      operationId: list_forms_api_forms_get
      parameters:
      - name: is_active
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/forms/{form_id}:
    get:
      tags:
      - Forms
      - Forms
      summary: Get Form
      description: Get form details
      operationId: get_form_api_forms__form_id__get
      parameters:
      - name: form_id
        in: path
        required: true
        schema:
          type: string
          title: Form Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Forms
      - Forms
      summary: Update Form
      description: Update form
      operationId: update_form_api_forms__form_id__put
      parameters:
      - name: form_id
        in: path
        required: true
        schema:
          type: string
          title: Form Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FormUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Forms
      - Forms
      summary: Delete Form
      description: Delete form
      operationId: delete_form_api_forms__form_id__delete
      parameters:
      - name: form_id
        in: path
        required: true
        schema:
          type: string
          title: Form Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/forms/public/id/{org_id}/{form_id}:
    get:
      tags:
      - Forms
      - Forms
      summary: Get Public Form By Id
      description: Get form by ID for public display - stable URL that doesn't change
      operationId: get_public_form_by_id_api_forms_public_id__org_id___form_id__get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: form_id
        in: path
        required: true
        schema:
          type: string
          title: Form Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/forms/public/{org_id}/{slug}:
    get:
      tags:
      - Forms
      - Forms
      summary: Get Public Form
      description: Get form for public display - requires org_id for efficiency (legacy
        slug-based URL)
      operationId: get_public_form_api_forms_public__org_id___slug__get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: slug
        in: path
        required: true
        schema:
          type: string
          title: Slug
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/forms/{form_id}/test-submission:
    post:
      tags:
      - Forms
      - Forms
      summary: Test Form Submission
      description: Test form submission with generated test data
      operationId: test_form_submission_api_forms__form_id__test_submission_post
      parameters:
      - name: form_id
        in: path
        required: true
        schema:
          type: string
          title: Form Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/forms/{form_id}/validate-mapping:
    post:
      tags:
      - Forms
      - Forms
      summary: Validate Form Mapping
      description: Validate form field mapping configuration
      operationId: validate_form_mapping_api_forms__form_id__validate_mapping_post
      parameters:
      - name: form_id
        in: path
        required: true
        schema:
          type: string
          title: Form Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
              - type: object
                additionalProperties: true
              - type: 'null'
              title: Mapping Config
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/forms/public/id/{org_id}/{form_id}/submit:
    post:
      tags:
      - Forms
      - Forms
      summary: Submit Form By Id
      description: Handle form submission by ID - stable endpoint that doesn't break
        when form name changes
      operationId: submit_form_by_id_api_forms_public_id__org_id___form_id__submit_post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: form_id
        in: path
        required: true
        schema:
          type: string
          title: Form Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/forms/public/{org_id}/{slug}/submit:
    post:
      tags:
      - Forms
      - Forms
      summary: Submit Form
      description: Handle form submission (legacy slug-based URL)
      operationId: submit_form_api_forms_public__org_id___slug__submit_post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: slug
        in: path
        required: true
        schema:
          type: string
          title: Slug
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/forms/{form_id}/submissions:
    get:
      tags:
      - Forms
      - Forms
      summary: Get Form Submissions
      description: Get all submissions for a specific form
      operationId: get_form_submissions_api_forms__form_id__submissions_get
      parameters:
      - name: form_id
        in: path
        required: true
        schema:
          type: string
          title: Form Id
      - name: skip
        in: query
        required: false
        schema:
          type: integer
          default: 0
          title: Skip
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 100
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/forms/{form_id}/debug-submissions:
    get:
      tags:
      - Forms
      - Forms
      summary: Debug Form Submissions
      description: Debug endpoint to check form submissions
      operationId: debug_form_submissions_api_forms__form_id__debug_submissions_get
      parameters:
      - name: form_id
        in: path
        required: true
        schema:
          type: string
          title: Form Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/forms/{form_id}/embed-code:
    get:
      tags:
      - Forms
      - Forms
      summary: Get Embed Code
      description: Get embed code for the form
      operationId: get_embed_code_api_forms__form_id__embed_code_get
      parameters:
      - name: form_id
        in: path
        required: true
        schema:
          type: string
          title: Form Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/files/upload:
    post:
      tags:
      - File Upload
      summary: Upload File
      description: "Upload a file\n\nArgs:\n    file: The file to upload\n    purpose:\
        \ Purpose of upload (import, attachment, context, analysis)\n    allowed_types:\
        \ Comma-separated list of allowed types (spreadsheet, document, image)"
      operationId: upload_file_api_files_upload_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_file_api_files_upload_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/files:
    get:
      tags:
      - File Upload
      summary: List Files
      description: List uploaded files
      operationId: list_files_api_files_get
      parameters:
      - name: purpose
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Purpose
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 50
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          default: 0
          title: Offset
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/files/{file_id}:
    get:
      tags:
      - File Upload
      summary: Get File Info
      description: Get file information
      operationId: get_file_info_api_files__file_id__get
      parameters:
      - name: file_id
        in: path
        required: true
        schema:
          type: string
          title: File Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - File Upload
      summary: Delete File
      description: Delete a file
      operationId: delete_file_api_files__file_id__delete
      parameters:
      - name: file_id
        in: path
        required: true
        schema:
          type: string
          title: File Id
      - name: hard_delete
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Hard Delete
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/files/files/{file_id}/serve:
    get:
      tags:
      - File Upload
      summary: Serve File
      description: 'Serve a file for inline display (images, etc.)


        This endpoint doesn''t require auth - security is provided by the unguessable
        UUID.

        This allows <img src=""> tags to load images directly.'
      operationId: serve_file_api_files_files__file_id__serve_get
      parameters:
      - name: file_id
        in: path
        required: true
        schema:
          type: string
          title: File Id
      - name: org
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Organization ID for efficient lookup
          title: Org
        description: Organization ID for efficient lookup
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/files/{file_id}/download:
    get:
      tags:
      - File Upload
      summary: Download File
      description: Download a file
      operationId: download_file_api_files__file_id__download_get
      parameters:
      - name: file_id
        in: path
        required: true
        schema:
          type: string
          title: File Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/files/{file_id}/preview:
    post:
      tags:
      - File Upload
      summary: Preview File
      description: Preview file content
      operationId: preview_file_api_files__file_id__preview_post
      parameters:
      - name: file_id
        in: path
        required: true
        schema:
          type: string
          title: File Id
      - name: rows
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 10
          title: Rows
      - name: sheet_name
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Sheet Name
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/files/{file_id}/content:
    get:
      tags:
      - File Upload
      summary: Get File Content
      description: Get file content in specified format
      operationId: get_file_content_api_files__file_id__content_get
      parameters:
      - name: file_id
        in: path
        required: true
        schema:
          type: string
          title: File Id
      - name: format
        in: query
        required: false
        schema:
          type: string
          pattern: ^(text|json|dataframe)$
          default: text
          title: Format
      - name: sheet_name
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Sheet Name
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/tickets/test-db:
    get:
      tags:
      - Support Tickets
      - tickets
      summary: Test Database Connection
      description: Test database connection and tickets table
      operationId: test_database_connection_api_tickets_test_db_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/tickets:
    post:
      tags:
      - Support Tickets
      - tickets
      summary: Create Ticket
      description: Create a new support ticket
      operationId: create_ticket_api_tickets_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TicketCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Support Tickets
      - tickets
      summary: List Tickets
      description: List user's tickets with filters
      operationId: list_tickets_api_tickets_get
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Per Page
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          title: Status
      - name: priority
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          title: Priority
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          title: Category
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TicketList'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/tickets/{ticket_id}:
    get:
      tags:
      - Support Tickets
      - tickets
      summary: Get Ticket
      description: Get a specific ticket
      operationId: get_ticket_api_tickets__ticket_id__get
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Ticket Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Support Tickets
      - tickets
      summary: Update Ticket
      description: Update a ticket (limited fields for users)
      operationId: update_ticket_api_tickets__ticket_id__put
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Ticket Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TicketUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/tickets/{ticket_id}/comments:
    post:
      tags:
      - Support Tickets
      - tickets
      summary: Add Comment
      description: Add a comment to a ticket
      operationId: add_comment_api_tickets__ticket_id__comments_post
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Ticket Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/models__support__ticket__CommentCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TicketComment'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Support Tickets
      - tickets
      summary: Get Comments
      description: Get all comments for a ticket
      operationId: get_comments_api_tickets__ticket_id__comments_get
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Ticket Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TicketComment'
                title: Response Get Comments Api Tickets  Ticket Id  Comments Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/tickets/{ticket_id}/attachments:
    post:
      tags:
      - Support Tickets
      - tickets
      summary: Upload Attachment
      description: Upload an attachment to a ticket
      operationId: upload_attachment_api_tickets__ticket_id__attachments_post
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Ticket Id
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_attachment_api_tickets__ticket_id__attachments_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Support Tickets
      - tickets
      summary: Get Attachments
      description: Get all attachments for a ticket
      operationId: get_attachments_api_tickets__ticket_id__attachments_get
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Ticket Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TicketAttachment'
                title: Response Get Attachments Api Tickets  Ticket Id  Attachments
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/tickets/{ticket_id}/attachments/{attachment_id}/download:
    get:
      tags:
      - Support Tickets
      - tickets
      summary: Download Attachment
      description: Download an attachment file
      operationId: download_attachment_api_tickets__ticket_id__attachments__attachment_id__download_get
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Ticket Id
      - name: attachment_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Attachment Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/tickets:
    get:
      tags:
      - Admin Tickets
      - admin-tickets
      summary: List All Tickets
      description: List all tickets across organizations (admin only)
      operationId: list_all_tickets_api_admin_tickets_get
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Per Page
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          title: Status
      - name: priority
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          title: Priority
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          title: Category
      - name: org_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Org Id
      - name: user_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: User Id
      - name: assigned_to
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Assigned To
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: date_from
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Date From
      - name: date_to
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Date To
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TicketList'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/tickets/stats:
    get:
      tags:
      - Admin Tickets
      - admin-tickets
      summary: Get Ticket Stats
      description: Get ticket statistics (admin only)
      operationId: get_ticket_stats_api_admin_tickets_stats_get
      parameters:
      - name: org_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Org Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TicketStats'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/tickets/{ticket_id}:
    get:
      tags:
      - Admin Tickets
      - admin-tickets
      summary: Get Ticket
      description: Get any ticket (admin only)
      operationId: get_ticket_api_admin_tickets__ticket_id__get
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Ticket Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Admin Tickets
      - admin-tickets
      summary: Update Ticket
      description: Update any ticket (admin only)
      operationId: update_ticket_api_admin_tickets__ticket_id__put
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Ticket Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TicketUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/tickets/{ticket_id}/assign:
    post:
      tags:
      - Admin Tickets
      - admin-tickets
      summary: Assign Ticket
      description: Assign a ticket to an admin
      operationId: assign_ticket_api_admin_tickets__ticket_id__assign_post
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Ticket Id
      - name: assigned_to
        in: query
        required: true
        schema:
          type: string
          format: uuid
          title: Assigned To
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/tickets/{ticket_id}/comments:
    post:
      tags:
      - Admin Tickets
      - admin-tickets
      summary: Add Admin Comment
      description: Add an admin comment to a ticket
      operationId: add_admin_comment_api_admin_tickets__ticket_id__comments_post
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Ticket Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/models__support__ticket__CommentCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TicketComment'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Admin Tickets
      - admin-tickets
      summary: Get All Comments
      description: Get all comments including internal ones (admin only)
      operationId: get_all_comments_api_admin_tickets__ticket_id__comments_get
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Ticket Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TicketComment'
                title: Response Get All Comments Api Admin Tickets  Ticket Id  Comments
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/tickets/{ticket_id}/attachments:
    get:
      tags:
      - Admin Tickets
      - admin-tickets
      summary: Get Ticket Attachments
      description: Get all attachments for a ticket (admin only)
      operationId: get_ticket_attachments_api_admin_tickets__ticket_id__attachments_get
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Ticket Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Admin Tickets
      - admin-tickets
      summary: Upload Attachment
      description: Upload an attachment to any ticket (admin only)
      operationId: upload_attachment_api_admin_tickets__ticket_id__attachments_post
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Ticket Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_attachment_api_admin_tickets__ticket_id__attachments_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/tickets/{ticket_id}/attachments/{attachment_id}/download:
    get:
      tags:
      - Admin Tickets
      - admin-tickets
      summary: Download Attachment
      description: Download an attachment (admin only)
      operationId: download_attachment_api_admin_tickets__ticket_id__attachments__attachment_id__download_get
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Ticket Id
      - name: attachment_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Attachment Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/tickets/bulk-update:
    post:
      tags:
      - Admin Tickets
      - admin-tickets
      summary: Bulk Update Tickets
      description: Update multiple tickets at once (admin only)
      operationId: bulk_update_tickets_api_admin_tickets_bulk_update_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_bulk_update_tickets_api_admin_tickets_bulk_update_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/:
    post:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Create Knowledge Base
      description: Create a new knowledge base
      operationId: create_knowledge_base_api_knowledge_base__post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateKnowledgeBaseRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Knowledge Base Api Knowledge Base  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: List Knowledge Bases
      description: List all knowledge bases
      operationId: list_knowledge_bases_api_knowledge_base__get
      parameters:
      - name: include_inactive
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Include Inactive
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
                title: Response List Knowledge Bases Api Knowledge Base  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/check-name:
    get:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Check Kb Name
      description: Check if a knowledge base name is available (case-insensitive)
      operationId: check_kb_name_api_knowledge_base_check_name_get
      parameters:
      - name: name
        in: query
        required: true
        schema:
          type: string
          description: KB name to check
          title: Name
        description: KB name to check
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Check Kb Name Api Knowledge Base Check Name Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/{kb_id}:
    get:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Get Knowledge Base Stats
      description: Get statistics for a knowledge base
      operationId: get_knowledge_base_stats_api_knowledge_base__kb_id__get
      parameters:
      - name: kb_id
        in: path
        required: true
        schema:
          type: string
          title: Kb Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Knowledge Base Stats Api Knowledge Base  Kb Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Delete Knowledge Base
      description: Delete an entire knowledge base
      operationId: delete_knowledge_base_api_knowledge_base__kb_id__delete
      parameters:
      - name: kb_id
        in: path
        required: true
        schema:
          type: string
          title: Kb Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Knowledge Base Api Knowledge Base  Kb Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Update Knowledge Base
      description: Update a knowledge base's name and/or description
      operationId: update_knowledge_base_api_knowledge_base__kb_id__put
      parameters:
      - name: kb_id
        in: path
        required: true
        schema:
          type: string
          title: Kb Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateKnowledgeBaseRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Knowledge Base Api Knowledge Base  Kb Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/{kb_id}/documents:
    get:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: List Documents
      description: List documents in a knowledge base with optional search filter
      operationId: list_documents_api_knowledge_base__kb_id__documents_get
      parameters:
      - name: kb_id
        in: path
        required: true
        schema:
          type: string
          title: Kb Id
      - name: page
        in: query
        required: false
        schema:
          type: integer
          default: 1
          title: Page
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 20
          title: Limit
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Search term to filter documents by title or content
          title: Search
        description: Search term to filter documents by title or content
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response List Documents Api Knowledge Base  Kb Id  Documents
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Add Document Text
      description: Add text document to knowledge base
      operationId: add_document_text_api_knowledge_base__kb_id__documents_post
      parameters:
      - name: kb_id
        in: path
        required: true
        schema:
          type: string
          title: Kb Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddDocumentRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Add Document Text Api Knowledge Base  Kb Id  Documents
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/{kb_id}/documents/upload:
    post:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Upload Document File
      description: Upload file to knowledge base
      operationId: upload_document_file_api_knowledge_base__kb_id__documents_upload_post
      parameters:
      - name: kb_id
        in: path
        required: true
        schema:
          type: string
          title: Kb Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_document_file_api_knowledge_base__kb_id__documents_upload_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Upload Document File Api Knowledge Base  Kb Id  Documents
                  Upload Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/crm/search:
    post:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Search Crm Knowledge Base
      description: Search the CRM knowledge base
      operationId: search_crm_knowledge_base_api_knowledge_base_crm_search_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__knowledge_base__kb_routes__SearchRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Search Crm Knowledge Base Api Knowledge Base Crm Search
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/crm-default:
    get:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Get Crm Knowledge Base
      description: Get or create the default Data Model knowledge base for the organization
      operationId: get_crm_knowledge_base_api_knowledge_base_crm_default_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Crm Knowledge Base Api Knowledge Base Crm Default
                  Get
  /api/knowledge-base/{kb_id}/documents/{document_id}:
    delete:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Delete Document
      description: Delete a document and all its chunks from knowledge base
      operationId: delete_document_api_knowledge_base__kb_id__documents__document_id__delete
      parameters:
      - name: kb_id
        in: path
        required: true
        schema:
          type: string
          title: Kb Id
      - name: document_id
        in: path
        required: true
        schema:
          type: string
          title: Document Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Document Api Knowledge Base  Kb Id  Documents  Document
                  Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/chunks/{chunk_id}:
    delete:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Delete Chunk
      description: Delete a specific chunk from knowledge base
      operationId: delete_chunk_api_knowledge_base_chunks__chunk_id__delete
      parameters:
      - name: chunk_id
        in: path
        required: true
        schema:
          type: string
          title: Chunk Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Chunk Api Knowledge Base Chunks  Chunk Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/{kb_id}/search:
    post:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Search Knowledge Base
      description: Search documents in knowledge base
      operationId: search_knowledge_base_api_knowledge_base__kb_id__search_post
      parameters:
      - name: kb_id
        in: path
        required: true
        schema:
          type: string
          title: Kb Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__knowledge_base__kb_routes__SearchRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Search Knowledge Base Api Knowledge Base  Kb Id  Search
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/{kb_id}/ask:
    post:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Rag Query
      description: Ask a question and get AI-generated answer
      operationId: rag_query_api_knowledge_base__kb_id__ask_post
      parameters:
      - name: kb_id
        in: path
        required: true
        schema:
          type: string
          title: Kb Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RAGQueryRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Rag Query Api Knowledge Base  Kb Id  Ask Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/documents/{document_id}:
    put:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Update Document
      description: Update a document in the knowledge base
      operationId: update_document_api_knowledge_base_documents__document_id__put
      parameters:
      - name: document_id
        in: path
        required: true
        schema:
          type: string
          title: Document Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateDocumentRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Document Api Knowledge Base Documents  Document
                  Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Delete Document
      description: Delete a document from the knowledge base
      operationId: delete_document_api_knowledge_base_documents__document_id__delete
      parameters:
      - name: document_id
        in: path
        required: true
        schema:
          type: string
          title: Document Id
      - name: hard_delete
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Hard Delete
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Document Api Knowledge Base Documents  Document
                  Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/{kb_id}/metadata:
    get:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Get Documents Metadata
      description: Get raw metadata from kb_documents table
      operationId: get_documents_metadata_api_knowledge_base__kb_id__metadata_get
      parameters:
      - name: kb_id
        in: path
        required: true
        schema:
          type: string
          title: Kb Id
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - 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:
                type: array
                items:
                  type: object
                  additionalProperties: true
                title: Response Get Documents Metadata Api Knowledge Base  Kb Id  Metadata
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/{kb_id}/embeddings:
    get:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Get Embeddings Metadata
      description: Get embeddings metadata from kb_chunks table
      operationId: get_embeddings_metadata_api_knowledge_base__kb_id__embeddings_get
      parameters:
      - name: kb_id
        in: path
        required: true
        schema:
          type: string
          title: Kb Id
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - 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:
                type: array
                items:
                  type: object
                  additionalProperties: true
                title: Response Get Embeddings Metadata Api Knowledge Base  Kb Id  Embeddings
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/{kb_id}/metadata-values:
    get:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Get Metadata Values
      description: Get all unique metadata values for filtering
      operationId: get_metadata_values_api_knowledge_base__kb_id__metadata_values_get
      parameters:
      - name: kb_id
        in: path
        required: true
        schema:
          type: string
          title: Kb Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: array
                  items:
                    type: object
                    additionalProperties: true
                title: Response Get Metadata Values Api Knowledge Base  Kb Id  Metadata
                  Values Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/agent/metadata:
    post:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Get Agent Metadata Discovery
      description: 'Get aggregated metadata for agent decision-making.

        Only returns metadata for selected KBs and documents.'
      operationId: get_agent_metadata_discovery_api_knowledge_base_agent_metadata_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentMetadataRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Agent Metadata Discovery Api Knowledge Base Agent
                  Metadata Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/agent/relationships:
    post:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Get Agent Relationship Map
      description: 'Get relationship mapping between entities across selected KBs.

        Helps agents understand how to navigate between different data types.'
      operationId: get_agent_relationship_map_api_knowledge_base_agent_relationships_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentRelationshipRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Agent Relationship Map Api Knowledge Base Agent
                  Relationships Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/health:
    get:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Health Check
      description: Check if knowledge base service is healthy
      operationId: health_check_api_knowledge_base_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Health Check Api Knowledge Base Health Get
  /api/knowledge-base/{kb_id}/export:
    post:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Export Knowledge Base
      description: 'Export knowledge base documents to JSON format


        Returns document content and metadata for import into other organizations.

        Vectors are NOT exported - they will be regenerated on import.'
      operationId: export_knowledge_base_api_knowledge_base__kb_id__export_post
      parameters:
      - name: kb_id
        in: path
        required: true
        schema:
          type: string
          title: Kb Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExportKBRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Export Knowledge Base Api Knowledge Base  Kb Id  Export
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/import/validate:
    post:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Validate Import Data
      description: 'Validate import data format and compatibility


        Use this before actual import to check for issues.'
      operationId: validate_import_data_api_knowledge_base_import_validate_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Import Data
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Validate Import Data Api Knowledge Base Import Validate
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/import/new:
    post:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Import To New Kb
      description: 'Import documents into a NEW knowledge base


        Creates a new KB and imports all documents with fresh chunking/embedding.'
      operationId: import_to_new_kb_api_knowledge_base_import_new_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Request
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Import To New Kb Api Knowledge Base Import New Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/knowledge-base/import/existing:
    post:
      tags:
      - Knowledge Base
      - knowledge-base
      summary: Import To Existing Kb
      description: 'Import documents into an EXISTING knowledge base


        Adds documents to existing KB with duplicate handling.'
      operationId: import_to_existing_kb_api_knowledge_base_import_existing_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Request
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Import To Existing Kb Api Knowledge Base Import Existing
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/kb-templates/templates:
    get:
      tags:
      - KB Templates & Structured Content
      - KB Templates & Structured Content
      summary: List Templates
      description: List all available KB templates
      operationId: list_templates_api_kb_templates_templates_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response List Templates Api Kb Templates Templates Get
  /api/kb-templates/templates/{template_key}:
    get:
      tags:
      - KB Templates & Structured Content
      - KB Templates & Structured Content
      summary: Get Template
      description: Get a single template by key
      operationId: get_template_api_kb_templates_templates__template_key__get
      parameters:
      - name: template_key
        in: path
        required: true
        schema:
          type: string
          title: Template Key
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Template Api Kb Templates Templates  Template
                  Key  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/kb-templates/{kb_id}/apply-template:
    post:
      tags:
      - KB Templates & Structured Content
      - KB Templates & Structured Content
      summary: Apply Template
      description: Apply a template to a knowledge base, creating pre-populated sections
      operationId: apply_template_api_kb_templates__kb_id__apply_template_post
      parameters:
      - name: kb_id
        in: path
        required: true
        schema:
          type: string
          title: Kb Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__knowledge_base__kb_templates_routes__ApplyTemplateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Apply Template Api Kb Templates  Kb Id  Apply Template
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/kb-templates/{kb_id}/sections:
    get:
      tags:
      - KB Templates & Structured Content
      - KB Templates & Structured Content
      summary: Get Sections
      description: Get all structured sections for a knowledge base
      operationId: get_sections_api_kb_templates__kb_id__sections_get
      parameters:
      - name: kb_id
        in: path
        required: true
        schema:
          type: string
          title: Kb Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Sections Api Kb Templates  Kb Id  Sections Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - KB Templates & Structured Content
      - KB Templates & Structured Content
      summary: Create Section
      description: Create a new structured section for a knowledge base
      operationId: create_section_api_kb_templates__kb_id__sections_post
      parameters:
      - name: kb_id
        in: path
        required: true
        schema:
          type: string
          title: Kb Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSectionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Section Api Kb Templates  Kb Id  Sections Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/kb-templates/sections/{section_id}:
    put:
      tags:
      - KB Templates & Structured Content
      - KB Templates & Structured Content
      summary: Update Section
      description: Update a structured section
      operationId: update_section_api_kb_templates_sections__section_id__put
      parameters:
      - name: section_id
        in: path
        required: true
        schema:
          type: string
          title: Section Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSectionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Section Api Kb Templates Sections  Section
                  Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - KB Templates & Structured Content
      - KB Templates & Structured Content
      summary: Delete Section
      description: Delete a structured section
      operationId: delete_section_api_kb_templates_sections__section_id__delete
      parameters:
      - name: section_id
        in: path
        required: true
        schema:
          type: string
          title: Section Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Section Api Kb Templates Sections  Section
                  Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/kb-templates/sections/{section_id}/faq-items:
    get:
      tags:
      - KB Templates & Structured Content
      - KB Templates & Structured Content
      summary: Get Faq Items
      description: Get FAQ items for a structured section
      operationId: get_faq_items_api_kb_templates_sections__section_id__faq_items_get
      parameters:
      - name: section_id
        in: path
        required: true
        schema:
          type: string
          title: Section Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Faq Items Api Kb Templates Sections  Section Id  Faq
                  Items Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - KB Templates & Structured Content
      - KB Templates & Structured Content
      summary: Create Faq Item
      description: Create a new FAQ item
      operationId: create_faq_item_api_kb_templates_sections__section_id__faq_items_post
      parameters:
      - name: section_id
        in: path
        required: true
        schema:
          type: string
          title: Section Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFAQItemRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Faq Item Api Kb Templates Sections  Section
                  Id  Faq Items Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/kb-templates/faq-items/{faq_id}:
    put:
      tags:
      - KB Templates & Structured Content
      - KB Templates & Structured Content
      summary: Update Faq Item
      description: Update a FAQ item
      operationId: update_faq_item_api_kb_templates_faq_items__faq_id__put
      parameters:
      - name: faq_id
        in: path
        required: true
        schema:
          type: string
          title: Faq Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateFAQItemRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Faq Item Api Kb Templates Faq Items  Faq Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - KB Templates & Structured Content
      - KB Templates & Structured Content
      summary: Delete Faq Item
      description: Delete a FAQ item
      operationId: delete_faq_item_api_kb_templates_faq_items__faq_id__delete
      parameters:
      - name: faq_id
        in: path
        required: true
        schema:
          type: string
          title: Faq Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Faq Item Api Kb Templates Faq Items  Faq Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/kb-templates/{kb_id}/sync-status:
    get:
      tags:
      - KB Templates & Structured Content
      - KB Templates & Structured Content
      summary: Get Sync Status
      description: Get sync status for structured KB content
      operationId: get_sync_status_api_kb_templates__kb_id__sync_status_get
      parameters:
      - name: kb_id
        in: path
        required: true
        schema:
          type: string
          title: Kb Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Sync Status Api Kb Templates  Kb Id  Sync Status
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketplace/categories:
    get:
      tags:
      - Agent Marketplace
      summary: Get Marketplace Categories
      description: Get available marketplace categories
      operationId: get_marketplace_categories_api_marketplace_categories_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/marketplace:
    get:
      tags:
      - Agent Marketplace
      summary: Get Marketplace Items
      description: Browse the agent marketplace with enhanced filtering
      operationId: get_marketplace_items_api_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: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          default: 50
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          default: 0
          title: Offset
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MarketplaceItem'
                title: Response Get Marketplace Items Api Marketplace Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketplace/{marketplace_id}/view:
    post:
      tags:
      - Agent Marketplace
      summary: Increment View Count
      description: Increment view count for a marketplace item
      operationId: increment_view_count_api_marketplace__marketplace_id__view_post
      parameters:
      - name: marketplace_id
        in: path
        required: true
        schema:
          type: string
          title: Marketplace Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketplace/{workflow_id}:
    get:
      tags:
      - Agent Marketplace
      summary: Get Marketplace Item
      description: Get a specific marketplace item by ID
      operationId: get_marketplace_item_api_marketplace__workflow_id__get
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketplace/workflow/{workflow_id}/latest-version:
    get:
      tags:
      - Agent Marketplace
      summary: Get Latest Published Version
      description: Get the latest published version of a workflow
      operationId: get_latest_published_version_api_marketplace_workflow__workflow_id__latest_version_get
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketplace/publish:
    post:
      tags:
      - Agent Marketplace
      summary: Publish To Marketplace
      description: Publish a workflow to the marketplace with enhanced metadata
      operationId: publish_to_marketplace_api_marketplace_publish_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublishWorkflowRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketplace/{marketplace_id}/import-preview:
    get:
      tags:
      - Agent Marketplace
      summary: Get Import Preview
      description: 'Get remap requirements for a marketplace workflow before importing.


        Returns the list of integrations/KBs that need to be remapped

        so the frontend can show a remapping wizard.'
      operationId: get_import_preview_api_marketplace__marketplace_id__import_preview_get
      parameters:
      - name: marketplace_id
        in: path
        required: true
        schema:
          type: string
          title: Marketplace Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketplace/import:
    post:
      tags:
      - Agent Marketplace
      summary: Import From Marketplace
      description: Import a workflow from marketplace to user's organization
      operationId: import_from_marketplace_api_marketplace_import_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImportWorkflowRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketplace/check-updates:
    get:
      tags:
      - Agent Marketplace
      summary: Check For Updates
      description: Check if any imported workflows have newer versions in marketplace
      operationId: check_for_updates_api_marketplace_check_updates_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/marketplace/{marketplace_id}/favorite:
    post:
      tags:
      - Agent Marketplace
      summary: Toggle Favorite
      description: Toggle favorite for current user
      operationId: toggle_favorite_api_marketplace__marketplace_id__favorite_post
      parameters:
      - name: marketplace_id
        in: path
        required: true
        schema:
          type: string
          title: Marketplace Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketplace/user/favorites:
    get:
      tags:
      - Agent Marketplace
      summary: Get User Favorites
      description: Get all favorited marketplace item IDs for current user
      operationId: get_user_favorites_api_marketplace_user_favorites_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketplace/creators/{creator_id}:
    get:
      tags:
      - Agent Marketplace
      summary: Get Creator Profile
      description: Get a creator's profile and stats
      operationId: get_creator_profile_api_marketplace_creators__creator_id__get
      parameters:
      - name: creator_id
        in: path
        required: true
        schema:
          type: string
          title: Creator Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketplace/creators/{creator_id}/templates:
    get:
      tags:
      - Agent Marketplace
      summary: Get Creator Templates
      description: Get published marketplace items by a creator
      operationId: get_creator_templates_api_marketplace_creators__creator_id__templates_get
      parameters:
      - name: creator_id
        in: path
        required: true
        schema:
          type: string
          title: Creator Id
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          default: 50
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          default: 0
          title: Offset
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketplace/profile:
    put:
      tags:
      - Agent Marketplace
      summary: Update Own Profile
      description: Update own creator profile
      operationId: update_own_profile_api_marketplace_profile_put
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCreatorProfileRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/dashboard:
    get:
      tags:
      - Marketing Hub
      - marketing-hub
      summary: Get Marketing Dashboard
      description: Get marketing dashboard overview with key metrics
      operationId: get_marketing_dashboard_api_marketing_dashboard_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Marketing Dashboard Api Marketing Dashboard Get
  /api/marketing/overview:
    get:
      tags:
      - Marketing Hub
      - marketing-hub
      summary: Get Marketing Overview
      description: Get marketing hub overview for navigation and quick access
      operationId: get_marketing_overview_api_marketing_overview_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Marketing Overview Api Marketing Overview Get
  /api/marketing/stats:
    get:
      tags:
      - Marketing Hub
      - marketing-hub
      summary: Get Marketing Stats
      description: Get marketing statistics for dashboard widgets
      operationId: get_marketing_stats_api_marketing_stats_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Marketing Stats Api Marketing Stats Get
  /api/marketing/campaigns/analytics/overview:
    get:
      tags:
      - Campaign Analytics
      summary: Get Campaigns Overview
      description: Get campaigns overview metrics
      operationId: get_campaigns_overview_api_marketing_campaigns_analytics_overview_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: channel_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by channel_type
          title: Channel Type
        description: Filter by channel_type
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/analytics/channel-distribution:
    get:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Get Campaign Channel Distribution
      description: Get campaign distribution by channel
      operationId: get_campaign_channel_distribution_api_marketing_campaigns_analytics_channel_distribution_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          default: month
          title: Period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Campaign Channel Distribution Api Marketing Campaigns
                  Analytics Channel Distribution Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/analytics/performance-trends:
    get:
      tags:
      - Campaign Analytics
      summary: Get Campaign Performance Trends
      description: Get campaign performance trends over time
      operationId: get_campaign_performance_trends_api_marketing_campaigns_analytics_performance_trends_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: channel_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by channel_type
          title: Channel Type
        description: Filter by channel_type
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/analytics/engagement-funnel:
    get:
      tags:
      - Campaign Analytics
      summary: Get Campaign Engagement Funnel
      description: Get campaign engagement funnel data
      operationId: get_campaign_engagement_funnel_api_marketing_campaigns_analytics_engagement_funnel_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: channel_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by channel_type
          title: Channel Type
        description: Filter by channel_type
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/analytics/top-campaigns:
    get:
      tags:
      - Campaign Analytics
      summary: Get Top Campaigns
      description: Get top performing campaigns
      operationId: get_top_campaigns_api_marketing_campaigns_analytics_top_campaigns_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: channel_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by channel_type
          title: Channel Type
        description: Filter by channel_type
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          description: Number of top campaigns to return
          default: 5
          title: Limit
        description: Number of top campaigns to return
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/:
    get:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Get Campaigns
      description: Get list of campaigns with filtering and pagination
      operationId: get_campaigns_api_marketing_campaigns__get
      parameters:
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by campaign status
          title: Status
        description: Filter by campaign status
      - name: campaign_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by campaign type
          title: Campaign Type
        description: Filter by campaign type
      - name: channel
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by channel type
          title: Channel
        description: Filter by channel type
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Search campaigns by name or description
          title: Search
        description: Search campaigns by name or description
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          description: Number of campaigns to return
          default: 50
          title: Limit
        description: Number of campaigns to return
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          description: Number of campaigns to skip
          default: 0
          title: Offset
        description: Number of campaigns to skip
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Campaigns Api Marketing Campaigns  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Create Campaign
      description: Create a new campaign with channel validation
      operationId: create_campaign_api_marketing_campaigns__post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Campaign Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Campaign Api Marketing Campaigns  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/{campaign_id}:
    get:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Get Campaign
      description: Get campaign details by ID
      operationId: get_campaign_api_marketing_campaigns__campaign_id__get
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Campaign Api Marketing Campaigns  Campaign Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Update Campaign
      description: Update campaign details
      operationId: update_campaign_api_marketing_campaigns__campaign_id__put
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Campaign Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Campaign Api Marketing Campaigns  Campaign
                  Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Delete Campaign
      description: Delete or archive a campaign
      operationId: delete_campaign_api_marketing_campaigns__campaign_id__delete
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      - name: soft_delete
        in: query
        required: false
        schema:
          type: boolean
          description: Use soft delete (archive) instead of permanent deletion
          default: true
          title: Soft Delete
        description: Use soft delete (archive) instead of permanent deletion
      - name: force
        in: query
        required: false
        schema:
          type: boolean
          description: Force hard delete even for active campaigns
          default: false
          title: Force
        description: Force hard delete even for active campaigns
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Campaign Api Marketing Campaigns  Campaign
                  Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/{campaign_id}/restore:
    post:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Restore Campaign
      description: Restore an archived campaign
      operationId: restore_campaign_api_marketing_campaigns__campaign_id__restore_post
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Restore Campaign Api Marketing Campaigns  Campaign
                  Id  Restore Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/{campaign_id}/validate:
    post:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Validate Campaign
      description: Validate a campaign before launch - checks all requirements
      operationId: validate_campaign_api_marketing_campaigns__campaign_id__validate_post
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Validate Campaign Api Marketing Campaigns  Campaign
                  Id  Validate Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/{campaign_id}/launch:
    post:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Launch Campaign
      description: Launch a campaign with optional pre-launch validation
      operationId: launch_campaign_api_marketing_campaigns__campaign_id__launch_post
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      - name: skip_validation
        in: query
        required: false
        schema:
          type: boolean
          description: Skip pre-launch validation (not recommended)
          default: false
          title: Skip Validation
        description: Skip pre-launch validation (not recommended)
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Launch Campaign Api Marketing Campaigns  Campaign
                  Id  Launch Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/{campaign_id}/pause:
    post:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Pause Campaign
      description: Pause an active campaign
      operationId: pause_campaign_api_marketing_campaigns__campaign_id__pause_post
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Pause Campaign Api Marketing Campaigns  Campaign Id  Pause
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/{campaign_id}/duplicate:
    post:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Duplicate Campaign
      description: Duplicate an existing campaign
      operationId: duplicate_campaign_api_marketing_campaigns__campaign_id__duplicate_post
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Duplicate Campaign Api Marketing Campaigns  Campaign
                  Id  Duplicate Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/{campaign_id}/analytics:
    get:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Get Campaign Analytics
      description: Get campaign analytics and performance metrics
      operationId: get_campaign_analytics_api_marketing_campaigns__campaign_id__analytics_get
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Campaign Analytics Api Marketing Campaigns  Campaign
                  Id  Analytics Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/batch-statistics:
    post:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Get Batch Campaign Statistics
      description: Get statistics for multiple campaigns at once
      operationId: get_batch_campaign_statistics_api_marketing_campaigns_batch_statistics_post
      requestBody:
        content:
          application/json:
            schema:
              items:
                type: string
              type: array
              title: Campaign Ids
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Batch Campaign Statistics Api Marketing Campaigns
                  Batch Statistics Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/{campaign_id}/analytics/by-channel:
    get:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Get Campaign Analytics By Channel
      description: Get campaign analytics broken down by channel (email, SMS, WhatsApp)
      operationId: get_campaign_analytics_by_channel_api_marketing_campaigns__campaign_id__analytics_by_channel_get
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Campaign Analytics By Channel Api Marketing Campaigns  Campaign
                  Id  Analytics By Channel Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/{campaign_id}/recipients:
    get:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Get Campaign Recipients
      description: Get campaign recipients with their contact details and delivery
        status
      operationId: get_campaign_recipients_api_marketing_campaigns__campaign_id__recipients_get
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by delivery status
          title: Status
        description: Filter by delivery status
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          description: Number of recipients to return
          default: 100
          title: Limit
        description: Number of recipients to return
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          description: Number of recipients to skip
          default: 0
          title: Offset
        description: Number of recipients to skip
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Campaign Recipients Api Marketing Campaigns  Campaign
                  Id  Recipients Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/{campaign_id}/activities:
    get:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Get Campaign Activities
      description: Get activity stream for a campaign across all channels
      operationId: get_campaign_activities_api_marketing_campaigns__campaign_id__activities_get
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      - name: channel
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by channel (email, sms, whatsapp)
          title: Channel
        description: Filter by channel (email, sms, whatsapp)
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by activity status
          title: Status
        description: Filter by activity status
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          description: Number of activities to return
          default: 100
          title: Limit
        description: Number of activities to return
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          description: Number of activities to skip
          default: 0
          title: Offset
        description: Number of activities to skip
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Campaign Activities Api Marketing Campaigns  Campaign
                  Id  Activities Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/analytics/channels:
    get:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Get Overall Channel Performance
      description: Get overall channel performance across all campaigns
      operationId: get_overall_channel_performance_api_marketing_campaigns_analytics_channels_get
      parameters:
      - name: date_from
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Start date (YYYY-MM-DD)
          title: Date From
        description: Start date (YYYY-MM-DD)
      - name: date_to
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: End date (YYYY-MM-DD)
          title: Date To
        description: End date (YYYY-MM-DD)
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Overall Channel Performance Api Marketing Campaigns
                  Analytics Channels Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/{campaign_id}/health-check:
    get:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Get Campaign Health Check
      description: Get campaign health status with performance metrics and recommendations
      operationId: get_campaign_health_check_api_marketing_campaigns__campaign_id__health_check_get
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Campaign Health Check Api Marketing Campaigns  Campaign
                  Id  Health Check Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/types:
    get:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Get Campaign Types
      description: Get available campaign types
      operationId: get_campaign_types_api_marketing_campaigns_types_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Campaign Types Api Marketing Campaigns Types Get
  /api/marketing/campaigns/channels:
    get:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Get Campaign Channels
      description: Get available campaign channels
      operationId: get_campaign_channels_api_marketing_campaigns_channels_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Campaign Channels Api Marketing Campaigns Channels
                  Get
  /api/marketing/campaigns/channels/{channel}/validate:
    get:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Validate Channel Setup
      description: Validate that a specific channel is properly configured with required
        integrations
      operationId: validate_channel_setup_api_marketing_campaigns_channels__channel__validate_get
      parameters:
      - name: channel
        in: path
        required: true
        schema:
          type: string
          title: Channel
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Validate Channel Setup Api Marketing Campaigns Channels  Channel  Validate
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/statuses:
    get:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Get Campaign Statuses
      description: Get available campaign statuses
      operationId: get_campaign_statuses_api_marketing_campaigns_statuses_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Campaign Statuses Api Marketing Campaigns Statuses
                  Get
  /api/marketing/campaigns/batch/status:
    get:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Get Batch Status
      description: 'Get batch processing status for campaigns

        Frontend-compatible endpoint for monitoring batch operations'
      operationId: get_batch_status_api_marketing_campaigns_batch_status_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Batch Status Api Marketing Campaigns Batch Status
                  Get
  /api/marketing/campaigns/billing-rate/{channel}:
    get:
      tags:
      - Marketing Campaigns
      - campaigns
      summary: Get Campaign Billing Rate
      description: "Get the billing rate for a campaign channel based on the organization's\n\
        active/default managed integration.\n\nCurrently only email campaigns have\
        \ billing implemented.\nWhatsApp and SMS billing is not yet implemented.\n\
        \nArgs:\n    channel: Campaign channel type (email, whatsapp, sms)\n\nReturns:\n\
        \    - rate: Credits per message (0 if no managed integration or not implemented)\n\
        \    - is_managed: Whether the integration is managed by Expedify\n    - integration_type:\
        \ The specific integration type (resend, sendgrid, etc.)"
      operationId: get_campaign_billing_rate_api_marketing_campaigns_billing_rate__channel__get
      parameters:
      - name: channel
        in: path
        required: true
        schema:
          type: string
          title: Channel
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Campaign Billing Rate Api Marketing Campaigns
                  Billing Rate  Channel  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/:
    get:
      tags:
      - Marketing Templates
      - templates
      summary: Get Templates
      description: 'Get list of templates with filtering and pagination


        Use limit=0 or limit=-1 to fetch all templates (no limit)'
      operationId: get_templates_api_marketing_templates__get
      parameters:
      - name: channel
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by channel (email, sms, whatsapp)
          title: Channel
        description: Filter by channel (email, sms, whatsapp)
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by template category
          title: Category
        description: Filter by template category
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by template status
          title: Status
        description: Filter by template status
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Search templates by name or content
          title: Search
        description: Search templates by name or content
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          description: Number of templates to return (use 0 or -1 for all)
          default: 50
          title: Limit
        description: Number of templates to return (use 0 or -1 for all)
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          description: Number of templates to skip
          default: 0
          title: Offset
        description: Number of templates to skip
      - name: filter_by_active_integrations
        in: query
        required: false
        schema:
          type: boolean
          description: Only show templates from active/default integrations
          default: true
          title: Filter By Active Integrations
        description: Only show templates from active/default integrations
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateListResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Marketing Templates
      - templates
      summary: Create Template
      description: Create a new template
      operationId: create_template_api_marketing_templates__post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateCreateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/{template_id}:
    get:
      tags:
      - Marketing Templates
      - templates
      summary: Get Template
      description: Get template details by ID
      operationId: get_template_api_marketing_templates__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:
                $ref: '#/components/schemas/ApiResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Marketing Templates
      - templates
      summary: Update Template
      description: Update template details
      operationId: update_template_api_marketing_templates__template_id__put
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateUpdateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Marketing Templates
      - templates
      summary: Delete Template
      description: Delete a template
      operationId: delete_template_api_marketing_templates__template_id__delete
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Template Api Marketing Templates  Template
                  Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/{template_id}/duplicate:
    post:
      tags:
      - Marketing Templates
      - templates
      summary: Duplicate Template
      description: Duplicate an existing template
      operationId: duplicate_template_api_marketing_templates__template_id__duplicate_post
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Duplicate Template Api Marketing Templates  Template
                  Id  Duplicate Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/{template_id}/test:
    post:
      tags:
      - Marketing Templates
      - templates
      summary: Test Template
      description: Send a test message using the template
      operationId: test_template_api_marketing_templates__template_id__test_post
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateTestRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateTestResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/{template_id}/preview:
    post:
      tags:
      - Marketing Templates
      - templates
      summary: Preview Template
      description: Preview template with sample or provided variables
      operationId: preview_template_api_marketing_templates__template_id__preview_post
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/models__marketing__template_schemas__TemplatePreviewRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplatePreviewResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/categories:
    get:
      tags:
      - Marketing Templates
      - templates
      summary: Get Template Categories
      description: Get list of available template categories
      operationId: get_template_categories_api_marketing_templates_categories_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/TemplateCategoryResponse'
                type: array
                title: Response Get Template Categories Api Marketing Templates Categories
                  Get
  /api/marketing/templates/channels:
    get:
      tags:
      - Marketing Templates
      - templates
      summary: Get Template Channels
      description: Get list of available template channels
      operationId: get_template_channels_api_marketing_templates_channels_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/TemplateChannelResponse'
                type: array
                title: Response Get Template Channels Api Marketing Templates Channels
                  Get
  /api/marketing/templates/{template_id}/variables:
    get:
      tags:
      - Marketing Templates
      - templates
      summary: Get Template Variables
      description: Get detailed variable information for a template
      operationId: get_template_variables_api_marketing_templates__template_id__variables_get
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateVariablesResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/validate:
    post:
      tags:
      - Marketing Templates
      - templates
      summary: Validate Template
      description: Validate template content for a specific channel
      operationId: validate_template_api_marketing_templates_validate_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateValidationRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateValidationResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/{template_id}/sample-preview:
    get:
      tags:
      - Marketing Templates
      - templates
      summary: Get Sample Preview
      description: Generate a preview with sample data
      operationId: get_sample_preview_api_marketing_templates__template_id__sample_preview_get
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplatePreviewResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/variables/suggestions:
    get:
      tags:
      - Marketing Templates
      - templates
      summary: Get Variable Suggestions
      description: Get variable suggestions for autocomplete
      operationId: get_variable_suggestions_api_marketing_templates_variables_suggestions_get
      parameters:
      - name: partial_name
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Partial variable name for autocomplete
          default: ''
          title: Partial Name
        description: Partial variable name for autocomplete
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
                title: Response Get Variable Suggestions Api Marketing Templates Variables
                  Suggestions Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/validate/email:
    post:
      tags:
      - Marketing Templates
      - templates
      summary: Validate Email Template
      description: Comprehensive email template validation with spam check and compliance
      operationId: validate_email_template_api_marketing_templates_validate_email_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateValidationRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateValidationResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/{template_id}/spam-check:
    get:
      tags:
      - Marketing Templates
      - templates
      summary: Check Template Spam Score
      description: Check spam score for an email template
      operationId: check_template_spam_score_api_marketing_templates__template_id__spam_check_get
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Check Template Spam Score Api Marketing Templates  Template
                  Id  Spam Check Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/{template_id}/preview/enhanced:
    post:
      tags:
      - Marketing Templates
      - templates
      summary: Get Enhanced Preview
      description: Generate enhanced preview with device-specific rendering, dark
        mode, and additional features
      operationId: get_enhanced_preview_api_marketing_templates__template_id__preview_enhanced_post
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      - name: device
        in: query
        required: false
        schema:
          type: string
          description: 'Device type: mobile, tablet, desktop'
          default: desktop
          title: Device
        description: 'Device type: mobile, tablet, desktop'
      - name: dark_mode
        in: query
        required: false
        schema:
          type: boolean
          description: Generate dark mode preview
          default: false
          title: Dark Mode
        description: Generate dark mode preview
      - name: include_plain_text
        in: query
        required: false
        schema:
          type: boolean
          description: Include plain text version
          default: true
          title: Include Plain Text
        description: Include plain text version
      - name: include_thumbnail
        in: query
        required: false
        schema:
          type: boolean
          description: Include thumbnail generation
          default: false
          title: Include Thumbnail
        description: Include thumbnail generation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/models__marketing__template_schemas__TemplatePreviewRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Enhanced Preview Api Marketing Templates  Template
                  Id  Preview Enhanced Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/{template_id}/preview/multi-device:
    get:
      tags:
      - Marketing Templates
      - templates
      summary: Get Multi Device Preview
      description: Generate previews for all device types (mobile, tablet, desktop)
      operationId: get_multi_device_preview_api_marketing_templates__template_id__preview_multi_device_get
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      - name: include_dark_mode
        in: query
        required: false
        schema:
          type: boolean
          description: Include dark mode previews for all devices
          default: false
          title: Include Dark Mode
        description: Include dark mode previews for all devices
      - name: variables
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: JSON string of template variables
          title: Variables
        description: JSON string of template variables
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Multi Device Preview Api Marketing Templates  Template
                  Id  Preview Multi Device Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/{template_id}/preview/plain-text:
    get:
      tags:
      - Marketing Templates
      - templates
      summary: Get Plain Text Preview
      description: Generate plain text version of email template
      operationId: get_plain_text_preview_api_marketing_templates__template_id__preview_plain_text_get
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      - name: variables
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: JSON string of template variables
          title: Variables
        description: JSON string of template variables
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Plain Text Preview Api Marketing Templates  Template
                  Id  Preview Plain Text Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/{template_id}/preview/thumbnail:
    get:
      tags:
      - Marketing Templates
      - templates
      summary: Get Template Thumbnail
      description: Generate thumbnail for email template
      operationId: get_template_thumbnail_api_marketing_templates__template_id__preview_thumbnail_get
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      - name: width
        in: query
        required: false
        schema:
          type: integer
          description: Thumbnail width in pixels
          default: 300
          title: Width
        description: Thumbnail width in pixels
      - name: height
        in: query
        required: false
        schema:
          type: integer
          description: Thumbnail height in pixels
          default: 200
          title: Height
        description: Thumbnail height in pixels
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Template Thumbnail Api Marketing Templates  Template
                  Id  Preview Thumbnail Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/preview/options:
    get:
      tags:
      - Marketing Templates
      - templates
      summary: Get Preview Options
      description: Get available preview options and configurations
      operationId: get_preview_options_api_marketing_templates_preview_options_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Preview Options Api Marketing Templates Preview
                  Options Get
  /api/marketing/templates/components:
    get:
      tags:
      - Marketing Templates
      - templates
      summary: Get Components Library
      description: Get email template components library
      operationId: get_components_library_api_marketing_templates_components_get
      parameters:
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by component category
          title: Category
        description: Filter by component category
      - name: component_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by component type
          title: Component Type
        description: Filter by component type
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Components Library Api Marketing Templates Components
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/components/{component_id}:
    get:
      tags:
      - Marketing Templates
      - templates
      summary: Get Component
      description: Get specific email template component by ID
      operationId: get_component_api_marketing_templates_components__component_id__get
      parameters:
      - name: component_id
        in: path
        required: true
        schema:
          type: string
          title: Component Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Component Api Marketing Templates Components  Component
                  Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/components/{component_id}/render:
    post:
      tags:
      - Marketing Templates
      - templates
      summary: Render Component
      description: Render a component with provided variables
      operationId: render_component_api_marketing_templates_components__component_id__render_post
      parameters:
      - name: component_id
        in: path
        required: true
        schema:
          type: string
          title: Component Id
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
              - type: object
                additionalProperties: true
              - type: 'null'
              title: Variables
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Render Component Api Marketing Templates Components  Component
                  Id  Render Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/components/{component_id}/validate:
    post:
      tags:
      - Marketing Templates
      - templates
      summary: Validate Component Variables
      description: Validate variables for a component
      operationId: validate_component_variables_api_marketing_templates_components__component_id__validate_post
      parameters:
      - name: component_id
        in: path
        required: true
        schema:
          type: string
          title: Component Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Validate Component Variables Api Marketing Templates
                  Components  Component Id  Validate Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/build-from-components:
    post:
      tags:
      - Marketing Templates
      - templates
      summary: Build Template From Components
      description: Build a complete email template from multiple components
      operationId: build_template_from_components_api_marketing_templates_build_from_components_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Build Template From Components Api Marketing Templates
                  Build From Components Post
  /api/marketing/templates/components/{component_id}/preview:
    post:
      tags:
      - Marketing Templates
      - templates
      summary: Preview Component
      description: Generate a preview of a component with sample or provided data
      operationId: preview_component_api_marketing_templates_components__component_id__preview_post
      parameters:
      - name: component_id
        in: path
        required: true
        schema:
          type: string
          title: Component Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Preview Component Api Marketing Templates Components  Component
                  Id  Preview Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/{template_id}/whatsapp-parameters:
    get:
      tags:
      - Marketing Templates
      - templates
      summary: Get Whatsapp Template Parameters
      description: Get WhatsApp template parameters for campaign creation
      operationId: get_whatsapp_template_parameters_api_marketing_templates__template_id__whatsapp_parameters_get
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Whatsapp Template Parameters Api Marketing Templates  Template
                  Id  Whatsapp Parameters Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/{template_id}/submit-approval:
    post:
      tags:
      - Marketing Templates
      - templates
      summary: Submit Whatsapp Template For Approval
      description: Submit WhatsApp template for Meta approval
      operationId: submit_whatsapp_template_for_approval_api_marketing_templates__template_id__submit_approval_post
      parameters:
      - name: template_id
        in: path
        required: true
        schema:
          type: string
          title: Template Id
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
              - type: string
              - type: 'null'
              description: Optional submission notes
              title: Notes
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Submit Whatsapp Template For Approval Api Marketing
                  Templates  Template Id  Submit Approval Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/template-search/search:
    post:
      tags:
      - Template Search
      - Template Search
      summary: Search Templates Endpoint
      description: "Search templates with basic filters\n\nArgs:\n    request: Search\
        \ parameters\n    \nReturns:\n    Search results with metadata"
      operationId: search_templates_endpoint_api_template_search_search_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__marketing__template_search_routes__SearchRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/template-search/advanced-search:
    post:
      tags:
      - Template Search
      - Template Search
      summary: Advanced Search Templates
      description: "Advanced template search with detailed filters\n\nArgs:\n    request:\
        \ Advanced search parameters\n    \nReturns:\n    Search results with metadata"
      operationId: advanced_search_templates_api_template_search_advanced_search_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AdvancedSearchRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/template-search/facets:
    get:
      tags:
      - Template Search
      - Template Search
      summary: Get Search Facets
      description: "Get available search facets for filtering\n\nReturns:\n    Available\
        \ facets with counts"
      operationId: get_search_facets_api_template_search_facets_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/template-search/suggestions:
    get:
      tags:
      - Template Search
      - Template Search
      summary: Get Search Suggestions
      description: "Get search suggestions based on partial query\n\nArgs:\n    query:\
        \ Partial search query\n    limit: Number of suggestions to return\n    \n\
        Returns:\n    List of search suggestions"
      operationId: get_search_suggestions_api_template_search_suggestions_get
      parameters:
      - name: query
        in: query
        required: true
        schema:
          type: string
          minLength: 2
          description: Partial search query
          title: Query
        description: Partial search query
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 20
          minimum: 1
          description: Number of suggestions
          default: 5
          title: Limit
        description: Number of suggestions
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/template-search/saved-searches:
    get:
      tags:
      - Template Search
      - Template Search
      summary: Get Saved Searches
      description: "Get saved searches for the user\n\nReturns:\n    List of saved\
        \ searches"
      operationId: get_saved_searches_api_template_search_saved_searches_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
    post:
      tags:
      - Template Search
      - Template Search
      summary: Save Search Query
      description: "Save a search query for reuse\n\nArgs:\n    request: Search to\
        \ save\n    \nReturns:\n    Saved search ID"
      operationId: save_search_query_api_template_search_saved_searches_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SavedSearchRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/template-search/popular-terms:
    get:
      tags:
      - Template Search
      - Template Search
      summary: Get Popular Search Terms
      description: "Get popular search terms\n\nArgs:\n    limit: Number of terms\
        \ to return\n    days: Days to look back\n    \nReturns:\n    Popular search\
        \ terms with statistics"
      operationId: get_popular_search_terms_api_template_search_popular_terms_get
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 50
          minimum: 1
          description: Number of terms to return
          default: 10
          title: Limit
        description: Number of terms to return
      - name: days
        in: query
        required: false
        schema:
          type: integer
          maximum: 365
          minimum: 1
          description: Days to look back
          default: 30
          title: Days
        description: Days to look back
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/template-search/quick-search:
    get:
      tags:
      - Template Search
      - Template Search
      summary: Quick Search Templates
      description: "Quick search for templates (lightweight)\n\nArgs:\n    q: Search\
        \ query\n    limit: Number of results\n    channel: Filter by channel\n  \
        \  \nReturns:\n    Quick search results"
      operationId: quick_search_templates_api_template_search_quick_search_get
      parameters:
      - name: q
        in: query
        required: true
        schema:
          type: string
          minLength: 1
          description: Quick search query
          title: Q
        description: Quick search query
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 50
          minimum: 1
          description: Number of results
          default: 10
          title: Limit
        description: Number of results
      - name: channel
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by channel
          title: Channel
        description: Filter by channel
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/template-search/search-analytics:
    get:
      tags:
      - Template Search
      - Template Search
      summary: Get Search Analytics
      description: "Get search analytics and insights\n\nArgs:\n    days: Number of\
        \ days to analyze\n    \nReturns:\n    Search analytics data"
      operationId: get_search_analytics_api_template_search_search_analytics_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          maximum: 365
          minimum: 1
          description: Days to analyze
          default: 30
          title: Days
        description: Days to analyze
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/audiences/:
    get:
      tags:
      - Marketing Audiences
      - audiences
      summary: Get Audiences
      description: Get list of audiences with filtering and pagination
      operationId: get_audiences_api_marketing_audiences__get
      parameters:
      - name: audience_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by type (static, dynamic)
          title: Audience Type
        description: Filter by type (static, dynamic)
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Search audiences by name
          title: Search
        description: Search audiences by name
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          description: Number of audiences to return
          default: 50
          title: Limit
        description: Number of audiences to return
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          description: Number of audiences to skip
          default: 0
          title: Offset
        description: Number of audiences to skip
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Audiences Api Marketing Audiences  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Marketing Audiences
      - audiences
      summary: Create Audience
      description: Create a new audience segment
      operationId: create_audience_api_marketing_audiences__post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Audience Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Audience Api Marketing Audiences  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/audiences/from-segments:
    post:
      tags:
      - Marketing Audiences
      - audiences
      summary: Create Audiences From Segments
      description: Create marketing audiences from existing CRM segments
      operationId: create_audiences_from_segments_api_marketing_audiences_from_segments_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Request Data
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Create Audiences From Segments Api Marketing Audiences
                  From Segments Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/audiences/{audience_id}:
    get:
      tags:
      - Marketing Audiences
      - audiences
      summary: Get Audience
      description: Get audience details by ID
      operationId: get_audience_api_marketing_audiences__audience_id__get
      parameters:
      - name: audience_id
        in: path
        required: true
        schema:
          type: string
          title: Audience Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Audience Api Marketing Audiences  Audience Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Marketing Audiences
      - audiences
      summary: Update Audience
      description: Update audience details and criteria
      operationId: update_audience_api_marketing_audiences__audience_id__put
      parameters:
      - name: audience_id
        in: path
        required: true
        schema:
          type: string
          title: Audience Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Audience Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Audience Api Marketing Audiences  Audience
                  Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Marketing Audiences
      - audiences
      summary: Delete Audience
      description: Delete an audience
      operationId: delete_audience_api_marketing_audiences__audience_id__delete
      parameters:
      - name: audience_id
        in: path
        required: true
        schema:
          type: string
          title: Audience Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Audience Api Marketing Audiences  Audience
                  Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/audiences/{audience_id}/members:
    get:
      tags:
      - Marketing Audiences
      - audiences
      summary: Get Audience Members
      description: Get members of an audience
      operationId: get_audience_members_api_marketing_audiences__audience_id__members_get
      parameters:
      - name: audience_id
        in: path
        required: true
        schema:
          type: string
          title: Audience Id
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          description: Number of members to return
          default: 100
          title: Limit
        description: Number of members to return
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          description: Number of members to skip
          default: 0
          title: Offset
        description: Number of members to skip
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Audience Members Api Marketing Audiences  Audience
                  Id  Members Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Marketing Audiences
      - audiences
      summary: Add Audience Members
      description: Add members to a static audience
      operationId: add_audience_members_api_marketing_audiences__audience_id__members_post
      parameters:
      - name: audience_id
        in: path
        required: true
        schema:
          type: string
          title: Audience Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Member Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Add Audience Members Api Marketing Audiences  Audience
                  Id  Members Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Marketing Audiences
      - audiences
      summary: Remove Audience Members
      description: Remove members from a static audience
      operationId: remove_audience_members_api_marketing_audiences__audience_id__members_delete
      parameters:
      - name: audience_id
        in: path
        required: true
        schema:
          type: string
          title: Audience Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Member Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Remove Audience Members Api Marketing Audiences  Audience
                  Id  Members Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/audiences/{audience_id}/refresh:
    post:
      tags:
      - Marketing Audiences
      - audiences
      summary: Refresh Audience
      description: Refresh a dynamic audience by re-evaluating criteria
      operationId: refresh_audience_api_marketing_audiences__audience_id__refresh_post
      parameters:
      - name: audience_id
        in: path
        required: true
        schema:
          type: string
          title: Audience Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Refresh Audience Api Marketing Audiences  Audience
                  Id  Refresh Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/audiences/{audience_id}/export:
    get:
      tags:
      - Marketing Audiences
      - audiences
      summary: Export Audience
      description: Export audience members to file
      operationId: export_audience_api_marketing_audiences__audience_id__export_get
      parameters:
      - name: audience_id
        in: path
        required: true
        schema:
          type: string
          title: Audience Id
      - name: format
        in: query
        required: false
        schema:
          type: string
          description: Export format (csv, excel)
          default: csv
          title: Format
        description: Export format (csv, excel)
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Export Audience Api Marketing Audiences  Audience
                  Id  Export Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/audiences/criteria/fields:
    get:
      tags:
      - Marketing Audiences
      - audiences
      summary: Get Criteria Fields
      description: Get available fields for audience criteria from CRM
      operationId: get_criteria_fields_api_marketing_audiences_criteria_fields_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Criteria Fields Api Marketing Audiences Criteria
                  Fields Get
  /api/marketing/assets/:
    get:
      tags:
      - Marketing Assets
      - assets
      summary: Get Assets
      description: Get list of assets with filtering and pagination
      operationId: get_assets_api_marketing_assets__get
      parameters:
      - name: asset_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by type (image, document, video)
          title: Asset Type
        description: Filter by type (image, document, video)
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by category
          title: Category
        description: Filter by category
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Search assets by name
          title: Search
        description: Search assets by name
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          description: Number of assets to return
          default: 50
          title: Limit
        description: Number of assets to return
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          description: Number of assets to skip
          default: 0
          title: Offset
        description: Number of assets to skip
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Assets Api Marketing Assets  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/assets/upload/email-assets:
    post:
      tags:
      - Marketing Assets
      - assets
      summary: Upload Email Assets
      description: Upload multiple assets for email builder
      operationId: upload_email_assets_api_marketing_assets_upload_email_assets_post
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_email_assets_api_marketing_assets_upload_email_assets_post'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Upload Email Assets Api Marketing Assets Upload Email
                  Assets Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/assets/upload:
    post:
      tags:
      - Marketing Assets
      - assets
      summary: Upload Asset
      description: Upload a new asset file
      operationId: upload_asset_api_marketing_assets_upload_post
      parameters:
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Asset category
          default: general
          title: Category
        description: Asset category
      - name: description
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Asset description
          title: Description
        description: Asset description
      - name: tags
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Comma-separated tags
          title: Tags
        description: Comma-separated tags
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_asset_api_marketing_assets_upload_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Upload Asset Api Marketing Assets Upload Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/assets/{asset_id}:
    get:
      tags:
      - Marketing Assets
      - assets
      summary: Get Asset
      description: Get asset details by ID
      operationId: get_asset_api_marketing_assets__asset_id__get
      parameters:
      - name: asset_id
        in: path
        required: true
        schema:
          type: string
          title: Asset Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Asset Api Marketing Assets  Asset Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Marketing Assets
      - assets
      summary: Delete Asset
      description: Delete an asset and its file
      operationId: delete_asset_api_marketing_assets__asset_id__delete
      parameters:
      - name: asset_id
        in: path
        required: true
        schema:
          type: string
          title: Asset Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Asset Api Marketing Assets  Asset Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Marketing Assets
      - assets
      summary: Update Asset
      description: Update asset metadata (name, description, category)
      operationId: update_asset_api_marketing_assets__asset_id__put
      parameters:
      - name: asset_id
        in: path
        required: true
        schema:
          type: string
          title: Asset Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Asset Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Asset Api Marketing Assets  Asset Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/assets/files/{asset_id}:
    get:
      tags:
      - Marketing Assets
      - assets
      summary: Serve Asset File
      description: Serve asset file
      operationId: serve_asset_file_api_marketing_assets_files__asset_id__get
      parameters:
      - name: asset_id
        in: path
        required: true
        schema:
          type: string
          title: Asset Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/assets/thumbnails/{asset_id}:
    get:
      tags:
      - Marketing Assets
      - assets
      summary: Serve Thumbnail
      description: Serve asset thumbnail
      operationId: serve_thumbnail_api_marketing_assets_thumbnails__asset_id__get
      parameters:
      - name: asset_id
        in: path
        required: true
        schema:
          type: string
          title: Asset Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/assets/categories:
    get:
      tags:
      - Marketing Assets
      - assets
      summary: Get Asset Categories
      description: Get list of available asset categories
      operationId: get_asset_categories_api_marketing_assets_categories_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Asset Categories Api Marketing Assets Categories
                  Get
  /api/marketing/assets/types:
    get:
      tags:
      - Marketing Assets
      - assets
      summary: Get Asset Types
      description: Get list of supported asset types
      operationId: get_asset_types_api_marketing_assets_types_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Asset Types Api Marketing Assets Types Get
  /api/marketing/assets/{asset_id}/usage:
    get:
      tags:
      - Marketing Assets
      - assets
      summary: Get Asset Usage
      description: Get where an asset is being used (campaigns, templates, etc.)
      operationId: get_asset_usage_api_marketing_assets__asset_id__usage_get
      parameters:
      - name: asset_id
        in: path
        required: true
        schema:
          type: string
          title: Asset Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Asset Usage Api Marketing Assets  Asset Id  Usage
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/automation:
    post:
      tags:
      - Campaign Automation
      - campaign_automation
      summary: Create Automated Campaign
      description: Create a new automated campaign with workflow integration
      operationId: create_automated_campaign_api_marketing_automation_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Request Data
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Create Automated Campaign Api Marketing Automation
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/automation/{campaign_id}/execute:
    post:
      tags:
      - Campaign Automation
      - campaign_automation
      summary: Execute Automated Campaign
      description: Execute an automated campaign immediately
      operationId: execute_automated_campaign_api_marketing_automation__campaign_id__execute_post
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Execute Automated Campaign Api Marketing Automation  Campaign
                  Id  Execute Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/automation/{campaign_id}/status:
    get:
      tags:
      - Campaign Automation
      - campaign_automation
      summary: Get Campaign Execution Status
      description: Get execution status and metrics for an automated campaign
      operationId: get_campaign_execution_status_api_marketing_automation__campaign_id__status_get
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Campaign Execution Status Api Marketing Automation  Campaign
                  Id  Status Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/automation/{campaign_id}/pause:
    post:
      tags:
      - Campaign Automation
      - campaign_automation
      summary: Pause Campaign
      description: Pause an executing automated campaign
      operationId: pause_campaign_api_marketing_automation__campaign_id__pause_post
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Pause Campaign Api Marketing Automation  Campaign
                  Id  Pause Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/automation/{campaign_id}/resume:
    post:
      tags:
      - Campaign Automation
      - campaign_automation
      summary: Resume Campaign
      description: Resume a paused automated campaign
      operationId: resume_campaign_api_marketing_automation__campaign_id__resume_post
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Resume Campaign Api Marketing Automation  Campaign
                  Id  Resume Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/automation/templates:
    get:
      tags:
      - Campaign Automation
      - campaign_automation
      summary: Get Automation Templates
      description: Get available automation templates for campaigns
      operationId: get_automation_templates_api_marketing_automation_templates_get
      parameters:
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Automation Templates Api Marketing Automation
                  Templates Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/automation/{campaign_id}/analytics/event:
    post:
      tags:
      - Campaign Automation
      - campaign_automation
      summary: Record Campaign Event
      description: Record a campaign analytics event (open, click, etc.)
      operationId: record_campaign_event_api_marketing_automation__campaign_id__analytics_event_post
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Event Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Record Campaign Event Api Marketing Automation  Campaign
                  Id  Analytics Event Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/automation/{campaign_id}/workflow:
    get:
      tags:
      - Campaign Automation
      - campaign_automation
      summary: Get Campaign Workflow
      description: Get the workflow definition for an automated campaign
      operationId: get_campaign_workflow_api_marketing_automation__campaign_id__workflow_get
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Campaign Workflow Api Marketing Automation  Campaign
                  Id  Workflow Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/automation/bulk-execute:
    post:
      tags:
      - Campaign Automation
      - campaign_automation
      summary: Bulk Execute Campaigns
      description: Execute multiple campaigns in bulk
      operationId: bulk_execute_campaigns_api_marketing_automation_bulk_execute_post
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
              title: Request Data
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Bulk Execute Campaigns Api Marketing Automation Bulk
                  Execute Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaign-batch/launch:
    post:
      tags:
      - Campaign Batch Processing
      - Campaign Batch Management
      summary: Launch Campaign
      description: 'Launch a campaign with batch processing for large audiences


        Supports:

        - Manual immediate execution

        - Scheduled future execution

        - Custom batch size configuration

        - Test mode for validation'
      operationId: launch_campaign_api_marketing_campaign_batch_launch_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CampaignLaunchRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CampaignLaunchResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaign-batch/progress/{campaign_id}:
    get:
      tags:
      - Campaign Batch Processing
      - Campaign Batch Management
      summary: Get Campaign Progress
      description: Get real-time progress information for a campaign batch processing
      operationId: get_campaign_progress_api_marketing_campaign_batch_progress__campaign_id__get
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CampaignProgressResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaign-batch/active:
    get:
      tags:
      - Campaign Batch Processing
      - Campaign Batch Management
      summary: Get Active Campaigns
      description: Get list of all active campaign batch processing with optional
        status filtering
      operationId: get_active_campaigns_api_marketing_campaign_batch_active_get
      parameters:
      - name: status_filter
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by status
          title: Status Filter
        description: Filter by status
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CampaignProgressResponse'
                title: Response Get Active Campaigns Api Marketing Campaign Batch
                  Active Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaign-batch/cancel/{campaign_id}:
    post:
      tags:
      - Campaign Batch Processing
      - Campaign Batch Management
      summary: Cancel Campaign
      description: Cancel a running campaign batch processing
      operationId: cancel_campaign_api_marketing_campaign_batch_cancel__campaign_id__post
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Cancel Campaign Api Marketing Campaign Batch Cancel  Campaign
                  Id  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaign-batch/configuration:
    get:
      tags:
      - Campaign Batch Processing
      - Campaign Batch Management
      summary: Get Batch Configuration
      description: Get batch processing configuration information for all channels
      operationId: get_batch_configuration_api_marketing_campaign_batch_configuration_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchConfigurationResponse'
  /api/marketing/campaign-batch/retry/{campaign_id}:
    post:
      tags:
      - Campaign Batch Processing
      - Campaign Batch Management
      summary: Retry Failed Batches
      description: 'Retry failed batches for a campaign


        If batch_numbers is not provided, will retry all failed batches'
      operationId: retry_failed_batches_api_marketing_campaign_batch_retry__campaign_id__post
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      - name: batch_numbers
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: integer
          - type: 'null'
          description: Specific batch numbers to retry
          title: Batch Numbers
        description: Specific batch numbers to retry
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Retry Failed Batches Api Marketing Campaign Batch
                  Retry  Campaign Id  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaign-batch/statistics:
    get:
      tags:
      - Campaign Batch Processing
      - Campaign Batch Management
      summary: Get Batch Statistics
      description: Get batch processing statistics and performance metrics
      operationId: get_batch_statistics_api_marketing_campaign_batch_statistics_get
      parameters:
      - name: hours
        in: query
        required: false
        schema:
          type: integer
          description: Hours of statistics to retrieve
          default: 24
          title: Hours
        description: Hours of statistics to retrieve
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Batch Statistics Api Marketing Campaign Batch
                  Statistics Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaign-batch/status:
    get:
      tags:
      - Campaign Batch Processing
      - Campaign Batch Management
      summary: Get Batch Status
      description: 'Get overall batch processing status and active campaigns

        Frontend-compatible endpoint for monitoring batch operations'
      operationId: get_batch_status_api_marketing_campaign_batch_status_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Batch Status Api Marketing Campaign Batch Status
                  Get
  /api/marketing/campaign-batch/health:
    get:
      tags:
      - Campaign Batch Processing
      - Campaign Batch Management
      summary: Get Batch Health
      description: Get health status of batch processing system
      operationId: get_batch_health_api_marketing_campaign_batch_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Batch Health Api Marketing Campaign Batch Health
                  Get
  /api/marketing/email-validation/validate-single:
    post:
      tags:
      - Email Validation
      - Email Validation
      summary: Validate Single Email
      description: 'Validate a single email address


        Performs comprehensive validation including:

        - Syntax validation

        - Domain verification

        - MX record checks

        - Disposable email detection

        - Role-based email detection'
      operationId: validate_single_email_api_marketing_email_validation_validate_single_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SingleEmailValidationRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailValidationResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/email-validation/validate-bulk:
    post:
      tags:
      - Email Validation
      - Email Validation
      summary: Validate Bulk Emails
      description: 'Validate a list of email addresses in bulk


        Processes emails in batches with configurable concurrency for optimal performance.

        Returns individual results plus summary statistics.'
      operationId: validate_bulk_emails_api_marketing_email_validation_validate_bulk_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkEmailValidationRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkValidationResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/email-validation/validate-file:
    post:
      tags:
      - Email Validation
      - Email Validation
      summary: Validate Email File
      description: 'Validate emails from uploaded CSV file


        Supports CSV files with configurable email column name.

        Processes large files efficiently with batching.'
      operationId: validate_email_file_api_marketing_email_validation_validate_file_post
      parameters:
      - name: email_column
        in: query
        required: false
        schema:
          type: string
          default: email
          title: Email Column
      - name: batch_size
        in: query
        required: false
        schema:
          type: integer
          default: 50
          title: Batch Size
      - name: max_concurrent
        in: query
        required: false
        schema:
          type: integer
          default: 10
          title: Max Concurrent
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_validate_email_file_api_marketing_email_validation_validate_file_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkValidationResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/email-validation/summary/{validation_id}:
    get:
      tags:
      - Email Validation
      - Email Validation
      summary: Get Validation Summary
      description: 'Get summary for a previous validation (if stored)


        Note: This endpoint is a placeholder for future implementation

        where validation results are stored and can be retrieved later.'
      operationId: get_validation_summary_api_marketing_email_validation_summary__validation_id__get
      parameters:
      - name: validation_id
        in: path
        required: true
        schema:
          type: string
          title: Validation Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationSummaryResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/email-validation/health:
    get:
      tags:
      - Email Validation
      - Email Validation
      summary: Get Validation Service Health
      description: 'Get health status of email validation service


        Returns service status, configuration, and performance metrics.'
      operationId: get_validation_service_health_api_marketing_email_validation_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Validation Service Health Api Marketing Email
                  Validation Health Get
  /api/marketing/email-validation/configuration:
    get:
      tags:
      - Email Validation
      - Email Validation
      summary: Get Validation Configuration
      description: Get email validation service configuration and recommendations
      operationId: get_validation_configuration_api_marketing_email_validation_configuration_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Validation Configuration Api Marketing Email Validation
                  Configuration Get
  /api/marketing/campaigns/analytics/debug-channels:
    get:
      tags:
      - Campaign Analytics
      summary: Debug Channel Types
      description: Debug endpoint to check what channel_types exist in campaigns table
      operationId: debug_channel_types_api_marketing_campaigns_analytics_debug_channels_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/marketing/campaigns/analytics/channel_type-distribution:
    get:
      tags:
      - Campaign Analytics
      summary: Get Campaign Channel Type Distribution
      description: Get campaign distribution by channel_type
      operationId: get_campaign_channel_type_distribution_api_marketing_campaigns_analytics_channel_type_distribution_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/analytics/delivery-breakdown:
    get:
      tags:
      - Campaign Analytics
      summary: Get Delivery Breakdown
      description: Get delivery breakdown data for pie chart (delivered, bounced,
        failed, pending)
      operationId: get_delivery_breakdown_api_marketing_campaigns_analytics_delivery_breakdown_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: channel_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by channel_type
          title: Channel Type
        description: Filter by channel_type
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/analytics/aggregated-table:
    get:
      tags:
      - Campaign Analytics
      summary: Get Campaigns Aggregated Table
      description: 'Get aggregated campaign analytics with flexible dimension grouping.


        Uses campaign_activities table if available, otherwise falls back to campaigns
        table stats.'
      operationId: get_campaigns_aggregated_table_api_marketing_campaigns_analytics_aggregated_table_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: channel_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by channel_type
          title: Channel Type
        description: Filter by channel_type
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      - name: group_by
        in: query
        required: false
        schema:
          type: string
          description: Comma-separated dimensions to group by
          default: campaign_name
          title: Group By
        description: Comma-separated dimensions to group by
      - name: sort_by
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Field to sort by
          default: sent
          title: Sort By
        description: Field to sort by
      - name: sort_direction
        in: query
        required: false
        schema:
          type: string
          description: Sort direction (asc/desc)
          default: desc
          title: Sort Direction
        description: Sort direction (asc/desc)
      - name: page
        in: query
        required: false
        schema:
          type: integer
          description: Page number
          default: 1
          title: Page
        description: Page number
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          description: Items per page
          default: 20
          title: Limit
        description: Items per page
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/analytics/recipient-status-distribution:
    get:
      tags:
      - Campaign Analytics
      summary: Get Recipient Status Distribution
      description: Get recipient counts grouped by status for horizontal bar chart.
      operationId: get_recipient_status_distribution_api_marketing_campaigns_analytics_recipient_status_distribution_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: channel_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by channel_type
          title: Channel Type
        description: Filter by channel_type
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/campaigns/analytics/recipient-activity:
    get:
      tags:
      - Campaign Analytics
      summary: Get Recipient Activity
      description: Get paginated list of individual recipient activities across all
        campaigns.
      operationId: get_recipient_activity_api_marketing_campaigns_analytics_recipient_activity_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: channel_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by channel_type
          title: Channel Type
        description: Filter by channel_type
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by recipient status
          title: Status
        description: Filter by recipient status
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Search recipient address or name
          title: Search
        description: Search recipient address or name
      - name: sort_by
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Sort field
          default: sent_at
          title: Sort By
        description: Sort field
      - name: sort_direction
        in: query
        required: false
        schema:
          type: string
          description: Sort direction
          default: desc
          title: Sort Direction
        description: Sort direction
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      - name: page
        in: query
        required: false
        schema:
          type: integer
          description: Page number
          default: 1
          title: Page
        description: Page number
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          description: Items per page
          default: 20
          title: Limit
        description: Items per page
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/analytics/overview:
    get:
      tags:
      - Template Analytics
      summary: Get Templates Overview
      description: Get templates overview metrics
      operationId: get_templates_overview_api_marketing_templates_analytics_overview_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: channel
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by channel
          title: Channel
        description: Filter by channel
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/analytics/channel-distribution:
    get:
      tags:
      - Template Analytics
      summary: Get Template Channel Distribution
      description: Get template distribution by channel
      operationId: get_template_channel_distribution_api_marketing_templates_analytics_channel_distribution_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/analytics/performance-trends:
    get:
      tags:
      - Template Analytics
      summary: Get Template Performance Trends
      description: Get template performance trends over time
      operationId: get_template_performance_trends_api_marketing_templates_analytics_performance_trends_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: channel
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by channel
          title: Channel
        description: Filter by channel
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/templates/analytics/top-templates:
    get:
      tags:
      - Template Analytics
      summary: Get Top Templates
      description: Get top performing templates
      operationId: get_top_templates_api_marketing_templates_analytics_top_templates_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: channel
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by channel
          title: Channel
        description: Filter by channel
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          description: Number of top templates to return
          default: 5
          title: Limit
        description: Number of top templates to return
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/audiences/analytics/overview:
    get:
      tags:
      - Audience Analytics
      summary: Get Audiences Overview
      description: Get segments overview metrics
      operationId: get_audiences_overview_api_marketing_audiences_analytics_overview_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: entity_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by entity type
          title: Entity Type
        description: Filter by entity type
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/audiences/analytics/entity-type-distribution:
    get:
      tags:
      - Audience Analytics
      summary: Get Segment Entity Type Distribution
      description: Get segment distribution by entity type
      operationId: get_segment_entity_type_distribution_api_marketing_audiences_analytics_entity_type_distribution_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/audiences/analytics/growth-trends:
    get:
      tags:
      - Audience Analytics
      summary: Get Segment Growth Trends
      description: Get segment growth trends over time
      operationId: get_segment_growth_trends_api_marketing_audiences_analytics_growth_trends_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: entity_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by entity type
          title: Entity Type
        description: Filter by entity type
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/audiences/analytics/top-segments:
    get:
      tags:
      - Audience Analytics
      summary: Get Top Segments
      description: Get top performing segments by member count
      operationId: get_top_segments_api_marketing_audiences_analytics_top_segments_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: entity_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by entity type
          title: Entity Type
        description: Filter by entity type
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          description: Number of top segments to return
          default: 5
          title: Limit
        description: Number of top segments to return
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/assets/analytics/overview:
    get:
      tags:
      - Asset Analytics
      summary: Get Assets Overview
      description: Get assets overview metrics
      operationId: get_assets_overview_api_marketing_assets_analytics_overview_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: asset_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by asset type
          title: Asset Type
        description: Filter by asset type
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/assets/analytics/type-distribution:
    get:
      tags:
      - Asset Analytics
      summary: Get Asset Type Distribution
      description: Get asset distribution by type
      operationId: get_asset_type_distribution_api_marketing_assets_analytics_type_distribution_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/assets/analytics/usage-trends:
    get:
      tags:
      - Asset Analytics
      summary: Get Asset Usage Trends
      description: Get asset usage trends over time
      operationId: get_asset_usage_trends_api_marketing_assets_analytics_usage_trends_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: asset_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by asset type
          title: Asset Type
        description: Filter by asset type
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/marketing/assets/analytics/top-assets:
    get:
      tags:
      - Asset Analytics
      summary: Get Top Assets
      description: Get top performing assets
      operationId: get_top_assets_api_marketing_assets_analytics_top_assets_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: Time period
          default: month
          title: Period
        description: Time period
      - name: asset_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by asset type
          title: Asset Type
        description: Filter by asset type
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: Start date for custom range
          title: Start Date
        description: Start date for custom range
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: End date for custom range
          title: End Date
        description: End date for custom range
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          description: Number of top assets to return
          default: 5
          title: Limit
        description: Number of top assets to return
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/unsubscribe/{token}:
    get:
      tags:
      - Unsubscribe Management
      summary: Unsubscribe Page
      description: "Display unsubscribe page or auto-confirm unsubscribe\n\nArgs:\n\
        \    token: Encrypted unsubscribe token\n    auto_confirm: If True, immediately\
        \ process unsubscribe without showing form"
      operationId: unsubscribe_page_api_unsubscribe__token__get
      parameters:
      - name: token
        in: path
        required: true
        schema:
          type: string
          title: Token
      - name: auto_confirm
        in: query
        required: false
        schema:
          type: boolean
          description: Auto-confirm unsubscribe without showing form
          default: false
          title: Auto Confirm
        description: Auto-confirm unsubscribe without showing form
      responses:
        '200':
          description: Successful Response
          content:
            text/html:
              schema:
                type: string
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Unsubscribe Management
      summary: Process Unsubscribe
      description: "Process unsubscribe request with reason\n\nArgs:\n    token: Encrypted\
        \ unsubscribe token\n    unsubscribe_data: Unsubscribe reason and details"
      operationId: process_unsubscribe_api_unsubscribe__token__post
      parameters:
      - name: token
        in: path
        required: true
        schema:
          type: string
          title: Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UnsubscribeRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/unsubscribe/preferences/{token}:
    get:
      tags:
      - Unsubscribe Management
      summary: Preference Center
      description: "Display email preference center\n\nArgs:\n    token: Encrypted\
        \ preference center token"
      operationId: preference_center_api_unsubscribe_preferences__token__get
      parameters:
      - name: token
        in: path
        required: true
        schema:
          type: string
          title: Token
      responses:
        '200':
          description: Successful Response
          content:
            text/html:
              schema:
                type: string
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Unsubscribe Management
      summary: Update Preferences
      description: "Update email preferences\n\nArgs:\n    token: Encrypted preference\
        \ center token\n    preference_data: Updated preferences"
      operationId: update_preferences_api_unsubscribe_preferences__token__post
      parameters:
      - name: token
        in: path
        required: true
        schema:
          type: string
          title: Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreferenceUpdateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/unsubscribe/preferences/{token}/data:
    get:
      tags:
      - Unsubscribe Management
      summary: Get Preference Data
      description: "Get current preference data for the preference center\n\nArgs:\n\
        \    token: Encrypted preference center token"
      operationId: get_preference_data_api_unsubscribe_preferences__token__data_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/unsubscribe/subscribe:
    post:
      tags:
      - Unsubscribe Management
      summary: Subscribe Contact
      description: "Subscribe a new contact to email preferences\n\nArgs:\n    subscribe_data:\
        \ Subscription details"
      operationId: subscribe_contact_api_unsubscribe_subscribe_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscribeRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/unsubscribe/confirm/{token}:
    get:
      tags:
      - Unsubscribe Management
      summary: Confirm Subscription
      description: "Confirm subscription from double opt-in token\n\nArgs:\n    token:\
        \ Confirmation token"
      operationId: confirm_subscription_api_unsubscribe_confirm__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/unsubscribe/check-status/{email}:
    get:
      tags:
      - Unsubscribe Management
      summary: Check Subscription Status
      description: "Check if email is unsubscribed (for internal use by email sending\
        \ services)\n\nArgs:\n    email: Email address to check\n    preference_type:\
        \ Specific preference type to check"
      operationId: check_subscription_status_api_unsubscribe_check_status__email__get
      parameters:
      - name: email
        in: path
        required: true
        schema:
          type: string
          title: Email
      - name: preference_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Preference Type
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/unsubscribe/statistics:
    get:
      tags:
      - Unsubscribe Management
      summary: Get Unsubscribe Statistics
      description: "Get unsubscribe statistics for analysis\n\nArgs:\n    days: Number\
        \ of days to analyze\n    campaign_id: Specific campaign ID to analyze"
      operationId: get_unsubscribe_statistics_api_unsubscribe_statistics_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          description: Number of days to analyze
          default: 30
          title: Days
        description: Number of days to analyze
      - name: campaign_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Specific campaign ID
          title: Campaign Id
        description: Specific campaign ID
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /unsubscribe/{token}:
    get:
      tags:
      - Unsubscribe Management
      summary: Unsubscribe Page
      description: "Display unsubscribe page or auto-confirm unsubscribe\n\nArgs:\n\
        \    token: Encrypted unsubscribe token\n    auto_confirm: If True, immediately\
        \ process unsubscribe without showing form"
      operationId: unsubscribe_page_unsubscribe__token__get
      parameters:
      - name: token
        in: path
        required: true
        schema:
          type: string
          title: Token
      - name: auto_confirm
        in: query
        required: false
        schema:
          type: boolean
          description: Auto-confirm unsubscribe without showing form
          default: false
          title: Auto Confirm
        description: Auto-confirm unsubscribe without showing form
      responses:
        '200':
          description: Successful Response
          content:
            text/html:
              schema:
                type: string
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Unsubscribe Management
      summary: Process Unsubscribe
      description: "Process unsubscribe request with reason\n\nArgs:\n    token: Encrypted\
        \ unsubscribe token\n    unsubscribe_data: Unsubscribe reason and details"
      operationId: process_unsubscribe_unsubscribe__token__post
      parameters:
      - name: token
        in: path
        required: true
        schema:
          type: string
          title: Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UnsubscribeRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /unsubscribe/preferences/{token}:
    get:
      tags:
      - Unsubscribe Management
      summary: Preference Center
      description: "Display email preference center\n\nArgs:\n    token: Encrypted\
        \ preference center token"
      operationId: preference_center_unsubscribe_preferences__token__get
      parameters:
      - name: token
        in: path
        required: true
        schema:
          type: string
          title: Token
      responses:
        '200':
          description: Successful Response
          content:
            text/html:
              schema:
                type: string
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Unsubscribe Management
      summary: Update Preferences
      description: "Update email preferences\n\nArgs:\n    token: Encrypted preference\
        \ center token\n    preference_data: Updated preferences"
      operationId: update_preferences_unsubscribe_preferences__token__post
      parameters:
      - name: token
        in: path
        required: true
        schema:
          type: string
          title: Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreferenceUpdateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /unsubscribe/preferences/{token}/data:
    get:
      tags:
      - Unsubscribe Management
      summary: Get Preference Data
      description: "Get current preference data for the preference center\n\nArgs:\n\
        \    token: Encrypted preference center token"
      operationId: get_preference_data_unsubscribe_preferences__token__data_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'
  /unsubscribe/subscribe:
    post:
      tags:
      - Unsubscribe Management
      summary: Subscribe Contact
      description: "Subscribe a new contact to email preferences\n\nArgs:\n    subscribe_data:\
        \ Subscription details"
      operationId: subscribe_contact_unsubscribe_subscribe_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscribeRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /unsubscribe/confirm/{token}:
    get:
      tags:
      - Unsubscribe Management
      summary: Confirm Subscription
      description: "Confirm subscription from double opt-in token\n\nArgs:\n    token:\
        \ Confirmation token"
      operationId: confirm_subscription_unsubscribe_confirm__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'
  /unsubscribe/check-status/{email}:
    get:
      tags:
      - Unsubscribe Management
      summary: Check Subscription Status
      description: "Check if email is unsubscribed (for internal use by email sending\
        \ services)\n\nArgs:\n    email: Email address to check\n    preference_type:\
        \ Specific preference type to check"
      operationId: check_subscription_status_unsubscribe_check_status__email__get
      parameters:
      - name: email
        in: path
        required: true
        schema:
          type: string
          title: Email
      - name: preference_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Preference Type
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /unsubscribe/statistics:
    get:
      tags:
      - Unsubscribe Management
      summary: Get Unsubscribe Statistics
      description: "Get unsubscribe statistics for analysis\n\nArgs:\n    days: Number\
        \ of days to analyze\n    campaign_id: Specific campaign ID to analyze"
      operationId: get_unsubscribe_statistics_unsubscribe_statistics_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          description: Number of days to analyze
          default: 30
          title: Days
        description: Number of days to analyze
      - name: campaign_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Specific campaign ID
          title: Campaign Id
        description: Specific campaign ID
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/templates/preview:
    post:
      tags:
      - Template Preview
      summary: Preview Template
      description: 'Generate preview of template with variable substitution


        Returns rendered template with metadata for specified channel'
      operationId: preview_template_api_templates_preview_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__marketing__template_preview_routes__TemplatePreviewRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/templates/preview/batch:
    post:
      tags:
      - Template Preview
      summary: Preview Template Batch
      description: 'Generate preview for multiple channels simultaneously


        Returns previews for all specified channels with comparative analysis'
      operationId: preview_template_batch_api_templates_preview_batch_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchPreviewRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/templates/preview/html/{channel}:
    get:
      tags:
      - Template Preview
      summary: Preview Template Html
      description: 'Get HTML preview for rendering in iframe or browser


        Returns rendered template as HTML for visual preview'
      operationId: preview_template_html_api_templates_preview_html__channel__get
      parameters:
      - name: channel
        in: path
        required: true
        schema:
          type: string
          title: Channel
      - name: template_content
        in: query
        required: true
        schema:
          type: string
          description: Template content to preview
          title: Template Content
        description: Template content to preview
      - name: contact_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Contact ID for CRM data
          title: Contact Id
        description: Contact ID for CRM data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/templates/variables/discover:
    post:
      tags:
      - Template Preview
      summary: Discover Variables
      description: 'Discover available variables for templates based on CRM data


        Returns list of available variables with sample values and data types'
      operationId: discover_variables_api_templates_variables_discover_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VariableDiscoveryRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/templates/test/send:
    post:
      tags:
      - Template Preview
      summary: Send Test Message
      description: 'Send test message to specified recipient


        Generates preview and sends actual test message via the specified channel'
      operationId: send_test_message_api_templates_test_send_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestMessageRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/templates/variables/extract:
    get:
      tags:
      - Template Preview
      summary: Extract Template Variables
      description: 'Extract variables from template content


        Returns list of variables found in the template'
      operationId: extract_template_variables_api_templates_variables_extract_get
      parameters:
      - name: template_content
        in: query
        required: true
        schema:
          type: string
          description: Template content to analyze
          title: Template Content
        description: Template content to analyze
      - name: subject_template
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Email subject template
          title: Subject Template
        description: Email subject template
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/teams:
    get:
      tags:
      - Teams
      - teams
      summary: Get Teams
      description: Get all teams with pagination and filters
      operationId: get_teams_api_teams_get
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Per Page
      - name: department
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Department
      - name: is_active
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Teams
      - teams
      summary: Create Team
      description: Create new team
      operationId: create_team_api_teams_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TeamCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/teams/{team_id}:
    get:
      tags:
      - Teams
      - teams
      summary: Get Team
      description: Get single team with details
      operationId: get_team_api_teams__team_id__get
      parameters:
      - name: team_id
        in: path
        required: true
        schema:
          type: string
          title: Team Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Teams
      - teams
      summary: Update Team
      description: Update team details
      operationId: update_team_api_teams__team_id__put
      parameters:
      - name: team_id
        in: path
        required: true
        schema:
          type: string
          title: Team Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TeamUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Teams
      - teams
      summary: Delete Team
      description: Delete team (soft delete by default)
      operationId: delete_team_api_teams__team_id__delete
      parameters:
      - name: team_id
        in: path
        required: true
        schema:
          type: string
          title: Team Id
      - name: permanent
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Permanent
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/teams/{team_id}/members:
    get:
      tags:
      - Teams
      - teams
      summary: Get Team Members
      description: Get all members of a team
      operationId: get_team_members_api_teams__team_id__members_get
      parameters:
      - name: team_id
        in: path
        required: true
        schema:
          type: string
          title: Team Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/teams/{team_id}/add-member:
    post:
      tags:
      - Teams
      - teams
      summary: Add Team Member
      description: Add member to team
      operationId: add_team_member_api_teams__team_id__add_member_post
      parameters:
      - name: team_id
        in: path
        required: true
        schema:
          type: string
          title: Team Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddMemberRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/teams/{team_id}/remove-member:
    delete:
      tags:
      - Teams
      - teams
      summary: Remove Team Member
      description: Remove member from team
      operationId: remove_team_member_api_teams__team_id__remove_member_delete
      parameters:
      - name: team_id
        in: path
        required: true
        schema:
          type: string
          title: Team Id
      - name: member_id
        in: query
        required: true
        schema:
          type: string
          title: Member Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/team-members:
    get:
      tags:
      - Team Members
      - team-members
      summary: Get Team Members
      description: Get all team members with pagination and filters
      operationId: get_team_members_api_team_members_get
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Per Page
      - name: team_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Team Id
      - name: department
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Department
      - name: skill_level
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Skill Level
      - name: is_active
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Team Members
      - team-members
      summary: Create Team Member
      description: Create new team member
      operationId: create_team_member_api_team_members_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TeamMemberCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/team-members/search:
    get:
      tags:
      - Team Members
      - team-members
      summary: Search Team Members
      description: Search team members by name, email, or employee ID
      operationId: search_team_members_api_team_members_search_get
      parameters:
      - name: q
        in: query
        required: true
        schema:
          type: string
          minLength: 1
          title: Q
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 50
          minimum: 1
          default: 10
          title: Limit
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/team-members/linked-users:
    get:
      tags:
      - Team Members
      - team-members
      summary: Get Linked Users
      description: Get all user IDs that are already linked to team members
      operationId: get_linked_users_api_team_members_linked_users_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/team-members/export:
    get:
      tags:
      - Team Members
      - team-members
      summary: Export Team Members
      description: Export team members to CSV
      operationId: export_team_members_api_team_members_export_get
      parameters:
      - name: format
        in: query
        required: false
        schema:
          type: string
          pattern: ^(csv|excel)$
          default: csv
          title: Format
      - name: team_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Team Id
      - name: department
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Department
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/team-members/{member_id}:
    get:
      tags:
      - Team Members
      - team-members
      summary: Get Team Member
      description: Get team member details
      operationId: get_team_member_api_team_members__member_id__get
      parameters:
      - name: member_id
        in: path
        required: true
        schema:
          type: string
          title: Member Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Team Members
      - team-members
      summary: Update Team Member
      description: Update team member
      operationId: update_team_member_api_team_members__member_id__put
      parameters:
      - name: member_id
        in: path
        required: true
        schema:
          type: string
          title: Member Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TeamMemberUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Team Members
      - team-members
      summary: Delete Team Member
      description: Delete team member (soft delete by default)
      operationId: delete_team_member_api_team_members__member_id__delete
      parameters:
      - name: member_id
        in: path
        required: true
        schema:
          type: string
          title: Member Id
      - name: permanent
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Permanent
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/team-members/{member_id}/link-user:
    post:
      tags:
      - Team Members
      - team-members
      summary: Link User To Member
      description: Link team member to system user
      operationId: link_user_to_member_api_team_members__member_id__link_user_post
      parameters:
      - name: member_id
        in: path
        required: true
        schema:
          type: string
          title: Member Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LinkUserRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/team-members/{member_id}/unlink-user:
    delete:
      tags:
      - Team Members
      - team-members
      summary: Unlink User From Member
      description: Unlink team member from system user
      operationId: unlink_user_from_member_api_team_members__member_id__unlink_user_delete
      parameters:
      - name: member_id
        in: path
        required: true
        schema:
          type: string
          title: Member Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/team-members/import/preview:
    post:
      tags:
      - Team Members
      - team-members
      summary: Preview Import
      description: Preview team member import file - same pattern as contact import
      operationId: preview_import_api_team_members_import_preview_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_preview_import_api_team_members_import_preview_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/team-members/import/execute:
    post:
      tags:
      - Team Members
      - team-members
      summary: Execute Import
      description: Execute the import
      operationId: execute_import_api_team_members_import_execute_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Request Body
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/comments/workflow/{workflow_id}:
    get:
      tags:
      - Workflow Comments
      summary: Get Workflow Comments
      description: Get all comments for a workflow in threaded format
      operationId: get_workflow_comments_api_comments_workflow__workflow_id__get
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          maximum: 200
          minimum: 1
          default: 50
          title: Per Page
      - name: sort_by
        in: query
        required: false
        schema:
          type: string
          pattern: ^(created_at|top)$
          default: created_at
          title: Sort By
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Workflow Comments
      summary: Create Comment
      description: Create a new comment or reply
      operationId: create_comment_api_comments_workflow__workflow_id__post
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__community__comments_routes__CommentCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/comments/{comment_id}:
    put:
      tags:
      - Workflow Comments
      summary: Update Comment
      description: Update an existing comment (only by original commenter)
      operationId: update_comment_api_comments__comment_id__put
      parameters:
      - name: comment_id
        in: path
        required: true
        schema:
          type: string
          title: Comment Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__community__comments_routes__CommentUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Workflow Comments
      summary: Delete Comment
      description: Delete a comment (soft delete - replaces text with [deleted])
      operationId: delete_comment_api_comments__comment_id__delete
      parameters:
      - name: comment_id
        in: path
        required: true
        schema:
          type: string
          title: Comment Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/comments/{comment_id}/flag:
    post:
      tags:
      - Workflow Comments
      summary: Flag Comment
      description: Flag a comment for moderation
      operationId: flag_comment_api_comments__comment_id__flag_post
      parameters:
      - name: comment_id
        in: path
        required: true
        schema:
          type: string
          title: Comment Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommentFlag'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/profiles/{user_id}:
    get:
      tags:
      - User Profiles
      summary: Get User Profile
      description: Get a user's public profile
      operationId: get_user_profile_api_profiles__user_id__get
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: string
          title: User Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/profiles/me:
    get:
      tags:
      - User Profiles
      summary: Get My Profile
      description: Get current user's profile
      operationId: get_my_profile_api_profiles_me_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
    post:
      tags:
      - User Profiles
      summary: Create Or Update Profile
      description: Create or update current user's profile
      operationId: create_or_update_profile_api_profiles_me_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProfileUpdate'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/profiles/{user_id}/followers:
    get:
      tags:
      - User Profiles
      summary: Get User Followers
      description: Get users who follow this user
      operationId: get_user_followers_api_profiles__user_id__followers_get
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: string
          title: User Id
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          maximum: 200
          minimum: 1
          default: 50
          title: Per Page
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/profiles/{user_id}/following:
    get:
      tags:
      - User Profiles
      summary: Get User Following
      description: Get users that this user follows
      operationId: get_user_following_api_profiles__user_id__following_get
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: string
          title: User Id
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          maximum: 200
          minimum: 1
          default: 50
          title: Per Page
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/profiles/{user_id}/follow:
    post:
      tags:
      - User Profiles
      summary: Follow User
      description: Follow or unfollow a user
      operationId: follow_user_api_profiles__user_id__follow_post
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: string
          title: User Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/interactions/favorite/workflow/{workflow_id}:
    post:
      tags:
      - User Interactions
      summary: Toggle Workflow Favorite
      description: Toggle favorite status for a workflow
      operationId: toggle_workflow_favorite_api_interactions_favorite_workflow__workflow_id__post
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/interactions/bookmark/workflow/{workflow_id}:
    post:
      tags:
      - User Interactions
      summary: Toggle Workflow Bookmark
      description: Toggle bookmark status for a workflow
      operationId: toggle_workflow_bookmark_api_interactions_bookmark_workflow__workflow_id__post
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/interactions/favorites:
    get:
      tags:
      - User Interactions
      summary: Get My Favorites
      description: Get current user's favorite workflows
      operationId: get_my_favorites_api_interactions_favorites_get
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Per Page
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/interactions/bookmarks:
    get:
      tags:
      - User Interactions
      summary: Get My Bookmarks
      description: Get current user's bookmarked workflows
      operationId: get_my_bookmarks_api_interactions_bookmarks_get
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Per Page
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/interactions/history:
    get:
      tags:
      - User Interactions
      summary: Get Interaction History
      description: Get user's interaction history
      operationId: get_interaction_history_api_interactions_history_get
      parameters:
      - name: interaction_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            pattern: ^(favorite|bookmark|follow|helpful|flag)$
          - type: 'null'
          title: Interaction Type
      - name: target_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            pattern: ^(workflow|user|comment|review)$
          - type: 'null'
          title: Target Type
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          maximum: 200
          minimum: 1
          default: 50
          title: Per Page
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/interactions/{interaction_id}:
    delete:
      tags:
      - User Interactions
      summary: Delete Interaction
      description: Delete a specific interaction
      operationId: delete_interaction_api_interactions__interaction_id__delete
      parameters:
      - name: interaction_id
        in: path
        required: true
        schema:
          type: string
          title: Interaction Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/workflow/{workflow_id}/event:
    post:
      tags:
      - Analytics
      summary: Track Workflow Event
      description: Track an analytics event for a workflow
      operationId: track_workflow_event_api_analytics_workflow__workflow_id__event_post
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnalyticsEvent'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/workflow/{workflow_id}/statistics:
    get:
      tags:
      - Analytics
      summary: Get Workflow Statistics
      description: Get comprehensive statistics for a workflow
      operationId: get_workflow_statistics_api_analytics_workflow__workflow_id__statistics_get
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/workflow/{workflow_id}/timeline:
    get:
      tags:
      - Analytics
      summary: Get Workflow Timeline
      description: Get timeline analytics for a workflow
      operationId: get_workflow_timeline_api_analytics_workflow__workflow_id__timeline_get
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      - name: period
        in: query
        required: false
        schema:
          type: string
          pattern: ^(7d|30d|90d|1y|all)$
          default: 30d
          title: Period
      - name: event_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            pattern: ^(view|download|share|fork|all)$
          - type: 'null'
          title: Event Type
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/trending:
    get:
      tags:
      - Analytics
      summary: Get Trending Workflows
      description: Get trending workflows based on recent activity
      operationId: get_trending_workflows_api_analytics_trending_get
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          pattern: ^(1d|7d|30d)$
          default: 7d
          title: Period
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 50
          minimum: 1
          default: 10
          title: Limit
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/analytics/creator/{user_id}/statistics:
    get:
      tags:
      - Analytics
      summary: Get Creator Statistics
      description: Get creator statistics for a user
      operationId: get_creator_statistics_api_analytics_creator__user_id__statistics_get
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: string
          title: User Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/publishing/submit:
    post:
      tags:
      - Publishing Queue
      summary: Submit For Publishing
      description: Submit a workflow for publishing review
      operationId: submit_for_publishing_api_publishing_submit_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublishingSubmit'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/publishing/queue:
    get:
      tags:
      - Publishing Queue
      summary: Get Publishing Queue
      description: Get publishing queue entries (admin only for all, users see their
        own)
      operationId: get_publishing_queue_api_publishing_queue_get
      parameters:
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            pattern: ^(pending|approved|rejected|needs_revision|published)$
          - type: 'null'
          title: Status
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Per Page
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/publishing/queue/{queue_id}/review:
    put:
      tags:
      - Publishing Queue
      summary: Review Publishing Submission
      description: Review a publishing submission (admin only)
      operationId: review_publishing_submission_api_publishing_queue__queue_id__review_put
      parameters:
      - name: queue_id
        in: path
        required: true
        schema:
          type: string
          title: Queue Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__community__publishing_routes__PublishingReview'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/publishing/workflow/{workflow_id}/versions:
    get:
      tags:
      - Publishing Queue
      summary: Get Workflow Versions
      description: Get version history for a workflow
      operationId: get_workflow_versions_api_publishing_workflow__workflow_id__versions_get
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          maximum: 50
          minimum: 1
          default: 10
          title: Per Page
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/publishing/workflow/{workflow_id}/version:
    post:
      tags:
      - Publishing Queue
      summary: Create Workflow Version
      description: Create a new version for a workflow
      operationId: create_workflow_version_api_publishing_workflow__workflow_id__version_post
      parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkflowVersion'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/collections:
    post:
      tags:
      - Workflow Collections
      summary: Create Collection
      description: Create a new workflow collection
      operationId: create_collection_api_collections_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CollectionCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Workflow Collections
      summary: Get My Collections
      description: Get current user's collections
      operationId: get_my_collections_api_collections_get
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Per Page
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/collections/public:
    get:
      tags:
      - Workflow Collections
      summary: Get Public Collections
      description: Get public collections
      operationId: get_public_collections_api_collections_public_get
      parameters:
      - name: user_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: User Id
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Search
      - name: tags
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          title: Tags
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Per Page
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/collections/{collection_id}:
    get:
      tags:
      - Workflow Collections
      summary: Get Collection Details
      description: Get collection details
      operationId: get_collection_details_api_collections__collection_id__get
      parameters:
      - name: collection_id
        in: path
        required: true
        schema:
          type: string
          title: Collection Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Workflow Collections
      summary: Update Collection
      description: Update collection details
      operationId: update_collection_api_collections__collection_id__put
      parameters:
      - name: collection_id
        in: path
        required: true
        schema:
          type: string
          title: Collection Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CollectionUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Workflow Collections
      summary: Delete Collection
      description: Delete a collection
      operationId: delete_collection_api_collections__collection_id__delete
      parameters:
      - name: collection_id
        in: path
        required: true
        schema:
          type: string
          title: Collection Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/collections/{collection_id}/items:
    get:
      tags:
      - Workflow Collections
      summary: Get Collection Items
      description: Get workflows in a collection
      operationId: get_collection_items_api_collections__collection_id__items_get
      parameters:
      - name: collection_id
        in: path
        required: true
        schema:
          type: string
          title: Collection Id
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 20
          title: Per Page
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Workflow Collections
      summary: Add To Collection
      description: Add a workflow to a collection
      operationId: add_to_collection_api_collections__collection_id__items_post
      parameters:
      - name: collection_id
        in: path
        required: true
        schema:
          type: string
          title: Collection Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CollectionItemAdd'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/collections/{collection_id}/items/{workflow_id}:
    delete:
      tags:
      - Workflow Collections
      summary: Remove From Collection
      description: Remove a workflow from a collection
      operationId: remove_from_collection_api_collections__collection_id__items__workflow_id__delete
      parameters:
      - name: collection_id
        in: path
        required: true
        schema:
          type: string
          title: Collection Id
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          title: Workflow Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/collections/{collection_id}/subscribe:
    post:
      tags:
      - Workflow Collections
      summary: Toggle Collection Subscription
      description: Subscribe or unsubscribe from a collection
      operationId: toggle_collection_subscription_api_collections__collection_id__subscribe_post
      parameters:
      - name: collection_id
        in: path
        required: true
        schema:
          type: string
          title: Collection Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/public/crm/contacts:
    post:
      tags:
      - Public API
      - Public API
      summary: Create Contact Public
      description: 'Create a new contact via public API


        This endpoint allows external applications to create contacts in your CRM

        using API key authentication.


        Required header:

        - X-API-Key: Your API key


        Returns:

        - 201: Contact created successfully with contact ID and details

        - 400: Invalid request data

        - 401: Invalid or missing API key

        - 403: API key lacks required permissions

        - 429: Rate limit exceeded'
      operationId: create_contact_public_api_public_crm_contacts_post
      parameters:
      - name: x-api-key
        in: header
        required: true
        schema:
          type: string
          description: API Key for authentication
          title: X-Api-Key
        description: API Key for authentication
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublicContactCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/public/crm/contacts/{contact_id}:
    put:
      tags:
      - Public API
      - Public API
      summary: Update Contact Public
      description: 'Update an existing contact via public API


        Limited fields can be updated:

        - first_name, last_name

        - phone, job_title

        - company

        - tags (appends to existing)

        - custom_fields (merges with existing)'
      operationId: update_contact_public_api_public_crm_contacts__contact_id__put
      parameters:
      - name: contact_id
        in: path
        required: true
        schema:
          type: string
          title: Contact Id
      - name: x-api-key
        in: header
        required: true
        schema:
          type: string
          description: API Key for authentication
          title: X-Api-Key
        description: API Key for authentication
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              title: Update Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /track/open/{encoded_data}:
    get:
      tags:
      - Email Tracking
      - Email Tracking
      summary: Track Email Open
      description: 'Track email open event and return a 1x1 transparent pixel


        This endpoint is called when the tracking pixel in an email is loaded.'
      operationId: track_email_open_track_open__encoded_data__get
      parameters:
      - name: encoded_data
        in: path
        required: true
        schema:
          type: string
          title: Encoded Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /track/click/{encoded_data}:
    get:
      tags:
      - Email Tracking
      - Email Tracking
      summary: Track Email Click
      description: 'Track email click event and redirect to the original URL


        This endpoint is called when a tracked link in an email is clicked.'
      operationId: track_email_click_track_click__encoded_data__get
      parameters:
      - name: encoded_data
        in: path
        required: true
        schema:
          type: string
          title: Encoded Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /track/pixel/{tracking_id}.gif:
    get:
      tags:
      - Email Tracking
      - Email Tracking
      summary: Legacy Tracking Pixel
      description: 'Legacy tracking pixel endpoint for backward compatibility


        This is a simpler tracking endpoint that just uses a tracking ID.'
      operationId: legacy_tracking_pixel_track_pixel__tracking_id__gif_get
      parameters:
      - name: tracking_id
        in: path
        required: true
        schema:
          type: string
          title: Tracking Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /s/{short_code}:
    get:
      tags:
      - SMS Tracking
      summary: Handle Sms Click
      description: 'Handle SMS link click and redirect


        This is a public endpoint that:

        1. Looks up the destination URL

        2. Records the click event

        3. Emits campaign activity event

        4. Redirects to the destination'
      operationId: handle_sms_click_s__short_code__get
      parameters:
      - name: short_code
        in: path
        required: true
        schema:
          type: string
          title: Short Code
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/sms/tracking/stats/{campaign_id}:
    get:
      tags:
      - SMS Tracking
      summary: Get Sms Tracking Stats
      description: "Get SMS tracking statistics for a campaign\n\nArgs:\n    campaign_id:\
        \ Campaign ID\n    org_id: Organization ID (from auth)\n    \nReturns:\n \
        \   SMS tracking statistics"
      operationId: get_sms_tracking_stats_api_sms_tracking_stats__campaign_id__get
      parameters:
      - name: campaign_id
        in: path
        required: true
        schema:
          type: string
          title: Campaign Id
      - name: org_id
        in: query
        required: true
        schema:
          type: string
          title: Org Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/public/tracking/{org_id}/identify:
    post:
      tags:
      - Visitor Tracking
      - Public Tracking
      summary: Identify Visitor
      description: 'Identify or create a visitor session


        Returns visitor_id and session_id for subsequent tracking calls'
      operationId: identify_visitor_api_public_tracking__org_id__identify_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/VisitorData'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/public/tracking/{org_id}/page-view:
    post:
      tags:
      - Visitor Tracking
      - Public Tracking
      summary: Track Page View
      description: 'Track a page view


        Extracts UTM parameters and attribution data from the URL.

        When ASYNC_TRACKING_ENABLED=true, queues to Redis for async batch processing.'
      operationId: track_page_view_api_public_tracking__org_id__page_view_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/PageViewData'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/public/tracking/{org_id}/event:
    post:
      tags:
      - Visitor Tracking
      - Public Tracking
      summary: Track Event
      description: 'Track a custom event (button click, video play, download, etc.)

        When ASYNC_TRACKING_ENABLED=true, queues to Redis for async batch processing.'
      operationId: track_event_api_public_tracking__org_id__event_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/routes__public__tracking_routes__EventData'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/public/tracking/{org_id}/form-interaction:
    post:
      tags:
      - Visitor Tracking
      - Public Tracking
      summary: Track Form Interaction
      description: 'Track form interactions (view, field focus, submission, etc.)

        When ASYNC_TRACKING_ENABLED=true, queues to Redis for async batch processing.'
      operationId: track_form_interaction_api_public_tracking__org_id__form_interaction_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/FormInteractionData'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/public/tracking/{org_id}/batch:
    post:
      tags:
      - Visitor Tracking
      - Public Tracking
      summary: Track Batch Events
      description: 'Track multiple events in a single request using multi-row INSERT
        for performance.

        Groups events by type and inserts each group in a single database query.'
      operationId: track_batch_events_api_public_tracking__org_id__batch_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/BatchEventData'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/public/tracking/{org_id}/link-contact:
    post:
      tags:
      - Visitor Tracking
      - Public Tracking
      summary: Link Visitor To Contact
      description: Link a visitor to a contact when they become identified (login,
        form submission, etc.)
      operationId: link_visitor_to_contact_api_public_tracking__org_id__link_contact_post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/public/tracking/{org_id}/identify-user:
    post:
      tags:
      - Visitor Tracking
      - Public Tracking
      summary: Identify User By Email
      description: "Identify a visitor by email - finds or creates a contact and links\
        \ the visitor.\n\nThis is the public API for customers to identify visitors\
        \ from their own\nforms/auth systems (Shopify, WordPress, etc.) without using\
        \ Expedify forms.\n\nExample usage in customer's JavaScript:\n```javascript\n\
        ExpedifyTracker.identify({\n    email: 'customer@example.com',\n    name:\
        \ 'John Doe',\n    phone: '+1234567890'\n});\n```"
      operationId: identify_user_by_email_api_public_tracking__org_id__identify_user_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/IdentifyUserData'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/public/tracking/{org_id}/visitor/{visitor_id}/journey:
    get:
      tags:
      - Visitor Tracking
      - Public Tracking
      summary: Get Visitor Journey
      description: 'Get complete visitor journey data


        This endpoint requires authentication or special access token'
      operationId: get_visitor_journey_api_public_tracking__org_id__visitor__visitor_id__journey_get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: visitor_id
        in: path
        required: true
        schema:
          type: string
          title: Visitor Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/public/tracking/{org_id}/active-visitors:
    get:
      tags:
      - Visitor Tracking
      - Public Tracking
      summary: Get Active Visitors
      description: 'Get currently active visitors


        This endpoint requires authentication'
      operationId: get_active_visitors_api_public_tracking__org_id__active_visitors_get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: minutes
        in: query
        required: false
        schema:
          type: integer
          default: 5
          title: Minutes
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/public/tracking/{org_id}/pixel.gif:
    get:
      tags:
      - Visitor Tracking
      - Public Tracking
      summary: Visitor Tracking Pixel
      description: '1x1 transparent pixel for visitor tracking fallback

        Used when main API calls fail (e.g., due to CORS or network issues)'
      operationId: visitor_tracking_pixel_api_public_tracking__org_id__pixel_gif_get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: visitor_id
        in: query
        required: false
        schema:
          type: string
          title: Visitor Id
      - name: session_id
        in: query
        required: false
        schema:
          type: string
          title: Session Id
      - name: page_url
        in: query
        required: false
        schema:
          type: string
          title: Page Url
      - name: referrer
        in: query
        required: false
        schema:
          type: string
          title: Referrer
      - name: fallback
        in: query
        required: false
        schema:
          type: string
          title: Fallback
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/public/tracking/{org_id}/pixel/{tracking_id}.gif:
    get:
      tags:
      - Visitor Tracking
      - Public Tracking
      summary: Tracking Pixel
      description: 1x1 transparent pixel for email open tracking
      operationId: tracking_pixel_api_public_tracking__org_id__pixel__tracking_id__gif_get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: tracking_id
        in: path
        required: true
        schema:
          type: string
          title: Tracking Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /redirect/{target_url}:
    get:
      tags:
      - Redirect
      - Redirect
      summary: Redirect To Url
      description: "Simple redirect endpoint for WhatsApp button URLs\n\nExample:\n\
        - Input: /redirect/technocravers.com/ or /redirect/technocravers.com/signup\n\
        - Output: Redirects to https://technocravers.com/ or https://technocravers.com/signup\n\
        \nArgs:\n    target_url: The target URL path (without protocol)\n\nReturns:\n\
        \    FastAPI RedirectResponse (302)"
      operationId: redirect_to_url_redirect__target_url__get
      parameters:
      - name: target_url
        in: path
        required: true
        schema:
          type: string
          title: Target Url
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /webhooks/resend/{org_id}/{integration_id}:
    post:
      tags:
      - Resend Webhooks
      - Resend Webhooks
      summary: Handle Resend Webhook
      description: "Handle Resend webhook events for email delivery tracking.\n\n\
        This endpoint receives webhook events from Resend for:\n- Delivery confirmations\
        \ (email.delivered)\n- Bounce notifications (email.bounced)\n- Spam complaints\
        \ (email.complained)\n- Send failures (email.failed)\n\nNote: We do NOT track\
        \ email.opened or email.clicked via webhooks\nbecause we have our own self-tracking\
        \ system using pixels and URL wrapping.\n\nArgs:\n    org_id: Organization\
        \ ID (from URL path)\n    integration_id: Integration ID (from URL path) -\
        \ supports multiple Resend integrations\n    request: FastAPI request with\
        \ webhook payload\n\nReturns:\n    Success response to acknowledge webhook\
        \ receipt"
      operationId: handle_resend_webhook_webhooks_resend__org_id___integration_id__post
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /webhooks/resend/{org_id}/{integration_id}/health:
    get:
      tags:
      - Resend Webhooks
      - Resend Webhooks
      summary: Webhook Health Check
      description: 'Health check endpoint to verify webhook endpoint is accessible.


        This can be used by Resend or monitoring systems to verify the webhook

        endpoint is responding correctly.'
      operationId: webhook_health_check_webhooks_resend__org_id___integration_id__health_get
      parameters:
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /webhooks/resend/master:
    post:
      tags:
      - Resend Webhooks
      - Resend Webhooks
      summary: Handle Master Resend Webhook Auto
      description: "Master webhook endpoint with AUTO-DETECTION of master integration.\n\
        \nThis is the SIMPLE URL version - just use /webhooks/resend/master\nand the\
        \ system will automatically find your master Resend integration.\n\nIf you\
        \ have multiple master integrations, use the explicit URL:\n/webhooks/resend/master/{integration_id}\n\
        \nThis endpoint:\n1. Auto-detects active master Resend integration from database\n\
        2. Delegates to the explicit handler\n\nArgs:\n    request: FastAPI request\
        \ with webhook payload\n\nReturns:\n    Success response to acknowledge webhook\
        \ receipt"
      operationId: handle_master_resend_webhook_auto_webhooks_resend_master_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /webhooks/resend/master/{integration_id}:
    post:
      tags:
      - Resend Webhooks
      - Resend Webhooks
      summary: Handle Master Resend Webhook
      description: "Handle Resend webhook events from MASTER integration (multi-domain).\n\
        \nEXPLICIT integration ID version - use this if you have multiple master integrations.\n\
        For simple setup with one master integration, use /webhooks/resend/master\
        \ instead.\n\nThis endpoint:\n1. Receives webhooks from master Resend account\n\
        2. Stores events in master DB\n3. Returns 200 OK immediately\n4. Processes\
        \ asynchronously and routes to org DBs based on domain\n\nMaster webhook flow:\n\
        - Single Resend account manages multiple domains\n- Webhook events stored\
        \ in master_resend_webhook_events table\n- Background task routes to appropriate\
        \ org based on domain config\n- Existing org-level webhooks remain unchanged\n\
        \nArgs:\n    integration_id: Master integration ID (from URL path)\n    request:\
        \ FastAPI request with webhook payload\n\nReturns:\n    Success response to\
        \ acknowledge webhook receipt"
      operationId: handle_master_resend_webhook_webhooks_resend_master__integration_id__post
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /webhooks/resend/master/health:
    get:
      tags:
      - Resend Webhooks
      - Resend Webhooks
      summary: Master Webhook Health Check Auto
      description: Health check endpoint for master webhook (auto-detect version).
      operationId: master_webhook_health_check_auto_webhooks_resend_master_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /webhooks/resend/master/{integration_id}/health:
    get:
      tags:
      - Resend Webhooks
      - Resend Webhooks
      summary: Master Webhook Health Check
      description: Health check endpoint for master webhook (explicit integration
        ID version).
      operationId: master_webhook_health_check_webhooks_resend_master__integration_id__health_get
      parameters:
      - name: integration_id
        in: path
        required: true
        schema:
          type: string
          title: Integration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /expedify-tracking.js:
    get:
      tags:
      - Tracking Script
      - Tracking Script
      summary: Get Tracking Script
      description: Serve the tracking JavaScript with environment-specific configuration
      operationId: get_tracking_script_expedify_tracking_js_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/v1/test:
    get:
      tags:
      - External API
      - external-api
      summary: Test External Api
      description: Test endpoint to verify external API is working
      operationId: test_external_api_api_v1_test_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/v1/add/contacts:
    post:
      tags:
      - External API
      - external-api
      summary: Add Contact
      description: Create a new contact via external API (with phone priority merge
        logic)
      operationId: add_contact_api_v1_add_contacts_post
      parameters:
      - name: X-API-Key
        in: header
        required: true
        schema:
          type: string
          title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactData'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/update/contacts:
    post:
      tags:
      - External API
      - external-api
      summary: Update Contact
      description: Update an existing contact via external API (phone priority - update
        old contact with new email)
      operationId: update_contact_api_v1_update_contacts_post
      parameters:
      - name: X-API-Key
        in: header
        required: true
        schema:
          type: string
          title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactData'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/add/companies:
    post:
      tags:
      - External API
      - external-api
      summary: Create Company
      description: Create a new company via external API
      operationId: create_company_api_v1_add_companies_post
      parameters:
      - name: X-API-Key
        in: header
        required: true
        schema:
          type: string
          title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompanyData'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/add/deals:
    post:
      tags:
      - External API
      - external-api
      summary: Create Deal
      description: Create a new deal via external API
      operationId: create_deal_api_v1_add_deals_post
      parameters:
      - name: X-API-Key
        in: header
        required: true
        schema:
          type: string
          title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DealData'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/events:
    post:
      tags:
      - External API
      - external-api
      summary: Track Event
      description: Track custom events via external API
      operationId: track_event_api_v1_events_post
      parameters:
      - name: X-API-Key
        in: header
        required: true
        schema:
          type: string
          title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__public__external_api_routes__EventData'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /chat-widget.js:
    get:
      tags:
      - Chat Widget
      summary: Serve Chat Widget Script
      description: Serve the chat widget JavaScript file
      operationId: serve_chat_widget_script_chat_widget_js_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
    options:
      tags:
      - Chat Widget
      summary: Chat Widget Options
      description: Handle preflight OPTIONS requests for chat widget script
      operationId: chat_widget_options_chat_widget_js_options
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /chat/widget:
    post:
      tags:
      - Chat Widget
      summary: Chat Widget Message
      description: Handle chat messages from embedded widgets
      operationId: chat_widget_message_chat_widget_post
      parameters:
      - name: X-API-Key
        in: header
        required: true
        schema:
          type: string
          title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatWidgetRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatWidgetResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    options:
      tags:
      - Chat Widget
      summary: Chat Widget Options
      description: Handle preflight requests for chat widget API
      operationId: chat_widget_options_chat_widget_options
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /chat/widget/health:
    get:
      tags:
      - Chat Widget
      summary: Widget Health Check
      description: Simple health check for chat widget functionality
      operationId: widget_health_check_chat_widget_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /chat/widget/transcribe:
    post:
      tags:
      - Chat Widget
      summary: Widget Voice Transcribe
      description: 'Handle voice transcription for embedded widgets

        Uses API key authentication instead of session-based auth'
      operationId: widget_voice_transcribe_chat_widget_transcribe_post
      parameters:
      - name: X-API-Key
        in: header
        required: true
        schema:
          type: string
          title: X-Api-Key
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    options:
      tags:
      - Chat Widget
      summary: Widget Transcribe Options
      description: Handle preflight requests for widget voice transcription
      operationId: widget_transcribe_options_chat_widget_transcribe_options
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /chat/widget/voice-call/initiate:
    post:
      tags:
      - Chat Widget
      summary: Widget Initiate Voice Call
      description: 'Initiate a voice call session for the chat widget.

        Returns the WebSocket URL and session ID for establishing the voice connection.'
      operationId: widget_initiate_voice_call_chat_widget_voice_call_initiate_post
      parameters:
      - name: X-API-Key
        in: header
        required: true
        schema:
          type: string
          title: X-Api-Key
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    options:
      tags:
      - Chat Widget
      summary: Widget Voice Call Options
      description: Handle preflight requests for widget voice call initiation
      operationId: widget_voice_call_options_chat_widget_voice_call_initiate_options
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /expedify-pixel.js:
    get:
      tags:
      - Pixel Script
      - Pixel Script
      summary: Get Pixel Script
      description: Serve the expedify-pixel.js tracking script
      operationId: get_pixel_script_expedify_pixel_js_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/tracker.js:
    get:
      tags:
      - Tracker Script
      - Tracker Script
      summary: Get Tracker Script
      description: Serve the tracker.js script with organization-specific configuration
      operationId: get_tracker_script_api_tracker_js_get
      parameters:
      - name: org_id
        in: query
        required: true
        schema:
          type: string
          description: Organization ID for tracking
          title: Org Id
        description: Organization ID for tracking
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/onboarding/progress:
    get:
      tags:
      - Onboarding
      - onboarding
      summary: Get Onboarding Progress
      operationId: get_onboarding_progress_api_onboarding_progress_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OnboardingProgressResponse'
  /api/onboarding/step/complete:
    post:
      tags:
      - Onboarding
      - onboarding
      summary: Complete Step
      operationId: complete_step_api_onboarding_step_complete_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompleteStepRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/onboarding/skip:
    post:
      tags:
      - Onboarding
      - onboarding
      summary: Skip Onboarding
      operationId: skip_onboarding_api_onboarding_skip_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/onboarding/dismiss:
    post:
      tags:
      - Onboarding
      - onboarding
      summary: Dismiss Onboarding
      operationId: dismiss_onboarding_api_onboarding_dismiss_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/onboarding/reset:
    post:
      tags:
      - Onboarding
      - onboarding
      summary: Reset Onboarding
      operationId: reset_onboarding_api_onboarding_reset_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/onboarding/start:
    post:
      tags:
      - Onboarding
      - onboarding
      summary: Start Onboarding
      operationId: start_onboarding_api_onboarding_start_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/onboarding/check-completion:
    get:
      tags:
      - Onboarding
      - onboarding
      summary: Check Completion Status
      operationId: check_completion_status_api_onboarding_check_completion_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/pd/preview:
    post:
      tags:
      - PDF Generation
      - PDF Generation
      summary: Generate Pdf Preview
      description: 'Generate an HTML preview of the PDF layout.

        Uses html2canvas approach on frontend for actual preview rendering.'
      operationId: generate_pdf_preview_api_pd_preview_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PDFPreviewRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PDFPreviewResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/traces:
    get:
      tags:
      - AI Evaluation
      - ai-eval
      summary: List Traces
      description: List LLM traces with filtering options
      operationId: list_traces_api_ai_eval_traces_get
      parameters:
      - name: workflow_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Id
      - name: name
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
      - name: level
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Level
      - name: user_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: User Id
      - name: from_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: From Date
      - name: to_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: To Date
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 500
          default: 50
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          default: 0
          title: Offset
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/traces/{trace_id}:
    get:
      tags:
      - AI Evaluation
      - ai-eval
      summary: Get Trace
      description: Get a single trace with its observations
      operationId: get_trace_api_ai_eval_traces__trace_id__get
      parameters:
      - name: trace_id
        in: path
        required: true
        schema:
          type: string
          title: Trace Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - AI Evaluation
      - ai-eval
      summary: Delete Trace
      description: Delete a trace and its related data
      operationId: delete_trace_api_ai_eval_traces__trace_id__delete
      parameters:
      - name: trace_id
        in: path
        required: true
        schema:
          type: string
          title: Trace Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/traces/{trace_id}/observations:
    get:
      tags:
      - AI Evaluation
      - ai-eval
      summary: Get Trace Observations
      description: Get observations for a specific trace
      operationId: get_trace_observations_api_ai_eval_traces__trace_id__observations_get
      parameters:
      - name: trace_id
        in: path
        required: true
        schema:
          type: string
          title: Trace Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/scores:
    post:
      tags:
      - AI Evaluation
      - ai-eval
      summary: Create Score
      description: 'Create a new score for a trace or observation.


        Each evaluation run creates a new score record, building up a history

        of scores over time.'
      operationId: create_score_api_ai_eval_scores_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScoreCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScoreResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/scores/trace/{trace_id}:
    get:
      tags:
      - AI Evaluation
      - ai-eval
      summary: Get Scores For Trace
      description: Get all scores for a specific trace
      operationId: get_scores_for_trace_api_ai_eval_scores_trace__trace_id__get
      parameters:
      - name: trace_id
        in: path
        required: true
        schema:
          type: string
          title: Trace Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/scores/{score_id}:
    delete:
      tags:
      - AI Evaluation
      - ai-eval
      summary: Delete Score
      description: Delete a score
      operationId: delete_score_api_ai_eval_scores__score_id__delete
      parameters:
      - name: score_id
        in: path
        required: true
        schema:
          type: string
          title: Score Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/scores/aggregate:
    post:
      tags:
      - AI Evaluation
      - ai-eval
      summary: Aggregate Scores
      description: 'Parse raw LLM response and compute structured aggregated scores

        using the evaluator''s linked score configs.'
      operationId: aggregate_scores_api_ai_eval_scores_aggregate_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AggregateScoresRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/analytics/summary:
    get:
      tags:
      - AI Evaluation
      - ai-eval
      summary: Get Analytics Summary
      description: Get summary analytics for LLM traces
      operationId: get_analytics_summary_api_ai_eval_analytics_summary_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          maximum: 90
          minimum: 1
          default: 7
          title: Days
      - name: workflow_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Id
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/analytics/by-workflow:
    get:
      tags:
      - AI Evaluation
      - ai-eval
      summary: Get Analytics By Workflow
      description: Get analytics grouped by workflow
      operationId: get_analytics_by_workflow_api_ai_eval_analytics_by_workflow_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          maximum: 90
          minimum: 1
          default: 7
          title: Days
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/analytics/by-model:
    get:
      tags:
      - AI Evaluation
      - ai-eval
      summary: Get Analytics By Model
      description: Get analytics grouped by LLM model
      operationId: get_analytics_by_model_api_ai_eval_analytics_by_model_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          maximum: 90
          minimum: 1
          default: 7
          title: Days
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/analytics/by-prompt:
    get:
      tags:
      - AI Evaluation
      summary: Get Analytics By Prompt
      description: Get aggregated analytics grouped by prompt
      operationId: get_analytics_by_prompt_api_ai_eval_analytics_by_prompt_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          description: Number of days to analyze
          default: 7
          title: Days
        description: Number of days to analyze
      - name: workflow_slug
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Slug
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Analytics By Prompt Api Ai Eval Analytics By Prompt
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/analytics/scores-summary:
    get:
      tags:
      - AI Evaluation
      - ai-eval
      summary: Get Scores Summary
      description: Get summary of evaluation scores with observation type and coverage
      operationId: get_scores_summary_api_ai_eval_analytics_scores_summary_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          maximum: 90
          minimum: 1
          default: 7
          title: Days
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/analytics/scores-trends:
    get:
      tags:
      - AI Evaluation
      - ai-eval
      summary: Get Scores Trends
      description: "Get daily score trends for time-series visualization.\n\nscope:\n\
        \  - all (default): all scores\n  - trace: effective trace scores (explicit\
        \ OR aggregated from observations)\n  - observation: observation-level scores\
        \ only"
      operationId: get_scores_trends_api_ai_eval_analytics_scores_trends_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          maximum: 90
          minimum: 1
          default: 7
          title: Days
      - name: scope
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            pattern: ^(all|trace|observation)$
          - type: 'null'
          default: all
          title: Scope
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/analytics/trace-score-distribution:
    get:
      tags:
      - AI Evaluation
      - ai-eval
      summary: Get Trace Score Distribution
      description: 'Get trace-level score distribution in 10 buckets (0-10%, 10-20%,
        ... 90-100%).


        Includes both explicit trace-level scores AND computed aggregates from observation
        scores.'
      operationId: get_trace_score_distribution_api_ai_eval_analytics_trace_score_distribution_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          maximum: 90
          minimum: 1
          default: 7
          title: Days
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/analytics/dimension-scores:
    get:
      tags:
      - AI Evaluation
      - ai-eval
      summary: Get Dimension Scores
      description: Get dimension-level score analytics from metadata JSONB
      operationId: get_dimension_scores_api_ai_eval_analytics_dimension_scores_get
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
          maximum: 90
          minimum: 1
          default: 7
          title: Days
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/score-configs:
    get:
      tags:
      - AI Evaluation
      summary: Get Score Configs
      description: Get all score configs
      operationId: get_score_configs_api_ai_eval_score_configs_get
      parameters:
      - name: include_system
        in: query
        required: false
        schema:
          type: boolean
          description: Include system score configs
          default: true
          title: Include System
        description: Include system score configs
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Score Configs Api Ai Eval Score Configs Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - AI Evaluation
      summary: Create Score Config
      description: Create a new score config
      operationId: create_score_config_api_ai_eval_score_configs_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScoreConfigCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Score Config Api Ai Eval Score Configs Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/score-configs/{config_id}:
    put:
      tags:
      - AI Evaluation
      summary: Update Score Config
      description: Update an existing score config
      operationId: update_score_config_api_ai_eval_score_configs__config_id__put
      parameters:
      - name: config_id
        in: path
        required: true
        schema:
          type: string
          title: Config Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScoreConfigCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Score Config Api Ai Eval Score Configs  Config
                  Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - AI Evaluation
      summary: Delete Score Config
      description: Delete a score config (soft delete by setting is_active=false)
      operationId: delete_score_config_api_ai_eval_score_configs__config_id__delete
      parameters:
      - name: config_id
        in: path
        required: true
        schema:
          type: string
          title: Config Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Score Config Api Ai Eval Score Configs  Config
                  Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/evaluators:
    get:
      tags:
      - AI Evaluation
      summary: Get Evaluators
      description: Get all LLM evaluators with their linked golden sets and score
        configs
      operationId: get_evaluators_api_ai_eval_evaluators_get
      parameters:
      - name: evaluator_type
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Evaluator Type
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Evaluators Api Ai Eval Evaluators Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - AI Evaluation
      summary: Create Evaluator
      description: Create a new LLM evaluator with optional golden sets and score
        configs
      operationId: create_evaluator_api_ai_eval_evaluators_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LLMEvaluatorCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Evaluator Api Ai Eval Evaluators Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/evaluators/{evaluator_id}:
    put:
      tags:
      - AI Evaluation
      summary: Update Evaluator
      description: Update an existing LLM evaluator with golden sets and score configs
      operationId: update_evaluator_api_ai_eval_evaluators__evaluator_id__put
      parameters:
      - name: evaluator_id
        in: path
        required: true
        schema:
          type: string
          title: Evaluator Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LLMEvaluatorCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Evaluator Api Ai Eval Evaluators  Evaluator
                  Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - AI Evaluation
      summary: Delete Evaluator
      description: Delete an LLM evaluator (soft delete by setting is_active=false)
      operationId: delete_evaluator_api_ai_eval_evaluators__evaluator_id__delete
      parameters:
      - name: evaluator_id
        in: path
        required: true
        schema:
          type: string
          title: Evaluator Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Evaluator Api Ai Eval Evaluators  Evaluator
                  Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/evaluators/templates:
    get:
      tags:
      - AI Evaluation
      summary: Get Evaluator Templates
      description: Get pre-built evaluator templates
      operationId: get_evaluator_templates_api_ai_eval_evaluators_templates_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Evaluator Templates Api Ai Eval Evaluators Templates
                  Get
  /api/ai-eval/evaluators/generate-prompt:
    post:
      tags:
      - AI Evaluation
      summary: Generate Prompt
      description: Auto-generate an evaluation prompt from selected score configs.
      operationId: generate_prompt_api_ai_eval_evaluators_generate_prompt_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromptGenerateRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Generate Prompt Api Ai Eval Evaluators Generate Prompt
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/workflow-evaluators/{workflow_slug}:
    get:
      tags:
      - AI Evaluation
      summary: Get Workflow Evaluators
      description: Get evaluators configured for a workflow
      operationId: get_workflow_evaluators_api_ai_eval_workflow_evaluators__workflow_slug__get
      parameters:
      - name: workflow_slug
        in: path
        required: true
        schema:
          type: string
          title: Workflow Slug
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Workflow Evaluators Api Ai Eval Workflow Evaluators  Workflow
                  Slug  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/workflow-evaluators:
    post:
      tags:
      - AI Evaluation
      summary: Create Workflow Evaluator Config
      description: Add an evaluator to a workflow
      operationId: create_workflow_evaluator_config_api_ai_eval_workflow_evaluators_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkflowEvaluatorConfigCreate'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Create Workflow Evaluator Config Api Ai Eval Workflow
                  Evaluators Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/workflow-evaluators/{config_id}:
    delete:
      tags:
      - AI Evaluation
      summary: Remove Workflow Evaluator
      description: Remove an evaluator from a workflow
      operationId: remove_workflow_evaluator_api_ai_eval_workflow_evaluators__config_id__delete
      parameters:
      - name: config_id
        in: path
        required: true
        schema:
          type: string
          title: Config Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Remove Workflow Evaluator Api Ai Eval Workflow Evaluators  Config
                  Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/analytics/prompt/{prompt_id}:
    get:
      tags:
      - AI Evaluation
      summary: Get Prompt Analytics
      description: Get detailed analytics for a specific prompt
      operationId: get_prompt_analytics_api_ai_eval_analytics_prompt__prompt_id__get
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      - name: days
        in: query
        required: false
        schema:
          type: integer
          default: 7
          title: Days
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Prompt Analytics Api Ai Eval Analytics Prompt  Prompt
                  Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/annotation-queues:
    get:
      tags:
      - AI Evaluation
      summary: Get Annotation Queues
      description: Get all annotation queues for the organization
      operationId: get_annotation_queues_api_ai_eval_annotation_queues_get
      parameters:
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by status (active, paused, completed)
          title: Status
        description: Filter by status (active, paused, completed)
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Annotation Queues Api Ai Eval Annotation Queues
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - AI Evaluation
      summary: Create Annotation Queue
      description: Create a new annotation queue
      operationId: create_annotation_queue_api_ai_eval_annotation_queues_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnnotationQueueCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Annotation Queue Api Ai Eval Annotation Queues
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/annotation-queues/{queue_id}/status:
    put:
      tags:
      - AI Evaluation
      summary: Update Queue Status
      description: Update annotation queue status
      operationId: update_queue_status_api_ai_eval_annotation_queues__queue_id__status_put
      parameters:
      - name: queue_id
        in: path
        required: true
        schema:
          type: string
          title: Queue Id
      - name: status
        in: query
        required: true
        schema:
          type: string
          description: New status (active, paused, completed)
          title: Status
        description: New status (active, paused, completed)
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Queue Status Api Ai Eval Annotation Queues  Queue
                  Id  Status Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/annotation-queues/{queue_id}/items:
    get:
      tags:
      - AI Evaluation
      summary: Get Queue Items
      description: Get items in an annotation queue
      operationId: get_queue_items_api_ai_eval_annotation_queues__queue_id__items_get
      parameters:
      - name: queue_id
        in: path
        required: true
        schema:
          type: string
          title: Queue Id
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by status
          title: Status
        description: Filter by status
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          default: 50
          title: Limit
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Queue Items Api Ai Eval Annotation Queues  Queue
                  Id  Items Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - AI Evaluation
      summary: Add Queue Item
      description: Add an item to an annotation queue
      operationId: add_queue_item_api_ai_eval_annotation_queues__queue_id__items_post
      parameters:
      - name: queue_id
        in: path
        required: true
        schema:
          type: string
          title: Queue Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnnotationQueueItemCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Add Queue Item Api Ai Eval Annotation Queues  Queue
                  Id  Items Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/annotation-queues/{queue_id}/populate:
    post:
      tags:
      - AI Evaluation
      summary: Populate Queue
      description: Auto-populate queue with observations matching criteria
      operationId: populate_queue_api_ai_eval_annotation_queues__queue_id__populate_post
      parameters:
      - name: queue_id
        in: path
        required: true
        schema:
          type: string
          title: Queue Id
      - name: days
        in: query
        required: false
        schema:
          type: integer
          description: Days of observations to consider
          default: 7
          title: Days
        description: Days of observations to consider
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 500
          description: Maximum items to add
          default: 100
          title: Limit
        description: Maximum items to add
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Populate Queue Api Ai Eval Annotation Queues  Queue
                  Id  Populate Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/annotation-queues/next-item:
    get:
      tags:
      - AI Evaluation
      summary: Get Next Item
      description: Get next item to annotate (assigns to current user)
      operationId: get_next_item_api_ai_eval_annotation_queues_next_item_get
      parameters:
      - name: queue_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Specific queue to get from
          title: Queue Id
        description: Specific queue to get from
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Next Item Api Ai Eval Annotation Queues Next Item
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/annotation-queue-items/{item_id}/annotate:
    post:
      tags:
      - AI Evaluation
      summary: Submit Annotation
      description: Submit annotation for an item
      operationId: submit_annotation_api_ai_eval_annotation_queue_items__item_id__annotate_post
      parameters:
      - name: item_id
        in: path
        required: true
        schema:
          type: string
          title: Item Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnnotationSubmit'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Submit Annotation Api Ai Eval Annotation Queue Items  Item
                  Id  Annotate Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/annotation-queue-items/{item_id}/skip:
    post:
      tags:
      - AI Evaluation
      summary: Skip Item
      description: Skip an annotation item
      operationId: skip_item_api_ai_eval_annotation_queue_items__item_id__skip_post
      parameters:
      - name: item_id
        in: path
        required: true
        schema:
          type: string
          title: Item Id
      - name: reason
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Reason
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Skip Item Api Ai Eval Annotation Queue Items  Item
                  Id  Skip Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/golden-sets:
    get:
      tags:
      - AI Evaluation
      summary: Get Golden Sets
      description: Get all golden sets for the organization with linked evaluators
      operationId: get_golden_sets_api_ai_eval_golden_sets_get
      parameters:
      - name: evaluator_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Evaluator Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Golden Sets Api Ai Eval Golden Sets Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - AI Evaluation
      summary: Create Golden Set
      description: Create a new golden set
      operationId: create_golden_set_api_ai_eval_golden_sets_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GoldenSetCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Golden Set Api Ai Eval Golden Sets Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/golden-sets/{set_id}:
    get:
      tags:
      - AI Evaluation
      summary: Get Golden Set
      description: Get a golden set with its examples
      operationId: get_golden_set_api_ai_eval_golden_sets__set_id__get
      parameters:
      - name: set_id
        in: path
        required: true
        schema:
          type: string
          title: Set Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Golden Set Api Ai Eval Golden Sets  Set Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - AI Evaluation
      summary: Update Golden Set
      description: Update a golden set
      operationId: update_golden_set_api_ai_eval_golden_sets__set_id__put
      parameters:
      - name: set_id
        in: path
        required: true
        schema:
          type: string
          title: Set Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GoldenSetCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Golden Set Api Ai Eval Golden Sets  Set Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - AI Evaluation
      summary: Delete Golden Set
      description: Delete a golden set (soft delete by setting is_active=false)
      operationId: delete_golden_set_api_ai_eval_golden_sets__set_id__delete
      parameters:
      - name: set_id
        in: path
        required: true
        schema:
          type: string
          title: Set Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Golden Set Api Ai Eval Golden Sets  Set Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/golden-sets/{set_id}/examples:
    post:
      tags:
      - AI Evaluation
      summary: Add Golden Example
      description: Add an example to a golden set
      operationId: add_golden_example_api_ai_eval_golden_sets__set_id__examples_post
      parameters:
      - name: set_id
        in: path
        required: true
        schema:
          type: string
          title: Set Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GoldenExampleCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Add Golden Example Api Ai Eval Golden Sets  Set Id  Examples
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/golden-sets/{set_id}/examples/bulk:
    post:
      tags:
      - AI Evaluation
      summary: Bulk Add Golden Examples
      description: Bulk add examples to a golden set. Additive (does not replace existing).
      operationId: bulk_add_golden_examples_api_ai_eval_golden_sets__set_id__examples_bulk_post
      parameters:
      - name: set_id
        in: path
        required: true
        schema:
          type: string
          title: Set Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkExamplesCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Bulk Add Golden Examples Api Ai Eval Golden Sets  Set
                  Id  Examples Bulk Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/golden-sets/{set_id}/examples/{example_id}:
    put:
      tags:
      - AI Evaluation
      summary: Update Golden Example
      description: Update an example in a golden set
      operationId: update_golden_example_api_ai_eval_golden_sets__set_id__examples__example_id__put
      parameters:
      - name: set_id
        in: path
        required: true
        schema:
          type: string
          title: Set Id
      - name: example_id
        in: path
        required: true
        schema:
          type: string
          title: Example Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GoldenExampleCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Golden Example Api Ai Eval Golden Sets  Set
                  Id  Examples  Example Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - AI Evaluation
      summary: Delete Golden Example
      description: Delete an example from a golden set
      operationId: delete_golden_example_api_ai_eval_golden_sets__set_id__examples__example_id__delete
      parameters:
      - name: set_id
        in: path
        required: true
        schema:
          type: string
          title: Set Id
      - name: example_id
        in: path
        required: true
        schema:
          type: string
          title: Example Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Golden Example Api Ai Eval Golden Sets  Set
                  Id  Examples  Example Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/calibrations:
    get:
      tags:
      - AI Evaluation
      summary: Get Calibrations
      description: Get calibration runs for evaluators
      operationId: get_calibrations_api_ai_eval_calibrations_get
      parameters:
      - name: evaluator_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Evaluator Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Calibrations Api Ai Eval Calibrations Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/calibrations/run:
    post:
      tags:
      - AI Evaluation
      summary: Run Calibration
      description: 'Create a calibration record and return trigger info.


        The actual calibration runs through a workflow via Click Trigger.

        This keeps credit tracking, debugging, and execution history in the workflow
        system.'
      operationId: run_calibration_api_ai_eval_calibrations_run_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CalibrationRunCreate'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Run Calibration Api Ai Eval Calibrations Run Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/calibrations/{calibration_id}:
    get:
      tags:
      - AI Evaluation
      summary: Get Calibration Results
      description: Get detailed calibration results
      operationId: get_calibration_results_api_ai_eval_calibrations__calibration_id__get
      parameters:
      - name: calibration_id
        in: path
        required: true
        schema:
          type: string
          title: Calibration Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Calibration Results Api Ai Eval Calibrations  Calibration
                  Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/ab-tests:
    get:
      tags:
      - AI Evaluation
      summary: Get Ab Tests
      description: Get all A/B tests for the organization
      operationId: get_ab_tests_api_ai_eval_ab_tests_get
      parameters:
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by status
          title: Status
        description: Filter by status
      - name: workflow_slug
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Slug
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Ab Tests Api Ai Eval Ab Tests Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - AI Evaluation
      summary: Create Ab Test
      description: Create a new A/B test
      operationId: create_ab_test_api_ai_eval_ab_tests_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ABTestCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Ab Test Api Ai Eval Ab Tests Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/ab-tests/{test_id}/start:
    post:
      tags:
      - AI Evaluation
      summary: Start Ab Test
      description: Start an A/B test
      operationId: start_ab_test_api_ai_eval_ab_tests__test_id__start_post
      parameters:
      - name: test_id
        in: path
        required: true
        schema:
          type: string
          title: Test Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Start Ab Test Api Ai Eval Ab Tests  Test Id  Start
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/ab-tests/{test_id}/stop:
    post:
      tags:
      - AI Evaluation
      summary: Stop Ab Test
      description: Stop an A/B test
      operationId: stop_ab_test_api_ai_eval_ab_tests__test_id__stop_post
      parameters:
      - name: test_id
        in: path
        required: true
        schema:
          type: string
          title: Test Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Stop Ab Test Api Ai Eval Ab Tests  Test Id  Stop Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/ab-tests/{test_id}:
    put:
      tags:
      - AI Evaluation
      summary: Update Ab Test
      description: Update A/B test settings
      operationId: update_ab_test_api_ai_eval_ab_tests__test_id__put
      parameters:
      - name: test_id
        in: path
        required: true
        schema:
          type: string
          title: Test Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ABTestUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Ab Test Api Ai Eval Ab Tests  Test Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/ab-tests/{test_id}/results:
    get:
      tags:
      - AI Evaluation
      summary: Get Ab Test Results
      description: Get A/B test results with statistical analysis
      operationId: get_ab_test_results_api_ai_eval_ab_tests__test_id__results_get
      parameters:
      - name: test_id
        in: path
        required: true
        schema:
          type: string
          title: Test Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Ab Test Results Api Ai Eval Ab Tests  Test Id  Results
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/ab-tests/active/select-prompt:
    get:
      tags:
      - AI Evaluation
      summary: Select Prompt For Ab Test
      description: 'Select which prompt to use for a workflow with active A/B test.

        Returns the appropriate prompt ID based on traffic split.'
      operationId: select_prompt_for_ab_test_api_ai_eval_ab_tests_active_select_prompt_get
      parameters:
      - name: workflow_slug
        in: query
        required: true
        schema:
          type: string
          title: Workflow Slug
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Select Prompt For Ab Test Api Ai Eval Ab Tests Active
                  Select Prompt Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/optimization/start:
    post:
      tags:
      - AI Evaluation
      summary: Start Optimization
      description: Start an iterative prompt optimization run.
      operationId: start_optimization_api_ai_eval_optimization_start_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OptimizationStartRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Start Optimization Api Ai Eval Optimization Start
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/optimization/{optimization_id}/stream:
    get:
      tags:
      - AI Evaluation
      summary: Stream Optimization Progress
      description: SSE endpoint for streaming optimization progress.
      operationId: stream_optimization_progress_api_ai_eval_optimization__optimization_id__stream_get
      parameters:
      - name: optimization_id
        in: path
        required: true
        schema:
          type: string
          title: Optimization Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/optimization/{optimization_id}/cancel:
    post:
      tags:
      - AI Evaluation
      summary: Cancel Optimization
      description: Cancel a running optimization.
      operationId: cancel_optimization_api_ai_eval_optimization__optimization_id__cancel_post
      parameters:
      - name: optimization_id
        in: path
        required: true
        schema:
          type: string
          title: Optimization Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Cancel Optimization Api Ai Eval Optimization  Optimization
                  Id  Cancel Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/optimization/{optimization_id}:
    get:
      tags:
      - AI Evaluation
      summary: Get Optimization Detail
      description: Get detailed optimization results.
      operationId: get_optimization_detail_api_ai_eval_optimization__optimization_id__get
      parameters:
      - name: optimization_id
        in: path
        required: true
        schema:
          type: string
          title: Optimization Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Optimization Detail Api Ai Eval Optimization  Optimization
                  Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/optimizations:
    get:
      tags:
      - AI Evaluation
      summary: List Optimizations
      description: List optimization runs.
      operationId: list_optimizations_api_ai_eval_optimizations_get
      parameters:
      - name: prompt_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Prompt Id
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 20
          title: Limit
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response List Optimizations Api Ai Eval Optimizations Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/ai-eval/optimization/{optimization_id}/apply:
    post:
      tags:
      - AI Evaluation
      summary: Apply Optimization
      description: Apply an optimization result as a new prompt version.
      operationId: apply_optimization_api_ai_eval_optimization__optimization_id__apply_post
      parameters:
      - name: optimization_id
        in: path
        required: true
        schema:
          type: string
          title: Optimization Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Apply Optimization Api Ai Eval Optimization  Optimization
                  Id  Apply Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/prompts/{prompt_id}/analysis:
    get:
      tags:
      - Prompt Optimization
      summary: Get Prompt Analysis
      description: Get performance analysis for a prompt
      operationId: get_prompt_analysis_api_prompts__prompt_id__analysis_get
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      - name: workflow_slug
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Slug
      - name: days
        in: query
        required: false
        schema:
          type: integer
          default: 7
          title: Days
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Prompt Analysis Api Prompts  Prompt Id  Analysis
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/prompts/{prompt_id}/failures:
    get:
      tags:
      - Prompt Optimization
      summary: Get Prompt Failures
      description: Get failure diagnoses for a prompt
      operationId: get_prompt_failures_api_prompts__prompt_id__failures_get
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 20
          title: Limit
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Prompt Failures Api Prompts  Prompt Id  Failures
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/prompts/{prompt_id}/optimize:
    post:
      tags:
      - Prompt Optimization
      summary: Create Optimization
      description: Start an optimization run for a prompt
      operationId: create_optimization_api_prompts__prompt_id__optimize_post
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      - name: workflow_slug
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Slug
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Optimization Api Prompts  Prompt Id  Optimize
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/prompts/optimizations:
    get:
      tags:
      - Prompt Optimization
      summary: Get Optimizations
      description: Get optimization runs
      operationId: get_optimizations_api_prompts_optimizations_get
      parameters:
      - name: prompt_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Prompt Id
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Optimizations Api Prompts Optimizations Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/prompts/optimizations/{optimization_id}:
    get:
      tags:
      - Prompt Optimization
      summary: Get Optimization Detail
      description: Get details of an optimization run
      operationId: get_optimization_detail_api_prompts_optimizations__optimization_id__get
      parameters:
      - name: optimization_id
        in: path
        required: true
        schema:
          type: string
          title: Optimization Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Optimization Detail Api Prompts Optimizations  Optimization
                  Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/prompts/optimizations/{optimization_id}/apply:
    post:
      tags:
      - Prompt Optimization
      summary: Apply Optimization
      description: Apply an optimization (create new prompt version)
      operationId: apply_optimization_api_prompts_optimizations__optimization_id__apply_post
      parameters:
      - name: optimization_id
        in: path
        required: true
        schema:
          type: string
          title: Optimization Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Apply Optimization Api Prompts Optimizations  Optimization
                  Id  Apply Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/prompts/{prompt_id}/generate-feedback:
    post:
      tags:
      - Prompt Optimization
      summary: Generate Feedback
      description: Generate structured feedback for a prompt
      operationId: generate_feedback_api_prompts__prompt_id__generate_feedback_post
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Generate Feedback Api Prompts  Prompt Id  Generate
                  Feedback Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/prompts/{prompt_id}/generate-improvement:
    post:
      tags:
      - Prompt Optimization
      summary: Generate Improvement
      description: Generate an improved version of a prompt
      operationId: generate_improvement_api_prompts__prompt_id__generate_improvement_post
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Generate Improvement Api Prompts  Prompt Id  Generate
                  Improvement Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/prompt-marketplace/categories:
    get:
      tags:
      - Prompt Marketplace
      - prompt-marketplace
      summary: Get Prompt Categories
      description: Get available prompt categories
      operationId: get_prompt_categories_api_prompt_marketplace_categories_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /api/prompt-marketplace/{marketplace_id}:
    get:
      tags:
      - Prompt Marketplace
      - prompt-marketplace
      summary: Get Marketplace Prompt Detail
      description: Get details of a specific marketplace prompt
      operationId: get_marketplace_prompt_detail_api_prompt_marketplace__marketplace_id__get
      parameters:
      - name: marketplace_id
        in: path
        required: true
        schema:
          type: string
          title: Marketplace Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/prompt-marketplace/publish:
    post:
      tags:
      - Prompt Marketplace
      - prompt-marketplace
      summary: Publish Prompt To Marketplace
      description: Submit a prompt from org library to marketplace for review
      operationId: publish_prompt_to_marketplace_api_prompt_marketplace_publish_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromptPublishRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/prompt-marketplace/my-submissions:
    get:
      tags:
      - Prompt Marketplace
      - prompt-marketplace
      summary: Get My Submissions
      description: Get prompts submitted by this org to marketplace
      operationId: get_my_submissions_api_prompt_marketplace_my_submissions_get
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/prompt-marketplace/install:
    post:
      tags:
      - Prompt Marketplace
      - prompt-marketplace
      summary: Install Prompt From Marketplace
      description: Install a prompt from marketplace to org's library
      operationId: install_prompt_from_marketplace_api_prompt_marketplace_install_post
      parameters:
      - name: X-Service-Token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Service-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/routes__prompts__prompt_marketplace_routes__PromptInstallRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/system-prompts:
    get:
      tags:
      - System Management
      summary: Get System Prompts
      description: Get all system prompts (Super Admin only)
      operationId: get_system_prompts_api_super_admin_system_prompts_get
      parameters:
      - name: category
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
      - name: workflow_slug
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Slug
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get System Prompts Api Super Admin System Prompts
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - System Management
      summary: Create System Prompt
      description: Create a new system prompt (Super Admin only)
      operationId: create_system_prompt_api_super_admin_system_prompts_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SystemPromptCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create System Prompt Api Super Admin System Prompts
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/system-prompts/{prompt_id}:
    put:
      tags:
      - System Management
      summary: Update System Prompt
      description: Update a system prompt (Super Admin only)
      operationId: update_system_prompt_api_super_admin_system_prompts__prompt_id__put
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SystemPromptUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update System Prompt Api Super Admin System Prompts  Prompt
                  Id  Put
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - System Management
      summary: Delete System Prompt
      description: Delete a system prompt (Super Admin only)
      operationId: delete_system_prompt_api_super_admin_system_prompts__prompt_id__delete
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete System Prompt Api Super Admin System Prompts  Prompt
                  Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/system-prompts/promote:
    post:
      tags:
      - System Management
      summary: Promote Prompt
      description: Promote an org prompt to system level (Super Admin only)
      operationId: promote_prompt_api_super_admin_system_prompts_promote_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromotePromptRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Promote Prompt Api Super Admin System Prompts Promote
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/system-prompts/{prompt_id}/auto-deploy:
    patch:
      tags:
      - System Management
      summary: Toggle Prompt Auto Deploy
      description: Toggle auto-deploy for a system prompt (Super Admin only)
      operationId: toggle_prompt_auto_deploy_api_super_admin_system_prompts__prompt_id__auto_deploy_patch
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ToggleAutoDeployRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Toggle Prompt Auto Deploy Api Super Admin System Prompts  Prompt
                  Id  Auto Deploy Patch
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/system-prompts/{prompt_id}/protected:
    patch:
      tags:
      - System Management
      summary: Toggle Prompt Protected
      description: 'Toggle is_protected for a system prompt (Super Admin only)


        When is_protected is changed, future deployments will use the new setting.

        Existing deployments are NOT automatically updated.'
      operationId: toggle_prompt_protected_api_super_admin_system_prompts__prompt_id__protected_patch
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ToggleProtectedRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Toggle Prompt Protected Api Super Admin System Prompts  Prompt
                  Id  Protected Patch
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/system-prompts/{prompt_id}/deploy:
    post:
      tags:
      - System Management
      summary: Deploy To All Orgs
      description: Deploy a system prompt to all organizations (Super Admin only)
      operationId: deploy_to_all_orgs_api_super_admin_system_prompts__prompt_id__deploy_post
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Deploy To All Orgs Api Super Admin System Prompts  Prompt
                  Id  Deploy Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/system-prompts/{prompt_id}/deploy/{org_id}:
    post:
      tags:
      - System Management
      summary: Deploy To Org
      description: Deploy a system prompt to a specific organization (Super Admin
        only)
      operationId: deploy_to_org_api_super_admin_system_prompts__prompt_id__deploy__org_id__post
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Deploy To Org Api Super Admin System Prompts  Prompt
                  Id  Deploy  Org Id  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/system-prompts/{prompt_id}/deploy-selected:
    post:
      tags:
      - System Management
      summary: Deploy To Selected Orgs
      description: Deploy a system prompt to selected organizations (Super Admin only)
      operationId: deploy_to_selected_orgs_api_super_admin_system_prompts__prompt_id__deploy_selected_post
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchDeployRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Deploy To Selected Orgs Api Super Admin System Prompts  Prompt
                  Id  Deploy Selected Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/system-prompts/{prompt_id}/deployment-status:
    get:
      tags:
      - System Management
      summary: Get Deployment Status
      description: Get deployment status for a system prompt (Super Admin only)
      operationId: get_deployment_status_api_super_admin_system_prompts__prompt_id__deployment_status_get
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Deployment Status Api Super Admin System Prompts  Prompt
                  Id  Deployment Status Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/system-prompts/{prompt_id}/deployments/{org_id}:
    delete:
      tags:
      - System Management
      summary: Undeploy Prompt From Org
      description: 'Undeploy (remove) a system prompt from a specific organization
        (Super Admin only)


        This removes the prompt from the org''s database completely.'
      operationId: undeploy_prompt_from_org_api_super_admin_system_prompts__prompt_id__deployments__org_id__delete
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      - name: org_id
        in: path
        required: true
        schema:
          type: string
          title: Org Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Undeploy Prompt From Org Api Super Admin System Prompts  Prompt
                  Id  Deployments  Org Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/system-prompts/{prompt_id}/deployments:
    delete:
      tags:
      - System Management
      summary: Undeploy Prompt From All Orgs
      description: 'Undeploy (remove) a system prompt from ALL organizations (Super
        Admin only)


        This is a batch operation that removes the prompt from every org it was deployed
        to.

        Use with caution - this affects all organizations!'
      operationId: undeploy_prompt_from_all_orgs_api_super_admin_system_prompts__prompt_id__deployments_delete
      parameters:
      - name: prompt_id
        in: path
        required: true
        schema:
          type: string
          title: Prompt Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Undeploy Prompt From All Orgs Api Super Admin System
                  Prompts  Prompt Id  Deployments Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/marketplace-prompts/{marketplace_id}/deploy-selected:
    post:
      tags:
      - System Management
      summary: Deploy Marketplace Prompt To Selected Orgs
      description: Deploy a marketplace prompt directly to selected organizations
        (Super Admin only)
      operationId: deploy_marketplace_prompt_to_selected_orgs_api_super_admin_marketplace_prompts__marketplace_id__deploy_selected_post
      parameters:
      - name: marketplace_id
        in: path
        required: true
        schema:
          type: string
          title: Marketplace Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchDeployRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Deploy Marketplace Prompt To Selected Orgs Api Super
                  Admin Marketplace Prompts  Marketplace Id  Deploy Selected Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/marketplace-prompts:
    get:
      tags:
      - System Management
      summary: Get Marketplace Prompts
      description: Get all marketplace prompts (Super Admin only)
      operationId: get_marketplace_prompts_api_super_admin_marketplace_prompts_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
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Marketplace Prompts Api Super Admin Marketplace
                  Prompts Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/super-admin/marketplace-prompts/{marketplace_id}/auto-deploy:
    patch:
      tags:
      - System Management
      summary: Toggle Marketplace Prompt Auto Deploy
      description: Toggle auto-deploy for a marketplace prompt (Super Admin only)
      operationId: toggle_marketplace_prompt_auto_deploy_api_super_admin_marketplace_prompts__marketplace_id__auto_deploy_patch
      parameters:
      - name: marketplace_id
        in: path
        required: true
        schema:
          type: string
          title: Marketplace Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ToggleAutoDeployRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Toggle Marketplace Prompt Auto Deploy Api Super Admin
                  Marketplace Prompts  Marketplace Id  Auto Deploy Patch
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /:
    get:
      summary: Serve Home
      description: Serve the home page if authenticated, otherwise redirect to login
      operationId: serve_home__get
      responses:
        '200':
          description: Successful Response
          content:
            text/html:
              schema:
                type: string
  /set-mautic-credentials:
    post:
      summary: Set Mautic Credentials
      description: Set Mautic API credentials in session
      operationId: set_mautic_credentials_set_mautic_credentials_post
      parameters:
      - name: base_url
        in: query
        required: true
        schema:
          type: string
          title: Base Url
      - name: username
        in: query
        required: true
        schema:
          type: string
          title: Username
      - name: password
        in: query
        required: true
        schema:
          type: string
          title: Password
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /set-llm-model:
    post:
      summary: Set Llm Model
      description: Set LLM model preferences in session
      operationId: set_llm_model_set_llm_model_post
      parameters:
      - name: model_name
        in: query
        required: true
        schema:
          type: string
          title: Model Name
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /health:
    get:
      summary: Health Check
      description: Health check endpoint for container orchestration and monitoring
      operationId: health_check_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
components:
  schemas:
    ABTestCreate:
      properties:
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        workflow_slug:
          type: string
          title: Workflow Slug
        control_prompt_id:
          type: string
          title: Control Prompt Id
        variant_prompt_id:
          type: string
          title: Variant Prompt Id
        traffic_split:
          type: number
          title: Traffic Split
          default: 0.5
        target_sample_size:
          type: integer
          title: Target Sample Size
          default: 100
      type: object
      required:
      - name
      - workflow_slug
      - control_prompt_id
      - variant_prompt_id
      title: ABTestCreate
    ABTestUpdate:
      properties:
        traffic_split:
          anyOf:
          - type: number
          - type: 'null'
          title: Traffic Split
        status:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
      type: object
      title: ABTestUpdate
    AcceptTransferNewUserRequest:
      properties:
        name:
          type: string
          title: Name
        password:
          type: string
          title: Password
      type: object
      required:
      - name
      - password
      title: AcceptTransferNewUserRequest
    ActionCondition:
      properties:
        id:
          type: string
          title: Id
        field:
          type: string
          title: Field
        operator:
          type: string
          title: Operator
        value:
          type: string
          title: Value
      type: object
      required:
      - id
      - field
      - operator
      - value
      title: ActionCondition
    ActionCreate:
      properties:
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        match_groups:
          items:
            $ref: '#/components/schemas/ActionMatchGroup'
          type: array
          title: Match Groups
        is_active:
          type: boolean
          title: Is Active
          default: true
      type: object
      required:
      - name
      - match_groups
      title: ActionCreate
    ActionMatchGroup:
      properties:
        id:
          type: string
          title: Id
        match_type:
          type: string
          title: Match Type
        conditions:
          items:
            $ref: '#/components/schemas/ActionCondition'
          type: array
          title: Conditions
      type: object
      required:
      - id
      - match_type
      - conditions
      title: ActionMatchGroup
    ActionUpdate:
      properties:
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        match_groups:
          anyOf:
          - items:
              $ref: '#/components/schemas/ActionMatchGroup'
            type: array
          - type: 'null'
          title: Match Groups
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
      type: object
      title: ActionUpdate
    ActivityCreate:
      properties:
        activity_type:
          type: string
          title: Activity Type
        activity_subtype:
          anyOf:
          - type: string
          - type: 'null'
          title: Activity Subtype
        title:
          anyOf:
          - type: string
          - type: 'null'
          title: Title
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        entity_type:
          type: string
          title: Entity Type
        entity_id:
          type: string
          title: Entity Id
        contact_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Contact Id
        company_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Company Id
        deal_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Deal Id
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
        performed_by_email:
          anyOf:
          - type: string
          - type: 'null'
          title: Performed By Email
      type: object
      required:
      - activity_type
      - entity_type
      - entity_id
      title: ActivityCreate
    AdAccountSelectionRequest:
      properties:
        integration_id:
          type: string
          title: Integration Id
          description: Integration ID
        selected_ad_accounts:
          items:
            type: string
          type: array
          title: Selected Ad Accounts
          description: List of selected ad account IDs
      type: object
      required:
      - integration_id
      - selected_ad_accounts
      title: AdAccountSelectionRequest
    AddChartRequest:
      properties:
        date_column:
          anyOf:
          - type: string
          - type: 'null'
          title: Date Column
          description: Date column to use for dashboard date filter
        acknowledged_no_date:
          type: boolean
          title: Acknowledged No Date
          description: User acknowledged chart has no date column
          default: false
        position:
          anyOf:
          - additionalProperties:
              type: integer
            type: object
          - type: 'null'
          title: Position
          description: Initial position {x, y}
        size:
          anyOf:
          - additionalProperties:
              type: integer
            type: object
          - type: 'null'
          title: Size
          description: Initial size {width, height}
        control_mappings:
          anyOf:
          - additionalProperties:
              anyOf:
              - type: string
              - type: 'null'
            type: object
          - type: 'null'
          title: Control Mappings
          description: 'Generic control mappings: {controlId: columnName}'
      type: object
      title: AddChartRequest
      description: Request body for adding a chart to dashboard with optional filter
        mapping
    AddCreditsRequest:
      properties:
        org_id:
          type: string
          title: Org Id
        credits:
          type: number
          title: Credits
        reason:
          type: string
          title: Reason
        adjustment_type:
          type: string
          title: Adjustment Type
          default: purchase
      type: object
      required:
      - org_id
      - credits
      - reason
      title: AddCreditsRequest
    AddDocumentRequest:
      properties:
        content:
          anyOf:
          - type: string
          - type: 'null'
          title: Content
          description: Text content to add
        title:
          anyOf:
          - type: string
          - type: 'null'
          title: Title
          description: Document title
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
          description: Additional metadata
        chunk_size:
          anyOf:
          - type: integer
            maximum: 4000.0
            minimum: 100.0
          - type: 'null'
          title: Chunk Size
          description: Chunk size
          default: 1000
        chunk_overlap:
          anyOf:
          - type: integer
            maximum: 1000.0
            minimum: 0.0
          - type: 'null'
          title: Chunk Overlap
          description: Chunk overlap
          default: 200
      type: object
      title: AddDocumentRequest
    AddDomainRequest:
      properties:
        domain:
          type: string
          title: Domain
          description: Domain name to add (e.g., example.com)
      type: object
      required:
      - domain
      title: AddDomainRequest
    AddMemberRequest:
      properties:
        member_id:
          type: string
          title: Member Id
      type: object
      required:
      - member_id
      title: AddMemberRequest
    AdvancedSearchRequest:
      properties:
        query:
          type: string
          title: Query
          description: Search query
          default: ''
        channels:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Channels
          description: Filter by channels
        categories:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Categories
          description: Filter by categories
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
          description: Filter by tags
        creators:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Creators
          description: Filter by creators
        date_from:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Date From
          description: Date range start
        date_to:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Date To
          description: Date range end
        usage_min:
          anyOf:
          - type: integer
            minimum: 0.0
          - type: 'null'
          title: Usage Min
          description: Minimum usage count
        usage_max:
          anyOf:
          - type: integer
            minimum: 0.0
          - type: 'null'
          title: Usage Max
          description: Maximum usage count
        engagement_min:
          anyOf:
          - type: number
            maximum: 100.0
            minimum: 0.0
          - type: 'null'
          title: Engagement Min
          description: Minimum engagement score
        engagement_max:
          anyOf:
          - type: number
            maximum: 100.0
            minimum: 0.0
          - type: 'null'
          title: Engagement Max
          description: Maximum engagement score
        has_variables:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Has Variables
          description: Has template variables
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
          description: Is active
        page:
          type: integer
          minimum: 1.0
          title: Page
          description: Page number
          default: 1
        page_size:
          type: integer
          maximum: 100.0
          minimum: 1.0
          title: Page Size
          description: Results per page
          default: 20
        sort_field:
          type: string
          title: Sort Field
          description: Sort field
          default: relevance
        sort_order:
          type: string
          title: Sort Order
          description: Sort order
          default: desc
      type: object
      title: AdvancedSearchRequest
      description: Advanced search request with detailed filters
    AgentMetadataRequest:
      properties:
        selected_kbs:
          items:
            type: string
          type: array
          title: Selected Kbs
          description: Selected knowledge base IDs
        selected_documents:
          anyOf:
          - additionalProperties:
              items:
                type: string
              type: array
            type: object
          - type: 'null'
          title: Selected Documents
          description: Selected document IDs per KB
      type: object
      required:
      - selected_kbs
      title: AgentMetadataRequest
    AgentRelationshipRequest:
      properties:
        selected_kbs:
          items:
            type: string
          type: array
          title: Selected Kbs
          description: Selected knowledge base IDs for relationship analysis
      type: object
      required:
      - selected_kbs
      title: AgentRelationshipRequest
    AgenticChatRequest:
      properties:
        message:
          type: string
          title: Message
          description: User message to process
        session_id:
          type: string
          title: Session Id
          description: Chat session ID for context
        execution_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Execution Id
          description: Resume from specific execution
        max_iterations:
          anyOf:
          - type: integer
          - type: 'null'
          title: Max Iterations
          description: Max agent loop iterations
          default: 10
        llm_model:
          anyOf:
          - type: string
          - type: 'null'
          title: Llm Model
          description: LLM model to use
          default: gpt-4o
      type: object
      required:
      - message
      - session_id
      title: AgenticChatRequest
      description: Request for agentic chat interaction
    AgenticChatStreamRequest:
      properties:
        message:
          type: string
          title: Message
          description: User message to process
        session_id:
          type: string
          title: Session Id
          description: Chat session ID
        attachments:
          anyOf:
          - items:
              $ref: '#/components/schemas/ChatAttachment'
            type: array
          - type: 'null'
          title: Attachments
          description: User file attachments
      type: object
      required:
      - message
      - session_id
      title: AgenticChatStreamRequest
      description: Request for streaming agentic chat
    AggregateScoresRequest:
      properties:
        llm_response:
          type: string
          title: Llm Response
          description: Raw LLM response text to parse
        evaluator_id:
          type: string
          title: Evaluator Id
          description: Evaluator ID to get linked score configs
      type: object
      required:
      - llm_response
      - evaluator_id
      title: AggregateScoresRequest
    AnalyticsEvent:
      properties:
        event_type:
          type: string
          title: Event Type
        source:
          anyOf:
          - type: string
          - type: 'null'
          title: Source
          default: web
        referrer:
          anyOf:
          - type: string
          - type: 'null'
          title: Referrer
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
          default: {}
      type: object
      required:
      - event_type
      title: AnalyticsEvent
    AnnotationQueueCreate:
      properties:
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        prompt_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Prompt Id
        workflow_slug:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Slug
        criteria:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Criteria
      type: object
      required:
      - name
      title: AnnotationQueueCreate
    AnnotationQueueItemCreate:
      properties:
        queue_id:
          type: string
          title: Queue Id
        observation_id:
          type: string
          title: Observation Id
        priority:
          type: integer
          title: Priority
          default: 0
      type: object
      required:
      - queue_id
      - observation_id
      title: AnnotationQueueItemCreate
    AnnotationSubmit:
      properties:
        score_name:
          type: string
          title: Score Name
        score_value:
          type: number
          title: Score Value
        comment:
          anyOf:
          - type: string
          - type: 'null'
          title: Comment
      type: object
      required:
      - score_name
      - score_value
      title: AnnotationSubmit
    ApiResponse:
      properties:
        status:
          type: string
          title: Status
          description: 'Response status: success, error'
        data:
          anyOf:
          - {}
          - type: 'null'
          title: Data
          description: Response data
        message:
          anyOf:
          - type: string
          - type: 'null'
          title: Message
          description: Response message
      type: object
      required:
      - status
      title: ApiResponse
      description: Standard API response wrapper
      example:
        data: {}
        message: Operation completed successfully
        status: success
    ApplyConfigRequest:
      properties:
        config_id:
          type: string
          title: Config Id
      type: object
      required:
      - config_id
      title: ApplyConfigRequest
      description: Model for applying a configuration
    ApplyEnhancedTemplateRequest:
      properties:
        template_id:
          type: string
          title: Template Id
        customizations:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Customizations
          default: {}
      type: object
      required:
      - template_id
      title: ApplyEnhancedTemplateRequest
    ApplyRuleRequest:
      properties:
        run_async:
          type: boolean
          title: Run Async
          description: Run in background (recommended)
          default: true
        limit:
          type: integer
          maximum: 10000.0
          minimum: 1.0
          title: Limit
          description: Max contacts to process
          default: 1000
      type: object
      title: ApplyRuleRequest
      description: Request to apply a rule to contacts
    AssignEntityRequest:
      properties:
        entity_type:
          type: string
          title: Entity Type
          description: 'Entity type: contact or deal'
        entity_id:
          type: string
          title: Entity Id
          description: Entity ID to assign
        user_id:
          anyOf:
          - type: string
          - type: 'null'
          title: User Id
          description: Specific user ID (optional)
        assigned_by:
          type: string
          title: Assigned By
          description: Assignment source
          default: manual
      type: object
      required:
      - entity_type
      - entity_id
      title: AssignEntityRequest
      description: Request model for manual entity assignment
    AsteriskChatRequest:
      properties:
        session_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Session Id
          description: Session ID from init (optional in session-less mode)
        user_message:
          type: string
          title: User Message
          description: Transcribed user speech
        conversation_history:
          anyOf:
          - items:
              additionalProperties:
                type: string
              type: object
            type: array
          - type: 'null'
          title: Conversation History
          description: Previous conversation messages
        contact_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Contact Id
          description: CRM contact ID
        call_metadata:
          anyOf:
          - $ref: '#/components/schemas/CallMetadata'
          - type: 'null'
          description: Call metadata
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
          description: Additional metadata including workflow_id and voice_agent_node_id
            from outbound call
      type: object
      required:
      - user_message
      title: AsteriskChatRequest
      description: Request to get LLM response for transcribed text
    AsteriskChatResponse:
      properties:
        success:
          type: boolean
          title: Success
        response:
          type: string
          title: Response
        session_id:
          type: string
          title: Session Id
        should_end_call:
          type: boolean
          title: Should End Call
          default: false
        tool_results:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Tool Results
          default: []
      type: object
      required:
      - success
      - response
      - session_id
      title: AsteriskChatResponse
      description: Response with AI-generated text
    AsteriskEndRequest:
      properties:
        session_id:
          type: string
          title: Session Id
          description: Session ID to end
        final_transcript:
          anyOf:
          - items:
              additionalProperties:
                type: string
              type: object
            type: array
          - type: 'null'
          title: Final Transcript
          description: Complete conversation transcript
        call_duration_seconds:
          type: integer
          title: Call Duration Seconds
          description: Call duration in seconds
          default: 0
        call_status:
          type: string
          title: Call Status
          description: Call end status
          default: completed
      type: object
      required:
      - session_id
      title: AsteriskEndRequest
      description: Request to end a voice chat session
    AsteriskEndResponse:
      properties:
        success:
          type: boolean
          title: Success
        transcript_saved:
          type: boolean
          title: Transcript Saved
        call_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Call Id
      type: object
      required:
      - success
      - transcript_saved
      title: AsteriskEndResponse
      description: Response confirming session end
    AsteriskHealthResponse:
      properties:
        success:
          type: boolean
          title: Success
        integration_active:
          type: boolean
          title: Integration Active
        workflow_configured:
          type: boolean
          title: Workflow Configured
        message:
          type: string
          title: Message
          default: ''
      type: object
      required:
      - success
      - integration_active
      - workflow_configured
      title: AsteriskHealthResponse
      description: Health check response
    AsteriskInitRequest:
      properties:
        call_metadata:
          $ref: '#/components/schemas/CallMetadata'
        contact_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Contact Id
          description: CRM contact ID if known
      type: object
      required:
      - call_metadata
      title: AsteriskInitRequest
      description: Request to initialize a voice chat session
    AsteriskInitResponse:
      properties:
        success:
          type: boolean
          title: Success
        session_id:
          type: string
          title: Session Id
        first_message:
          type: string
          title: First Message
        voice_config:
          additionalProperties: true
          type: object
          title: Voice Config
      type: object
      required:
      - success
      - session_id
      - first_message
      - voice_config
      title: AsteriskInitResponse
      description: Response with session info and first message
    AsteriskWebhookRequest:
      properties:
        event:
          type: string
          title: Event
          description: 'Event type: init, chat, end, health, save'
        call_metadata:
          anyOf:
          - $ref: '#/components/schemas/CallMetadata'
          - type: 'null'
          description: Call metadata (for init/save)
        contact_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Contact Id
          description: CRM contact ID
        session_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Session Id
          description: Session ID (for chat/end/save)
        user_message:
          anyOf:
          - type: string
          - type: 'null'
          title: User Message
          description: User message (for chat)
        conversation_history:
          anyOf:
          - items:
              additionalProperties:
                type: string
              type: object
            type: array
          - type: 'null'
          title: Conversation History
          description: Conversation history
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
          description: Additional metadata including workflow_id and voice_agent_node_id
            from outbound call (for chat)
        final_transcript:
          anyOf:
          - items:
              additionalProperties:
                type: string
              type: object
            type: array
          - type: 'null'
          title: Final Transcript
          description: Final transcript (for end/save)
        call_duration_seconds:
          anyOf:
          - type: integer
          - type: 'null'
          title: Call Duration Seconds
          description: Call duration (for end/save)
          default: 0
        call_status:
          anyOf:
          - type: string
          - type: 'null'
          title: Call Status
          description: Call status (for end/save)
          default: completed
        recording_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Recording Url
          description: URL to call recording (for save)
        recording_duration:
          anyOf:
          - type: integer
          - type: 'null'
          title: Recording Duration
          description: Recording duration in seconds (for save)
        start_time:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Time
          description: Call start time ISO format (for save)
        end_time:
          anyOf:
          - type: string
          - type: 'null'
          title: End Time
          description: Call end time ISO format (for save)
        provider_call_sid:
          anyOf:
          - type: string
          - type: 'null'
          title: Provider Call Sid
          description: Asterisk call SID/ID (for save)
      type: object
      required:
      - event
      title: AsteriskWebhookRequest
      description: Unified webhook request - single endpoint for all events
    AudienceDefinition:
      properties:
        type:
          type: string
          title: Type
        filters:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Filters
          default: []
        customQuery:
          anyOf:
          - type: string
          - type: 'null'
          title: Customquery
        estimatedCount:
          type: integer
          title: Estimatedcount
          default: 0
      type: object
      required:
      - type
      title: AudienceDefinition
    AutoPurchaseRequest:
      properties:
        enabled:
          type: boolean
          title: Enabled
        threshold:
          type: integer
          title: Threshold
          default: 1000
        package_id:
          type: string
          title: Package Id
          default: growth_pack
      type: object
      required:
      - enabled
      title: AutoPurchaseRequest
    BatchConfigurationResponse:
      properties:
        batch_configs:
          additionalProperties: true
          type: object
          title: Batch Configs
        queue_mapping:
          additionalProperties:
            type: string
          type: object
          title: Queue Mapping
        supported_channels:
          items:
            type: string
          type: array
          title: Supported Channels
        max_campaign_size:
          type: integer
          title: Max Campaign Size
        memory_optimization:
          type: boolean
          title: Memory Optimization
      type: object
      required:
      - batch_configs
      - queue_mapping
      - supported_channels
      - max_campaign_size
      - memory_optimization
      title: BatchConfigurationResponse
      description: Response model for batch configuration information
    BatchDeployRequest:
      properties:
        org_ids:
          items:
            type: string
          type: array
          title: Org Ids
      type: object
      required:
      - org_ids
      title: BatchDeployRequest
    BatchEventData:
      properties:
        events:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Events
        visitor_id:
          type: string
          title: Visitor Id
        session_id:
          type: string
          title: Session Id
      type: object
      required:
      - events
      - visitor_id
      - session_id
      title: BatchEventData
    BatchOperationResponse:
      properties:
        success_count:
          type: integer
          title: Success Count
        total_count:
          type: integer
          title: Total Count
        errors:
          items:
            type: string
          type: array
          title: Errors
      type: object
      required:
      - success_count
      - total_count
      title: BatchOperationResponse
    BatchPreviewRequest:
      properties:
        template_content:
          type: string
          title: Template Content
        subject_template:
          anyOf:
          - type: string
          - type: 'null'
          title: Subject Template
        variables:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Variables
        contact_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Contact Id
        channels:
          items:
            $ref: '#/components/schemas/ChannelType'
          type: array
          title: Channels
          default:
          - email
          - sms
          - whatsapp
      type: object
      required:
      - template_content
      title: BatchPreviewRequest
      description: Request model for batch preview across multiple channels
    BillingAddressCreate:
      properties:
        address_label:
          anyOf:
          - type: string
          - type: 'null'
          title: Address Label
        company_name:
          type: string
          title: Company Name
        address_line_1:
          type: string
          title: Address Line 1
        address_line_2:
          anyOf:
          - type: string
          - type: 'null'
          title: Address Line 2
        city:
          type: string
          title: City
        state:
          type: string
          title: State
        pincode:
          type: string
          title: Pincode
        country:
          type: string
          title: Country
          default: India
        has_gst:
          type: boolean
          title: Has Gst
          default: false
        gst_number:
          anyOf:
          - type: string
          - type: 'null'
          title: Gst Number
        make_default:
          type: boolean
          title: Make Default
          default: false
      type: object
      required:
      - company_name
      - address_line_1
      - city
      - state
      - pincode
      title: BillingAddressCreate
    BillingAddressRequest:
      properties:
        legal_name:
          type: string
          title: Legal Name
        trade_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Trade Name
        gstin:
          anyOf:
          - type: string
          - type: 'null'
          title: Gstin
        address_line1:
          type: string
          title: Address Line1
        address_line2:
          anyOf:
          - type: string
          - type: 'null'
          title: Address Line2
        city:
          type: string
          title: City
        state:
          type: string
          title: State
        pincode:
          type: string
          title: Pincode
        country:
          type: string
          title: Country
          default: India
        business_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Business Type
      type: object
      required:
      - legal_name
      - address_line1
      - city
      - state
      - pincode
      title: BillingAddressRequest
    BillingAddressUpdate:
      properties:
        address_label:
          anyOf:
          - type: string
          - type: 'null'
          title: Address Label
        company_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Company Name
        address_line_1:
          anyOf:
          - type: string
          - type: 'null'
          title: Address Line 1
        address_line_2:
          anyOf:
          - type: string
          - type: 'null'
          title: Address Line 2
        city:
          anyOf:
          - type: string
          - type: 'null'
          title: City
        state:
          anyOf:
          - type: string
          - type: 'null'
          title: State
        pincode:
          anyOf:
          - type: string
          - type: 'null'
          title: Pincode
        country:
          anyOf:
          - type: string
          - type: 'null'
          title: Country
        has_gst:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Has Gst
        gst_number:
          anyOf:
          - type: string
          - type: 'null'
          title: Gst Number
        make_default:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Make Default
      type: object
      title: BillingAddressUpdate
    BlueprintGenerateRequest:
      properties:
        additionalContext:
          anyOf:
          - type: string
          - type: 'null'
          title: Additionalcontext
        workflowName:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflowname
      type: object
      title: BlueprintGenerateRequest
      description: Request model for generating a workflow from blueprint
    Body_batch_synthesize_api_synthesizer_batch_synthesize_post:
      properties:
        texts:
          items:
            type: string
          type: array
          title: Texts
        voice_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Voice Id
        format:
          type: string
          title: Format
          default: mp3
        integration_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Id
      type: object
      required:
      - texts
      title: Body_batch_synthesize_api_synthesizer_batch_synthesize_post
    Body_bulk_update_tickets_api_admin_tickets_bulk_update_post:
      properties:
        ticket_ids:
          items:
            type: string
            format: uuid
          type: array
          title: Ticket Ids
        update_data:
          $ref: '#/components/schemas/TicketUpdate'
      type: object
      required:
      - ticket_ids
      - update_data
      title: Body_bulk_update_tickets_api_admin_tickets_bulk_update_post
    Body_create_import_workflow_api_crm_import_create_import_workflow_post:
      properties:
        entity_type:
          type: string
          pattern: ^(contact|company|deal)$
          title: Entity Type
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
      type: object
      required:
      - entity_type
      title: Body_create_import_workflow_api_crm_import_create_import_workflow_post
    Body_duplicate_saved_query_api_analytics_queries__query_id__duplicate_post:
      properties:
        new_name:
          anyOf:
          - type: string
          - type: 'null'
          title: New Name
      type: object
      title: Body_duplicate_saved_query_api_analytics_queries__query_id__duplicate_post
    Body_get_voice_sample_api_synthesizer_voice_sample_post:
      properties:
        voice_id:
          type: string
          title: Voice Id
        text:
          anyOf:
          - type: string
          - type: 'null'
          title: Text
        integration_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Id
        format:
          type: string
          title: Format
          default: mp3
        speed:
          anyOf:
          - type: number
          - type: 'null'
          title: Speed
        pitch:
          anyOf:
          - type: number
          - type: 'null'
          title: Pitch
        volume:
          anyOf:
          - type: string
          - type: 'null'
          title: Volume
        style:
          anyOf:
          - type: string
          - type: 'null'
          title: Style
        temperature:
          anyOf:
          - type: number
          - type: 'null'
          title: Temperature
        language:
          anyOf:
          - type: string
          - type: 'null'
          title: Language
        model:
          anyOf:
          - type: string
          - type: 'null'
          title: Model
        stability:
          anyOf:
          - type: number
          - type: 'null'
          title: Stability
        similarity_boost:
          anyOf:
          - type: number
          - type: 'null'
          title: Similarity Boost
        use_speaker_boost:
          anyOf:
          - type: string
          - type: 'null'
          title: Use Speaker Boost
      type: object
      required:
      - voice_id
      title: Body_get_voice_sample_api_synthesizer_voice_sample_post
    Body_prepare_deal_product_mapping_api_crm_deal_products_prepare_mapping_post:
      properties:
        file_id:
          type: string
          title: File Id
        sheet_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Sheet Name
      type: object
      required:
      - file_id
      title: Body_prepare_deal_product_mapping_api_crm_deal_products_prepare_mapping_post
    Body_prepare_import_api_crm_import_prepare_post:
      properties:
        file_id:
          type: string
          title: File Id
        entity_type:
          type: string
          pattern: ^(contact|company|deal|product)$
          title: Entity Type
        sheet_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Sheet Name
      type: object
      required:
      - file_id
      - entity_type
      title: Body_prepare_import_api_crm_import_prepare_post
    Body_preview_import_api_team_members_import_preview_post:
      properties:
        file_id:
          type: string
          title: File Id
        sheet:
          anyOf:
          - type: string
          - type: 'null'
          title: Sheet
      type: object
      required:
      - file_id
      title: Body_preview_import_api_team_members_import_preview_post
    Body_process_document_upload_api_admin_business_profile_process_document_post:
      properties:
        file:
          type: string
          format: binary
          title: File
        section_type:
          type: string
          title: Section Type
      type: object
      required:
      - file
      - section_type
      title: Body_process_document_upload_api_admin_business_profile_process_document_post
    Body_send_media_message_api_whatsapp_conversations__conversation_id__send_media_post:
      properties:
        file:
          type: string
          format: binary
          title: File
          description: Media file to send
        message_type:
          type: string
          title: Message Type
          description: 'Type of media: image, video, audio, document'
        caption:
          anyOf:
          - type: string
          - type: 'null'
          title: Caption
          description: Optional caption for media
      type: object
      required:
      - file
      - message_type
      title: Body_send_media_message_api_whatsapp_conversations__conversation_id__send_media_post
    Body_synthesize_speech_api_synthesizer_synthesize_post:
      properties:
        text:
          type: string
          title: Text
        voice_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Voice Id
        language:
          anyOf:
          - type: string
          - type: 'null'
          title: Language
        format:
          type: string
          title: Format
          default: mp3
        speed:
          type: number
          title: Speed
          default: 1.0
        pitch:
          type: number
          title: Pitch
          default: 0.0
        integration_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Id
        stream:
          type: boolean
          title: Stream
          default: false
      type: object
      required:
      - text
      title: Body_synthesize_speech_api_synthesizer_synthesize_post
    Body_transcribe_audio_api_transcriber_transcribe_post:
      properties:
        file:
          type: string
          format: binary
          title: File
        integration_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Id
        language:
          anyOf:
          - type: string
          - type: 'null'
          title: Language
        model:
          anyOf:
          - type: string
          - type: 'null'
          title: Model
        enable_timestamps:
          type: boolean
          title: Enable Timestamps
          default: true
        enable_diarization:
          type: boolean
          title: Enable Diarization
          default: false
      type: object
      required:
      - file
      title: Body_transcribe_audio_api_transcriber_transcribe_post
    Body_upload_analytics_file_api_analytics_upload_file_post:
      properties:
        file:
          type: string
          format: binary
          title: File
        display_name:
          type: string
          title: Display Name
        expires_days:
          type: integer
          title: Expires Days
          default: 7
        sheet_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Sheet Name
      type: object
      required:
      - file
      - display_name
      title: Body_upload_analytics_file_api_analytics_upload_file_post
    Body_upload_asset_api_marketing_assets_upload_post:
      properties:
        file:
          type: string
          format: binary
          title: File
      type: object
      required:
      - file
      title: Body_upload_asset_api_marketing_assets_upload_post
    Body_upload_attachment_api_admin_tickets__ticket_id__attachments_post:
      properties:
        file:
          type: string
          format: binary
          title: File
      type: object
      required:
      - file
      title: Body_upload_attachment_api_admin_tickets__ticket_id__attachments_post
    Body_upload_attachment_api_tickets__ticket_id__attachments_post:
      properties:
        file:
          type: string
          format: binary
          title: File
      type: object
      required:
      - file
      title: Body_upload_attachment_api_tickets__ticket_id__attachments_post
    Body_upload_document_file_api_knowledge_base__kb_id__documents_upload_post:
      properties:
        file:
          type: string
          format: binary
          title: File
        title:
          anyOf:
          - type: string
          - type: 'null'
          title: Title
        metadata:
          anyOf:
          - type: string
          - type: 'null'
          title: Metadata
          default: '{}'
        chunk_size:
          anyOf:
          - type: integer
          - type: 'null'
          title: Chunk Size
          default: 1000
        chunk_overlap:
          anyOf:
          - type: integer
          - type: 'null'
          title: Chunk Overlap
          default: 200
      type: object
      required:
      - file
      title: Body_upload_document_file_api_knowledge_base__kb_id__documents_upload_post
    Body_upload_email_assets_api_marketing_assets_upload_email_assets_post:
      properties:
        files:
          items:
            type: string
            format: binary
          type: array
          title: Files
      type: object
      required:
      - files
      title: Body_upload_email_assets_api_marketing_assets_upload_email_assets_post
    Body_upload_file_api_files_upload_post:
      properties:
        file:
          type: string
          format: binary
          title: File
        purpose:
          type: string
          title: Purpose
          default: general
        allowed_types:
          anyOf:
          - type: string
          - type: 'null'
          title: Allowed Types
      type: object
      required:
      - file
      title: Body_upload_file_api_files_upload_post
    Body_upload_note_attachment_api_crm_notes__note_id__attachments_post:
      properties:
        file:
          type: string
          format: binary
          title: File
        sync_to_kb:
          type: boolean
          title: Sync To Kb
          default: false
        enable_embedding:
          type: boolean
          title: Enable Embedding
          default: true
      type: object
      required:
      - file
      title: Body_upload_note_attachment_api_crm_notes__note_id__attachments_post
    Body_upload_task_attachment_api_crm_tasks__task_id__attachments_post:
      properties:
        file:
          type: string
          format: binary
          title: File
        sync_to_kb:
          type: boolean
          title: Sync To Kb
          default: false
        enable_embedding:
          type: boolean
          title: Enable Embedding
          default: true
      type: object
      required:
      - file
      title: Body_upload_task_attachment_api_crm_tasks__task_id__attachments_post
    Body_validate_email_file_api_marketing_email_validation_validate_file_post:
      properties:
        file:
          type: string
          format: binary
          title: File
          description: CSV file containing email addresses
      type: object
      required:
      - file
      title: Body_validate_email_file_api_marketing_email_validation_validate_file_post
    BroadcastEmailRequest:
      properties:
        account_id:
          type: string
          title: Account Id
        recipients:
          anyOf:
          - items:
              type: string
              format: email
            type: array
          - items:
              additionalProperties: true
              type: object
            type: array
          - items:
              type: string
            type: array
          title: Recipients
        subject:
          type: string
          title: Subject
        html_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Html Content
        text_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Text Content
        template_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Template Id
        personalization:
          anyOf:
          - additionalProperties:
              additionalProperties: true
              type: object
            type: object
          - type: 'null'
          title: Personalization
      type: object
      required:
      - account_id
      - recipients
      - subject
      title: BroadcastEmailRequest
    BulkCalculateRequest:
      properties:
        contact_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Contact Ids
        limit:
          type: integer
          maximum: 10000.0
          minimum: 1.0
          title: Limit
          default: 1000
        run_async:
          type: boolean
          title: Run Async
          description: Run in background (recommended for large datasets)
          default: true
      type: object
      title: BulkCalculateRequest
      description: Request for bulk score calculation
    BulkCreateRequest:
      properties:
        template_name:
          type: string
          title: Template Name
        selected_fields:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Selected Fields
        field_customizations:
          anyOf:
          - additionalProperties:
              additionalProperties: true
              type: object
            type: object
          - type: 'null'
          title: Field Customizations
      type: object
      required:
      - template_name
      title: BulkCreateRequest
    BulkDeploymentRequest:
      properties:
        integration_ids:
          items:
            type: string
          type: array
          title: Integration Ids
        org_ids:
          items:
            type: string
          type: array
          title: Org Ids
      type: object
      required:
      - integration_ids
      - org_ids
      title: BulkDeploymentRequest
      description: Model for bulk deployment request
    BulkEmailSendRequest:
      properties:
        recipients:
          items:
            type: string
            format: email
          type: array
          title: Recipients
        subject:
          type: string
          title: Subject
        html_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Html Content
        text_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Text Content
        template_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Template Id
        personalization:
          anyOf:
          - additionalProperties:
              additionalProperties: true
              type: object
            type: object
          - type: 'null'
          title: Personalization
        provider_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Provider Type
      type: object
      required:
      - recipients
      - subject
      title: BulkEmailSendRequest
    BulkEmailValidationRequest:
      properties:
        emails:
          items:
            type: string
            format: email
          type: array
          title: Emails
          description: List of email addresses to validate
        batch_size:
          type: integer
          maximum: 100.0
          minimum: 1.0
          title: Batch Size
          description: Batch size for processing
          default: 50
        max_concurrent:
          type: integer
          maximum: 20.0
          minimum: 1.0
          title: Max Concurrent
          description: Maximum concurrent validations
          default: 10
      type: object
      required:
      - emails
      title: BulkEmailValidationRequest
      description: Request model for bulk email validation
    BulkExamplesCreate:
      properties:
        examples:
          items:
            $ref: '#/components/schemas/GoldenExampleCreate'
          type: array
          title: Examples
      type: object
      required:
      - examples
      title: BulkExamplesCreate
    BulkImportRequest:
      properties:
        products:
          items:
            $ref: '#/components/schemas/ProductCreate'
          type: array
          title: Products
          description: List of products to import
      type: object
      required:
      - products
      title: BulkImportRequest
    BulkPriceUpdate:
      properties:
        id:
          type: string
          title: Id
          description: Product ID
        price:
          anyOf:
          - type: number
            minimum: 0.0
          - type: string
            pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Price
          description: New price
      type: object
      required:
      - id
      - price
      title: BulkPriceUpdate
    BulkRateUpdate:
      properties:
        resource_type:
          type: string
          title: Resource Type
        resource_subtype:
          type: string
          title: Resource Subtype
        credits_per_unit:
          anyOf:
          - type: number
          - type: 'null'
          title: Credits Per Unit
        input_credits_per_unit:
          anyOf:
          - type: number
          - type: 'null'
          title: Input Credits Per Unit
        output_credits_per_unit:
          anyOf:
          - type: number
          - type: 'null'
          title: Output Credits Per Unit
        unit_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Unit Type
          default: per_unit
      type: object
      required:
      - resource_type
      - resource_subtype
      title: BulkRateUpdate
    BulkRatesRequest:
      properties:
        rates:
          items:
            $ref: '#/components/schemas/BulkRateUpdate'
          type: array
          title: Rates
      type: object
      required:
      - rates
      title: BulkRatesRequest
    BulkRecordRequest:
      properties:
        entity_id:
          type: string
          title: Entity Id
          description: ID of the entity
        records:
          items:
            additionalProperties: true
            type: object
          type: array
          maxItems: 100
          minItems: 1
          title: Records
          description: List of records to create
      type: object
      required:
      - entity_id
      - records
      title: BulkRecordRequest
    BulkSkillUpdateRequest:
      properties:
        skill_names:
          items:
            type: string
          type: array
          title: Skill Names
          description: List of skill names to update
        is_enabled:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Enabled
        requires_approval:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Requires Approval
      type: object
      required:
      - skill_names
      title: BulkSkillUpdateRequest
      description: Request to update multiple skills
    BulkUpdateResponse:
      properties:
        updated:
          type: integer
          title: Updated
        message:
          type: string
          title: Message
      type: object
      required:
      - updated
      - message
      title: BulkUpdateResponse
      description: Response for bulk update
    BulkValidationResponse:
      properties:
        results:
          items:
            $ref: '#/components/schemas/EmailValidationResponse'
          type: array
          title: Results
        summary:
          additionalProperties: true
          type: object
          title: Summary
        total_processed:
          type: integer
          title: Total Processed
        processing_time_seconds:
          type: number
          title: Processing Time Seconds
      type: object
      required:
      - results
      - summary
      - total_processed
      - processing_time_seconds
      title: BulkValidationResponse
      description: Response model for bulk email validation
    BusinessProfileSection:
      properties:
        id:
          anyOf:
          - type: string
          - type: 'null'
          title: Id
        section_type:
          type: string
          title: Section Type
        section_title:
          type: string
          title: Section Title
        content:
          type: string
          title: Content
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
          default: {}
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
          default: true
        display_order:
          anyOf:
          - type: integer
          - type: 'null'
          title: Display Order
          default: 0
        section_category:
          anyOf:
          - type: string
          - type: 'null'
          title: Section Category
          default: custom
        is_template:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Template
          default: false
        allows_custom_content:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Allows Custom Content
          default: true
        sync_to_kb:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Sync To Kb
          default: false
      type: object
      required:
      - section_type
      - section_title
      - content
      title: BusinessProfileSection
    BusinessProfileUpdate:
      properties:
        section_title:
          anyOf:
          - type: string
          - type: 'null'
          title: Section Title
        content:
          anyOf:
          - type: string
          - type: 'null'
          title: Content
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
        display_order:
          anyOf:
          - type: integer
          - type: 'null'
          title: Display Order
        section_category:
          anyOf:
          - type: string
          - type: 'null'
          title: Section Category
        sync_to_kb:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Sync To Kb
          default: false
      type: object
      title: BusinessProfileUpdate
    ButtonStyle:
      properties:
        fontSize:
          type: string
          title: Fontsize
          default: 16px
        fontWeight:
          type: string
          title: Fontweight
          default: '500'
        color:
          type: string
          title: Color
          default: '#FFFFFF'
        marginBottom:
          anyOf:
          - type: string
          - type: 'null'
          title: Marginbottom
        fontFamily:
          type: string
          title: Fontfamily
          default: Inter, system-ui, sans-serif
        backgroundColor:
          type: string
          title: Backgroundcolor
          default: '#4F46E5'
        padding:
          type: string
          title: Padding
          default: 12px 24px
        borderRadius:
          type: string
          title: Borderradius
          default: 6px
        marginTop:
          type: string
          title: Margintop
          default: 24px
        textAlign:
          type: string
          title: Textalign
          default: center
        width:
          anyOf:
          - type: string
          - type: 'null'
          title: Width
          default: 100%
      type: object
      title: ButtonStyle
    CRMConfig:
      properties:
        companies_enabled:
          type: boolean
          title: Companies Enabled
          default: true
        contacts_enabled:
          type: boolean
          title: Contacts Enabled
          default: true
        deals_enabled:
          type: boolean
          title: Deals Enabled
          default: true
      type: object
      title: CRMConfig
      description: CRM module configuration
    CalibrationRunCreate:
      properties:
        evaluator_id:
          type: string
          title: Evaluator Id
        golden_set_id:
          type: string
          title: Golden Set Id
      type: object
      required:
      - evaluator_id
      - golden_set_id
      title: CalibrationRunCreate
    CallMetadata:
      properties:
        from_number:
          anyOf:
          - type: string
          - type: 'null'
          title: From Number
          description: Caller's phone number
        to_number:
          anyOf:
          - type: string
          - type: 'null'
          title: To Number
          description: Called number
        call_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Call Id
          description: Asterisk call ID
        direction:
          type: string
          title: Direction
          description: 'Call direction: inbound or outbound'
          default: inbound
      type: object
      title: CallMetadata
      description: Metadata about the phone call
    CampaignAnalytics:
      properties:
        sent:
          type: integer
          title: Sent
          default: 0
        delivered:
          type: integer
          title: Delivered
          default: 0
        opened:
          type: integer
          title: Opened
          default: 0
        clicked:
          type: integer
          title: Clicked
          default: 0
        failed:
          type: integer
          title: Failed
          default: 0
        deliveryRate:
          type: number
          title: Deliveryrate
          default: 0.0
        openRate:
          type: number
          title: Openrate
          default: 0.0
        clickRate:
          type: number
          title: Clickrate
          default: 0.0
        failureRate:
          type: number
          title: Failurerate
          default: 0.0
      type: object
      title: CampaignAnalytics
    CampaignCreate:
      properties:
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        channel:
          type: string
          title: Channel
        templateId:
          type: string
          title: Templateid
        audience:
          $ref: '#/components/schemas/AudienceDefinition'
        schedule:
          $ref: '#/components/schemas/ScheduleConfig'
        execution:
          $ref: '#/components/schemas/ExecutionConfig'
        workflowId:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflowid
      type: object
      required:
      - name
      - channel
      - templateId
      - audience
      - schedule
      - execution
      title: CampaignCreate
    CampaignLaunchRequest:
      properties:
        campaign_id:
          type: string
          title: Campaign Id
          description: ID of the campaign to launch
        execution_mode:
          type: string
          title: Execution Mode
          description: 'Execution mode: manual, scheduled, triggered'
          default: manual
        scheduled_at:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Scheduled At
          description: Scheduled execution time (for scheduled mode)
        priority:
          type: string
          title: Priority
          description: 'Campaign priority: high, normal, low'
          default: normal
        batch_size_override:
          anyOf:
          - type: integer
          - type: 'null'
          title: Batch Size Override
          description: Override default batch size
        test_mode:
          type: boolean
          title: Test Mode
          description: Run in test mode with limited recipients
          default: false
      type: object
      required:
      - campaign_id
      title: CampaignLaunchRequest
      description: Request model for launching a campaign with batch processing
    CampaignLaunchResponse:
      properties:
        success:
          type: boolean
          title: Success
        campaign_id:
          type: string
          title: Campaign Id
        task_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Task Id
        scheduled_task_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Scheduled Task Id
        total_batches:
          anyOf:
          - type: integer
          - type: 'null'
          title: Total Batches
        total_recipients:
          anyOf:
          - type: integer
          - type: 'null'
          title: Total Recipients
        batch_size:
          anyOf:
          - type: integer
          - type: 'null'
          title: Batch Size
        estimated_completion:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Estimated Completion
        status:
          type: string
          title: Status
        error:
          anyOf:
          - type: string
          - type: 'null'
          title: Error
      type: object
      required:
      - success
      - campaign_id
      - status
      title: CampaignLaunchResponse
      description: Response model for campaign launch
    CampaignListResponse:
      properties:
        campaigns:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Campaigns
        stats:
          additionalProperties:
            type: integer
          type: object
          title: Stats
      type: object
      required:
      - campaigns
      - stats
      title: CampaignListResponse
    CampaignProgressResponse:
      properties:
        campaign_id:
          type: string
          title: Campaign Id
        status:
          type: string
          title: Status
        total_batches:
          type: integer
          title: Total Batches
        completed_batches:
          type: integer
          title: Completed Batches
        failed_batches:
          type: integer
          title: Failed Batches
        current_batch:
          anyOf:
          - type: integer
          - type: 'null'
          title: Current Batch
        progress_percentage:
          type: number
          title: Progress Percentage
        estimated_completion:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Estimated Completion
        start_time:
          type: string
          format: date-time
          title: Start Time
        last_update:
          type: string
          format: date-time
          title: Last Update
        error_message:
          anyOf:
          - type: string
          - type: 'null'
          title: Error Message
      type: object
      required:
      - campaign_id
      - status
      - total_batches
      - completed_batches
      - failed_batches
      - current_batch
      - progress_percentage
      - estimated_completion
      - start_time
      - last_update
      title: CampaignProgressResponse
      description: Response model for campaign progress information
    CampaignUpdate:
      properties:
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        templateId:
          anyOf:
          - type: string
          - type: 'null'
          title: Templateid
        audience:
          anyOf:
          - $ref: '#/components/schemas/AudienceDefinition'
          - type: 'null'
        schedule:
          anyOf:
          - $ref: '#/components/schemas/ScheduleConfig'
          - type: 'null'
        execution:
          anyOf:
          - $ref: '#/components/schemas/ExecutionConfig'
          - type: 'null'
        workflowId:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflowid
      type: object
      title: CampaignUpdate
    CatalogCreate:
      properties:
        integration_id:
          type: string
          title: Integration Id
          description: WhatsApp integration ID
        catalog_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Catalog Id
          description: Specific Meta catalog ID to register (if None, uses first available)
        catalog_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Catalog Name
          description: Custom catalog name
        force_create:
          type: boolean
          title: Force Create
          description: Force creation of new catalog in Meta (instead of registering
            existing)
          default: false
      type: object
      required:
      - integration_id
      title: CatalogCreate
    ChannelType:
      type: string
      enum:
      - email
      - sms
      - whatsapp
      title: ChannelType
      description: Supported communication channels
    Chart:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        query_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Query Id
        query_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Query Name
        chart_type:
          type: string
          title: Chart Type
        chart_config:
          additionalProperties: true
          type: object
          title: Chart Config
        is_shared:
          type: boolean
          title: Is Shared
        created_by:
          type: string
          title: Created By
        organization_id:
          type: string
          title: Organization Id
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
      - id
      - name
      - chart_type
      - chart_config
      - is_shared
      - created_by
      - organization_id
      - created_at
      - updated_at
      title: Chart
    ChartCreate:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
        query_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Query Id
          description: ID of the saved query to visualize (optional for text widgets)
        chart_type:
          type: string
          title: Chart Type
          description: 'Chart type: bar, line, pie, table, area, text, etc.'
        chart_config:
          additionalProperties: true
          type: object
          title: Chart Config
          description: Chart configuration
          default: {}
        is_shared:
          type: boolean
          title: Is Shared
          description: Share with organization
          default: false
      type: object
      required:
      - name
      - chart_type
      title: ChartCreate
    ChartQueryRequest:
      properties:
        query_type:
          type: string
          title: Query Type
          description: '''visual'' or ''sql'''
        config:
          additionalProperties: true
          type: object
          title: Config
          description: Query configuration
        parameters:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Parameters
          description: Query parameters
          default: {}
        chart_config:
          additionalProperties: true
          type: object
          title: Chart Config
          description: Chart config with dimensions and metrics
        limit:
          anyOf:
          - type: integer
            maximum: 10000.0
          - type: 'null'
          title: Limit
          description: Result limit
          default: 10000
      type: object
      required:
      - query_type
      - config
      - chart_config
      title: ChartQueryRequest
    ChartUpdate:
      properties:
        name:
          anyOf:
          - type: string
            maxLength: 255
            minLength: 1
          - type: 'null'
          title: Name
        query_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Query Id
          description: ID of the saved query to visualize
        chart_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Chart Type
        chart_config:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Chart Config
        is_shared:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Shared
      type: object
      title: ChartUpdate
    ChatAttachment:
      properties:
        file_id:
          type: string
          title: File Id
          description: Unique file identifier
        filename:
          type: string
          title: Filename
          description: Original filename
        mime_type:
          type: string
          title: Mime Type
          description: MIME type of the file
        url:
          type: string
          title: Url
          description: URL to access the file
        size:
          anyOf:
          - type: integer
          - type: 'null'
          title: Size
          description: File size in bytes
      type: object
      required:
      - file_id
      - filename
      - mime_type
      - url
      title: ChatAttachment
      description: File attachment from user
    ChatMessageInput:
      properties:
        message:
          type: string
          title: Message
        sessionContext:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Sessioncontext
      type: object
      required:
      - message
      title: ChatMessageInput
    ChatMessageResponse:
      properties:
        id:
          type: string
          title: Id
        session_id:
          type: string
          title: Session Id
        role:
          type: string
          title: Role
        content:
          anyOf:
          - type: string
          - type: 'null'
          title: Content
        response_components:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Response Components
        workflow_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Id
        workflow_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Name
        timestamp:
          type: string
          format: date-time
          title: Timestamp
        message_index:
          anyOf:
          - type: integer
          - type: 'null'
          title: Message Index
      type: object
      required:
      - id
      - session_id
      - role
      - content
      - response_components
      - workflow_id
      - workflow_name
      - timestamp
      - message_index
      title: ChatMessageResponse
    ChatSessionResponse:
      properties:
        id:
          type: string
          title: Id
        project_id:
          type: string
          title: Project Id
        user_id:
          type: string
          title: User Id
        title:
          type: string
          title: Title
        created_at:
          type: string
          format: date-time
          title: Created At
        last_message_at:
          type: string
          format: date-time
          title: Last Message At
        message_count:
          type: integer
          title: Message Count
        selected_agents:
          items:
            type: string
          type: array
          title: Selected Agents
        is_archived:
          type: boolean
          title: Is Archived
        is_favorite:
          type: boolean
          title: Is Favorite
        first_message:
          anyOf:
          - type: string
          - type: 'null'
          title: First Message
          description: Full content of the first user message for hover display
      type: object
      required:
      - id
      - project_id
      - user_id
      - title
      - created_at
      - last_message_at
      - message_count
      - selected_agents
      - is_archived
      - is_favorite
      title: ChatSessionResponse
    ChatWidgetConfigCreate:
      properties:
        name:
          type: string
          title: Name
          description: Widget name for identification
        api_key_id:
          type: string
          title: Api Key Id
          description: API key ID this widget is linked to
        position:
          type: string
          title: Position
          description: 'Widget position: bottom-right or bottom-left'
          default: bottom-right
        theme:
          type: string
          title: Theme
          description: 'Theme: light or dark'
          default: light
        primary_color:
          type: string
          title: Primary Color
          description: Primary color hex code
          default: '#ee785b'
        button_text:
          type: string
          title: Button Text
          description: Button text
          default: Chat with us
        header_title:
          type: string
          title: Header Title
          description: Chat header title
          default: Chat
        company_logo:
          anyOf:
          - type: string
          - type: 'null'
          title: Company Logo
          description: Company logo URL
        welcome_heading:
          type: string
          title: Welcome Heading
          description: Welcome heading text
          default: Hi there!
        welcome_subheading:
          anyOf:
          - type: string
          - type: 'null'
          title: Welcome Subheading
          description: Welcome subheading text
        suggested_questions:
          items:
            type: string
          type: array
          title: Suggested Questions
          description: Suggested questions list
          default: []
        section_questions:
          additionalProperties:
            items:
              type: string
            type: array
          type: object
          title: Section Questions
          description: Section-wise questions
          default: {}
        workflow_ids:
          items:
            type: string
          type: array
          title: Workflow Ids
          description: Workflow IDs to execute
          default: []
        custom_css:
          anyOf:
          - type: string
          - type: 'null'
          title: Custom Css
          description: Custom CSS overrides
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
          description: Additional metadata
          default: {}
      type: object
      required:
      - name
      - api_key_id
      title: ChatWidgetConfigCreate
      description: Request model for creating a chat widget config
    ChatWidgetConfigResponse:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        api_key_id:
          type: string
          title: Api Key Id
        position:
          type: string
          title: Position
        theme:
          type: string
          title: Theme
        primary_color:
          type: string
          title: Primary Color
        button_text:
          type: string
          title: Button Text
        header_title:
          type: string
          title: Header Title
        company_logo:
          anyOf:
          - type: string
          - type: 'null'
          title: Company Logo
        welcome_heading:
          type: string
          title: Welcome Heading
        welcome_subheading:
          anyOf:
          - type: string
          - type: 'null'
          title: Welcome Subheading
        suggested_questions:
          items:
            type: string
          type: array
          title: Suggested Questions
        section_questions:
          additionalProperties:
            items:
              type: string
            type: array
          type: object
          title: Section Questions
        workflow_ids:
          items:
            type: string
          type: array
          title: Workflow Ids
        custom_css:
          anyOf:
          - type: string
          - type: 'null'
          title: Custom Css
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
        is_active:
          type: boolean
          title: Is Active
        created_at:
          anyOf:
          - type: string
          - type: 'null'
          title: Created At
        updated_at:
          anyOf:
          - type: string
          - type: 'null'
          title: Updated At
        created_by:
          anyOf:
          - type: string
          - type: 'null'
          title: Created By
        updated_by:
          anyOf:
          - type: string
          - type: 'null'
          title: Updated By
      type: object
      required:
      - id
      - name
      - api_key_id
      - position
      - theme
      - primary_color
      - button_text
      - header_title
      - company_logo
      - welcome_heading
      - welcome_subheading
      - suggested_questions
      - section_questions
      - workflow_ids
      - custom_css
      - metadata
      - is_active
      - created_at
      - updated_at
      - created_by
      - updated_by
      title: ChatWidgetConfigResponse
      description: Response model for chat widget config
    ChatWidgetConfigUpdate:
      properties:
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        position:
          anyOf:
          - type: string
          - type: 'null'
          title: Position
        theme:
          anyOf:
          - type: string
          - type: 'null'
          title: Theme
        primary_color:
          anyOf:
          - type: string
          - type: 'null'
          title: Primary Color
        button_text:
          anyOf:
          - type: string
          - type: 'null'
          title: Button Text
        header_title:
          anyOf:
          - type: string
          - type: 'null'
          title: Header Title
        company_logo:
          anyOf:
          - type: string
          - type: 'null'
          title: Company Logo
        welcome_heading:
          anyOf:
          - type: string
          - type: 'null'
          title: Welcome Heading
        welcome_subheading:
          anyOf:
          - type: string
          - type: 'null'
          title: Welcome Subheading
        suggested_questions:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Suggested Questions
        section_questions:
          anyOf:
          - additionalProperties:
              items:
                type: string
              type: array
            type: object
          - type: 'null'
          title: Section Questions
        workflow_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Workflow Ids
        custom_css:
          anyOf:
          - type: string
          - type: 'null'
          title: Custom Css
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
      type: object
      title: ChatWidgetConfigUpdate
      description: Request model for updating a chat widget config
    ChatWidgetRequest:
      properties:
        message:
          type: string
          title: Message
        workflows:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Workflows
          default: []
        conversation_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Conversation Id
      type: object
      required:
      - message
      title: ChatWidgetRequest
    ChatWidgetResponse:
      properties:
        response:
          type: string
          title: Response
        conversation_id:
          type: string
          title: Conversation Id
        success:
          type: boolean
          title: Success
      type: object
      required:
      - response
      - conversation_id
      - success
      title: ChatWidgetResponse
    ChatWorkflowResponse:
      properties:
        response:
          type: string
          title: Response
        workflowId:
          type: string
          title: Workflowid
        executionId:
          type: string
          title: Executionid
        source:
          type: string
          title: Source
          default: workflow
        data:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Data
        suggestions:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Suggestions
      type: object
      required:
      - response
      - workflowId
      - executionId
      title: ChatWorkflowResponse
    CollectionCreate:
      properties:
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        is_public:
          type: boolean
          title: Is Public
          default: true
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
          default: []
      type: object
      required:
      - name
      title: CollectionCreate
    CollectionItemAdd:
      properties:
        workflow_id:
          type: string
          title: Workflow Id
        notes:
          anyOf:
          - type: string
          - type: 'null'
          title: Notes
      type: object
      required:
      - workflow_id
      title: CollectionItemAdd
    CollectionUpdate:
      properties:
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        is_public:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Public
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
      type: object
      title: CollectionUpdate
    CommentAttachment:
      properties:
        file_id:
          type: string
          title: File Id
        file_name:
          type: string
          title: File Name
        file_path:
          anyOf:
          - type: string
          - type: 'null'
          title: File Path
        file_size:
          type: integer
          title: File Size
        file_type:
          type: string
          title: File Type
        azure_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Azure Url
        uploaded_by:
          anyOf:
          - type: string
          - type: 'null'
          title: Uploaded By
        uploaded_at:
          anyOf:
          - type: string
          - type: 'null'
          title: Uploaded At
      type: object
      required:
      - file_id
      - file_name
      - file_size
      - file_type
      title: CommentAttachment
      description: Model for comment attachment
    CommentFlag:
      properties:
        reason:
          type: string
          title: Reason
      type: object
      required:
      - reason
      title: CommentFlag
    CompanyBatchUpdate:
      properties:
        company_ids:
          items:
            type: string
          type: array
          title: Company Ids
          description: List of company IDs to update
        updates:
          $ref: '#/components/schemas/CompanyUpdate'
          description: Fields to update on all selected companies
      type: object
      required:
      - company_ids
      - updates
      title: CompanyBatchUpdate
    CompanyCreate:
      properties:
        extras:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Extras
          description: Additional fields not in core model
        tags:
          items:
            type: string
          type: array
          title: Tags
          description: Tags for the entity
        custom_fields:
          additionalProperties: true
          type: object
          title: Custom Fields
          description: Custom field values
        utm_source:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Source
          description: UTM source parameter
        utm_medium:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Medium
          description: UTM medium parameter
        utm_campaign:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Campaign
          description: UTM campaign parameter
        utm_term:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Term
          description: UTM term parameter
        utm_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Content
          description: UTM content parameter
        name:
          type: string
          maxLength: 255
          title: Name
          description: Company name (required)
        domain:
          anyOf:
          - type: string
            maxLength: 255
          - type: 'null'
          title: Domain
          description: Company domain
        website:
          anyOf:
          - type: string
          - type: 'null'
          title: Website
          description: Company website URL
        phone:
          anyOf:
          - type: string
            maxLength: 50
          - type: 'null'
          title: Phone
          description: Company phone number
        industry:
          anyOf:
          - type: string
          - type: 'null'
          title: Industry
          description: Company industry
        size:
          anyOf:
          - type: string
          - type: 'null'
          title: Size
          description: Company size (1-10, 11-50, etc.)
      additionalProperties: true
      type: object
      required:
      - name
      title: CompanyCreate
      description: Company creation model using hybrid approach - validates core fields,
        accepts any extras
      example:
        address_line1: 123 Business St
        annual_revenue: $10M-50M
        city: San Francisco
        company_size: 51-200
        country: USA
        description: Leading provider of business solutions
        domain: acme.com
        email: info@acme.com
        industry: Technology
        linkedin_url: https://linkedin.com/company/acme
        name: ACME Corporation
        phone: '+1234567890'
        postal_code: '94105'
        size: 51-200
        state: CA
        tags:
        - enterprise
        - technology
        utm_source: partner_referral
        website: https://acme.com
    CompanyData:
      properties:
        name:
          type: string
          title: Name
        domain:
          anyOf:
          - type: string
          - type: 'null'
          title: Domain
        industry:
          anyOf:
          - type: string
          - type: 'null'
          title: Industry
        size:
          anyOf:
          - type: string
          - type: 'null'
          title: Size
        source:
          anyOf:
          - type: string
          - type: 'null'
          title: Source
          default: external_api
        custom_fields:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Custom Fields
      type: object
      required:
      - name
      title: CompanyData
      description: Company data model for external API
    CompanyUpdate:
      properties:
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        domain:
          anyOf:
          - type: string
          - type: 'null'
          title: Domain
        website:
          anyOf:
          - type: string
          - type: 'null'
          title: Website
        industry:
          anyOf:
          - type: string
          - type: 'null'
          title: Industry
        company_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Company Type
        size:
          anyOf:
          - type: string
          - type: 'null'
          title: Size
        company_size:
          anyOf:
          - type: string
          - type: 'null'
          title: Company Size
        annual_revenue:
          anyOf:
          - type: string
          - type: 'null'
          title: Annual Revenue
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        phone:
          anyOf:
          - type: string
          - type: 'null'
          title: Phone
        email:
          anyOf:
          - type: string
          - type: 'null'
          title: Email
        status:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
        address_line1:
          anyOf:
          - type: string
          - type: 'null'
          title: Address Line1
        address_line2:
          anyOf:
          - type: string
          - type: 'null'
          title: Address Line2
        city:
          anyOf:
          - type: string
          - type: 'null'
          title: City
        state:
          anyOf:
          - type: string
          - type: 'null'
          title: State
        postal_code:
          anyOf:
          - type: string
          - type: 'null'
          title: Postal Code
        country:
          anyOf:
          - type: string
          - type: 'null'
          title: Country
        linkedin_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Linkedin Url
        twitter_handle:
          anyOf:
          - type: string
          - type: 'null'
          title: Twitter Handle
        facebook_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Facebook Url
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
        contact_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Contact Ids
        deal_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Deal Ids
        custom_fields:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Custom Fields
      type: object
      title: CompanyUpdate
    CompleteStepRequest:
      properties:
        step_id:
          type: string
          title: Step Id
        sub_step_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Sub Step Id
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
      type: object
      required:
      - step_id
      title: CompleteStepRequest
    ConfigUpdateRequest:
      properties:
        auto_create_contacts:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Auto Create Contacts
        sync_interval_minutes:
          anyOf:
          - type: integer
          - type: 'null'
          title: Sync Interval Minutes
        selected_forms:
          anyOf:
          - items:
              additionalProperties: true
              type: object
            type: array
          - type: 'null'
          title: Selected Forms
        field_mapping:
          anyOf:
          - additionalProperties:
              type: string
            type: object
          - type: 'null'
          title: Field Mapping
      type: object
      title: ConfigUpdateRequest
      description: Request to update integration configuration
    ConnectRequest:
      properties:
        service:
          type: string
          enum:
          - calendar
          - sheets
          - forms
          title: Service
      type: object
      required:
      - service
      title: ConnectRequest
    ConnectWorkflowRequest:
      properties:
        workflow_id:
          type: string
          title: Workflow Id
        node_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Node Id
      type: object
      required:
      - workflow_id
      title: ConnectWorkflowRequest
    ContactBatchUpdate:
      properties:
        contact_ids:
          items:
            type: string
          type: array
          title: Contact Ids
          description: List of contact IDs to update
        updates:
          $ref: '#/components/schemas/ContactUpdate'
          description: Fields to update on all selected contacts
      type: object
      required:
      - contact_ids
      - updates
      title: ContactBatchUpdate
    ContactCreate:
      properties:
        extras:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Extras
          description: Additional fields not in core model
        tags:
          items:
            type: string
          type: array
          title: Tags
          description: Tags for the entity
        custom_fields:
          additionalProperties: true
          type: object
          title: Custom Fields
          description: Custom field values
        utm_source:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Source
          description: UTM source parameter
        utm_medium:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Medium
          description: UTM medium parameter
        utm_campaign:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Campaign
          description: UTM campaign parameter
        utm_term:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Term
          description: UTM term parameter
        utm_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Content
          description: UTM content parameter
        email:
          anyOf:
          - type: string
            format: email
          - type: 'null'
          title: Email
          description: Contact email address
        first_name:
          anyOf:
          - type: string
            maxLength: 255
          - type: 'null'
          title: First Name
          description: Contact first name
        last_name:
          anyOf:
          - type: string
            maxLength: 255
          - type: 'null'
          title: Last Name
          description: Contact last name
        phone:
          anyOf:
          - type: string
            maxLength: 50
          - type: 'null'
          title: Phone
          description: Primary phone number
        lead_status:
          anyOf:
          - type: string
          - type: 'null'
          title: Lead Status
          description: Lead status (new, contacted, qualified, etc.)
        lead_score:
          anyOf:
          - type: integer
            maximum: 100.0
            minimum: 0.0
          - type: 'null'
          title: Lead Score
          description: Lead score (0-100)
          default: 0
        ai_lead_score:
          anyOf:
          - type: integer
            maximum: 100.0
            minimum: 0.0
          - type: 'null'
          title: Ai Lead Score
          description: AI-calculated lead score (0-100)
      additionalProperties: true
      type: object
      title: ContactCreate
      description: Contact creation model using hybrid approach - validates core fields,
        accepts any extras
      example:
        city: New York
        email: john.doe@example.com
        first_name: John
        job_title: CEO
        last_name: Doe
        lead_score: 75
        lead_status: new
        mobile: '+1987654321'
        phone: '+1234567890'
        tags:
        - important
        - enterprise
        utm_campaign: summer2024
        utm_source: google
    ContactData:
      properties:
        email:
          type: string
          title: Email
        first_name:
          anyOf:
          - type: string
          - type: 'null'
          title: First Name
        last_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Last Name
        phone:
          anyOf:
          - type: string
          - type: 'null'
          title: Phone
        company_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Company Name
        source:
          anyOf:
          - type: string
          - type: 'null'
          title: Source
          default: external_api
        utm_source:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Source
        utm_medium:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Medium
        utm_campaign:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Campaign
        utm_term:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Term
        utm_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Content
        custom_fields:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Custom Fields
      type: object
      required:
      - email
      title: ContactData
      description: Contact data model for external API
    ContactLink:
      properties:
        contact_ids:
          items:
            type: string
          type: array
          title: Contact Ids
        role:
          anyOf:
          - type: string
          - type: 'null'
          title: Role
          default: other
        is_primary:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Primary
          default: false
      type: object
      required:
      - contact_ids
      title: ContactLink
    ContactStatsResponse:
      properties:
        total_deal_value:
          type: number
          title: Total Deal Value
          default: 0
        deal_count:
          type: integer
          title: Deal Count
          default: 0
        active_deal_count:
          type: integer
          title: Active Deal Count
          default: 0
        won_deal_count:
          type: integer
          title: Won Deal Count
          default: 0
        open_task_count:
          type: integer
          title: Open Task Count
          default: 0
        completed_task_count:
          type: integer
          title: Completed Task Count
          default: 0
        note_count:
          type: integer
          title: Note Count
          default: 0
        activity_count:
          type: integer
          title: Activity Count
          default: 0
        last_activity_date:
          anyOf:
          - type: string
          - type: 'null'
          title: Last Activity Date
        last_activity_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Last Activity Type
        company_count:
          type: integer
          title: Company Count
          default: 0
      type: object
      title: ContactStatsResponse
      description: Response model for contact stats
    ContactUpdate:
      properties:
        email:
          anyOf:
          - type: string
            format: email
          - type: 'null'
          title: Email
        first_name:
          anyOf:
          - type: string
          - type: 'null'
          title: First Name
        last_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Last Name
        phone:
          anyOf:
          - type: string
          - type: 'null'
          title: Phone
        mobile:
          anyOf:
          - type: string
          - type: 'null'
          title: Mobile
        job_title:
          anyOf:
          - type: string
          - type: 'null'
          title: Job Title
        department:
          anyOf:
          - type: string
          - type: 'null'
          title: Department
        lead_status:
          anyOf:
          - type: string
          - type: 'null'
          title: Lead Status
        lead_score:
          anyOf:
          - type: integer
          - type: 'null'
          title: Lead Score
        ai_lead_score:
          anyOf:
          - type: integer
          - type: 'null'
          title: Ai Lead Score
        lifecycle_stage_id_fk:
          anyOf:
          - type: string
          - type: 'null'
          title: Lifecycle Stage Id Fk
        preferred_contact_method:
          anyOf:
          - type: string
          - type: 'null'
          title: Preferred Contact Method
        timezone:
          anyOf:
          - type: string
          - type: 'null'
          title: Timezone
        language:
          anyOf:
          - type: string
          - type: 'null'
          title: Language
        last_contacted_at:
          anyOf:
          - type: string
          - type: 'null'
          title: Last Contacted At
        address_line1:
          anyOf:
          - type: string
          - type: 'null'
          title: Address Line1
        address_line2:
          anyOf:
          - type: string
          - type: 'null'
          title: Address Line2
        city:
          anyOf:
          - type: string
          - type: 'null'
          title: City
        state:
          anyOf:
          - type: string
          - type: 'null'
          title: State
        postal_code:
          anyOf:
          - type: string
          - type: 'null'
          title: Postal Code
        country:
          anyOf:
          - type: string
          - type: 'null'
          title: Country
        linkedin_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Linkedin Url
        twitter_handle:
          anyOf:
          - type: string
          - type: 'null'
          title: Twitter Handle
        facebook_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Facebook Url
        source:
          anyOf:
          - type: string
          - type: 'null'
          title: Source
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
        deal_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Deal Ids
        custom_fields:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Custom Fields
        summary:
          anyOf:
          - type: string
          - type: 'null'
          title: Summary
        last_summary_generated:
          anyOf:
          - type: string
          - type: 'null'
          title: Last Summary Generated
        utm_source:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Source
        utm_medium:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Medium
        utm_campaign:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Campaign
        utm_term:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Term
        utm_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Content
        acquisition_channel:
          anyOf:
          - type: string
          - type: 'null'
          title: Acquisition Channel
        acquisition_source:
          anyOf:
          - type: string
          - type: 'null'
          title: Acquisition Source
        acquisition_medium:
          anyOf:
          - type: string
          - type: 'null'
          title: Acquisition Medium
        acquisition_campaign:
          anyOf:
          - type: string
          - type: 'null'
          title: Acquisition Campaign
        acquisition_date:
          anyOf:
          - type: string
          - type: 'null'
          title: Acquisition Date
        acquisition_entry_landing_page:
          anyOf:
          - type: string
          - type: 'null'
          title: Acquisition Entry Landing Page
        acquisition_exit_landing_page:
          anyOf:
          - type: string
          - type: 'null'
          title: Acquisition Exit Landing Page
        landing_page_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Landing Page Url
        exit_landing_page_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Exit Landing Page Url
        referrer_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Referrer Url
        channel:
          anyOf:
          - type: string
          - type: 'null'
          title: Channel
        medium:
          anyOf:
          - type: string
          - type: 'null'
          title: Medium
        call_status:
          anyOf:
          - type: string
          - type: 'null'
          title: Call Status
        owner_email:
          anyOf:
          - type: string
          - type: 'null'
          title: Owner Email
        gender:
          anyOf:
          - type: string
          - type: 'null'
          title: Gender
        communication_opt_in_status:
          anyOf:
          - type: string
          - type: 'null'
          title: Communication Opt In Status
      type: object
      title: ContactUpdate
    CreateAPIKeyRequest:
      properties:
        name:
          type: string
          title: Name
        expires_in_days:
          anyOf:
          - type: integer
          - type: 'null'
          title: Expires In Days
        permissions:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Permissions
      type: object
      required:
      - name
      title: CreateAPIKeyRequest
    CreateAsteriskIntegrationRequest:
      properties:
        integration_name:
          type: string
          title: Integration Name
          description: Name for this integration
          default: Expedify Tele
        ami_host:
          type: string
          title: Ami Host
          description: Server URL for outbound calls (e.g., expedify.tail24bc6c.ts.net)
        api_key:
          type: string
          title: Api Key
          description: API key for X-API-Key header authentication
        phone_number:
          type: string
          title: Phone Number
          description: Phone number for voice calls (e.g., +919876543210)
      type: object
      required:
      - ami_host
      - api_key
      - phone_number
      title: CreateAsteriskIntegrationRequest
      description: Request to create a new Expedify Tele integration
    CreateChatSessionRequest:
      properties:
        title:
          anyOf:
          - type: string
          - type: 'null'
          title: Title
          description: Optional title for the chat session
        selected_agents:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Selected Agents
          description: List of selected agent/workflow IDs
      type: object
      title: CreateChatSessionRequest
    CreateFAQItemRequest:
      properties:
        question:
          type: string
          title: Question
        answer:
          type: string
          title: Answer
        category:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
          default: general
        display_order:
          anyOf:
          - type: integer
          - type: 'null'
          title: Display Order
          default: 0
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
          default: true
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
        sync_to_kb:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Sync To Kb
          default: false
      type: object
      required:
      - question
      - answer
      title: CreateFAQItemRequest
    CreateKnowledgeBaseRequest:
      properties:
        name:
          type: string
          title: Name
          description: Name of the knowledge base
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          description: Description of the knowledge base
        vector_db_integration_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Vector Db Integration Id
          description: Vector database integration ID
        settings:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Settings
          description: Additional settings
      type: object
      required:
      - name
      title: CreateKnowledgeBaseRequest
    CreateNewCatalogRequest:
      properties:
        integration_id:
          type: string
          title: Integration Id
        catalog_name:
          type: string
          title: Catalog Name
        set_as_default:
          type: boolean
          title: Set As Default
          description: Set this catalog as default
          default: true
      type: object
      required:
      - integration_id
      - catalog_name
      title: CreateNewCatalogRequest
    CreateRecordRequest:
      properties:
        entity_id:
          type: string
          title: Entity Id
          description: ID of the entity (contact/deal/company/task)
        record_data:
          additionalProperties: true
          type: object
          title: Record Data
          description: Data for the new record
      type: object
      required:
      - entity_id
      - record_data
      title: CreateRecordRequest
    CreateRuleRequest:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          default: ''
        enabled:
          type: boolean
          title: Enabled
          default: true
        field_scores:
          items:
            $ref: '#/components/schemas/FieldScore'
          type: array
          title: Field Scores
          description: Array of field-to-score mappings
        max_score:
          type: integer
          maximum: 100.0
          minimum: 1.0
          title: Max Score
          description: Maximum points this rule can contribute (mandatory)
        rule_config:
          anyOf:
          - $ref: '#/components/schemas/RuleConfig'
          - type: 'null'
        priority:
          anyOf:
          - type: integer
          - type: 'null'
          title: Priority
        rule_type:
          type: string
          title: Rule Type
          description: 'Rule type: snapshot, cumulative, or decay'
          default: snapshot
        decay_period_days:
          anyOf:
          - type: integer
          - type: 'null'
          title: Decay Period Days
          description: 'For decay rules: days of inactivity before applying'
      type: object
      required:
      - name
      - field_scores
      - max_score
      title: CreateRuleRequest
      description: Request to create a lead scoring rule
    CreateSchemaRequest:
      properties:
        schema_name:
          type: string
          maxLength: 50
          minLength: 3
          title: Schema Name
        display_name:
          type: string
          maxLength: 100
          minLength: 3
          title: Display Name
        description:
          anyOf:
          - type: string
            maxLength: 500
          - type: 'null'
          title: Description
        entity_type:
          type: string
          pattern: ^(contacts|deals|companies|tasks)$
          title: Entity Type
        icon:
          anyOf:
          - type: string
            maxLength: 50
          - type: 'null'
          title: Icon
          default: 📋
        category:
          anyOf:
          - type: string
            maxLength: 50
          - type: 'null'
          title: Category
        fields:
          items:
            $ref: '#/components/schemas/FieldDefinition'
          type: array
          maxItems: 20
          minItems: 1
          title: Fields
      type: object
      required:
      - schema_name
      - display_name
      - entity_type
      - fields
      title: CreateSchemaRequest
    CreateSectionRequest:
      properties:
        section_type:
          type: string
          title: Section Type
          description: Section type slug
        section_title:
          type: string
          title: Section Title
          description: Section display title
        content:
          type: string
          title: Content
          description: Section content
          default: ''
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
        section_category:
          anyOf:
          - type: string
          - type: 'null'
          title: Section Category
          default: custom
        display_order:
          anyOf:
          - type: integer
          - type: 'null'
          title: Display Order
          default: 0
        sync_to_kb:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Sync To Kb
          default: false
      type: object
      required:
      - section_type
      - section_title
      title: CreateSectionRequest
    CreditAdjustment:
      properties:
        adjustment_type:
          type: string
          title: Adjustment Type
        amount:
          type: number
          title: Amount
        reason:
          type: string
          title: Reason
      type: object
      required:
      - adjustment_type
      - amount
      - reason
      title: CreditAdjustment
    CreditPurchaseRequest:
      properties:
        credits:
          type: integer
          title: Credits
      type: object
      required:
      - credits
      title: CreditPurchaseRequest
    CustomConnectRequest:
      properties:
        service:
          type: string
          enum:
          - calendar
          - sheets
          - forms
          title: Service
        client_id:
          type: string
          title: Client Id
        client_secret:
          type: string
          title: Client Secret
      type: object
      required:
      - service
      - client_id
      - client_secret
      title: CustomConnectRequest
    CustomFieldCreate:
      properties:
        entity_type:
          type: string
          title: Entity Type
        field_name:
          type: string
          title: Field Name
        field_type:
          type: string
          title: Field Type
        field_label:
          type: string
          title: Field Label
        config:
          additionalProperties: true
          type: object
          title: Config
          default: {}
        is_required:
          type: boolean
          title: Is Required
          default: false
        is_unique:
          type: boolean
          title: Is Unique
          default: false
        field_order:
          type: integer
          title: Field Order
          default: 0
        show_in_list:
          type: boolean
          title: Show In List
          default: true
        show_in_detail:
          type: boolean
          title: Show In Detail
          default: true
        show_in_create:
          type: boolean
          title: Show In Create
          default: true
        searchable:
          type: boolean
          title: Searchable
          default: false
        group_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Group Id
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        placeholder:
          anyOf:
          - type: string
          - type: 'null'
          title: Placeholder
        help_text:
          anyOf:
          - type: string
          - type: 'null'
          title: Help Text
      type: object
      required:
      - entity_type
      - field_name
      - field_type
      - field_label
      title: CustomFieldCreate
    CustomFieldGroupCreate:
      properties:
        entity_type:
          type: string
          title: Entity Type
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        order_index:
          type: integer
          title: Order Index
          default: 0
        is_collapsible:
          type: boolean
          title: Is Collapsible
          default: true
        is_collapsed_default:
          type: boolean
          title: Is Collapsed Default
          default: false
      type: object
      required:
      - entity_type
      - name
      title: CustomFieldGroupCreate
    CustomFieldGroupUpdate:
      properties:
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        order_index:
          anyOf:
          - type: integer
          - type: 'null'
          title: Order Index
        is_collapsible:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Collapsible
        is_collapsed_default:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Collapsed Default
      type: object
      title: CustomFieldGroupUpdate
    CustomFieldUpdate:
      properties:
        field_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Field Name
        field_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Field Type
        field_label:
          anyOf:
          - type: string
          - type: 'null'
          title: Field Label
        config:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Config
        is_required:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Required
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
        is_unique:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Unique
        field_order:
          anyOf:
          - type: integer
          - type: 'null'
          title: Field Order
        show_in_list:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Show In List
        show_in_detail:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Show In Detail
        show_in_create:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Show In Create
        searchable:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Searchable
        group_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Group Id
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        placeholder:
          anyOf:
          - type: string
          - type: 'null'
          title: Placeholder
        help_text:
          anyOf:
          - type: string
          - type: 'null'
          title: Help Text
      type: object
      title: CustomFieldUpdate
    Dashboard:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        layout:
          additionalProperties: true
          type: object
          title: Layout
        chart_ids:
          items:
            type: string
          type: array
          title: Chart Ids
        is_shared:
          type: boolean
          title: Is Shared
        created_by:
          type: string
          title: Created By
        created_by_email:
          type: string
          title: Created By Email
        organization_id:
          type: string
          title: Organization Id
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
      - id
      - name
      - description
      - layout
      - chart_ids
      - is_shared
      - created_by
      - created_by_email
      - organization_id
      - created_at
      - updated_at
      title: Dashboard
    DashboardCreate:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
        description:
          anyOf:
          - type: string
            maxLength: 1000
          - type: 'null'
          title: Description
        layout:
          additionalProperties: true
          type: object
          title: Layout
          description: Grid layout configuration
          default: {}
        chart_ids:
          items:
            type: string
          type: array
          title: Chart Ids
          description: Charts to include in dashboard
          default: []
        is_shared:
          type: boolean
          title: Is Shared
          description: Share with organization
          default: false
      type: object
      required:
      - name
      title: DashboardCreate
    DashboardFiltersUpdate:
      properties:
        date_range_enabled:
          type: boolean
          title: Date Range Enabled
          description: Enable date range filter
          default: true
        default_preset:
          type: string
          title: Default Preset
          description: Default date preset
          default: last_30_days
        show_custom:
          type: boolean
          title: Show Custom
          description: Show custom date range option
          default: true
      type: object
      title: DashboardFiltersUpdate
      description: Request body for updating dashboard filter settings
    DashboardLayoutUpdate:
      properties:
        layouts:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Layouts
        visible_widgets:
          items:
            type: string
          type: array
          title: Visible Widgets
        version:
          type: integer
          title: Version
          default: 1
      type: object
      required:
      - layouts
      - visible_widgets
      title: DashboardLayoutUpdate
      description: Request model for saving dashboard layout
    DashboardUpdate:
      properties:
        name:
          anyOf:
          - type: string
            maxLength: 255
            minLength: 1
          - type: 'null'
          title: Name
        description:
          anyOf:
          - type: string
            maxLength: 1000
          - type: 'null'
          title: Description
        layout:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Layout
        chart_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Chart Ids
        is_shared:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Shared
        filters:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Filters
          description: Filter controls configuration
        active_filters:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Active Filters
          description: Active filter values
      type: object
      title: DashboardUpdate
    DashboardWithCharts:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        layout:
          additionalProperties: true
          type: object
          title: Layout
        charts:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Charts
        is_shared:
          type: boolean
          title: Is Shared
        created_by:
          type: string
          title: Created By
        created_by_email:
          type: string
          title: Created By Email
        organization_id:
          type: string
          title: Organization Id
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
      - id
      - name
      - description
      - layout
      - charts
      - is_shared
      - created_by
      - created_by_email
      - organization_id
      - created_at
      - updated_at
      title: DashboardWithCharts
    DatabaseConfigCreate:
      properties:
        config_name:
          type: string
          title: Config Name
        database_type:
          type: string
          title: Database Type
        host:
          type: string
          title: Host
        port:
          type: integer
          title: Port
        username:
          type: string
          title: Username
        password:
          type: string
          title: Password
        database:
          type: string
          title: Database
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Schema
          default: public
        service_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Service Name
        dsn:
          anyOf:
          - type: string
          - type: 'null'
          title: Dsn
        charset:
          anyOf:
          - type: string
          - type: 'null'
          title: Charset
          default: utf8mb4
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          default: ''
      type: object
      required:
      - config_name
      - database_type
      - host
      - port
      - username
      - password
      - database
      title: DatabaseConfigCreate
      description: Model for creating database configuration
    DatabaseConfigUpdate:
      properties:
        config_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Config Name
        database_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Database Type
        host:
          anyOf:
          - type: string
          - type: 'null'
          title: Host
        port:
          anyOf:
          - type: integer
          - type: 'null'
          title: Port
        username:
          anyOf:
          - type: string
          - type: 'null'
          title: Username
        password:
          anyOf:
          - type: string
          - type: 'null'
          title: Password
        database:
          anyOf:
          - type: string
          - type: 'null'
          title: Database
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Schema
        service_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Service Name
        dsn:
          anyOf:
          - type: string
          - type: 'null'
          title: Dsn
        charset:
          anyOf:
          - type: string
          - type: 'null'
          title: Charset
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
      type: object
      title: DatabaseConfigUpdate
      description: Model for updating database configuration
    DatabaseRemoval:
      properties:
        reason:
          type: string
          title: Reason
        confirmation:
          type: string
          title: Confirmation
      type: object
      required:
      - reason
      - confirmation
      title: DatabaseRemoval
    DeactivateTokenRequest:
      properties:
        fcm_token:
          type: string
          title: Fcm Token
      type: object
      required:
      - fcm_token
      title: DeactivateTokenRequest
    DealBatchUpdate:
      properties:
        deal_ids:
          items:
            type: string
          type: array
          title: Deal Ids
          description: List of deal IDs to update
        updates:
          $ref: '#/components/schemas/DealUpdate'
          description: Fields to update on all selected deals
      type: object
      required:
      - deal_ids
      - updates
      title: DealBatchUpdate
    DealCreate:
      properties:
        extras:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Extras
          description: Additional fields not in core model
        tags:
          items:
            type: string
          type: array
          title: Tags
          description: Tags for the entity
        custom_fields:
          additionalProperties: true
          type: object
          title: Custom Fields
          description: Custom field values
        utm_source:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Source
          description: UTM source parameter
        utm_medium:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Medium
          description: UTM medium parameter
        utm_campaign:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Campaign
          description: UTM campaign parameter
        utm_term:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Term
          description: UTM term parameter
        utm_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Content
          description: UTM content parameter
        name:
          type: string
          maxLength: 255
          title: Name
          description: Deal name (required)
        value:
          type: number
          minimum: 0.0
          title: Value
          description: Deal value (must be non-negative)
          default: 0
        stage_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Stage Name
          description: Deal stage (Unknown, Inquiry, Qualified, etc.)
        probability:
          anyOf:
          - type: integer
            maximum: 100.0
            minimum: 0.0
          - type: 'null'
          title: Probability
          description: Deal probability percentage (0-100)
        expected_close_date:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Expected Close Date
          description: Expected close date
        deal_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Deal Type
          description: Type of deal
        deal_status:
          anyOf:
          - type: string
          - type: 'null'
          title: Deal Status
          description: Deal status
          default: open
        owner_email:
          anyOf:
          - type: string
          - type: 'null'
          title: Owner Email
          description: Deal owner email
      additionalProperties: true
      type: object
      required:
      - name
      title: DealCreate
      description: Deal creation model using hybrid approach - validates core fields,
        accepts any extras
      example:
        close_reason: ''
        competitors:
        - competitor1
        - competitor2
        currency: USD
        deal_status: open
        deal_type: new_business
        description: Annual software license deal
        end_date: '2024-12-31'
        expected_close_date: '2024-12-31'
        is_renewal: false
        name: Enterprise Software Deal
        next_step: Schedule demo
        owner_email: sales@company.com
        parent_deal_id: parent-uuid
        payment_frequency_count: 12
        payment_frequency_period: monthly
        probability: 25
        product_id: product-uuid
        source: website
        stage_name: Qualified
        start_date: '2024-01-01'
        tags:
        - enterprise
        - high-value
        utm_source: google
        value: 50000
    DealData:
      properties:
        title:
          type: string
          title: Title
        value:
          anyOf:
          - type: number
          - type: 'null'
          title: Value
        stage_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Stage Name
          default: Lead
        contact_email:
          anyOf:
          - type: string
          - type: 'null'
          title: Contact Email
        company_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Company Name
        expected_close_date:
          anyOf:
          - type: string
          - type: 'null'
          title: Expected Close Date
        source:
          anyOf:
          - type: string
          - type: 'null'
          title: Source
          default: external_api
        custom_fields:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Custom Fields
      type: object
      required:
      - title
      title: DealData
      description: Deal data model for external API
    DealProductCreate:
      properties:
        product_id:
          type: string
          format: uuid
          title: Product Id
        quantity:
          type: integer
          minimum: 1.0
          title: Quantity
          default: 1
        unit_price:
          anyOf:
          - type: number
          - type: string
            pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          - type: 'null'
          title: Unit Price
        discount_amount:
          anyOf:
          - type: number
            minimum: 0.0
          - type: string
            pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          - type: 'null'
          title: Discount Amount
          default: 0
        notes:
          anyOf:
          - type: string
          - type: 'null'
          title: Notes
        assigned_member:
          anyOf:
          - type: string
          - type: 'null'
          title: Assigned Member
      type: object
      required:
      - product_id
      title: DealProductCreate
      description: Model for creating a deal-product relationship
    DealProductUpdate:
      properties:
        quantity:
          anyOf:
          - type: integer
            minimum: 1.0
          - type: 'null'
          title: Quantity
        unit_price:
          anyOf:
          - type: number
          - type: string
            pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          - type: 'null'
          title: Unit Price
        discount_amount:
          anyOf:
          - type: number
            minimum: 0.0
          - type: string
            pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          - type: 'null'
          title: Discount Amount
        notes:
          anyOf:
          - type: string
          - type: 'null'
          title: Notes
        assigned_member:
          anyOf:
          - type: string
          - type: 'null'
          title: Assigned Member
      type: object
      title: DealProductUpdate
      description: Model for updating a deal-product relationship
    DealUpdate:
      properties:
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        value:
          anyOf:
          - type: number
          - type: 'null'
          title: Value
        currency:
          anyOf:
          - type: string
          - type: 'null'
          title: Currency
        stage_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Stage Name
        probability:
          anyOf:
          - type: integer
          - type: 'null'
          title: Probability
        deal_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Deal Type
        deal_status:
          anyOf:
          - type: string
          - type: 'null'
          title: Deal Status
        start_date:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Start Date
        expected_close_date:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Expected Close Date
        end_date:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: End Date
        payment_frequency_count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Payment Frequency Count
        payment_frequency_period:
          anyOf:
          - type: string
          - type: 'null'
          title: Payment Frequency Period
        close_reason:
          anyOf:
          - type: string
          - type: 'null'
          title: Close Reason
        competitors:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Competitors
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        next_step:
          anyOf:
          - type: string
          - type: 'null'
          title: Next Step
        source:
          anyOf:
          - type: string
          - type: 'null'
          title: Source
        is_won:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Won
        is_lost:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Lost
        closed_at:
          anyOf:
          - type: string
          - type: 'null'
          title: Closed At
        owner_email:
          anyOf:
          - type: string
          - type: 'null'
          title: Owner Email
        product_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Product Id
        parent_deal_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Parent Deal Id
        is_renewal:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Renewal
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
        contact_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Contact Ids
        company_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Company Ids
        custom_fields:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Custom Fields
      type: object
      title: DealUpdate
    DeployKBRequest:
      properties:
        master_kb_id:
          type: string
          title: Master Kb Id
          description: Master KB ID to deploy
        target_org_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Target Org Ids
          description: Target org IDs (null or empty = all active)
        force_update:
          type: boolean
          title: Force Update
          description: Force update even if up-to-date
          default: false
      type: object
      required:
      - master_kb_id
      title: DeployKBRequest
      description: Request model for deploying a master KB
    DeploymentRequest:
      properties:
        org_ids:
          items:
            type: string
          type: array
          title: Org Ids
      type: object
      required:
      - org_ids
      title: DeploymentRequest
      description: Model for deployment request
    Domain:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        type:
          type: string
          title: Type
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
        item_count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Item Count
      type: object
      required:
      - id
      - name
      - type
      title: Domain
    DomainEmailAddress:
      properties:
        email_address:
          type: string
          title: Email Address
          description: Email address (must match verified domain)
        display_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Display Name
          description: Display name for the email
        is_default:
          type: boolean
          title: Is Default
          description: Set as default email for this integration
          default: false
      type: object
      required:
      - email_address
      title: DomainEmailAddress
    DomainListResponse:
      properties:
        domains:
          items:
            $ref: '#/components/schemas/Domain'
          type: array
          title: Domains
        total:
          type: integer
          title: Total
      type: object
      required:
      - domains
      - total
      title: DomainListResponse
    EmailComposeRequest:
      properties:
        to:
          items:
            type: string
            format: email
          type: array
          title: To
        cc:
          anyOf:
          - items:
              type: string
              format: email
            type: array
          - type: 'null'
          title: Cc
          default: []
        bcc:
          anyOf:
          - items:
              type: string
              format: email
            type: array
          - type: 'null'
          title: Bcc
          default: []
        subject:
          type: string
          title: Subject
        html_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Html Content
        text_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Text Content
        attachments:
          anyOf:
          - items:
              additionalProperties: true
              type: object
            type: array
          - type: 'null'
          title: Attachments
          default: []
        track_opens:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Track Opens
        track_clicks:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Track Clicks
        account_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Account Id
        provider:
          anyOf:
          - type: string
          - type: 'null'
          title: Provider
      type: object
      required:
      - to
      - subject
      title: EmailComposeRequest
    EmailIntegrationCreate:
      properties:
        provider_type:
          type: string
          title: Provider Type
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        api_settings:
          additionalProperties: true
          type: object
          title: Api Settings
        sender_email:
          anyOf:
          - type: string
            format: email
          - type: 'null'
          title: Sender Email
        sender_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Sender Name
        reply_to_email:
          anyOf:
          - type: string
            format: email
          - type: 'null'
          title: Reply To Email
        is_default:
          type: boolean
          title: Is Default
          default: false
      type: object
      required:
      - provider_type
      - name
      - api_settings
      title: EmailIntegrationCreate
    EmailIntegrationResponse:
      properties:
        id:
          type: string
          title: Id
        provider:
          type: string
          title: Provider
        email_address:
          type: string
          title: Email Address
        display_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Display Name
        is_default:
          type: boolean
          title: Is Default
        is_active:
          type: boolean
          title: Is Active
        email_signature:
          anyOf:
          - type: string
          - type: 'null'
          title: Email Signature
        track_opens:
          type: boolean
          title: Track Opens
        track_clicks:
          type: boolean
          title: Track Clicks
        emails_sent:
          type: integer
          title: Emails Sent
        last_used_at:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Last Used At
        created_at:
          type: string
          format: date-time
          title: Created At
      type: object
      required:
      - id
      - provider
      - email_address
      - display_name
      - is_default
      - is_active
      - email_signature
      - track_opens
      - track_clicks
      - emails_sent
      - last_used_at
      - created_at
      title: EmailIntegrationResponse
    EmailIntegrationTestRequest:
      properties:
        provider_type:
          type: string
          title: Provider Type
        api_settings:
          additionalProperties: true
          type: object
          title: Api Settings
      type: object
      required:
      - provider_type
      - api_settings
      title: EmailIntegrationTestRequest
    EmailSendRequest:
      properties:
        to:
          type: string
          format: email
          title: To
        subject:
          type: string
          title: Subject
        html_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Html Content
        text_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Text Content
        template_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Template Id
        template_variables:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Template Variables
        provider_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Provider Type
      type: object
      required:
      - to
      - subject
      title: EmailSendRequest
    EmailSignatureUpdate:
      properties:
        email_signature:
          type: string
          title: Email Signature
      type: object
      required:
      - email_signature
      title: EmailSignatureUpdate
    EmailTemplateCreate:
      properties:
        name:
          type: string
          title: Name
        subject:
          type: string
          title: Subject
        html_content:
          type: string
          title: Html Content
        text_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Text Content
        variables:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Variables
          default: []
        category:
          type: string
          title: Category
          default: marketing
        is_active:
          type: boolean
          title: Is Active
          default: true
      type: object
      required:
      - name
      - subject
      - html_content
      title: EmailTemplateCreate
    EmailTemplateUpdate:
      properties:
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        subject:
          anyOf:
          - type: string
          - type: 'null'
          title: Subject
        html_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Html Content
        text_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Text Content
        variables:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Variables
        category:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
      type: object
      title: EmailTemplateUpdate
    EmailTestRequest:
      properties:
        recipient:
          type: string
          format: email
          title: Recipient
        html:
          type: string
          title: Html
        css:
          anyOf:
          - type: string
          - type: 'null'
          title: Css
      type: object
      required:
      - recipient
      - html
      title: EmailTestRequest
    EmailTrackingUpdate:
      properties:
        track_opens:
          type: boolean
          title: Track Opens
        track_clicks:
          type: boolean
          title: Track Clicks
      type: object
      required:
      - track_opens
      - track_clicks
      title: EmailTrackingUpdate
    EmailValidationResponse:
      properties:
        email:
          type: string
          title: Email
        status:
          type: string
          title: Status
        score:
          type: number
          title: Score
        reasons:
          items:
            type: string
          type: array
          title: Reasons
        details:
          additionalProperties: true
          type: object
          title: Details
        validated_at:
          type: string
          title: Validated At
        is_deliverable:
          type: boolean
          title: Is Deliverable
        is_risky:
          type: boolean
          title: Is Risky
      type: object
      required:
      - email
      - status
      - score
      - reasons
      - details
      - validated_at
      - is_deliverable
      - is_risky
      title: EmailValidationResponse
      description: Response model for email validation
    EmbedChatRequest:
      properties:
        message:
          type: string
          title: Message
        workflow_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Id
        session_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Session Id
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
      type: object
      required:
      - message
      title: EmbedChatRequest
    EmbedChatResponse:
      properties:
        response:
          type: string
          title: Response
        session_id:
          type: string
          title: Session Id
        data:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Data
      type: object
      required:
      - response
      - session_id
      title: EmbedChatResponse
    EmergencyCredit:
      properties:
        org_id:
          type: string
          title: Org Id
        credits:
          type: number
          title: Credits
        reason:
          type: string
          title: Reason
      type: object
      required:
      - org_id
      - credits
      - reason
      title: EmergencyCredit
    ExecutionConfig:
      properties:
        batchSize:
          type: integer
          title: Batchsize
          default: 100
        delayBetweenBatches:
          type: integer
          title: Delaybetweenbatches
          default: 1000
        retryAttempts:
          type: integer
          title: Retryattempts
          default: 3
        priority:
          type: string
          title: Priority
          default: normal
      type: object
      title: ExecutionConfig
    ExecutionSnapshotResponse:
      properties:
        execution:
          additionalProperties: true
          type: object
          title: Execution
        workflow_snapshot:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Workflow Snapshot
        snapshot_available:
          type: boolean
          title: Snapshot Available
        snapshot_created_at:
          anyOf:
          - type: string
          - type: 'null'
          title: Snapshot Created At
        is_workflow_modified:
          type: boolean
          title: Is Workflow Modified
          default: false
        current_workflow_exists:
          type: boolean
          title: Current Workflow Exists
          default: true
        error:
          anyOf:
          - type: string
          - type: 'null'
          title: Error
      type: object
      required:
      - execution
      - snapshot_available
      title: ExecutionSnapshotResponse
      description: Response model for execution snapshot endpoint
    ExpedifyNotificationRequest:
      properties:
        title:
          type: string
          title: Title
        body:
          type: string
          title: Body
        user_id:
          anyOf:
          - type: string
          - type: 'null'
          title: User Id
        user_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: User Ids
        org_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Org Id
        org_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Org Ids
        platform:
          anyOf:
          - type: string
          - type: 'null'
          title: Platform
        broadcast:
          anyOf:
          - type: string
          - type: 'null'
          title: Broadcast
        subscription_plan:
          anyOf:
          - type: string
          - type: 'null'
          title: Subscription Plan
        user_role:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: User Role
        data:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Data
        image_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Image Url
        action_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Action Url
      type: object
      required:
      - title
      - body
      title: ExpedifyNotificationRequest
      description: Request model for Expedify admin notifications with flexible filtering
    ExportKBRequest:
      properties:
        document_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Document Ids
          description: Specific document IDs to export (if None, exports all)
      type: object
      title: ExportKBRequest
    ExportRequest:
      properties:
        query_type:
          type: string
          title: Query Type
          description: '''visual'' or ''sql'''
        config:
          additionalProperties: true
          type: object
          title: Config
          description: Query configuration (sql or visual config)
        parameters:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Parameters
          description: Query parameters
          default: {}
        query_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Query Name
          description: Display name for the export
          default: Query Export
      type: object
      required:
      - query_type
      - config
      title: ExportRequest
    ExtendGracePeriod:
      properties:
        grace_days:
          type: integer
          exclusiveMinimum: 0.0
          title: Grace Days
          description: Number of days to extend grace period
        reason:
          anyOf:
          - type: string
          - type: 'null'
          title: Reason
          description: Reason for extension
      type: object
      required:
      - grace_days
      title: ExtendGracePeriod
    FAQItem:
      properties:
        question:
          type: string
          title: Question
        answer:
          type: string
          title: Answer
        category:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
          default: general
        display_order:
          anyOf:
          - type: integer
          - type: 'null'
          title: Display Order
          default: 0
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
          default: true
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
          default: {}
        sync_to_kb:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Sync To Kb
          default: false
      type: object
      required:
      - question
      - answer
      title: FAQItem
    FAQItemUpdate:
      properties:
        question:
          anyOf:
          - type: string
          - type: 'null'
          title: Question
        answer:
          anyOf:
          - type: string
          - type: 'null'
          title: Answer
        category:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
        display_order:
          anyOf:
          - type: integer
          - type: 'null'
          title: Display Order
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
        sync_to_kb:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Sync To Kb
          default: false
      type: object
      title: FAQItemUpdate
    FeatureDetails:
      properties:
        enabled:
          type: boolean
          title: Enabled
        label:
          type: string
          title: Label
      type: object
      required:
      - enabled
      - label
      title: FeatureDetails
      description: Feature details with enabled status and label
    FeedbackRequest:
      properties:
        trace_id:
          type: string
          title: Trace Id
          description: Langfuse trace ID to score
        rating:
          type: integer
          maximum: 5.0
          minimum: 1.0
          title: Rating
          description: Rating from 1-5
        feedback_type:
          type: string
          title: Feedback Type
          description: Type of feedback
          default: user_feedback
        comment:
          anyOf:
          - type: string
          - type: 'null'
          title: Comment
          description: Optional comment
      type: object
      required:
      - trace_id
      - rating
      title: FeedbackRequest
    FeedbackResponse:
      properties:
        success:
          type: boolean
          title: Success
        message:
          type: string
          title: Message
        trace_id:
          type: string
          title: Trace Id
      type: object
      required:
      - success
      - message
      - trace_id
      title: FeedbackResponse
    FieldDefinition:
      properties:
        field_name:
          type: string
          maxLength: 50
          minLength: 2
          title: Field Name
        display_name:
          type: string
          maxLength: 100
          minLength: 1
          title: Display Name
        field_type:
          type: string
          pattern: ^(text|textarea|number|date|datetime|select|multi_select|boolean|email|phone|url)$
          title: Field Type
        is_required:
          type: boolean
          title: Is Required
          default: false
        field_options:
          additionalProperties: true
          type: object
          title: Field Options
          default: {}
        default_value:
          anyOf:
          - type: string
          - type: 'null'
          title: Default Value
        help_text:
          anyOf:
          - type: string
          - type: 'null'
          title: Help Text
        display_order:
          anyOf:
          - type: integer
          - type: 'null'
          title: Display Order
      type: object
      required:
      - field_name
      - display_name
      - field_type
      title: FieldDefinition
    FieldLayoutUpdate:
      properties:
        sections_order:
          items:
            type: string
          type: array
          title: Sections Order
        field_config:
          additionalProperties:
            additionalProperties: true
            type: object
          type: object
          title: Field Config
      type: object
      required:
      - sections_order
      - field_config
      title: FieldLayoutUpdate
      description: Request model for saving field layout
    FieldMapping:
      properties:
        entity_type:
          type: string
          title: Entity Type
        crm_field:
          type: string
          title: Crm Field
        original_label:
          anyOf:
          - type: string
          - type: 'null'
          title: Original Label
      type: object
      required:
      - entity_type
      - crm_field
      title: FieldMapping
    FieldMappingRequest:
      properties:
        integration_id:
          type: string
          title: Integration Id
        field_mapping:
          additionalProperties:
            type: string
          type: object
          title: Field Mapping
      type: object
      required:
      - integration_id
      - field_mapping
      title: FieldMappingRequest
      description: Request to update field mapping configuration
    FieldScore:
      properties:
        field:
          type: string
          title: Field
          description: Field name to score (e.g., 'lead_status', 'industry')
        scores:
          additionalProperties:
            type: integer
          type: object
          title: Scores
          description: 'Value-to-points mapping (e.g., {''new'': 10, ''qualified'':
            25, ''_default'': 0})'
      type: object
      required:
      - field
      - scores
      title: FieldScore
      description: Single field score mapping
    FieldStyle:
      properties:
        fontSize:
          type: string
          title: Fontsize
          default: 16px
        fontWeight:
          type: string
          title: Fontweight
          default: '400'
        color:
          type: string
          title: Color
          default: '#111827'
        marginBottom:
          type: string
          title: Marginbottom
          default: 16px
        fontFamily:
          type: string
          title: Fontfamily
          default: Inter, system-ui, sans-serif
        padding:
          type: string
          title: Padding
          default: 10px 14px
        borderRadius:
          type: string
          title: Borderradius
          default: 6px
        borderColor:
          type: string
          title: Bordercolor
          default: '#D1D5DB'
        backgroundColor:
          type: string
          title: Backgroundcolor
          default: '#FFFFFF'
      type: object
      title: FieldStyle
    FieldTemplate:
      properties:
        field_name:
          type: string
          title: Field Name
        entity_type:
          type: string
          title: Entity Type
        field_type:
          type: string
          title: Field Type
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        required:
          type: boolean
          title: Required
          default: false
        default_value:
          anyOf:
          - {}
          - type: 'null'
          title: Default Value
        options:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Options
        category:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
      type: object
      required:
      - field_name
      - entity_type
      - field_type
      title: FieldTemplate
    FieldValuesUpdate:
      properties:
        values:
          additionalProperties: true
          type: object
          title: Values
      type: object
      required:
      - values
      title: FieldValuesUpdate
      description: Update custom field values for an entity
    FlatRateUpdate:
      properties:
        credits_per_unit:
          type: number
          title: Credits Per Unit
        unit_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Unit Type
      type: object
      required:
      - credits_per_unit
      title: FlatRateUpdate
      description: Model for updating flat rate
    FlushSessionRequest:
      properties:
        session_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Session Ids
          description: Specific sessions to flush, or all if empty
      type: object
      title: FlushSessionRequest
    ForgotPasswordRequest:
      properties:
        email:
          type: string
          title: Email
      type: object
      required:
      - email
      title: ForgotPasswordRequest
    FormContainerStyle:
      properties:
        backgroundColor:
          type: string
          title: Backgroundcolor
          default: '#FFFFFF'
        padding:
          type: string
          title: Padding
          default: 32px
        maxWidth:
          type: string
          title: Maxwidth
          default: 600px
        borderRadius:
          type: string
          title: Borderradius
          default: 8px
      type: object
      title: FormContainerStyle
    FormCreate:
      properties:
        name:
          type: string
          title: Name
        headerTitle:
          anyOf:
          - type: string
          - type: 'null'
          title: Headertitle
        subheading:
          anyOf:
          - type: string
          - type: 'null'
          title: Subheading
        fields:
          items:
            $ref: '#/components/schemas/FormField'
          type: array
          title: Fields
        style:
          anyOf:
          - $ref: '#/components/schemas/FormStyle'
          - type: 'null'
          default:
            form:
              backgroundColor: '#FFFFFF'
              borderRadius: 8px
              maxWidth: 600px
              padding: 32px
            header:
              color: '#111827'
              fontFamily: Inter, system-ui, sans-serif
              fontSize: 28px
              fontWeight: '700'
              marginBottom: 24px
              textAlign: center
            label:
              color: '#374151'
              fontFamily: Inter, system-ui, sans-serif
              fontSize: 14px
              fontWeight: '500'
              marginBottom: 6px
            field:
              backgroundColor: '#FFFFFF'
              borderColor: '#D1D5DB'
              borderRadius: 6px
              color: '#111827'
              fontFamily: Inter, system-ui, sans-serif
              fontSize: 16px
              fontWeight: '400'
              marginBottom: 16px
              padding: 10px 14px
            button:
              backgroundColor: '#4F46E5'
              borderRadius: 6px
              color: '#FFFFFF'
              fontFamily: Inter, system-ui, sans-serif
              fontSize: 16px
              fontWeight: '500'
              marginTop: 24px
              padding: 12px 24px
              textAlign: center
              width: 100%
            layout:
              fieldLayout: single
              labelPosition: top
        settings:
          anyOf:
          - $ref: '#/components/schemas/FormSettings'
          - type: 'null'
          default:
            thankYouMessage: Thank you for your submission!
            showProgressBar: false
            requireTerms: false
            termsText: I agree to the terms and conditions
      type: object
      required:
      - name
      - fields
      title: FormCreate
    FormField:
      properties:
        name:
          type: string
          title: Name
        label:
          type: string
          title: Label
        type:
          type: string
          title: Type
          default: text
        required:
          type: boolean
          title: Required
          default: false
        placeholder:
          anyOf:
          - type: string
          - type: 'null'
          title: Placeholder
        options:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Options
        phoneCountryCode:
          anyOf:
          - type: string
          - type: 'null'
          title: Phonecountrycode
        mapping:
          anyOf:
          - $ref: '#/components/schemas/FieldMapping'
          - type: 'null'
        content:
          anyOf:
          - type: string
          - type: 'null'
          title: Content
        textStyle:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Textstyle
      type: object
      required:
      - name
      - label
      title: FormField
    FormInteractionData:
      properties:
        form_id:
          type: string
          title: Form Id
        interaction_type:
          type: string
          title: Interaction Type
        field_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Field Name
        field_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Field Type
        field_value:
          anyOf:
          - type: string
          - type: 'null'
          title: Field Value
        time_spent:
          anyOf:
          - type: integer
          - type: 'null'
          title: Time Spent
        fields_completed:
          anyOf:
          - type: integer
          - type: 'null'
          title: Fields Completed
        total_fields:
          anyOf:
          - type: integer
          - type: 'null'
          title: Total Fields
        completion_percentage:
          anyOf:
          - type: integer
          - type: 'null'
          title: Completion Percentage
        utm_source:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Source
        utm_medium:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Medium
        utm_campaign:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Campaign
        save_value:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Save Value
          default: false
      type: object
      required:
      - form_id
      - interaction_type
      title: FormInteractionData
    FormSettings:
      properties:
        thankYouMessage:
          type: string
          title: Thankyoumessage
          default: Thank you for your submission!
        redirectUrl:
          anyOf:
          - type: string
          - type: 'null'
          title: Redirecturl
        notificationEmail:
          anyOf:
          - type: string
          - type: 'null'
          title: Notificationemail
        showProgressBar:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Showprogressbar
          default: false
        requireTerms:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Requireterms
          default: false
        termsText:
          anyOf:
          - type: string
          - type: 'null'
          title: Termstext
          default: I agree to the terms and conditions
        termsLink:
          anyOf:
          - type: string
          - type: 'null'
          title: Termslink
        customCSS:
          anyOf:
          - type: string
          - type: 'null'
          title: Customcss
      type: object
      title: FormSettings
    FormStyle:
      properties:
        form:
          $ref: '#/components/schemas/FormContainerStyle'
          default:
            backgroundColor: '#FFFFFF'
            padding: 32px
            maxWidth: 600px
            borderRadius: 8px
        header:
          $ref: '#/components/schemas/HeaderStyle'
          default:
            fontSize: 28px
            fontWeight: '700'
            color: '#111827'
            marginBottom: 24px
            fontFamily: Inter, system-ui, sans-serif
            textAlign: center
        label:
          $ref: '#/components/schemas/LabelStyle'
          default:
            fontSize: 14px
            fontWeight: '500'
            color: '#374151'
            marginBottom: 6px
            fontFamily: Inter, system-ui, sans-serif
        field:
          $ref: '#/components/schemas/FieldStyle'
          default:
            fontSize: 16px
            fontWeight: '400'
            color: '#111827'
            marginBottom: 16px
            fontFamily: Inter, system-ui, sans-serif
            padding: 10px 14px
            borderRadius: 6px
            borderColor: '#D1D5DB'
            backgroundColor: '#FFFFFF'
        button:
          $ref: '#/components/schemas/ButtonStyle'
          default:
            fontSize: 16px
            fontWeight: '500'
            color: '#FFFFFF'
            fontFamily: Inter, system-ui, sans-serif
            backgroundColor: '#4F46E5'
            padding: 12px 24px
            borderRadius: 6px
            marginTop: 24px
            textAlign: center
            width: 100%
        layout:
          $ref: '#/components/schemas/LayoutStyle'
          default:
            fieldLayout: single
            labelPosition: top
      type: object
      title: FormStyle
    FormUpdate:
      properties:
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        headerTitle:
          anyOf:
          - type: string
          - type: 'null'
          title: Headertitle
        subheading:
          anyOf:
          - type: string
          - type: 'null'
          title: Subheading
        fields:
          anyOf:
          - items:
              $ref: '#/components/schemas/FormField'
            type: array
          - type: 'null'
          title: Fields
        style:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Style
        settings:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Settings
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
      type: object
      title: FormUpdate
    FromNameUpdate:
      properties:
        from_name:
          type: string
          title: From Name
          description: Sender display name
      type: object
      required:
      - from_name
      title: FromNameUpdate
    GSTDetailsRequest:
      properties:
        gstin:
          anyOf:
          - type: string
          - type: 'null'
          title: Gstin
        legal_name:
          type: string
          title: Legal Name
        trade_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Trade Name
        address_line1:
          type: string
          title: Address Line1
        address_line2:
          anyOf:
          - type: string
          - type: 'null'
          title: Address Line2
        city:
          type: string
          title: City
        state:
          type: string
          title: State
        pincode:
          type: string
          title: Pincode
        business_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Business Type
      type: object
      required:
      - legal_name
      - address_line1
      - city
      - state
      - pincode
      title: GSTDetailsRequest
    GetContextRequest:
      properties:
        current_message:
          type: string
          title: Current Message
          description: Current message to get context for
        max_tokens:
          anyOf:
          - type: integer
          - type: 'null'
          title: Max Tokens
          description: Maximum context tokens
          default: 4000
        max_messages:
          anyOf:
          - type: integer
          - type: 'null'
          title: Max Messages
          description: Maximum messages to consider
          default: 50
        strategy:
          anyOf:
          - type: string
          - type: 'null'
          title: Strategy
          description: Context strategy
          default: conversation_aware
        model_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Model Type
          description: Model type for token counting
          default: gpt
      type: object
      required:
      - current_message
      title: GetContextRequest
    GoldenExampleCreate:
      properties:
        input_data:
          additionalProperties: true
          type: object
          title: Input Data
        output_data:
          type: string
          title: Output Data
        expected_score:
          type: number
          title: Expected Score
        rationale:
          anyOf:
          - type: string
          - type: 'null'
          title: Rationale
      type: object
      required:
      - input_data
      - output_data
      - expected_score
      title: GoldenExampleCreate
    GoldenSetCreate:
      properties:
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        evaluator_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Evaluator Id
        prompt_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Prompt Id
      type: object
      required:
      - name
      title: GoldenSetCreate
    GoogleSheetImportRequest:
      properties:
        spreadsheet_id:
          type: string
          title: Spreadsheet Id
        display_name:
          type: string
          title: Display Name
        sheet_name:
          type: string
          title: Sheet Name
          default: Sheet1
        range_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Range Name
        expires_days:
          type: integer
          title: Expires Days
          default: 7
        integration_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Id
      type: object
      required:
      - spreadsheet_id
      - display_name
      title: GoogleSheetImportRequest
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    HeaderStyle:
      properties:
        fontSize:
          type: string
          title: Fontsize
          default: 28px
        fontWeight:
          type: string
          title: Fontweight
          default: '700'
        color:
          type: string
          title: Color
          default: '#111827'
        marginBottom:
          type: string
          title: Marginbottom
          default: 24px
        fontFamily:
          type: string
          title: Fontfamily
          default: Inter, system-ui, sans-serif
        textAlign:
          type: string
          title: Textalign
          default: center
      type: object
      title: HeaderStyle
    HumanInputResponse:
      properties:
        success:
          type: boolean
          title: Success
        execution_id:
          type: string
          title: Execution Id
        resumed:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Resumed
        message:
          anyOf:
          - type: string
          - type: 'null'
          title: Message
        error:
          anyOf:
          - type: string
          - type: 'null'
          title: Error
      type: object
      required:
      - success
      - execution_id
      title: HumanInputResponse
      description: Response model for human input operations
    HumanInputSubmission:
      properties:
        input:
          type: string
          title: Input
        selectedIndex:
          anyOf:
          - type: integer
          - type: 'null'
          title: Selectedindex
        selectedIndices:
          anyOf:
          - items:
              type: integer
            type: array
          - type: 'null'
          title: Selectedindices
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
      type: object
      required:
      - input
      title: HumanInputSubmission
      description: Request model for submitting human input
    IdentifyUserData:
      properties:
        visitor_id:
          type: string
          title: Visitor Id
        session_id:
          type: string
          title: Session Id
        email:
          type: string
          title: Email
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        phone:
          anyOf:
          - type: string
          - type: 'null'
          title: Phone
        properties:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Properties
          default: {}
      type: object
      required:
      - visitor_id
      - session_id
      - email
      title: IdentifyUserData
      description: Data for identifying a visitor by email (linking to contact)
    ImportProductsRequest:
      properties:
        integration_id:
          type: string
          title: Integration Id
        whatsapp_catalog_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Whatsapp Catalog Id
          description: Specific catalog to import from (uses default if not provided)
        overwrite_existing:
          type: boolean
          title: Overwrite Existing
          description: Update existing products if found
          default: false
      type: object
      required:
      - integration_id
      title: ImportProductsRequest
    ImportWorkflowRequest:
      properties:
        marketplace_id:
          type: string
          title: Marketplace Id
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        remappings:
          anyOf:
          - additionalProperties:
              type: string
            type: object
          - type: 'null'
          title: Remappings
      type: object
      required:
      - marketplace_id
      title: ImportWorkflowRequest
      description: Model for importing a workflow from marketplace
    IncomingWebhookCreate:
      properties:
        slug:
          type: string
          title: Slug
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        workflow_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Id
        expected_schema:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Expected Schema
        is_active:
          type: boolean
          title: Is Active
          default: true
      type: object
      required:
      - slug
      title: IncomingWebhookCreate
    IncomingWebhookUpdate:
      properties:
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        workflow_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Id
        node_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Node Id
        expected_schema:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Expected Schema
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
      type: object
      title: IncomingWebhookUpdate
    InitiateTransferRequest:
      properties:
        new_owner_email:
          type: string
          format: email
          title: New Owner Email
        password:
          type: string
          title: Password
        new_role_for_self:
          type: string
          title: New Role For Self
          default: admin
        reason:
          anyOf:
          - type: string
          - type: 'null'
          title: Reason
      type: object
      required:
      - new_owner_email
      - password
      title: InitiateTransferRequest
    InputSubmissionRequest:
      properties:
        inputId:
          type: string
          title: Inputid
        response:
          additionalProperties: true
          type: object
          title: Response
      type: object
      required:
      - inputId
      - response
      title: InputSubmissionRequest
      description: Request model for submitting human input
    IntegrationConfig:
      properties:
        integration_type:
          type: string
          title: Integration Type
        integration_name:
          type: string
          title: Integration Name
        display_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Display Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        configuration:
          additionalProperties: true
          type: object
          title: Configuration
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
        category:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
        icon:
          anyOf:
          - type: string
          - type: 'null'
          title: Icon
        is_active:
          type: boolean
          title: Is Active
          default: true
        is_global:
          type: boolean
          title: Is Global
          default: false
        allowed_orgs:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Allowed Orgs
      type: object
      required:
      - integration_type
      - integration_name
      - configuration
      title: IntegrationConfig
      description: Model for integration configuration
    IntegrationCreate:
      properties:
        integration_type:
          type: string
          title: Integration Type
          description: Type of integration (e.g., 'azure_blob', 'google_storage')
        integration_name:
          type: string
          title: Integration Name
          description: User-friendly name for this integration
        configuration:
          additionalProperties: true
          type: object
          title: Configuration
          description: Integration-specific configuration
        is_active:
          type: boolean
          title: Is Active
          description: Whether this integration is active
          default: true
        is_default:
          type: boolean
          title: Is Default
          description: Whether this integration is the default for its type
          default: false
      type: object
      required:
      - integration_type
      - integration_name
      - configuration
      title: IntegrationCreate
    IntegrationPermissionsUpdate:
      properties:
        permissions:
          additionalProperties:
            type: boolean
          type: object
          title: Permissions
      type: object
      required:
      - permissions
      title: IntegrationPermissionsUpdate
    InternalFeatureRateCreate:
      properties:
        category:
          type: string
          title: Category
        provider:
          type: string
          title: Provider
          default: execution
        model:
          type: string
          title: Model
          default: default
        display_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Display Name
        input_rate:
          type: number
          title: Input Rate
        unit_type:
          type: string
          title: Unit Type
        plan_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Plan Id
      type: object
      required:
      - category
      - input_rate
      - unit_type
      title: InternalFeatureRateCreate
      description: Model for creating/updating internal feature rate
    InvitationAccept:
      properties:
        invitation_token:
          type: string
          title: Invitation Token
        user_name:
          type: string
          title: User Name
        password:
          type: string
          title: Password
      type: object
      required:
      - invitation_token
      - user_name
      - password
      title: InvitationAccept
    InvitationCreate:
      properties:
        email:
          type: string
          format: email
          title: Email
        phone:
          anyOf:
          - type: string
          - type: 'null'
          title: Phone
        role:
          type: string
          title: Role
          default: member
        message:
          anyOf:
          - type: string
          - type: 'null'
          title: Message
      type: object
      required:
      - email
      title: InvitationCreate
    LLMEvaluatorCreate:
      properties:
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        evaluator_type:
          type: string
          title: Evaluator Type
        prompt_template:
          anyOf:
          - type: string
          - type: 'null'
          title: Prompt Template
        variables:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Variables
        score_config_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Score Config Id
        model:
          type: string
          title: Model
          default: gpt-4o-mini
        temperature:
          type: number
          title: Temperature
          default: 0.0
        few_shot_examples:
          anyOf:
          - items:
              additionalProperties: true
              type: object
            type: array
          - type: 'null'
          title: Few Shot Examples
        golden_set_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Golden Set Ids
        score_configs:
          anyOf:
          - items:
              additionalProperties: true
              type: object
            type: array
          - type: 'null'
          title: Score Configs
      type: object
      required:
      - name
      - evaluator_type
      title: LLMEvaluatorCreate
    LLMTemplateUpdate:
      properties:
        provider:
          type: string
          title: Provider
        model:
          type: string
          title: Model
        suggested_rate:
          anyOf:
          - type: number
          - type: 'null'
          title: Suggested Rate
        suggested_input_rate:
          anyOf:
          - type: number
          - type: 'null'
          title: Suggested Input Rate
        suggested_output_rate:
          anyOf:
          - type: number
          - type: 'null'
          title: Suggested Output Rate
        unit_type:
          type: string
          title: Unit Type
          default: per_1m_tokens
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        is_active:
          type: boolean
          title: Is Active
          default: true
        display_order:
          type: integer
          title: Display Order
          default: 0
      type: object
      required:
      - provider
      - model
      title: LLMTemplateUpdate
      description: Create or update LLM model template
    LabelStyle:
      properties:
        fontSize:
          type: string
          title: Fontsize
          default: 14px
        fontWeight:
          type: string
          title: Fontweight
          default: '500'
        color:
          type: string
          title: Color
          default: '#374151'
        marginBottom:
          type: string
          title: Marginbottom
          default: 6px
        fontFamily:
          type: string
          title: Fontfamily
          default: Inter, system-ui, sans-serif
      type: object
      title: LabelStyle
    LayoutStyle:
      properties:
        fieldLayout:
          type: string
          title: Fieldlayout
          default: single
        labelPosition:
          type: string
          title: Labelposition
          default: top
      type: object
      title: LayoutStyle
    LifecycleStageCreate:
      properties:
        name:
          type: string
          title: Name
        order_index:
          type: integer
          title: Order Index
          default: 0
        color:
          anyOf:
          - type: string
          - type: 'null'
          title: Color
          default: '#6B7280'
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          default: ''
      type: object
      required:
      - name
      title: LifecycleStageCreate
    LifecycleStageUpdate:
      properties:
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        order_index:
          anyOf:
          - type: integer
          - type: 'null'
          title: Order Index
        color:
          anyOf:
          - type: string
          - type: 'null'
          title: Color
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
      type: object
      title: LifecycleStageUpdate
    LinkUserRequest:
      properties:
        user_id:
          type: string
          title: User Id
      type: object
      required:
      - user_id
      title: LinkUserRequest
    ListColumnsUpdate:
      properties:
        columns:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Columns
      type: object
      required:
      - columns
      title: ListColumnsUpdate
      description: Request model for saving list column configuration
    LoginRequest:
      properties:
        username:
          type: string
          title: Username
        password:
          type: string
          title: Password
        _tracking:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Tracking
      type: object
      required:
      - username
      - password
      title: LoginRequest
    MCPPromptGetRequest:
      properties:
        name:
          type: string
          title: Name
          description: Prompt name
        arguments:
          anyOf:
          - additionalProperties:
              type: string
            type: object
          - type: 'null'
          title: Arguments
          description: Prompt arguments
      type: object
      required:
      - name
      title: MCPPromptGetRequest
      description: Request to get an MCP prompt
    MCPResourceReadRequest:
      properties:
        uri:
          type: string
          title: Uri
          description: Resource URI
      type: object
      required:
      - uri
      title: MCPResourceReadRequest
      description: Request to read an MCP resource
    MCPSkillExecuteRequest:
      properties:
        skill_name:
          type: string
          title: Skill Name
          description: Full skill name (e.g., mcp_filesystem_read_file)
        inputs:
          additionalProperties: true
          type: object
          title: Inputs
          description: Skill inputs
      type: object
      required:
      - skill_name
      title: MCPSkillExecuteRequest
      description: Request to execute an MCP skill by name
    MCPToolCallRequest:
      properties:
        tool_name:
          type: string
          title: Tool Name
          description: Name of the tool to execute
        arguments:
          additionalProperties: true
          type: object
          title: Arguments
          description: Tool arguments
      type: object
      required:
      - tool_name
      title: MCPToolCallRequest
      description: Request to execute an MCP tool
    MarketplaceCategory:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        slug:
          type: string
          title: Slug
        description:
          type: string
          title: Description
        icon:
          type: string
          title: Icon
      type: object
      required:
      - id
      - name
      - slug
      - description
      - icon
      title: MarketplaceCategory
      description: Model for marketplace categories
    MarketplaceItem:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        primary_category:
          type: string
          title: Primary Category
        subcategory:
          anyOf:
          - type: string
          - type: 'null'
          title: Subcategory
        icon:
          type: string
          title: Icon
        color_theme:
          type: string
          title: Color Theme
        usage_notes:
          anyOf:
          - type: string
          - type: 'null'
          title: Usage Notes
        short_description:
          anyOf:
          - type: string
          - type: 'null'
          title: Short Description
        complexity_level:
          type: string
          title: Complexity Level
        estimated_setup_time:
          anyOf:
          - type: integer
          - type: 'null'
          title: Estimated Setup Time
        prerequisites:
          anyOf:
          - type: string
          - type: 'null'
          title: Prerequisites
        setup_instructions:
          anyOf:
          - type: string
          - type: 'null'
          title: Setup Instructions
        industry_tags:
          items:
            type: string
          type: array
          title: Industry Tags
        use_case_tags:
          items:
            type: string
          type: array
          title: Use Case Tags
        required_integrations:
          items:
            type: string
          type: array
          title: Required Integrations
        node_count:
          type: integer
          title: Node Count
        import_count:
          type: integer
          title: Import Count
        avg_rating:
          type: number
          title: Avg Rating
        rating_count:
          type: integer
          title: Rating Count
        favorite_count:
          type: integer
          title: Favorite Count
        view_count:
          type: integer
          title: View Count
        success_rate:
          anyOf:
          - type: number
          - type: 'null'
          title: Success Rate
        avg_execution_time:
          anyOf:
          - type: integer
          - type: 'null'
          title: Avg Execution Time
        creator_name:
          type: string
          title: Creator Name
        creator_email:
          type: string
          title: Creator Email
        creator_org_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Creator Org Name
        creator_user_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Creator User Id
        version:
          type: string
          title: Version
        status:
          type: string
          title: Status
        is_featured:
          type: boolean
          title: Is Featured
        created_at:
          type: string
          format: date-time
          title: Created At
        published_at:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Published At
        demo_available:
          type: boolean
          title: Demo Available
        tutorial_video_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Tutorial Video Url
        documentation_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Documentation Url
        pricing_model:
          type: string
          title: Pricing Model
        price:
          type: number
          title: Price
        category_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Category Ids
          default: []
        categories:
          anyOf:
          - items:
              $ref: '#/components/schemas/MarketplaceCategory'
            type: array
          - type: 'null'
          title: Categories
          default: []
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
          default: []
      type: object
      required:
      - id
      - name
      - description
      - primary_category
      - subcategory
      - icon
      - color_theme
      - usage_notes
      - short_description
      - complexity_level
      - estimated_setup_time
      - prerequisites
      - setup_instructions
      - industry_tags
      - use_case_tags
      - required_integrations
      - node_count
      - import_count
      - avg_rating
      - rating_count
      - favorite_count
      - view_count
      - success_rate
      - avg_execution_time
      - creator_name
      - creator_email
      - creator_org_name
      - version
      - status
      - is_featured
      - created_at
      - published_at
      - demo_available
      - tutorial_video_url
      - documentation_url
      - pricing_model
      - price
      title: MarketplaceItem
      description: Model for marketplace items
    MasterWebhookCreate:
      properties:
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Url
        events:
          items:
            type: string
          type: array
          title: Events
        is_active:
          type: boolean
          title: Is Active
          default: true
        retry_count:
          type: integer
          title: Retry Count
          default: 3
        timeout_seconds:
          type: integer
          title: Timeout Seconds
          default: 30
      type: object
      required:
      - name
      - url
      - events
      title: MasterWebhookCreate
    MasterWebhookUpdate:
      properties:
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        url:
          anyOf:
          - type: string
            maxLength: 2083
            minLength: 1
            format: uri
          - type: 'null'
          title: Url
        events:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Events
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
        retry_count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Retry Count
        timeout_seconds:
          anyOf:
          - type: integer
          - type: 'null'
          title: Timeout Seconds
      type: object
      title: MasterWebhookUpdate
    MergeToQueryRequest:
      properties:
        transforms:
          $ref: '#/components/schemas/TransformationStack'
          description: Transformations to merge
        create_copy:
          type: boolean
          title: Create Copy
          description: If true, create a new query instead of updating
          default: false
        new_name:
          anyOf:
          - type: string
          - type: 'null'
          title: New Name
          description: Name for the new query (if create_copy=True)
        new_description:
          anyOf:
          - type: string
          - type: 'null'
          title: New Description
          description: Description for the new query
      type: object
      required:
      - transforms
      title: MergeToQueryRequest
      description: Request to merge transformations into a saved query
    MessageTemplateCreate:
      properties:
        template_name:
          type: string
          title: Template Name
        display_name:
          type: string
          title: Display Name
        category:
          type: string
          title: Category
        components:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Components
        language:
          type: string
          title: Language
          default: en
        variables:
          anyOf:
          - items:
              additionalProperties: true
              type: object
            type: array
          - type: 'null'
          title: Variables
          default: []
        preview_data:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Preview Data
          default: {}
      type: object
      required:
      - template_name
      - display_name
      - category
      - components
      title: MessageTemplateCreate
    MobileSessionRequest:
      properties:
        provider:
          type: string
          title: Provider
        access_token:
          type: string
          title: Access Token
        user_info:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: User Info
      type: object
      required:
      - provider
      - access_token
      title: MobileSessionRequest
    NoteCreate:
      properties:
        extras:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Extras
          description: Additional fields not in core model
        content:
          type: string
          title: Content
          description: Note content (required)
        entity_type:
          type: string
          title: Entity Type
          description: Entity type (contact, company, deal) - required
        entity_id:
          type: string
          title: Entity Id
          description: Entity ID - required
        is_pinned:
          type: boolean
          title: Is Pinned
          description: Whether note is pinned
          default: false
      additionalProperties: true
      type: object
      required:
      - content
      - entity_type
      - entity_id
      title: NoteCreate
      description: Note creation model using hybrid approach - validates core fields,
        accepts any extras
      example:
        attachments:
        - file1.pd
        - file2.doc
        content: Important client meeting notes
        entity_id: a672a737-f25b-4bcf-aaee-c150ab04b40b
        entity_type: contact
        is_pinned: false
    NoteUpdate:
      properties:
        content:
          anyOf:
          - type: string
          - type: 'null'
          title: Content
        is_pinned:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Pinned
      type: object
      title: NoteUpdate
    NotificationRequest:
      properties:
        title:
          type: string
          title: Title
        body:
          type: string
          title: Body
        user_id:
          anyOf:
          - type: string
          - type: 'null'
          title: User Id
        user_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: User Ids
        topic:
          anyOf:
          - type: string
          - type: 'null'
          title: Topic
        data:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Data
        image_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Image Url
        action_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Action Url
      type: object
      required:
      - title
      - body
      title: NotificationRequest
    OAuthCallbackRequest:
      properties:
        code:
          type: string
          title: Code
          description: OAuth authorization code
        state:
          type: string
          title: State
          description: OAuth state parameter
        integration_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Id
          description: Integration ID
      type: object
      required:
      - code
      - state
      title: OAuthCallbackRequest
    OAuthProviderRequest:
      properties:
        provider:
          type: string
          title: Provider
      type: object
      required:
      - provider
      title: OAuthProviderRequest
    OAuthStartRequest:
      properties:
        integration_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Id
          description: Existing integration ID to update
        redirect_uri:
          type: string
          title: Redirect Uri
          description: OAuth redirect URI
      type: object
      required:
      - redirect_uri
      title: OAuthStartRequest
    OTPStatusRequest:
      properties:
        user_id:
          type: string
          title: User Id
        otp_type:
          type: string
          title: Otp Type
          default: email_verification
      type: object
      required:
      - user_id
      title: OTPStatusRequest
    OnboardingProgressResponse:
      properties:
        progress:
          additionalProperties: true
          type: object
          title: Progress
        percentage:
          type: integer
          title: Percentage
        steps_completed:
          type: integer
          title: Steps Completed
        total_steps:
          type: integer
          title: Total Steps
        is_complete:
          type: boolean
          title: Is Complete
        is_activated:
          type: boolean
          title: Is Activated
        current_step_index:
          type: integer
          title: Current Step Index
      type: object
      required:
      - progress
      - percentage
      - steps_completed
      - total_steps
      - is_complete
      - is_activated
      - current_step_index
      title: OnboardingProgressResponse
    OptimizationStartRequest:
      properties:
        prompt_id:
          type: string
          title: Prompt Id
        evaluator_id:
          type: string
          title: Evaluator Id
        golden_set_id:
          type: string
          title: Golden Set Id
        llm_integration_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Llm Integration Id
        config:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Config
      type: object
      required:
      - prompt_id
      - evaluator_id
      - golden_set_id
      title: OptimizationStartRequest
    OrganizationCreate:
      properties:
        name:
          type: string
          title: Name
        slug:
          type: string
          title: Slug
        company_size:
          type: string
          title: Company Size
        industry:
          type: string
          title: Industry
        primary_use_case:
          type: string
          title: Primary Use Case
        how_heard_about_us:
          type: string
          title: How Heard About Us
          default: ''
      type: object
      required:
      - name
      - slug
      - company_size
      - industry
      - primary_use_case
      title: OrganizationCreate
    OrganizationNameUpdate:
      properties:
        name:
          type: string
          title: Name
      type: object
      required:
      - name
      title: OrganizationNameUpdate
    OrganizationOnboarding:
      properties:
        name:
          type: string
          title: Name
        website_url:
          type: string
          title: Website Url
          default: ''
        company_size:
          type: string
          title: Company Size
        industry:
          type: string
          title: Industry
        primary_use_case:
          type: string
          title: Primary Use Case
        how_heard_about_us:
          type: string
          title: How Heard About Us
          default: ''
        phone:
          type: string
          title: Phone
          default: ''
      type: object
      required:
      - company_size
      - industry
      - primary_use_case
      title: OrganizationOnboarding
    OrganizationSwitch:
      properties:
        org_id:
          type: string
          title: Org Id
      type: object
      required:
      - org_id
      title: OrganizationSwitch
    OutputFormat:
      type: string
      enum:
      - html
      - text
      - whatsapp
      - mobile
      title: OutputFormat
      description: Output format options
    OwnershipTransferRequest:
      properties:
        from_user_id:
          type: string
          title: From User Id
        to_user_id:
          type: string
          title: To User Id
        reason:
          type: string
          title: Reason
      type: object
      required:
      - from_user_id
      - to_user_id
      - reason
      title: OwnershipTransferRequest
    PDFPreviewRequest:
      properties:
        template_id:
          type: string
          title: Template Id
        items_per_page:
          type: integer
          title: Items Per Page
          default: 2
        page_size:
          type: string
          title: Page Size
          default: A4
        orientation:
          type: string
          title: Orientation
          default: portrait
        variable_prefix:
          type: string
          title: Variable Prefix
          default: item
        sample_data:
          anyOf:
          - items:
              additionalProperties: true
              type: object
            type: array
          - type: 'null'
          title: Sample Data
      type: object
      required:
      - template_id
      title: PDFPreviewRequest
    PDFPreviewResponse:
      properties:
        html:
          type: string
          title: Html
        success:
          type: boolean
          title: Success
        message:
          anyOf:
          - type: string
          - type: 'null'
          title: Message
      type: object
      required:
      - html
      - success
      title: PDFPreviewResponse
    PageSelectionRequest:
      properties:
        integration_id:
          type: string
          title: Integration Id
          description: Integration ID
        selected_pages:
          items:
            additionalProperties:
              type: string
            type: object
          type: array
          title: Selected Pages
          description: List of selected pages with IDs and tokens
        selected_forms:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Selected Forms
          description: List of selected form IDs (optional)
      type: object
      required:
      - integration_id
      - selected_pages
      title: PageSelectionRequest
    PageViewData:
      properties:
        visitor_id:
          type: string
          title: Visitor Id
        session_id:
          type: string
          title: Session Id
        page_url:
          type: string
          title: Page Url
        page_title:
          anyOf:
          - type: string
          - type: 'null'
          title: Page Title
        page_path:
          anyOf:
          - type: string
          - type: 'null'
          title: Page Path
        referrer_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Referrer Url
        viewed_at:
          anyOf:
          - type: string
          - type: 'null'
          title: Viewed At
        utm_source:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Source
        utm_medium:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Medium
        utm_campaign:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Campaign
        utm_term:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Term
        utm_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Content
        properties:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Properties
          default: {}
      type: object
      required:
      - visitor_id
      - session_id
      - page_url
      title: PageViewData
    PaymentCreate:
      properties:
        amount:
          anyOf:
          - type: number
            exclusiveMinimum: 0.0
          - type: string
            pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Amount
          description: Payment amount
        currency:
          type: string
          maxLength: 3
          title: Currency
          description: Currency code
          default: USD
        payment_method:
          type: string
          title: Payment Method
          description: Payment method (cash, card, etc)
        payment_date:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Payment Date
          description: Payment date (defaults to now)
        reference_number:
          anyOf:
          - type: string
          - type: 'null'
          title: Reference Number
          description: Payment reference/transaction ID
        status:
          type: string
          title: Status
          description: Payment status
          default: completed
        notes:
          anyOf:
          - type: string
          - type: 'null'
          title: Notes
          description: Payment notes
        generate_receipt:
          type: boolean
          title: Generate Receipt
          description: Whether to generate a receipt
          default: false
      type: object
      required:
      - amount
      - payment_method
      title: PaymentCreate
    PaymentUpdate:
      properties:
        amount:
          anyOf:
          - type: number
            exclusiveMinimum: 0.0
          - type: string
            pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          - type: 'null'
          title: Amount
          description: Payment amount
        currency:
          anyOf:
          - type: string
            maxLength: 3
          - type: 'null'
          title: Currency
          description: Currency code
        payment_method:
          anyOf:
          - type: string
          - type: 'null'
          title: Payment Method
          description: Payment method (cash, card, etc)
        payment_date:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Payment Date
          description: Payment date
        reference_number:
          anyOf:
          - type: string
          - type: 'null'
          title: Reference Number
          description: Payment reference/transaction ID
        status:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
          description: Payment status
        notes:
          anyOf:
          - type: string
          - type: 'null'
          title: Notes
          description: Payment notes
      type: object
      title: PaymentUpdate
    PlanChange:
      properties:
        plan_id:
          type: string
          title: Plan Id
        comment:
          type: string
          title: Comment
      type: object
      required:
      - plan_id
      - comment
      title: PlanChange
    PlanChangeRequest:
      properties:
        plan_id:
          type: string
          title: Plan Id
      type: object
      required:
      - plan_id
      title: PlanChangeRequest
    PlanExecuteRequest:
      properties:
        mode:
          type: string
          title: Mode
          description: 'Execution mode: ''execute_all'' or ''step_by_step'''
        session_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Session Id
          description: Optional session ID for execution context
      type: object
      required:
      - mode
      title: PlanExecuteRequest
      description: Request to start plan execution
    PlanFeatureUpdate:
      properties:
        plan_name:
          type: string
          title: Plan Name
        features:
          additionalProperties:
            $ref: '#/components/schemas/FeatureDetails'
          type: object
          title: Features
      type: object
      required:
      - plan_name
      - features
      title: PlanFeatureUpdate
      description: Update plan features
    PlanUpdate:
      properties:
        name:
          type: string
          title: Name
        display_name:
          type: string
          title: Display Name
        monthly_price:
          type: number
          title: Monthly Price
        included_credits:
          type: integer
          title: Included Credits
        included_seats:
          type: integer
          title: Included Seats
        razorpay_plan_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Razorpay Plan Id
        is_active:
          type: boolean
          title: Is Active
          default: true
      type: object
      required:
      - name
      - display_name
      - monthly_price
      - included_credits
      - included_seats
      title: PlanUpdate
      description: Update or create a subscription plan
    PreferenceType:
      type: string
      enum:
      - marketing
      - newsletters
      - product_updates
      - promotional
      - transactional
      - notifications
      - alerts
      - surveys
      title: PreferenceType
      description: Types of email preferences
    PreferenceUpdateRequest:
      properties:
        preferences:
          additionalProperties:
            additionalProperties: true
            type: object
          type: object
          title: Preferences
      type: object
      required:
      - preferences
      title: PreferenceUpdateRequest
      description: Request model for preference updates
    PreviewRuleRequest:
      properties:
        rule_config:
          $ref: '#/components/schemas/RuleConfig'
        limit:
          type: integer
          maximum: 500.0
          minimum: 1.0
          title: Limit
          default: 100
      type: object
      required:
      - rule_config
      title: PreviewRuleRequest
      description: Request to preview rule matching
    PreviewWithTransformsRequest:
      properties:
        query_type:
          type: string
          title: Query Type
          description: '''visual'' or ''sql'''
        config:
          additionalProperties: true
          type: object
          title: Config
          description: Base query configuration
        parameters:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Parameters
          description: Query parameters
          default: {}
        transforms:
          $ref: '#/components/schemas/TransformationStack'
          description: Transformations to apply
        limit:
          anyOf:
          - type: integer
            maximum: 10000.0
          - type: 'null'
          title: Limit
          description: Result limit
          default: 1000
        offset:
          anyOf:
          - type: integer
          - type: 'null'
          title: Offset
          description: Result offset for pagination
          default: 0
      type: object
      required:
      - query_type
      - config
      - transforms
      title: PreviewWithTransformsRequest
      description: Request to execute query with transformations applied
    ProcessTextRequest:
      properties:
        content:
          type: string
          title: Content
        section_type:
          type: string
          title: Section Type
      type: object
      required:
      - content
      - section_type
      title: ProcessTextRequest
    ProductCreate:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
          description: Product/service name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          description: Product/service description
        sku:
          anyOf:
          - type: string
            maxLength: 100
          - type: 'null'
          title: Sku
          description: Stock keeping unit
        category:
          anyOf:
          - type: string
            maxLength: 100
          - type: 'null'
          title: Category
          description: Product category
        price:
          anyOf:
          - type: number
            minimum: 0.0
          - type: string
            pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Price
          description: Product price
          default: '0'
        currency:
          type: string
          maxLength: 3
          title: Currency
          description: Currency code
          default: USD
        cost:
          anyOf:
          - type: number
            minimum: 0.0
          - type: string
            pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          - type: 'null'
          title: Cost
          description: Product cost
          default: '0'
        is_active:
          type: boolean
          title: Is Active
          description: Whether product is active
          default: true
        is_service:
          type: boolean
          title: Is Service
          description: Whether this is a service (vs physical product)
          default: true
        packages:
          anyOf:
          - type: string
            maxLength: 255
          - type: 'null'
          title: Packages
          description: Package type
        services:
          anyOf:
          - type: string
            maxLength: 255
          - type: 'null'
          title: Services
          description: Service type
        custom_fields:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Custom Fields
          description: Custom fields
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
          description: Additional metadata
      type: object
      required:
      - name
      title: ProductCreate
    ProductSyncRequest:
      properties:
        integration_id:
          type: string
          title: Integration Id
          description: WhatsApp integration ID
        whatsapp_catalog_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Whatsapp Catalog Id
          description: Specific catalog to sync to (uses default if not provided)
        product_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Product Ids
          description: Specific product IDs to sync (None = sync all)
        batch_size:
          type: integer
          maximum: 100.0
          minimum: 1.0
          title: Batch Size
          description: Batch size for syncing
          default: 50
      type: object
      required:
      - integration_id
      title: ProductSyncRequest
    ProductUpdate:
      properties:
        name:
          anyOf:
          - type: string
            maxLength: 255
            minLength: 1
          - type: 'null'
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        sku:
          anyOf:
          - type: string
            maxLength: 100
          - type: 'null'
          title: Sku
        category:
          anyOf:
          - type: string
            maxLength: 100
          - type: 'null'
          title: Category
        price:
          anyOf:
          - type: number
            minimum: 0.0
          - type: string
            pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          - type: 'null'
          title: Price
        currency:
          anyOf:
          - type: string
            maxLength: 3
          - type: 'null'
          title: Currency
        cost:
          anyOf:
          - type: number
            minimum: 0.0
          - type: string
            pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          - type: 'null'
          title: Cost
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
        is_service:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Service
        packages:
          anyOf:
          - type: string
          - type: 'null'
          title: Packages
        services:
          anyOf:
          - type: string
          - type: 'null'
          title: Services
        custom_fields:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Custom Fields
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
      type: object
      title: ProductUpdate
    ProfileUpdate:
      properties:
        display_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Display Name
        bio:
          anyOf:
          - type: string
          - type: 'null'
          title: Bio
        website_url:
          anyOf:
          - type: string
            maxLength: 2083
            minLength: 1
            format: uri
          - type: 'null'
          title: Website Url
        github_url:
          anyOf:
          - type: string
            maxLength: 2083
            minLength: 1
            format: uri
          - type: 'null'
          title: Github Url
        linkedin_url:
          anyOf:
          - type: string
            maxLength: 2083
            minLength: 1
            format: uri
          - type: 'null'
          title: Linkedin Url
        location:
          anyOf:
          - type: string
          - type: 'null'
          title: Location
        skills:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Skills
      type: object
      title: ProfileUpdate
    PromotePromptRequest:
      properties:
        org_id:
          type: string
          title: Org Id
        prompt_id:
          type: string
          title: Prompt Id
        slug:
          type: string
          title: Slug
        workflow_slug:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Slug
        is_protected:
          type: boolean
          title: Is Protected
          default: true
      type: object
      required:
      - org_id
      - prompt_id
      - slug
      title: PromotePromptRequest
    Prompt:
      properties:
        id:
          anyOf:
          - type: string
          - type: 'null'
          title: Id
        heading:
          type: string
          title: Heading
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        prompt_content:
          type: string
          title: Prompt Content
        category:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
          default: general
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
          default: []
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
          default: true
        is_system_prompt:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is System Prompt
          default: false
        display_order:
          anyOf:
          - type: integer
          - type: 'null'
          title: Display Order
          default: 0
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
          default: {}
        sync_to_kb:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Sync To Kb
          default: false
      type: object
      required:
      - heading
      - prompt_content
      title: Prompt
    PromptGenerateRequest:
      properties:
        score_config_ids:
          items:
            type: string
          type: array
          title: Score Config Ids
      type: object
      required:
      - score_config_ids
      title: PromptGenerateRequest
    PromptPromoteRequest:
      properties:
        slug:
          type: string
          title: Slug
        auto_deploy_new_orgs:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Auto Deploy New Orgs
          default: true
        is_protected:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Protected
          default: true
      type: object
      required:
      - slug
      title: PromptPromoteRequest
    PromptPublishRequest:
      properties:
        prompt_id:
          type: string
          title: Prompt Id
        version:
          anyOf:
          - type: string
          - type: 'null'
          title: Version
          default: 1.0.0
        release_notes:
          anyOf:
          - type: string
          - type: 'null'
          title: Release Notes
      type: object
      required:
      - prompt_id
      title: PromptPublishRequest
    PromptReview:
      properties:
        action:
          type: string
          title: Action
        review_notes:
          anyOf:
          - type: string
          - type: 'null'
          title: Review Notes
        rejection_reason:
          anyOf:
          - type: string
          - type: 'null'
          title: Rejection Reason
      type: object
      required:
      - action
      title: PromptReview
    PromptSubmission:
      properties:
        prompt_id:
          type: string
          title: Prompt Id
        org_id:
          type: string
          title: Org Id
        heading:
          type: string
          title: Heading
        content:
          type: string
          title: Content
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        category:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
          default: general
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
          default: []
        version:
          anyOf:
          - type: string
          - type: 'null'
          title: Version
          default: 1.0.0
        release_notes:
          anyOf:
          - type: string
          - type: 'null'
          title: Release Notes
      type: object
      required:
      - prompt_id
      - org_id
      - heading
      - content
      title: PromptSubmission
    PromptUpdate:
      properties:
        heading:
          anyOf:
          - type: string
          - type: 'null'
          title: Heading
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        prompt_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Prompt Content
        category:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
        display_order:
          anyOf:
          - type: integer
          - type: 'null'
          title: Display Order
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
        sync_to_kb:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Sync To Kb
          default: false
      type: object
      title: PromptUpdate
    PromptVersionCreate:
      properties:
        prompt_content:
          type: string
          title: Prompt Content
        change_summary:
          anyOf:
          - type: string
          - type: 'null'
          title: Change Summary
        source:
          anyOf:
          - type: string
          - type: 'null'
          title: Source
          default: manual
      type: object
      required:
      - prompt_content
      title: PromptVersionCreate
    PromptVersionUpdate:
      properties:
        prompt_content:
          type: string
          title: Prompt Content
        change_summary:
          anyOf:
          - type: string
          - type: 'null'
          title: Change Summary
      type: object
      required:
      - prompt_content
      title: PromptVersionUpdate
    ProviderModelCreate:
      properties:
        category:
          type: string
          title: Category
        provider:
          type: string
          title: Provider
        model:
          type: string
          title: Model
        display_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Display Name
        input_rate:
          type: number
          title: Input Rate
          default: 0
        output_rate:
          type: number
          title: Output Rate
          default: 0
        unit_type:
          type: string
          title: Unit Type
          default: per_1m_tokens
        is_active:
          type: boolean
          title: Is Active
          default: true
        display_order:
          type: integer
          title: Display Order
          default: 0
      type: object
      required:
      - category
      - provider
      - model
      title: ProviderModelCreate
      description: Create or update a provider model
    ProviderModelUpdate:
      properties:
        display_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Display Name
        input_rate:
          anyOf:
          - type: number
          - type: 'null'
          title: Input Rate
        output_rate:
          anyOf:
          - type: number
          - type: 'null'
          title: Output Rate
        unit_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Unit Type
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
        display_order:
          anyOf:
          - type: integer
          - type: 'null'
          title: Display Order
      type: object
      title: ProviderModelUpdate
      description: Update fields for a provider model
    PublicContactCreate:
      properties:
        email:
          type: string
          format: email
          title: Email
        first_name:
          anyOf:
          - type: string
          - type: 'null'
          title: First Name
        last_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Last Name
        phone:
          anyOf:
          - type: string
          - type: 'null'
          title: Phone
        company:
          anyOf:
          - type: string
          - type: 'null'
          title: Company
        job_title:
          anyOf:
          - type: string
          - type: 'null'
          title: Job Title
        source:
          anyOf:
          - type: string
          - type: 'null'
          title: Source
          default: api
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
          default: []
        custom_fields:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Custom Fields
          default: {}
      type: object
      required:
      - email
      title: PublicContactCreate
      description: Minimal contact creation model for public API
      example:
        company: Acme Corp
        email: john.doe@example.com
        first_name: John
        job_title: CEO
        last_name: Doe
        phone: '+1234567890'
        tags:
        - newsletter
        - prospect
    PublishKBRequest:
      properties:
        source_org_id:
          type: string
          title: Source Org Id
          description: Source organization ID
        kb_id:
          type: string
          title: Kb Id
          description: Knowledge base ID to publish
        is_published:
          type: boolean
          title: Is Published
          description: Make available for deployment
          default: true
        publish_to_template:
          type: boolean
          title: Publish To Template
          description: Auto-deploy to template DB
          default: true
        sync_mode:
          type: string
          title: Sync Mode
          description: 'Sync mode: replace, merge, skip_existing'
          default: replace
        include_documents:
          type: boolean
          title: Include Documents
          description: Include documents
          default: true
        include_embeddings:
          type: boolean
          title: Include Embeddings
          description: Include embeddings
          default: true
        tags:
          items:
            type: string
          type: array
          title: Tags
          description: Tags for categorization
        category:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
          description: Category
      type: object
      required:
      - source_org_id
      - kb_id
      title: PublishKBRequest
      description: Request model for publishing a KB to master
    PublishWorkflowRequest:
      properties:
        workflow_id:
          type: string
          title: Workflow Id
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          default: ''
        primary_category:
          type: string
          title: Primary Category
        subcategory:
          anyOf:
          - type: string
          - type: 'null'
          title: Subcategory
        icon:
          type: string
          title: Icon
          default: workflow-default
        color_theme:
          type: string
          title: Color Theme
          default: blue
        usage_notes:
          anyOf:
          - type: string
          - type: 'null'
          title: Usage Notes
          default: ''
        short_description:
          anyOf:
          - type: string
          - type: 'null'
          title: Short Description
        complexity_level:
          type: string
          title: Complexity Level
          default: intermediate
        estimated_setup_time:
          anyOf:
          - type: integer
          - type: 'null'
          title: Estimated Setup Time
        prerequisites:
          anyOf:
          - type: string
          - type: 'null'
          title: Prerequisites
        setup_instructions:
          anyOf:
          - type: string
          - type: 'null'
          title: Setup Instructions
        industry_tags:
          items:
            type: string
          type: array
          title: Industry Tags
          default: []
        use_case_tags:
          items:
            type: string
          type: array
          title: Use Case Tags
          default: []
        search_keywords:
          items:
            type: string
          type: array
          title: Search Keywords
          default: []
        example_inputs:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Example Inputs
        example_outputs:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Example Outputs
        version:
          type: string
          title: Version
          default: 1.0.0
        changelog:
          anyOf:
          - type: string
          - type: 'null'
          title: Changelog
        demo_available:
          type: boolean
          title: Demo Available
          default: false
        tutorial_video_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Tutorial Video Url
        documentation_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Documentation Url
        pricing_model:
          type: string
          title: Pricing Model
          default: free
        price:
          type: number
          title: Price
          default: 0.0
        category_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Category Ids
          default: []
        tags:
          items:
            type: string
          type: array
          title: Tags
          default: []
      type: object
      required:
      - workflow_id
      - name
      - primary_category
      title: PublishWorkflowRequest
      description: Model for publishing a workflow to marketplace
    PublishingSubmit:
      properties:
        workflow_id:
          type: string
          title: Workflow Id
        version:
          type: string
          title: Version
        release_notes:
          anyOf:
          - type: string
          - type: 'null'
          title: Release Notes
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
          default: []
        category:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
        visibility:
          type: string
          title: Visibility
          default: public
        min_price:
          anyOf:
          - type: number
          - type: 'null'
          title: Min Price
          default: 0
      type: object
      required:
      - workflow_id
      - version
      title: PublishingSubmit
    QueryRequest:
      properties:
        query_type:
          type: string
          title: Query Type
          description: '''visual'' or ''sql'''
        config:
          additionalProperties: true
          type: object
          title: Config
          description: Query configuration
        parameters:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Parameters
          description: Query parameters
          default: {}
        limit:
          anyOf:
          - type: integer
            maximum: 10000.0
          - type: 'null'
          title: Limit
          description: Result limit
          default: 1000
        offset:
          anyOf:
          - type: integer
          - type: 'null'
          title: Offset
          description: Result offset for pagination
          default: 0
      type: object
      required:
      - query_type
      - config
      title: QueryRequest
    QueryResult:
      properties:
        data:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Data
        total_rows:
          type: integer
          title: Total Rows
        execution_time_ms:
          type: integer
          title: Execution Time Ms
        query_hash:
          type: string
          title: Query Hash
        columns:
          items:
            additionalProperties:
              type: string
            type: object
          type: array
          title: Columns
      type: object
      required:
      - data
      - total_rows
      - execution_time_ms
      - query_hash
      - columns
      title: QueryResult
    RAGQueryRequest:
      properties:
        question:
          type: string
          title: Question
          description: Question to ask
        model:
          anyOf:
          - type: string
          - type: 'null'
          title: Model
          description: LLM model to use
          default: gpt-4o-mini
        temperature:
          anyOf:
          - type: number
            maximum: 2.0
            minimum: 0.0
          - type: 'null'
          title: Temperature
          description: Temperature
          default: 0.7
        system_prompt:
          anyOf:
          - type: string
          - type: 'null'
          title: System Prompt
          description: Custom system prompt
        max_context_docs:
          anyOf:
          - type: integer
            maximum: 20.0
            minimum: 1.0
          - type: 'null'
          title: Max Context Docs
          description: Max context documents
          default: 5
        metadata_filters:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata Filters
          description: Metadata filters
      type: object
      required:
      - question
      title: RAGQueryRequest
    RateUpdate:
      properties:
        resource_type:
          type: string
          title: Resource Type
        resource_subtype:
          type: string
          title: Resource Subtype
        credits_per_unit:
          anyOf:
          - type: number
          - type: 'null'
          title: Credits Per Unit
        input_credits_per_unit:
          anyOf:
          - type: number
          - type: 'null'
          title: Input Credits Per Unit
        output_credits_per_unit:
          anyOf:
          - type: number
          - type: 'null'
          title: Output Credits Per Unit
        unit_type:
          type: string
          title: Unit Type
          default: per_unit
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        is_active:
          type: boolean
          title: Is Active
          default: true
        plan_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Plan Id
      type: object
      required:
      - resource_type
      - resource_subtype
      title: RateUpdate
      description: Update or create a resource rate
    RefundRequest:
      properties:
        amount:
          anyOf:
          - type: number
            exclusiveMinimum: 0.0
          - type: string
            pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          - type: 'null'
          title: Amount
          description: Refund amount (defaults to full payment amount)
        reason:
          type: string
          minLength: 1
          title: Reason
          description: Refund reason
      type: object
      required:
      - reason
      title: RefundRequest
    RegisterTokenRequest:
      properties:
        fcm_token:
          type: string
          title: Fcm Token
        platform:
          type: string
          title: Platform
        device_info:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Device Info
      type: object
      required:
      - fcm_token
      - platform
      title: RegisterTokenRequest
    ReorderRulesRequest:
      properties:
        rule_ids:
          items:
            type: string
          type: array
          title: Rule Ids
      type: object
      required:
      - rule_ids
      title: ReorderRulesRequest
      description: Request to reorder rules
    RerunExecutionResponse:
      properties:
        success:
          type: boolean
          title: Success
        new_execution_id:
          anyOf:
          - type: string
          - type: 'null'
          title: New Execution Id
        original_execution_id:
          type: string
          title: Original Execution Id
        message:
          type: string
          title: Message
      type: object
      required:
      - success
      - original_execution_id
      - message
      title: RerunExecutionResponse
      description: Response model for rerun execution endpoint
    ResendOTPRequest:
      properties:
        user_id:
          type: string
          title: User Id
        email:
          type: string
          format: email
          title: Email
        otp_type:
          type: string
          title: Otp Type
          default: email_verification
      type: object
      required:
      - user_id
      - email
      title: ResendOTPRequest
    ResendVerificationRequest:
      properties:
        email:
          type: string
          title: Email
      type: object
      required:
      - email
      title: ResendVerificationRequest
    ResetPasswordRequest:
      properties:
        token:
          type: string
          title: Token
        password:
          type: string
          title: Password
      type: object
      required:
      - token
      - password
      title: ResetPasswordRequest
    RoundRobinConfigRequest:
      properties:
        entity_type:
          type: string
          title: Entity Type
          description: 'Entity type: contact or deal'
          default: contact
        is_enabled:
          type: boolean
          title: Is Enabled
          description: Enable/disable round robin
        eligible_member_ids:
          items:
            type: string
          type: array
          title: Eligible Member Ids
          description: List of user IDs for rotation
        assignment_field:
          type: string
          title: Assignment Field
          description: Field to update on assignment
          default: owner_email
        skip_inactive_users:
          type: boolean
          title: Skip Inactive Users
          description: Skip inactive users
          default: true
        skip_unverified_users:
          type: boolean
          title: Skip Unverified Users
          description: Skip unverified users
          default: true
      type: object
      required:
      - is_enabled
      - eligible_member_ids
      title: RoundRobinConfigRequest
      description: Request model for round robin configuration
    RuleConfig:
      properties:
        filter_groups:
          items:
            $ref: '#/components/schemas/routes__crm__scoring_routes__FilterGroup'
          type: array
          title: Filter Groups
          default: []
        group_connector:
          type: string
          title: Group Connector
          default: AND
      type: object
      title: RuleConfig
      description: Rule configuration with filter groups
    SaveChatMessageRequest:
      properties:
        role:
          type: string
          pattern: ^(user|assistant)$
          title: Role
          description: Message role
        content:
          anyOf:
          - type: string
          - type: 'null'
          title: Content
          description: Plain text content
        response_components:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Response Components
          description: Response builder components
        workflow_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Id
          description: ID of the workflow that generated this response
        workflow_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Name
          description: Name of the workflow for display
      type: object
      required:
      - role
      title: SaveChatMessageRequest
    SaveFromWorkflowRequest:
      properties:
        prompt_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Prompt Id
        heading:
          type: string
          title: Heading
        prompt_content:
          type: string
          title: Prompt Content
        change_summary:
          anyOf:
          - type: string
          - type: 'null'
          title: Change Summary
        save_as:
          type: string
          title: Save As
          default: new_version
        workflow_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Id
        node_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Node Id
      type: object
      required:
      - heading
      - prompt_content
      title: SaveFromWorkflowRequest
    SavedFilterCreate:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
        entity_type:
          type: string
          pattern: ^(contacts|companies|deals|tasks)$
          title: Entity Type
        filter_config:
          additionalProperties: true
          type: object
          title: Filter Config
        is_public:
          type: boolean
          title: Is Public
          default: false
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          default: ''
      type: object
      required:
      - name
      - entity_type
      - filter_config
      title: SavedFilterCreate
    SavedFilterUpdate:
      properties:
        name:
          anyOf:
          - type: string
            maxLength: 255
            minLength: 1
          - type: 'null'
          title: Name
        filter_config:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Filter Config
        is_public:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Public
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
      type: object
      title: SavedFilterUpdate
    SavedQuery:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        query_type:
          type: string
          title: Query Type
        query_config:
          additionalProperties: true
          type: object
          title: Query Config
        is_shared:
          type: boolean
          title: Is Shared
        created_by:
          type: string
          title: Created By
        organization_id:
          type: string
          title: Organization Id
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
      - id
      - name
      - description
      - query_type
      - query_config
      - is_shared
      - created_by
      - organization_id
      - created_at
      - updated_at
      title: SavedQuery
    SavedQueryCreate:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
        description:
          anyOf:
          - type: string
            maxLength: 1000
          - type: 'null'
          title: Description
        query_type:
          type: string
          title: Query Type
          description: '''visual'' or ''sql'''
        query_config:
          additionalProperties: true
          type: object
          title: Query Config
          description: Query configuration - tables, joins, filters, grouping
        is_shared:
          type: boolean
          title: Is Shared
          description: Share with organization
          default: false
      type: object
      required:
      - name
      - query_type
      - query_config
      title: SavedQueryCreate
    SavedQueryUpdate:
      properties:
        name:
          anyOf:
          - type: string
            maxLength: 255
            minLength: 1
          - type: 'null'
          title: Name
        description:
          anyOf:
          - type: string
            maxLength: 1000
          - type: 'null'
          title: Description
        query_config:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Query Config
        is_shared:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Shared
      type: object
      title: SavedQueryUpdate
    SavedSearchRequest:
      properties:
        name:
          type: string
          title: Name
          description: Search name
        query:
          type: string
          title: Query
          description: Search query
          default: ''
        filters:
          additionalProperties: true
          type: object
          title: Filters
          description: Search filters
      type: object
      required:
      - name
      title: SavedSearchRequest
      description: Save search request
    ScheduleConfig:
      properties:
        type:
          type: string
          title: Type
        scheduledTime:
          anyOf:
          - type: string
          - type: 'null'
          title: Scheduledtime
        timezone:
          type: string
          title: Timezone
          default: UTC
        recurringPattern:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Recurringpattern
      type: object
      required:
      - type
      title: ScheduleConfig
    SchemaFieldResponse:
      properties:
        id:
          anyOf:
          - type: string
          - type: 'null'
          title: Id
        field_name:
          type: string
          title: Field Name
        display_name:
          type: string
          title: Display Name
        field_type:
          type: string
          title: Field Type
        is_required:
          type: boolean
          title: Is Required
        field_options:
          additionalProperties: true
          type: object
          title: Field Options
          default: {}
        default_value:
          anyOf:
          - type: string
          - type: 'null'
          title: Default Value
        help_text:
          anyOf:
          - type: string
          - type: 'null'
          title: Help Text
        display_order:
          anyOf:
          - type: integer
          - type: 'null'
          title: Display Order
      type: object
      required:
      - field_name
      - display_name
      - field_type
      - is_required
      title: SchemaFieldResponse
    SchemaResponse:
      properties:
        id:
          type: string
          title: Id
        schema_name:
          type: string
          title: Schema Name
        display_name:
          type: string
          title: Display Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        entity_type:
          type: string
          title: Entity Type
        icon:
          type: string
          title: Icon
        category:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
        is_active:
          type: boolean
          title: Is Active
        created_by:
          anyOf:
          - type: string
          - type: 'null'
          title: Created By
        created_at:
          type: string
          title: Created At
        updated_at:
          type: string
          title: Updated At
        field_count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Field Count
          default: 0
        usage_count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Usage Count
          default: 0
        total_records:
          anyOf:
          - type: integer
          - type: 'null'
          title: Total Records
          default: 0
        fields:
          items:
            $ref: '#/components/schemas/SchemaFieldResponse'
          type: array
          title: Fields
          default: []
      type: object
      required:
      - id
      - schema_name
      - display_name
      - description
      - entity_type
      - icon
      - category
      - is_active
      - created_by
      - created_at
      - updated_at
      title: SchemaResponse
    ScoreConfigCreate:
      properties:
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        score_type:
          type: string
          title: Score Type
        options:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Options
        min_value:
          anyOf:
          - type: number
          - type: 'null'
          title: Min Value
        max_value:
          anyOf:
          - type: number
          - type: 'null'
          title: Max Value
        optimization_direction:
          type: string
          title: Optimization Direction
          default: maximize
        categorical_mode:
          anyOf:
          - type: string
          - type: 'null'
          title: Categorical Mode
        categories:
          anyOf:
          - items:
              additionalProperties: true
              type: object
            type: array
          - type: 'null'
          title: Categories
        expected_value:
          anyOf:
          - type: string
          - type: 'null'
          title: Expected Value
      type: object
      required:
      - name
      - score_type
      title: ScoreConfigCreate
    ScoreCreate:
      properties:
        trace_id:
          type: string
          title: Trace Id
          description: Trace ID to score
        observation_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Observation Id
          description: Optional observation ID
        name:
          type: string
          title: Name
          description: Score name (e.g., 'helpfulness', 'accuracy')
        value:
          type: number
          maximum: 1.0
          minimum: 0.0
          title: Value
          description: Score value between 0 and 1
        string_value:
          anyOf:
          - type: string
          - type: 'null'
          title: String Value
          description: Optional string value for categorical
        data_type:
          type: string
          title: Data Type
          description: NUMERIC, BOOLEAN, or CATEGORICAL
          default: NUMERIC
        source:
          type: string
          title: Source
          description: 'Score source: user, llm_judge, api'
          default: api
        comment:
          anyOf:
          - type: string
          - type: 'null'
          title: Comment
          description: Optional comment
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
          description: Structured metadata (dimension_scores, reasoning, etc.)
      type: object
      required:
      - trace_id
      - name
      - value
      title: ScoreCreate
    ScoreResponse:
      properties:
        id:
          type: string
          title: Id
        trace_id:
          type: string
          title: Trace Id
        name:
          type: string
          title: Name
        value:
          type: number
          title: Value
        source:
          type: string
          title: Source
      type: object
      required:
      - id
      - trace_id
      - name
      - value
      - source
      title: ScoreResponse
    SegmentCreate:
      properties:
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          default: ''
        entity_type:
          type: string
          title: Entity Type
        filter_config:
          $ref: '#/components/schemas/SegmentFilterConfig'
        segment_type:
          type: string
          title: Segment Type
          default: static_onetime
        is_public:
          type: boolean
          title: Is Public
          default: false
        tags:
          items:
            type: string
          type: array
          title: Tags
          default: []
      type: object
      required:
      - name
      - entity_type
      - filter_config
      title: SegmentCreate
    SegmentFilterConfig:
      properties:
        filters:
          items:
            $ref: '#/components/schemas/routes__crm__segment_routes__FilterCondition'
          type: array
          title: Filters
          default: []
        filter_groups:
          anyOf:
          - items:
              $ref: '#/components/schemas/routes__crm__segment_routes__FilterGroup'
            type: array
          - type: 'null'
          title: Filter Groups
        group_connector:
          anyOf:
          - type: string
          - type: 'null'
          title: Group Connector
          default: AND
        logic:
          type: string
          title: Logic
          default: AND
        relatedFilters:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Relatedfilters
        aggregateFilters:
          anyOf:
          - items:
              additionalProperties: true
              type: object
            type: array
          - type: 'null'
          title: Aggregatefilters
      type: object
      title: SegmentFilterConfig
    SegmentUpdate:
      properties:
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        filter_config:
          anyOf:
          - $ref: '#/components/schemas/SegmentFilterConfig'
          - type: 'null'
        segment_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Segment Type
        is_public:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Public
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
      type: object
      title: SegmentUpdate
    SendCategorizedProductMessage:
      properties:
        integration_id:
          type: string
          title: Integration Id
          description: WhatsApp integration ID
        customer_phone:
          type: string
          title: Customer Phone
          description: Customer WhatsApp number
        categories:
          items:
            type: string
          type: array
          title: Categories
          description: Product categories to send
        products_per_category:
          type: integer
          maximum: 30.0
          minimum: 1.0
          title: Products Per Category
          description: Max products per category
          default: 10
        body_text:
          anyOf:
          - type: string
          - type: 'null'
          title: Body Text
          description: Optional message text
      type: object
      required:
      - integration_id
      - customer_phone
      - categories
      title: SendCategorizedProductMessage
    SendMobileOTPRequest:
      properties:
        phone:
          type: string
          title: Phone
        user_id:
          anyOf:
          - type: string
          - type: 'null'
          title: User Id
        purpose:
          type: string
          title: Purpose
          default: phone_verification
      type: object
      required:
      - phone
      title: SendMobileOTPRequest
    SendProductMessage:
      properties:
        integration_id:
          type: string
          title: Integration Id
          description: WhatsApp integration ID
        customer_phone:
          type: string
          title: Customer Phone
          description: Customer WhatsApp number (with country code)
        product_ids:
          items:
            type: string
          type: array
          maxItems: 30
          minItems: 1
          title: Product Ids
          description: Product IDs to send
        message_type:
          type: string
          title: Message Type
          description: 'Message type: ''single'' or ''multi'''
          default: single
        body_text:
          anyOf:
          - type: string
          - type: 'null'
          title: Body Text
          description: Optional message text
        header_text:
          anyOf:
          - type: string
          - type: 'null'
          title: Header Text
          description: Optional header text (multi-product only)
      type: object
      required:
      - integration_id
      - customer_phone
      - product_ids
      title: SendProductMessage
    SendTemplateMessage:
      properties:
        recipient:
          type: string
          title: Recipient
        template_name:
          type: string
          title: Template Name
        language:
          type: string
          title: Language
          default: en
        components:
          anyOf:
          - items:
              additionalProperties: true
              type: object
            type: array
          - type: 'null'
          title: Components
      type: object
      required:
      - recipient
      - template_name
      title: SendTemplateMessage
    SendTextMessage:
      properties:
        recipient:
          type: string
          title: Recipient
        message:
          type: string
          title: Message
        preview_url:
          type: boolean
          title: Preview Url
          default: true
      type: object
      required:
      - recipient
      - message
      title: SendTextMessage
    SettingUpdate:
      properties:
        key:
          type: string
          title: Key
        value:
          title: Value
      type: object
      required:
      - key
      - value
      title: SettingUpdate
      description: Model for updating a single setting
    ShopifyConnectRequest:
      properties:
        shop_domain:
          type: string
          title: Shop Domain
      type: object
      required:
      - shop_domain
      title: ShopifyConnectRequest
      description: Request model for initiating Shopify connection
    SignupRequest:
      properties:
        email:
          type: string
          format: email
          title: Email
        name:
          type: string
          title: Name
        password:
          type: string
          title: Password
        mobile:
          anyOf:
          - type: string
          - type: 'null'
          title: Mobile
      type: object
      required:
      - email
      - name
      - password
      title: SignupRequest
    SignupResponse:
      properties:
        success:
          type: boolean
          title: Success
        message:
          type: string
          title: Message
        session_token:
          anyOf:
          - type: string
          - type: 'null'
          title: Session Token
        user:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: User
        organization:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Organization
        tokens:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Tokens
      type: object
      required:
      - success
      - message
      title: SignupResponse
    SimpleResponse:
      properties:
        message:
          type: string
          title: Message
        details:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Details
      type: object
      required:
      - message
      title: SimpleResponse
    SingleEmailValidationRequest:
      properties:
        email:
          type: string
          format: email
          title: Email
          description: Email address to validate
      type: object
      required:
      - email
      title: SingleEmailValidationRequest
      description: Request model for single email validation
    SkillConfigResponse:
      properties:
        skill_name:
          type: string
          title: Skill Name
        display_name:
          type: string
          title: Display Name
        description:
          type: string
          title: Description
        category:
          type: string
          title: Category
        role:
          type: string
          title: Role
        tags:
          items:
            type: string
          type: array
          title: Tags
        typical_use:
          type: string
          title: Typical Use
        is_enabled:
          type: boolean
          title: Is Enabled
        requires_approval:
          type: boolean
          title: Requires Approval
        approval_reason:
          anyOf:
          - type: string
          - type: 'null'
          title: Approval Reason
        required_integrations:
          items:
            type: string
          type: array
          title: Required Integrations
        integration_status:
          additionalProperties:
            type: boolean
          type: object
          title: Integration Status
        all_integrations_ready:
          type: boolean
          title: All Integrations Ready
        custom_settings:
          additionalProperties: true
          type: object
          title: Custom Settings
      type: object
      required:
      - skill_name
      - display_name
      - description
      - category
      - role
      - tags
      - typical_use
      - is_enabled
      - requires_approval
      - approval_reason
      - required_integrations
      - integration_status
      - all_integrations_ready
      - custom_settings
      title: SkillConfigResponse
      description: Response for a single skill configuration
    SkillListResponse:
      properties:
        total:
          type: integer
          title: Total
        categories:
          items:
            type: string
          type: array
          title: Categories
        skills:
          items:
            $ref: '#/components/schemas/SkillConfigResponse'
          type: array
          title: Skills
      type: object
      required:
      - total
      - categories
      - skills
      title: SkillListResponse
      description: Response for skill list
    SkillUpdateRequest:
      properties:
        is_enabled:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Enabled
        requires_approval:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Requires Approval
        approval_reason:
          anyOf:
          - type: string
          - type: 'null'
          title: Approval Reason
        custom_settings:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Custom Settings
      type: object
      title: SkillUpdateRequest
      description: Request to update a skill configuration
    SlackConnectRequest:
      properties: {}
      type: object
      title: SlackConnectRequest
    SlackCustomConnectRequest:
      properties:
        client_id:
          type: string
          title: Client Id
        client_secret:
          type: string
          title: Client Secret
      type: object
      required:
      - client_id
      - client_secret
      title: SlackCustomConnectRequest
    SlackListChannelsRequest:
      properties:
        integration_id:
          type: integer
          title: Integration Id
        types:
          type: string
          title: Types
          default: public_channel,private_channel
        exclude_archived:
          type: boolean
          title: Exclude Archived
          default: true
      type: object
      required:
      - integration_id
      title: SlackListChannelsRequest
    SlackSendMessageRequest:
      properties:
        integration_id:
          type: integer
          title: Integration Id
        channel:
          type: string
          title: Channel
        text:
          type: string
          title: Text
        blocks:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Blocks
      type: object
      required:
      - integration_id
      - channel
      - text
      title: SlackSendMessageRequest
    SlackTestConnectionRequest:
      properties:
        integration_id:
          type: integer
          title: Integration Id
      type: object
      required:
      - integration_id
      title: SlackTestConnectionRequest
    StageCreate:
      properties:
        name:
          type: string
          title: Name
        order_index:
          type: integer
          title: Order Index
          default: 0
        probability:
          type: integer
          title: Probability
          default: 0
        color:
          anyOf:
          - type: string
          - type: 'null'
          title: Color
          default: '#000000'
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          default: ''
      type: object
      required:
      - name
      title: StageCreate
    StageRuleRequest:
      properties:
        target_stage_id:
          type: string
          title: Target Stage Id
          description: Lifecycle stage ID to trigger on
        eligible_member_ids:
          items:
            type: string
          type: array
          title: Eligible Member Ids
          description: List of user IDs for rotation
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
          description: Optional rule name
      type: object
      required:
      - target_stage_id
      - eligible_member_ids
      title: StageRuleRequest
      description: Request model for stage-based round robin rule
    StageRuleUpdateRequest:
      properties:
        target_stage_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Target Stage Id
          description: Lifecycle stage ID
        eligible_member_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Eligible Member Ids
          description: User IDs
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
          description: Rule name
        is_enabled:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Enabled
          description: Enable/disable rule
      type: object
      title: StageRuleUpdateRequest
      description: Request model for updating a stage rule
    StageUpdate:
      properties:
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        order_index:
          anyOf:
          - type: integer
          - type: 'null'
          title: Order Index
        probability:
          anyOf:
          - type: integer
          - type: 'null'
          title: Probability
        color:
          anyOf:
          - type: string
          - type: 'null'
          title: Color
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
      type: object
      title: StageUpdate
    StandardFieldUpdate:
      properties:
        entity_type:
          type: string
          title: Entity Type
        field_name:
          type: string
          title: Field Name
        options:
          items:
            type: string
          type: array
          title: Options
      type: object
      required:
      - entity_type
      - field_name
      - options
      title: StandardFieldUpdate
    StatusUpdate:
      properties:
        status:
          type: string
          title: Status
        reason:
          type: string
          title: Reason
      type: object
      required:
      - status
      - reason
      title: StatusUpdate
    StepApprovalRequest:
      properties:
        modified_inputs:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Modified Inputs
          description: Optional modified inputs for the step
      type: object
      title: StepApprovalRequest
      description: Request to approve a step
    SubscribeRequest:
      properties:
        email:
          type: string
          format: email
          title: Email
        preference_types:
          items:
            $ref: '#/components/schemas/PreferenceType'
          type: array
          title: Preference Types
        frequency:
          type: string
          title: Frequency
          default: weekly
        double_optin:
          type: boolean
          title: Double Optin
          default: true
      type: object
      required:
      - email
      - preference_types
      title: SubscribeRequest
      description: Request model for new subscriptions
    SubtaskCreate:
      properties:
        title:
          type: string
          maxLength: 255
          title: Title
          description: Subtask title (required)
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          description: Subtask description
        priority:
          type: string
          title: Priority
          description: Priority (low, medium, high, urgent)
          default: medium
        status:
          type: string
          title: Status
          description: Status (pending, in_progress, completed, cancelled)
          default: pending
        due_date:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Due Date
          description: Due date
        assigned_to_email:
          anyOf:
          - type: string
          - type: 'null'
          title: Assigned To Email
          description: Assigned to email
        type:
          type: string
          title: Type
          description: Task type
          default: todo
      type: object
      required:
      - title
      title: SubtaskCreate
      description: Model for creating a subtask
    SubtaskReorder:
      properties:
        subtask_ids:
          items:
            type: string
          type: array
          title: Subtask Ids
          description: Ordered list of subtask IDs
      type: object
      required:
      - subtask_ids
      title: SubtaskReorder
      description: Model for reordering subtasks
    SuperAdminLoginRequest:
      properties:
        email:
          type: string
          format: email
          title: Email
      type: object
      required:
      - email
      title: SuperAdminLoginRequest
    SyncRequest:
      properties:
        form_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Form Id
      type: object
      title: SyncRequest
      description: Request to manually sync form responses
    SystemPromptCreate:
      properties:
        slug:
          type: string
          title: Slug
        heading:
          type: string
          title: Heading
        prompt_content:
          type: string
          title: Prompt Content
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        category:
          type: string
          title: Category
          default: system
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
        workflow_slug:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Slug
        is_protected:
          type: boolean
          title: Is Protected
          default: true
        auto_deploy_new_orgs:
          type: boolean
          title: Auto Deploy New Orgs
          default: true
      type: object
      required:
      - slug
      - heading
      - prompt_content
      title: SystemPromptCreate
    SystemPromptUpdate:
      properties:
        prompt_content:
          type: string
          title: Prompt Content
        heading:
          anyOf:
          - type: string
          - type: 'null'
          title: Heading
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
      type: object
      required:
      - prompt_content
      title: SystemPromptUpdate
    TableSchema:
      properties:
        table_name:
          type: string
          title: Table Name
        display_name:
          type: string
          title: Display Name
        columns:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Columns
        row_count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Row Count
        relationships:
          anyOf:
          - items:
              additionalProperties: true
              type: object
            type: array
          - type: 'null'
          title: Relationships
      type: object
      required:
      - table_name
      - display_name
      - columns
      title: TableSchema
    TaskCreate:
      properties:
        extras:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Extras
          description: Additional fields not in core model
        title:
          type: string
          maxLength: 255
          title: Title
          description: Task title (required)
        priority:
          type: string
          title: Priority
          description: Task priority (low, medium, high, urgent)
          default: medium
        status:
          type: string
          title: Status
          description: Task status (pending, in_progress, completed, cancelled)
          default: pending
        due_date:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Due Date
          description: Task due date
        assigned_to_email:
          anyOf:
          - type: string
          - type: 'null'
          title: Assigned To Email
          description: Email of assigned person
        type:
          type: string
          title: Type
          description: Task type (call, email, meeting, todo, general)
          default: general
      additionalProperties: true
      type: object
      required:
      - title
      title: TaskCreate
      description: Task creation model using hybrid approach - validates core fields,
        accepts any extras
      example:
        assigned_to_email: sales@company.com
        description: Call client to discuss contract
        due_date: '2024-12-01T10:00:00'
        entity_id: a672a737-f25b-4bcf-aaee-c150ab04b40b
        entity_type: deal
        priority: high
        reminder_date: '2024-11-30T09:00:00'
        status: pending
        title: Follow up with client
        type: call
    TaskType:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        label:
          type: string
          title: Label
        color:
          type: string
          title: Color
        icon:
          anyOf:
          - type: string
          - type: 'null'
          title: Icon
        is_active:
          type: boolean
          title: Is Active
        display_order:
          type: integer
          title: Display Order
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
      - id
      - name
      - label
      - color
      - icon
      - is_active
      - display_order
      - created_at
      - updated_at
      title: TaskType
    TaskTypeCreate:
      properties:
        name:
          type: string
          title: Name
        label:
          type: string
          title: Label
        color:
          anyOf:
          - type: string
          - type: 'null'
          title: Color
          default: '#6B7280'
        icon:
          anyOf:
          - type: string
          - type: 'null'
          title: Icon
        display_order:
          anyOf:
          - type: integer
          - type: 'null'
          title: Display Order
          default: 0
      type: object
      required:
      - name
      - label
      title: TaskTypeCreate
    TaskTypeUpdate:
      properties:
        label:
          anyOf:
          - type: string
          - type: 'null'
          title: Label
        color:
          anyOf:
          - type: string
          - type: 'null'
          title: Color
        icon:
          anyOf:
          - type: string
          - type: 'null'
          title: Icon
        display_order:
          anyOf:
          - type: integer
          - type: 'null'
          title: Display Order
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
      type: object
      title: TaskTypeUpdate
    TaskUpdate:
      properties:
        title:
          anyOf:
          - type: string
          - type: 'null'
          title: Title
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        due_date:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Due Date
        priority:
          anyOf:
          - type: string
          - type: 'null'
          title: Priority
        status:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
        type:
          anyOf:
          - type: string
          - type: 'null'
          title: Type
        assigned_to_email:
          anyOf:
          - type: string
          - type: 'null'
          title: Assigned To Email
        completed_at:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Completed At
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
        contact_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Contact Id
        company_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Company Id
        deal_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Deal Id
      type: object
      title: TaskUpdate
    TeamCreate:
      properties:
        name:
          type: string
          maxLength: 100
          minLength: 1
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        department:
          anyOf:
          - type: string
            maxLength: 100
          - type: 'null'
          title: Department
        team_lead_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Team Lead Id
        parent_team_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Parent Team Id
        budget:
          anyOf:
          - type: number
          - type: 'null'
          title: Budget
        custom_fields:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Custom Fields
          default: {}
      type: object
      required:
      - name
      title: TeamCreate
    TeamMemberCreate:
      properties:
        employee_id:
          type: string
          maxLength: 50
          minLength: 1
          title: Employee Id
        email:
          type: string
          format: email
          title: Email
        first_name:
          type: string
          maxLength: 100
          minLength: 1
          title: First Name
        last_name:
          type: string
          maxLength: 100
          minLength: 1
          title: Last Name
        phone:
          anyOf:
          - type: string
            maxLength: 50
          - type: 'null'
          title: Phone
        mobile:
          anyOf:
          - type: string
            maxLength: 50
          - type: 'null'
          title: Mobile
        department:
          anyOf:
          - type: string
            maxLength: 100
          - type: 'null'
          title: Department
        job_title:
          anyOf:
          - type: string
            maxLength: 100
          - type: 'null'
          title: Job Title
        employment_type:
          anyOf:
          - type: string
            pattern: ^(full_time|part_time|contractor|intern)$
          - type: 'null'
          title: Employment Type
          default: full_time
        hire_date:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Hire Date
        reports_to:
          anyOf:
          - type: string
          - type: 'null'
          title: Reports To
        team_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Team Id
        skill_level:
          anyOf:
          - type: string
            pattern: ^(tier_1|tier_2|tier_3|specialist)$
          - type: 'null'
          title: Skill Level
          default: tier_1
        salary:
          anyOf:
          - type: number
          - type: 'null'
          title: Salary
        salary_currency:
          anyOf:
          - type: string
            maxLength: 3
          - type: 'null'
          title: Salary Currency
          default: USD
        salary_frequency:
          anyOf:
          - type: string
            pattern: ^(hourly|weekly|bi_weekly|monthly|yearly)$
          - type: 'null'
          title: Salary Frequency
          default: monthly
        hourly_rate:
          anyOf:
          - type: number
          - type: 'null'
          title: Hourly Rate
        commission_rate:
          anyOf:
          - type: number
          - type: 'null'
          title: Commission Rate
        bonus_eligible:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Bonus Eligible
          default: false
        last_salary_review:
          anyOf:
          - type: string
            format: date
          - type: string
          - type: 'null'
          title: Last Salary Review
        next_salary_review:
          anyOf:
          - type: string
            format: date
          - type: string
          - type: 'null'
          title: Next Salary Review
        location:
          anyOf:
          - type: string
            maxLength: 100
          - type: 'null'
          title: Location
        timezone:
          anyOf:
          - type: string
            maxLength: 50
          - type: 'null'
          title: Timezone
          default: UTC
        skills:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Skills
          default: []
        certifications:
          anyOf:
          - items:
              additionalProperties: true
              type: object
            type: array
          - type: 'null'
          title: Certifications
          default: []
        emergency_contact:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Emergency Contact
          default: {}
        custom_fields:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Custom Fields
          default: {}
      type: object
      required:
      - employee_id
      - email
      - first_name
      - last_name
      title: TeamMemberCreate
    TeamMemberUpdate:
      properties:
        email:
          anyOf:
          - type: string
            format: email
          - type: 'null'
          title: Email
        first_name:
          anyOf:
          - type: string
            maxLength: 100
            minLength: 1
          - type: 'null'
          title: First Name
        last_name:
          anyOf:
          - type: string
            maxLength: 100
            minLength: 1
          - type: 'null'
          title: Last Name
        phone:
          anyOf:
          - type: string
            maxLength: 50
          - type: 'null'
          title: Phone
        mobile:
          anyOf:
          - type: string
            maxLength: 50
          - type: 'null'
          title: Mobile
        department:
          anyOf:
          - type: string
            maxLength: 100
          - type: 'null'
          title: Department
        job_title:
          anyOf:
          - type: string
            maxLength: 100
          - type: 'null'
          title: Job Title
        employment_type:
          anyOf:
          - type: string
            pattern: ^(full_time|part_time|contractor|intern)$
          - type: 'null'
          title: Employment Type
        hire_date:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Hire Date
        reports_to:
          anyOf:
          - type: string
          - type: 'null'
          title: Reports To
        team_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Team Id
        skill_level:
          anyOf:
          - type: string
            pattern: ^(tier_1|tier_2|tier_3|specialist)$
          - type: 'null'
          title: Skill Level
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
        is_available:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Available
        salary:
          anyOf:
          - type: number
          - type: 'null'
          title: Salary
        salary_currency:
          anyOf:
          - type: string
            maxLength: 3
          - type: 'null'
          title: Salary Currency
        salary_frequency:
          anyOf:
          - type: string
            pattern: ^(hourly|weekly|bi_weekly|monthly|yearly)$
          - type: 'null'
          title: Salary Frequency
        hourly_rate:
          anyOf:
          - type: number
          - type: 'null'
          title: Hourly Rate
        commission_rate:
          anyOf:
          - type: number
          - type: 'null'
          title: Commission Rate
        bonus_eligible:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Bonus Eligible
        last_salary_review:
          anyOf:
          - type: string
            format: date
          - type: string
          - type: 'null'
          title: Last Salary Review
        next_salary_review:
          anyOf:
          - type: string
            format: date
          - type: string
          - type: 'null'
          title: Next Salary Review
        location:
          anyOf:
          - type: string
            maxLength: 100
          - type: 'null'
          title: Location
        timezone:
          anyOf:
          - type: string
            maxLength: 50
          - type: 'null'
          title: Timezone
        skills:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Skills
        certifications:
          anyOf:
          - items:
              additionalProperties: true
              type: object
            type: array
          - type: 'null'
          title: Certifications
        emergency_contact:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Emergency Contact
        custom_fields:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Custom Fields
      type: object
      title: TeamMemberUpdate
    TeamUpdate:
      properties:
        name:
          anyOf:
          - type: string
            maxLength: 100
            minLength: 1
          - type: 'null'
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        department:
          anyOf:
          - type: string
            maxLength: 100
          - type: 'null'
          title: Department
        team_lead_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Team Lead Id
        parent_team_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Parent Team Id
        budget:
          anyOf:
          - type: number
          - type: 'null'
          title: Budget
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
        custom_fields:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Custom Fields
      type: object
      title: TeamUpdate
    TemplateCategory:
      type: string
      enum:
      - marketing
      - transactional
      - newsletter
      - drip
      - notification
      - other
      title: TemplateCategory
      description: Template category enumeration
    TemplateCategoryResponse:
      properties:
        value:
          type: string
          title: Value
          description: Category value
        label:
          type: string
          title: Label
          description: Category display label
      type: object
      required:
      - value
      - label
      title: TemplateCategoryResponse
      description: Response schema for available categories
      example:
        label: Marketing
        value: marketing
    TemplateChannel:
      type: string
      enum:
      - email
      - sms
      - whatsapp
      - push
      - slack
      - teams
      title: TemplateChannel
      description: Template channel enumeration
    TemplateChannelResponse:
      properties:
        value:
          type: string
          title: Value
          description: Channel value
        label:
          type: string
          title: Label
          description: Channel display label
      type: object
      required:
      - value
      - label
      title: TemplateChannelResponse
      description: Response schema for available channels
      example:
        label: EMAIL
        value: email
    TemplateCreateRequest:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
          description: Template name
        description:
          anyOf:
          - type: string
            maxLength: 1000
          - type: 'null'
          title: Description
          description: Template description
        channel:
          $ref: '#/components/schemas/TemplateChannel'
          description: Communication channel
        category:
          $ref: '#/components/schemas/TemplateCategory'
          description: Template category
        subject:
          anyOf:
          - type: string
            maxLength: 500
          - type: 'null'
          title: Subject
          description: Subject line (email only)
        preheader:
          anyOf:
          - type: string
            maxLength: 200
          - type: 'null'
          title: Preheader
          description: Preheader/preview text (email only, 40-100 chars)
        content:
          type: string
          minLength: 1
          title: Content
          description: Template content with variables
        status:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
          description: Template status
          default: draft
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
          description: Whether template is active
          default: true
        external_template_id:
          anyOf:
          - type: string
            maxLength: 255
          - type: 'null'
          title: External Template Id
          description: External template ID (Twilio SMS ID, WhatsApp template ID,
            etc.)
      type: object
      required:
      - name
      - channel
      - category
      - content
      title: TemplateCreateRequest
      description: Request schema for creating a new template
      example:
        category: marketing
        channel: email
        content: <h1>Welcome {{first_name}}!</h1><p>Thanks for joining us.</p>
        description: Welcome new customers to our platform
        is_active: true
        name: Welcome Email
        status: draft
        subject: Welcome to Expedify, {{first_name}}!
    TemplateListResponse:
      properties:
        templates:
          items:
            $ref: '#/components/schemas/models__marketing__template_schemas__TemplateResponse'
          type: array
          title: Templates
          description: List of templates
        total:
          type: integer
          title: Total
          description: Total number of templates
        limit:
          type: integer
          title: Limit
          description: Number of templates per page
        offset:
          type: integer
          title: Offset
          description: Number of templates skipped
        filters:
          additionalProperties:
            anyOf:
            - {}
            - type: 'null'
          type: object
          title: Filters
          description: Applied filters
      type: object
      required:
      - templates
      - total
      - limit
      - offset
      - filters
      title: TemplateListResponse
      description: Response schema for template list
      example:
        filters:
          category: marketing
          channel: email
          filter_by_active_integrations: true
          status: active
        limit: 10
        offset: 0
        templates: []
        total: 25
    TemplatePreviewResponse:
      properties:
        template_id:
          type: string
          title: Template Id
          description: Template UUID
        channel:
          type: string
          title: Channel
          description: Communication channel
        rendered_subject:
          anyOf:
          - type: string
          - type: 'null'
          title: Rendered Subject
          description: Rendered subject line
        rendered_content:
          type: string
          title: Rendered Content
          description: Rendered template content
        variables_used:
          items:
            type: string
          type: array
          title: Variables Used
          description: Variables that were replaced
        missing_variables:
          items:
            type: string
          type: array
          title: Missing Variables
          description: Variables not provided
      type: object
      required:
      - template_id
      - channel
      - rendered_content
      - variables_used
      - missing_variables
      title: TemplatePreviewResponse
      description: Response schema for template preview
      example:
        channel: email
        missing_variables: []
        rendered_content: <h1>Welcome John!</h1><p>Thanks for joining us.</p>
        rendered_subject: Welcome to Expedify, John!
        template_id: 123e4567-e89b-12d3-a456-426614174000
        variables_used:
        - first_name
    TemplateTestRequest:
      properties:
        recipient:
          type: string
          title: Recipient
          description: Test recipient (email/phone)
        variables:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Variables
          description: Variables for testing
          default: {}
      type: object
      required:
      - recipient
      title: TemplateTestRequest
      description: Request schema for template testing
      example:
        recipient: test@example.com
        variables:
          first_name: John
          order_id: ORD-12345
    TemplateTestResponse:
      properties:
        status:
          type: string
          title: Status
          description: Test status
        recipient:
          type: string
          title: Recipient
          description: Test recipient
        channel:
          type: string
          title: Channel
          description: Communication channel
        rendered_subject:
          anyOf:
          - type: string
          - type: 'null'
          title: Rendered Subject
          description: Rendered subject
        rendered_content:
          type: string
          title: Rendered Content
          description: Rendered content (truncated)
      type: object
      required:
      - status
      - recipient
      - channel
      - rendered_content
      title: TemplateTestResponse
      description: Response schema for template testing
      example:
        channel: email
        recipient: test@example.com
        rendered_content: <h1>Welcome John!</h1><p>Thanks for...
        rendered_subject: Welcome to Expedify, John!
        status: test_sent
    TemplateUpdateRequest:
      properties:
        name:
          anyOf:
          - type: string
            maxLength: 255
            minLength: 1
          - type: 'null'
          title: Name
          description: Template name
        description:
          anyOf:
          - type: string
            maxLength: 1000
          - type: 'null'
          title: Description
          description: Template description
        channel:
          anyOf:
          - $ref: '#/components/schemas/TemplateChannel'
          - type: 'null'
          description: Communication channel
        category:
          anyOf:
          - $ref: '#/components/schemas/TemplateCategory'
          - type: 'null'
          description: Template category
        subject:
          anyOf:
          - type: string
            maxLength: 500
          - type: 'null'
          title: Subject
          description: Subject line
        preheader:
          anyOf:
          - type: string
            maxLength: 200
          - type: 'null'
          title: Preheader
          description: Preheader/preview text (email only, 40-100 chars)
        content:
          anyOf:
          - type: string
            minLength: 1
          - type: 'null'
          title: Content
          description: Template content
        status:
          anyOf:
          - type: string
          - type: 'null'
          title: Status
          description: Template status
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
          description: Whether template is active
        external_template_id:
          anyOf:
          - type: string
            maxLength: 255
          - type: 'null'
          title: External Template Id
          description: External template ID (Twilio SMS ID, WhatsApp template ID,
            etc.)
      type: object
      title: TemplateUpdateRequest
      description: Request schema for updating a template
      example:
        content: <h1>Welcome {{first_name}}!</h1><p>We're excited to have you.</p>
        name: Updated Welcome Email
        status: active
    TemplateValidationRequest:
      properties:
        channel:
          $ref: '#/components/schemas/TemplateChannel'
          description: Channel to validate for
        content:
          type: string
          title: Content
          description: Template content to validate
        subject:
          anyOf:
          - type: string
          - type: 'null'
          title: Subject
          description: Subject to validate (email only)
      type: object
      required:
      - channel
      - content
      title: TemplateValidationRequest
      description: Request schema for template validation
      example:
        channel: email
        content: <h1>Welcome {{first_name}}!</h1>
        subject: Welcome {{first_name}}!
    TemplateValidationResponse:
      properties:
        is_valid:
          type: boolean
          title: Is Valid
          description: Whether template is valid
        errors:
          items:
            type: string
          type: array
          title: Errors
          description: Validation errors
          default: []
        warnings:
          items:
            type: string
          type: array
          title: Warnings
          description: Validation warnings
          default: []
        variables_found:
          items:
            type: string
          type: array
          title: Variables Found
          description: Variables found in template
          default: []
        character_count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Character Count
          description: Character count (SMS)
        segment_count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Segment Count
          description: SMS segments
      type: object
      required:
      - is_valid
      title: TemplateValidationResponse
      description: Response schema for template validation
      example:
        character_count: 45
        errors: []
        is_valid: true
        segment_count: 1
        variables_found:
        - first_name
        warnings:
        - Missing unsubscribe link
    TemplateVariable:
      properties:
        name:
          type: string
          title: Name
          description: Variable name (without curly braces)
        type:
          type: string
          title: Type
          description: 'Variable type: string, number, boolean, date'
          default: string
        required:
          type: boolean
          title: Required
          description: Whether this variable is required
          default: true
        default_value:
          anyOf:
          - type: string
          - type: 'null'
          title: Default Value
          description: Default value if not provided
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          description: Human-readable description of the variable
      type: object
      required:
      - name
      title: TemplateVariable
      description: Template variable definition
      example:
        default_value: Valued Customer
        description: Customer's first name
        name: first_name
        required: true
        type: string
    TemplateVariablesResponse:
      properties:
        template_id:
          type: string
          title: Template Id
          description: Template UUID
        variables:
          items:
            type: string
          type: array
          title: Variables
          description: List of variable names
        variable_details:
          items:
            $ref: '#/components/schemas/TemplateVariable'
          type: array
          title: Variable Details
          description: Detailed variable info
          default: []
      type: object
      required:
      - template_id
      - variables
      title: TemplateVariablesResponse
      description: Response schema for template variables
      example:
        template_id: 123e4567-e89b-12d3-a456-426614174000
        variable_details:
        - description: Customer's first name
          name: first_name
          required: true
          type: string
        variables:
        - first_name
        - company_name
    TestCallRequest:
      properties:
        from_number:
          type: string
          title: From Number
          description: Phone number to call from
        to_number:
          type: string
          title: To Number
          description: Phone number to call to
        test_message:
          anyOf:
          - type: string
          - type: 'null'
          title: Test Message
          description: Test call message
          default: This is a test call from Expedify voice integration
      type: object
      required:
      - from_number
      - to_number
      title: TestCallRequest
    TestEmailRequest:
      properties:
        to_email:
          type: string
          format: email
          title: To Email
        subject:
          type: string
          title: Subject
          default: Test Email with Tracking
        html_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Html Content
        track_opens:
          type: boolean
          title: Track Opens
          default: true
        track_clicks:
          type: boolean
          title: Track Clicks
          default: true
        include_test_links:
          type: boolean
          title: Include Test Links
          default: true
      type: object
      required:
      - to_email
      title: TestEmailRequest
      description: Test email request model
    TestMessageRequest:
      properties:
        channel:
          $ref: '#/components/schemas/ChannelType'
        template_content:
          type: string
          title: Template Content
        subject_template:
          anyOf:
          - type: string
          - type: 'null'
          title: Subject Template
        variables:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Variables
        contact_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Contact Id
        test_recipient:
          type: string
          title: Test Recipient
      type: object
      required:
      - channel
      - template_content
      - test_recipient
      title: TestMessageRequest
      description: Request model for sending test messages
    TestWebhookPayload:
      properties:
        test_data:
          additionalProperties: true
          type: object
          title: Test Data
          default: {}
      type: object
      title: TestWebhookPayload
    TestWorkflowExecute:
      properties:
        workflow_id:
          type: string
          title: Workflow Id
        event_type:
          type: string
          title: Event Type
          default: test
        additional_data:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Additional Data
      type: object
      required:
      - workflow_id
      title: TestWorkflowExecute
    Ticket:
      properties:
        title:
          type: string
          maxLength: 255
          minLength: 1
          title: Title
        description:
          type: string
          minLength: 1
          title: Description
        category:
          $ref: '#/components/schemas/TicketCategory'
        priority:
          $ref: '#/components/schemas/TicketPriority'
        id:
          type: string
          format: uuid
          title: Id
        ticket_number:
          type: string
          title: Ticket Number
        org_id:
          type: string
          title: Org Id
        user_id:
          type: string
          format: uuid
          title: User Id
        status:
          $ref: '#/components/schemas/TicketStatus'
        assigned_to:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Assigned To
        resolved_at:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Resolved At
        closed_at:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Closed At
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        user:
          anyOf:
          - $ref: '#/components/schemas/TicketUser'
          - type: 'null'
        assigned_user:
          anyOf:
          - $ref: '#/components/schemas/TicketUser'
          - type: 'null'
        org_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Org Name
        comments_count:
          type: integer
          title: Comments Count
          default: 0
        attachments_count:
          type: integer
          title: Attachments Count
          default: 0
      type: object
      required:
      - title
      - description
      - category
      - priority
      - id
      - ticket_number
      - org_id
      - user_id
      - status
      - created_at
      - updated_at
      title: Ticket
      description: Complete ticket model
    TicketAttachment:
      properties:
        file_name:
          type: string
          title: File Name
        file_size:
          anyOf:
          - type: integer
          - type: 'null'
          title: File Size
        mime_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Mime Type
        id:
          type: string
          format: uuid
          title: Id
        ticket_id:
          type: string
          format: uuid
          title: Ticket Id
        file_url:
          type: string
          title: File Url
        uploaded_by:
          type: string
          format: uuid
          title: Uploaded By
        created_at:
          type: string
          format: date-time
          title: Created At
        uploader:
          anyOf:
          - $ref: '#/components/schemas/TicketUser'
          - type: 'null'
      type: object
      required:
      - file_name
      - id
      - ticket_id
      - file_url
      - uploaded_by
      - created_at
      title: TicketAttachment
      description: Complete attachment model
    TicketCategory:
      type: string
      enum:
      - bug
      - feature
      - support
      - billing
      - other
      title: TicketCategory
    TicketComment:
      properties:
        comment:
          type: string
          minLength: 1
          title: Comment
        is_internal:
          type: boolean
          title: Is Internal
          default: false
        id:
          type: string
          format: uuid
          title: Id
        ticket_id:
          type: string
          format: uuid
          title: Ticket Id
        user_id:
          type: string
          format: uuid
          title: User Id
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        user:
          anyOf:
          - $ref: '#/components/schemas/TicketUser'
          - type: 'null'
      type: object
      required:
      - comment
      - id
      - ticket_id
      - user_id
      - created_at
      - updated_at
      title: TicketComment
      description: Complete comment model
    TicketCreate:
      properties:
        title:
          type: string
          maxLength: 255
          minLength: 1
          title: Title
        description:
          type: string
          minLength: 1
          title: Description
        category:
          $ref: '#/components/schemas/TicketCategory'
        priority:
          $ref: '#/components/schemas/TicketPriority'
      type: object
      required:
      - title
      - description
      - category
      - priority
      title: TicketCreate
      description: Model for creating a new ticket
    TicketList:
      properties:
        tickets:
          items:
            $ref: '#/components/schemas/Ticket'
          type: array
          title: Tickets
        total:
          type: integer
          title: Total
        page:
          type: integer
          title: Page
        per_page:
          type: integer
          title: Per Page
      type: object
      required:
      - tickets
      - total
      - page
      - per_page
      title: TicketList
      description: Response model for ticket listing
    TicketPriority:
      type: string
      enum:
      - low
      - medium
      - high
      - critical
      title: TicketPriority
    TicketStats:
      properties:
        total_tickets:
          type: integer
          title: Total Tickets
          default: 0
        open_tickets:
          type: integer
          title: Open Tickets
          default: 0
        in_progress_tickets:
          type: integer
          title: In Progress Tickets
          default: 0
        resolved_tickets:
          type: integer
          title: Resolved Tickets
          default: 0
        closed_tickets:
          type: integer
          title: Closed Tickets
          default: 0
        critical_tickets:
          type: integer
          title: Critical Tickets
          default: 0
        high_priority_tickets:
          type: integer
          title: High Priority Tickets
          default: 0
        tickets_by_category:
          additionalProperties: true
          type: object
          title: Tickets By Category
          default: {}
        avg_resolution_time_hours:
          anyOf:
          - type: number
          - type: 'null'
          title: Avg Resolution Time Hours
        avg_first_response_time_hours:
          anyOf:
          - type: number
          - type: 'null'
          title: Avg First Response Time Hours
      type: object
      title: TicketStats
      description: Ticket statistics for dashboard
    TicketStatus:
      type: string
      enum:
      - open
      - in_progress
      - waiting_on_user
      - resolved
      - closed
      title: TicketStatus
    TicketUpdate:
      properties:
        title:
          anyOf:
          - type: string
            maxLength: 255
            minLength: 1
          - type: 'null'
          title: Title
        description:
          anyOf:
          - type: string
            minLength: 1
          - type: 'null'
          title: Description
        category:
          anyOf:
          - $ref: '#/components/schemas/TicketCategory'
          - type: 'null'
        priority:
          anyOf:
          - $ref: '#/components/schemas/TicketPriority'
          - type: 'null'
        status:
          anyOf:
          - $ref: '#/components/schemas/TicketStatus'
          - type: 'null'
        assigned_to:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Assigned To
      type: object
      title: TicketUpdate
      description: Model for updating a ticket
    TicketUser:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        email:
          type: string
          title: Email
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
      type: object
      required:
      - id
      - email
      title: TicketUser
      description: Simplified user info for ticket responses
    TimezoneSettings:
      properties:
        timezone:
          anyOf:
          - type: string
          - type: 'null'
          title: Timezone
        date_format:
          anyOf:
          - type: string
          - type: 'null'
          title: Date Format
        time_format:
          anyOf:
          - type: string
          - type: 'null'
          title: Time Format
        week_starts_on:
          anyOf:
          - type: string
          - type: 'null'
          title: Week Starts On
      type: object
      title: TimezoneSettings
      description: Model for timezone and regional settings
    ToggleAutoDeployRequest:
      properties:
        auto_deploy:
          type: boolean
          title: Auto Deploy
      type: object
      required:
      - auto_deploy
      title: ToggleAutoDeployRequest
    ToggleProtectedRequest:
      properties:
        is_protected:
          type: boolean
          title: Is Protected
      type: object
      required:
      - is_protected
      title: ToggleProtectedRequest
    TrackingPerformanceSettings:
      properties:
        async_tracking_enabled:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Async Tracking Enabled
        tracking_disabled:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Tracking Disabled
      type: object
      title: TrackingPerformanceSettings
      description: Model for tracking performance settings
    TransformFilterConfig:
      properties:
        logic:
          type: string
          title: Logic
          description: 'Logic operator between groups: AND or OR'
          default: AND
        groups:
          items:
            $ref: '#/components/schemas/routes__analytics__transform_routes__FilterGroup'
          type: array
          title: Groups
          description: List of filter groups
          default: []
      type: object
      title: TransformFilterConfig
      description: Filter configuration with groups and main logic
    TransformationStack:
      properties:
        filters:
          $ref: '#/components/schemas/TransformFilterConfig'
      type: object
      title: TransformationStack
      description: Complete transformation stack to apply to a query
    TrialExtension:
      properties:
        days:
          type: integer
          title: Days
        reason:
          type: string
          title: Reason
      type: object
      required:
      - days
      - reason
      title: TrialExtension
    TriggerExecuteRequest:
      properties:
        trigger_uuid:
          type: string
          title: Trigger Uuid
          description: UUID of the trigger to execute
        variables:
          additionalProperties: true
          type: object
          title: Variables
          description: Variables to pass to workflow
        execution_mode:
          anyOf:
          - type: string
          - type: 'null'
          title: Execution Mode
          description: Execution mode (sync/async)
          default: async
      type: object
      required:
      - trigger_uuid
      title: TriggerExecuteRequest
    TriggerResponse:
      properties:
        success:
          type: boolean
          title: Success
        trigger_uuid:
          type: string
          title: Trigger Uuid
        execution_ids:
          items:
            type: string
          type: array
          title: Execution Ids
        workflows_found:
          type: integer
          title: Workflows Found
        message:
          type: string
          title: Message
        stream_urls:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Stream Urls
      type: object
      required:
      - success
      - trigger_uuid
      - execution_ids
      - workflows_found
      - message
      title: TriggerResponse
    TriggerTestRequest:
      properties:
        trigger_uuid:
          type: string
          title: Trigger Uuid
          description: UUID of the trigger to test
        test_variables:
          additionalProperties: true
          type: object
          title: Test Variables
          description: Variables for test execution
      type: object
      required:
      - trigger_uuid
      title: TriggerTestRequest
    UnifiedEmailSendRequest:
      properties:
        account_id:
          type: string
          title: Account Id
        recipients:
          anyOf:
          - items:
              type: string
              format: email
            type: array
          - items:
              additionalProperties: true
              type: object
            type: array
          - items:
              type: string
            type: array
          title: Recipients
        subject:
          type: string
          title: Subject
        html_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Html Content
        text_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Text Content
        template_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Template Id
        template_variables:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Template Variables
        email_type:
          type: string
          title: Email Type
          default: quick
        campaign_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Campaign Id
        workflow_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Id
      type: object
      required:
      - account_id
      - recipients
      - subject
      title: UnifiedEmailSendRequest
    UnsubscribeReason:
      type: string
      enum:
      - too_frequent
      - not_relevant
      - never_signed_up
      - privacy_concerns
      - technical_issues
      - temporary_break
      - switching_email
      - other
      title: UnsubscribeReason
      description: Reasons for unsubscribing
    UnsubscribeRequest:
      properties:
        reason:
          anyOf:
          - $ref: '#/components/schemas/UnsubscribeReason'
          - type: 'null'
          default: other
        reason_details:
          anyOf:
          - type: string
          - type: 'null'
          title: Reason Details
      type: object
      title: UnsubscribeRequest
      description: Request model for unsubscribe form submission
    UpdateAsteriskIntegrationRequest:
      properties:
        integration_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Type
          description: Integration type
          default: asterisk
        integration_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Name
          description: Name for this integration
          default: Expedify Tele
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
          description: Whether integration is active
          default: true
        configuration:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Configuration
          description: Integration configuration
      type: object
      title: UpdateAsteriskIntegrationRequest
      description: Request to update an Expedify Tele integration - accepts nested
        configuration
    UpdateChartMappingRequest:
      properties:
        date_column:
          anyOf:
          - type: string
          - type: 'null'
          title: Date Column
          description: Date column for filter (null to remove)
        acknowledged_no_date:
          type: boolean
          title: Acknowledged No Date
          description: User acknowledged chart has no date column
          default: false
      type: object
      title: UpdateChartMappingRequest
      description: Request body for updating a chart's filter mapping
    UpdateChatSessionRequest:
      properties:
        title:
          anyOf:
          - type: string
          - type: 'null'
          title: Title
        is_archived:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Archived
        is_favorite:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Favorite
        selected_agents:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Selected Agents
      type: object
      title: UpdateChatSessionRequest
    UpdateCreatorProfileRequest:
      properties:
        display_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Display Name
        bio:
          anyOf:
          - type: string
          - type: 'null'
          title: Bio
        avatar_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Avatar Url
        website_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Website Url
        github_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Github Url
        linkedin_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Linkedin Url
        location:
          anyOf:
          - type: string
          - type: 'null'
          title: Location
        skills:
          items:
            type: string
          type: array
          title: Skills
          default: []
      type: object
      title: UpdateCreatorProfileRequest
      description: Model for updating own creator profile
    UpdateDocumentRequest:
      properties:
        content:
          anyOf:
          - type: string
          - type: 'null'
          title: Content
          description: New content
        title:
          anyOf:
          - type: string
          - type: 'null'
          title: Title
          description: New title
        metadata_updates:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata Updates
          description: Metadata updates
        reindex:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Reindex
          description: Regenerate embeddings
          default: true
      type: object
      title: UpdateDocumentRequest
    UpdateFAQItemRequest:
      properties:
        question:
          anyOf:
          - type: string
          - type: 'null'
          title: Question
        answer:
          anyOf:
          - type: string
          - type: 'null'
          title: Answer
        category:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
        display_order:
          anyOf:
          - type: integer
          - type: 'null'
          title: Display Order
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
        sync_to_kb:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Sync To Kb
          default: false
      type: object
      title: UpdateFAQItemRequest
    UpdateKnowledgeBaseRequest:
      properties:
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
          description: New name for the knowledge base
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          description: New description for the knowledge base
      type: object
      title: UpdateKnowledgeBaseRequest
    UpdateMessageFeedbackRequest:
      properties:
        feedback:
          anyOf:
          - type: string
            pattern: ^(liked|disliked)$
          - type: 'null'
          title: Feedback
          description: Feedback type or null to remove
      type: object
      title: UpdateMessageFeedbackRequest
    UpdatePlanRequest:
      properties:
        display_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Display Name
        monthly_price:
          anyOf:
          - type: number
          - type: 'null'
          title: Monthly Price
        included_credits:
          anyOf:
          - type: integer
          - type: 'null'
          title: Included Credits
        included_seats:
          anyOf:
          - type: integer
          - type: 'null'
          title: Included Seats
      type: object
      title: UpdatePlanRequest
    UpdateRateRequest:
      properties:
        resource_type:
          type: string
          title: Resource Type
        resource_subtype:
          type: string
          title: Resource Subtype
        credits_per_unit:
          anyOf:
          - type: number
          - type: 'null'
          title: Credits Per Unit
        input_credits_per_unit:
          anyOf:
          - type: number
          - type: 'null'
          title: Input Credits Per Unit
        output_credits_per_unit:
          anyOf:
          - type: number
          - type: 'null'
          title: Output Credits Per Unit
        unit_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Unit Type
      type: object
      required:
      - resource_type
      - resource_subtype
      title: UpdateRateRequest
    UpdateRecordRequest:
      properties:
        record_data:
          additionalProperties: true
          type: object
          title: Record Data
          description: Updated data for the record
      type: object
      required:
      - record_data
      title: UpdateRecordRequest
    UpdateRuleRequest:
      properties:
        name:
          anyOf:
          - type: string
            maxLength: 255
            minLength: 1
          - type: 'null'
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        enabled:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Enabled
        field_scores:
          anyOf:
          - items:
              $ref: '#/components/schemas/FieldScore'
            type: array
          - type: 'null'
          title: Field Scores
        max_score:
          anyOf:
          - type: integer
            maximum: 100.0
            minimum: 1.0
          - type: 'null'
          title: Max Score
        rule_config:
          anyOf:
          - $ref: '#/components/schemas/RuleConfig'
          - type: 'null'
        priority:
          anyOf:
          - type: integer
          - type: 'null'
          title: Priority
        rule_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Rule Type
          description: 'Rule type: snapshot, cumulative, or decay'
        decay_period_days:
          anyOf:
          - type: integer
          - type: 'null'
          title: Decay Period Days
          description: 'For decay rules: days of inactivity before applying'
      type: object
      title: UpdateRuleRequest
      description: Request to update a lead scoring rule
    UpdateSchemaRequest:
      properties:
        display_name:
          anyOf:
          - type: string
            maxLength: 100
            minLength: 3
          - type: 'null'
          title: Display Name
        description:
          anyOf:
          - type: string
            maxLength: 500
          - type: 'null'
          title: Description
        icon:
          anyOf:
          - type: string
            maxLength: 50
          - type: 'null'
          title: Icon
        category:
          anyOf:
          - type: string
            maxLength: 50
          - type: 'null'
          title: Category
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
      type: object
      title: UpdateSchemaRequest
    UpdateSectionRequest:
      properties:
        section_title:
          anyOf:
          - type: string
          - type: 'null'
          title: Section Title
        content:
          anyOf:
          - type: string
          - type: 'null'
          title: Content
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
        section_category:
          anyOf:
          - type: string
          - type: 'null'
          title: Section Category
        display_order:
          anyOf:
          - type: integer
          - type: 'null'
          title: Display Order
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
        sync_to_kb:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Sync To Kb
          default: false
      type: object
      title: UpdateSectionRequest
    UserCreate:
      properties:
        email:
          type: string
          format: email
          title: Email
        name:
          type: string
          title: Name
        password:
          type: string
          title: Password
        role:
          type: string
          title: Role
          default: member
      type: object
      required:
      - email
      - name
      - password
      title: UserCreate
      description: Model for creating a new user
    UserRoleUpdate:
      properties:
        role:
          type: string
          title: Role
      type: object
      required:
      - role
      title: UserRoleUpdate
      description: Model for updating user role
    UserStatusUpdate:
      properties:
        is_active:
          type: boolean
          title: Is Active
      type: object
      required:
      - is_active
      title: UserStatusUpdate
      description: Model for updating user status
    UserUpdate:
      properties:
        name:
          type: string
          title: Name
        email:
          type: string
          format: email
          title: Email
        phone:
          anyOf:
          - type: string
          - type: 'null'
          title: Phone
        role:
          anyOf:
          - type: string
          - type: 'null'
          title: Role
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
      type: object
      required:
      - name
      - email
      title: UserUpdate
      description: Model for updating user details
    VAPIWebhookEvent:
      properties:
        event_type:
          type: string
          title: Event Type
        call_id:
          type: string
          title: Call Id
        timestamp:
          type: string
          title: Timestamp
        data:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Data
      type: object
      required:
      - event_type
      - call_id
      - timestamp
      title: VAPIWebhookEvent
    ValidateTransformRequest:
      properties:
        transform_type:
          type: string
          title: Transform Type
          description: Type of transformation
          default: filter
        column:
          type: string
          title: Column
          description: Column name
        operator:
          type: string
          title: Operator
          description: Operator
        value:
          anyOf:
          - {}
          - type: 'null'
          title: Value
        value2:
          anyOf:
          - {}
          - type: 'null'
          title: Value2
        available_columns:
          items:
            type: string
          type: array
          title: Available Columns
          description: List of available column names
      type: object
      required:
      - column
      - operator
      - available_columns
      title: ValidateTransformRequest
      description: Request to validate a transformation
    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
    ValidationSummaryResponse:
      properties:
        total_emails:
          type: integer
          title: Total Emails
        valid_count:
          type: integer
          title: Valid Count
        risky_count:
          type: integer
          title: Risky Count
        invalid_count:
          type: integer
          title: Invalid Count
        unknown_count:
          type: integer
          title: Unknown Count
        deliverable_count:
          type: integer
          title: Deliverable Count
        valid_percentage:
          type: number
          title: Valid Percentage
        risky_percentage:
          type: number
          title: Risky Percentage
        invalid_percentage:
          type: number
          title: Invalid Percentage
        deliverable_percentage:
          type: number
          title: Deliverable Percentage
        average_score:
          type: number
          title: Average Score
        recommended_action:
          type: string
          title: Recommended Action
      type: object
      required:
      - total_emails
      - valid_count
      - risky_count
      - invalid_count
      - unknown_count
      - deliverable_count
      - valid_percentage
      - risky_percentage
      - invalid_percentage
      - deliverable_percentage
      - average_score
      - recommended_action
      title: ValidationSummaryResponse
      description: Response model for validation summary
    VariableDiscoveryRequest:
      properties:
        contact_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Contact Id
        include_sample_data:
          type: boolean
          title: Include Sample Data
          default: true
      type: object
      title: VariableDiscoveryRequest
      description: Request model for discovering available variables
    VectorConfigCreate:
      properties:
        config_name:
          type: string
          title: Config Name
        vector_store_type:
          type: string
          title: Vector Store Type
        dimensions:
          anyOf:
          - type: integer
          - type: 'null'
          title: Dimensions
          default: 1536
        n_results:
          anyOf:
          - type: integer
          - type: 'null'
          title: N Results
          default: 10
        collection_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Collection Name
          default: documents
        pg_host:
          anyOf:
          - type: string
          - type: 'null'
          title: Pg Host
        pg_port:
          anyOf:
          - type: integer
          - type: 'null'
          title: Pg Port
        pg_username:
          anyOf:
          - type: string
          - type: 'null'
          title: Pg Username
        pg_password:
          anyOf:
          - type: string
          - type: 'null'
          title: Pg Password
        pg_database:
          anyOf:
          - type: string
          - type: 'null'
          title: Pg Database
        pg_schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Pg Schema
          default: public
        connection_string:
          anyOf:
          - type: string
          - type: 'null'
          title: Connection String
        oracle_host:
          anyOf:
          - type: string
          - type: 'null'
          title: Oracle Host
        oracle_port:
          anyOf:
          - type: integer
          - type: 'null'
          title: Oracle Port
        oracle_username:
          anyOf:
          - type: string
          - type: 'null'
          title: Oracle Username
        oracle_password:
          anyOf:
          - type: string
          - type: 'null'
          title: Oracle Password
        oracle_service_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Oracle Service Name
        oracle_dsn:
          anyOf:
          - type: string
          - type: 'null'
          title: Oracle Dsn
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          default: ''
      type: object
      required:
      - config_name
      - vector_store_type
      title: VectorConfigCreate
      description: Model for creating vector store configuration
    VerifyEmailRequest:
      properties:
        token:
          type: string
          title: Token
      type: object
      required:
      - token
      title: VerifyEmailRequest
    VerifyMobileOTPRequest:
      properties:
        phone:
          type: string
          title: Phone
        otp_code:
          type: string
          title: Otp Code
        user_id:
          anyOf:
          - type: string
          - type: 'null'
          title: User Id
        purpose:
          type: string
          title: Purpose
          default: phone_verification
      type: object
      required:
      - phone
      - otp_code
      title: VerifyMobileOTPRequest
    VisitorData:
      properties:
        visitor_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Visitor Id
        session_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Session Id
        fingerprint:
          anyOf:
          - {}
          - type: 'null'
          title: Fingerprint
        userAgent:
          anyOf:
          - type: string
          - type: 'null'
          title: Useragent
        user_agent:
          anyOf:
          - type: string
          - type: 'null'
          title: User Agent
        language:
          anyOf:
          - type: string
          - type: 'null'
          title: Language
        timezone:
          anyOf:
          - type: string
          - type: 'null'
          title: Timezone
        screenResolution:
          anyOf:
          - type: string
          - type: 'null'
          title: Screenresolution
        screen_resolution:
          anyOf:
          - type: string
          - type: 'null'
          title: Screen Resolution
        viewportSize:
          anyOf:
          - type: string
          - type: 'null'
          title: Viewportsize
        viewport_size:
          anyOf:
          - type: string
          - type: 'null'
          title: Viewport Size
        platform:
          anyOf:
          - type: string
          - type: 'null'
          title: Platform
        cookieEnabled:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Cookieenabled
        onlineStatus:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Onlinestatus
        page_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Page Url
        page_title:
          anyOf:
          - type: string
          - type: 'null'
          title: Page Title
        referrer:
          anyOf:
          - type: string
          - type: 'null'
          title: Referrer
        identified_at:
          anyOf:
          - type: string
          - type: 'null'
          title: Identified At
        initialized_at:
          anyOf:
          - type: string
          - type: 'null'
          title: Initialized At
        utm_source:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Source
        utm_medium:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Medium
        utm_campaign:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Campaign
        utm_term:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Term
        utm_content:
          anyOf:
          - type: string
          - type: 'null'
          title: Utm Content
        gclid:
          anyOf:
          - type: string
          - type: 'null'
          title: Gclid
        fbclid:
          anyOf:
          - type: string
          - type: 'null'
          title: Fbclid
        email:
          anyOf:
          - type: string
          - type: 'null'
          title: Email
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        properties:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Properties
          default: {}
        device_info:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Device Info
          default: {}
        consent_given:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Consent Given
          default: false
      type: object
      title: VisitorData
    VoiceCallCreate:
      properties:
        extras:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Extras
          description: Additional fields not in core model
        contact_number:
          type: string
          title: Contact Number
          description: Recipient phone number (required)
        user_number:
          type: string
          title: User Number
          description: Caller phone number (required)
        provider:
          type: string
          title: Provider
          description: Voice provider (required)
        direction:
          type: string
          title: Direction
          description: Call direction (inbound/outbound)
          default: outbound
        call_type:
          type: string
          title: Call Type
          description: Call type (ai/human/ivr)
          default: ai
        call_status:
          type: string
          title: Call Status
          description: Call status
          default: scheduled
        currency:
          type: string
          title: Currency
          description: Currency for pricing
          default: USD
      additionalProperties: true
      type: object
      required:
      - contact_number
      - user_number
      - provider
      title: VoiceCallCreate
      description: Voice call creation model using hybrid approach - validates core
        fields, accepts any extras
      example:
        call_duration: 120
        call_status: scheduled
        call_type: ai
        contact_id: contact-uuid-here
        contact_name: John Doe
        currency: USD
        direction: outbound
        end_time: '2024-11-12T10:02:00'
        from_number: +0987654321
        price: 2.5
        provider: VAPI
        recording_url: https://recordings.com/call123
        start_time: '2024-11-12T10:00:00'
        to_number: '+1234567890'
        transcription: Call transcript here...
        user_email: agent@company.com
    VoiceCallUpdate:
      properties:
        contact_number:
          anyOf:
          - type: string
          - type: 'null'
          title: Contact Number
        user_number:
          anyOf:
          - type: string
          - type: 'null'
          title: User Number
        provider:
          anyOf:
          - type: string
          - type: 'null'
          title: Provider
        direction:
          anyOf:
          - type: string
          - type: 'null'
          title: Direction
        call_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Call Type
        call_status:
          anyOf:
          - type: string
          - type: 'null'
          title: Call Status
        call_duration:
          anyOf:
          - type: integer
          - type: 'null'
          title: Call Duration
        contact_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Contact Id
        contact_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Contact Name
        user_email:
          anyOf:
          - type: string
          - type: 'null'
          title: User Email
        start_time:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Time
        end_time:
          anyOf:
          - type: string
          - type: 'null'
          title: End Time
        recording_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Recording Url
        transcription:
          anyOf:
          - type: string
          - type: 'null'
          title: Transcription
        price:
          anyOf:
          - type: string
          - type: 'null'
          title: Price
        currency:
          anyOf:
          - type: string
          - type: 'null'
          title: Currency
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
      type: object
      title: VoiceCallUpdate
    WatcherAdd:
      properties:
        user_email:
          anyOf:
          - type: string
          - type: 'null'
          title: User Email
          description: Email of user to add as watcher (defaults to current user)
      type: object
      title: WatcherAdd
      description: Model for adding a watcher
    WebhookCreate:
      properties:
        name:
          type: string
          title: Name
        url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Url
        events:
          items:
            type: string
          type: array
          title: Events
        webhook_type:
          type: string
          title: Webhook Type
          default: automatic
        is_active:
          type: boolean
          title: Is Active
          default: true
        retry_count:
          type: integer
          title: Retry Count
          default: 3
        timeout_seconds:
          type: integer
          title: Timeout Seconds
          default: 30
      type: object
      required:
      - name
      - url
      - events
      title: WebhookCreate
    WebhookUpdate:
      properties:
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        url:
          anyOf:
          - type: string
            maxLength: 2083
            minLength: 1
            format: uri
          - type: 'null'
          title: Url
        events:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Events
        webhook_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Webhook Type
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
        retry_count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Retry Count
        timeout_seconds:
          anyOf:
          - type: integer
          - type: 'null'
          title: Timeout Seconds
      type: object
      title: WebhookUpdate
    WhatsAppAccountCreate:
      properties:
        account_name:
          type: string
          title: Account Name
        phone_number:
          type: string
          title: Phone Number
        phone_number_id:
          type: string
          title: Phone Number Id
        waba_id:
          type: string
          title: Waba Id
        meta_business_account_id:
          type: string
          title: Meta Business Account Id
        access_token:
          type: string
          title: Access Token
        webhook_verify_token:
          anyOf:
          - type: string
          - type: 'null'
          title: Webhook Verify Token
          default: ''
        is_active:
          type: boolean
          title: Is Active
          default: true
      type: object
      required:
      - account_name
      - phone_number
      - phone_number_id
      - waba_id
      - meta_business_account_id
      - access_token
      title: WhatsAppAccountCreate
    WhatsAppOAuthCallbackRequest:
      properties:
        code:
          type: string
          title: Code
        state:
          type: string
          title: State
        waba_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Waba Id
        business_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Business Id
        is_coexistence:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Coexistence
          default: false
      type: object
      required:
      - code
      - state
      title: WhatsAppOAuthCallbackRequest
    WorkflowEvaluatorConfigCreate:
      properties:
        workflow_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Workflow Id
        workflow_slug:
          type: string
          title: Workflow Slug
        evaluator_id:
          type: string
          title: Evaluator Id
        sample_rate:
          type: number
          title: Sample Rate
          default: 1.0
      type: object
      required:
      - workflow_slug
      - evaluator_id
      title: WorkflowEvaluatorConfigCreate
    WorkflowExecutionResult:
      properties:
        id:
          type: string
          title: Id
        workflow_id:
          type: string
          title: Workflow Id
        status:
          type: string
          title: Status
        started_at:
          type: string
          title: Started At
        completed_at:
          anyOf:
          - type: string
          - type: 'null'
          title: Completed At
        created_at:
          type: string
          title: Created At
        inputs:
          additionalProperties: true
          type: object
          title: Inputs
        outputs:
          additionalProperties: true
          type: object
          title: Outputs
        error:
          anyOf:
          - type: string
          - type: 'null'
          title: Error
        created_by:
          anyOf:
          - type: string
          - type: 'null'
          title: Created By
        duration_ms:
          anyOf:
          - type: integer
          - type: 'null'
          title: Duration Ms
      type: object
      required:
      - id
      - workflow_id
      - status
      - started_at
      - completed_at
      - created_at
      - inputs
      - outputs
      - error
      - created_by
      - duration_ms
      title: WorkflowExecutionResult
    WorkflowInputRequest:
      properties:
        inputId:
          type: string
          title: Inputid
        response:
          title: Response
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
      type: object
      required:
      - inputId
      - response
      title: WorkflowInputRequest
      description: Request model for submitting human input
    WorkflowMatchResult:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        confidence:
          type: number
          title: Confidence
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
      type: object
      required:
      - id
      - name
      - confidence
      title: WorkflowMatchResult
    WorkflowStreamRequest:
      properties:
        message:
          type: string
          title: Message
        mode:
          anyOf:
          - type: string
          - type: 'null'
          title: Mode
        sessionContext:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Sessioncontext
      type: object
      required:
      - message
      title: WorkflowStreamRequest
      description: Request model for starting a streamed workflow execution
    WorkflowVersion:
      properties:
        version:
          type: string
          title: Version
        release_notes:
          anyOf:
          - type: string
          - type: 'null'
          title: Release Notes
        changes:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Changes
      type: object
      required:
      - version
      title: WorkflowVersion
    models__marketing__template_schemas__TemplatePreviewRequest:
      properties:
        variables:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Variables
          description: Variables for preview
          default: {}
      type: object
      title: TemplatePreviewRequest
      description: Request schema for template preview
      example:
        variables:
          amount: 99.99
          company_name: Acme Corp
          first_name: John
    models__marketing__template_schemas__TemplateResponse:
      properties:
        id:
          type: string
          title: Id
          description: Template UUID
        name:
          type: string
          title: Name
          description: Template name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          description: Template description
        channel:
          type: string
          title: Channel
          description: Communication channel
        category:
          type: string
          title: Category
          description: Template category
        subject:
          anyOf:
          - type: string
          - type: 'null'
          title: Subject
          description: Subject line
        preheader:
          anyOf:
          - type: string
          - type: 'null'
          title: Preheader
          description: Preheader/preview text (email only, 40-100 chars)
        content:
          type: string
          title: Content
          description: Template content
        variables:
          items:
            type: string
          type: array
          title: Variables
          description: Extracted template variables
          default: []
        is_active:
          type: boolean
          title: Is Active
          description: Whether template is active
        status:
          type: string
          title: Status
          description: Template status
        usage_count:
          type: integer
          title: Usage Count
          description: Number of times used
          default: 0
        last_used_at:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Last Used At
          description: Last usage timestamp
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Creation timestamp
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: Last update timestamp
        external_template_id:
          anyOf:
          - type: string
          - type: 'null'
          title: External Template Id
          description: External template ID (Twilio SMS ID, WhatsApp template ID,
            etc.)
      type: object
      required:
      - id
      - name
      - channel
      - category
      - content
      - is_active
      - status
      - created_at
      - updated_at
      title: TemplateResponse
      description: Response schema for template data
      example:
        category: marketing
        channel: email
        content: <h1>Welcome {{first_name}}!</h1>
        created_at: '2024-06-15T09:00:00Z'
        description: Welcome new customers
        id: 123e4567-e89b-12d3-a456-426614174000
        is_active: true
        last_used_at: '2024-06-20T10:30:00Z'
        name: Welcome Email
        status: active
        subject: Welcome to Expedify, {{first_name}}!
        updated_at: '2024-06-20T10:30:00Z'
        usage_count: 42
        variables:
        - first_name
    models__support__ticket__CommentCreate:
      properties:
        comment:
          type: string
          minLength: 1
          title: Comment
        is_internal:
          type: boolean
          title: Is Internal
          default: false
      type: object
      required:
      - comment
      title: CommentCreate
      description: Model for creating a comment
    routes__admin__prompt_publishing_routes__PromptInstallRequest:
      properties:
        queue_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Queue Id
        marketplace_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Marketplace Id
        target_org_id:
          type: string
          title: Target Org Id
        install_mode:
          anyOf:
          - type: string
          - type: 'null'
          title: Install Mode
          default: create_new
      type: object
      required:
      - target_org_id
      title: PromptInstallRequest
    routes__admin__super_admin_integrations__IntegrationUpdate:
      properties:
        integration_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Name
        display_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Display Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        configuration:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Configuration
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
        category:
          anyOf:
          - type: string
          - type: 'null'
          title: Category
        icon:
          anyOf:
          - type: string
          - type: 'null'
          title: Icon
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
        is_global:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Global
        allowed_orgs:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Allowed Orgs
      type: object
      title: IntegrationUpdate
      description: Model for updating integration
    routes__admin__super_admin_login_routes__VerifyOTPRequest:
      properties:
        email:
          type: string
          format: email
          title: Email
        otp:
          type: string
          title: Otp
      type: object
      required:
      - email
      - otp
      title: VerifyOTPRequest
    routes__admin__super_admin_publishing__PublishingReview:
      properties:
        action:
          type: string
          title: Action
        review_notes:
          anyOf:
          - type: string
          - type: 'null'
          title: Review Notes
        rejection_reason:
          anyOf:
          - type: string
          - type: 'null'
          title: Rejection Reason
      type: object
      required:
      - action
      title: PublishingReview
    routes__analytics__query_routes__AsyncExportRequest:
      properties:
        query_type:
          type: string
          title: Query Type
          description: '''visual'' or ''sql'''
        config:
          additionalProperties: true
          type: object
          title: Config
          description: Query configuration (sql or visual config)
        parameters:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Parameters
          description: Query parameters
          default: {}
        query_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Query Name
          description: Display name for the export
          default: Query Export
      type: object
      required:
      - query_type
      - config
      title: AsyncExportRequest
    routes__analytics__transform_routes__FilterCondition:
      properties:
        id:
          anyOf:
          - type: string
          - type: 'null'
          title: Id
        column:
          type: string
          title: Column
          description: Column name to filter on
        columnType:
          type: string
          title: Columntype
          description: 'Column data type: text, number, date, boolean'
          default: text
        operator:
          type: string
          title: Operator
          description: 'Filter operator: equals, contains, greater_than, etc.'
        value:
          title: Value
          description: Filter value
        value2:
          anyOf:
          - {}
          - type: 'null'
          title: Value2
          description: Second value for between operators
      type: object
      required:
      - column
      - operator
      title: FilterCondition
      description: A single filter condition
    routes__analytics__transform_routes__FilterGroup:
      properties:
        id:
          anyOf:
          - type: string
          - type: 'null'
          title: Id
        logic:
          type: string
          title: Logic
          description: 'Logic operator within group: AND or OR'
          default: AND
        conditions:
          items:
            $ref: '#/components/schemas/routes__analytics__transform_routes__FilterCondition'
          type: array
          title: Conditions
          description: List of filter conditions
          default: []
      type: object
      title: FilterGroup
      description: A group of filter conditions with AND/OR logic
    routes__auth__otp_routes__VerifyOTPRequest:
      properties:
        user_id:
          type: string
          title: User Id
        otp_code:
          type: string
          title: Otp Code
        otp_type:
          type: string
          title: Otp Type
          default: email_verification
      type: object
      required:
      - user_id
      - otp_code
      title: VerifyOTPRequest
    routes__community__comments_routes__CommentCreate:
      properties:
        comment_text:
          type: string
          title: Comment Text
        parent_comment_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Parent Comment Id
      type: object
      required:
      - comment_text
      title: CommentCreate
    routes__community__comments_routes__CommentUpdate:
      properties:
        comment_text:
          type: string
          title: Comment Text
      type: object
      required:
      - comment_text
      title: CommentUpdate
    routes__community__publishing_routes__PublishingReview:
      properties:
        status:
          type: string
          title: Status
        review_notes:
          anyOf:
          - type: string
          - type: 'null'
          title: Review Notes
        rejection_reason:
          anyOf:
          - type: string
          - type: 'null'
          title: Rejection Reason
      type: object
      required:
      - status
      title: PublishingReview
    routes__crm__company_routes__DealLink:
      properties:
        deal_ids:
          items:
            type: string
          type: array
          title: Deal Ids
        is_primary:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Primary
          default: false
      type: object
      required:
      - deal_ids
      title: DealLink
    routes__crm__company_routes__FilterCondition:
      properties:
        field:
          type: string
          title: Field
        operator:
          type: string
          title: Operator
        value:
          title: Value
      type: object
      required:
      - field
      - operator
      - value
      title: FilterCondition
    routes__crm__company_routes__FilterRequest:
      properties:
        filters:
          items:
            $ref: '#/components/schemas/routes__crm__company_routes__FilterCondition'
          type: array
          title: Filters
          default: []
        logic:
          type: string
          title: Logic
          default: AND
        sort_by:
          anyOf:
          - type: string
          - type: 'null'
          title: Sort By
        sort_order:
          anyOf:
          - type: string
          - type: 'null'
          title: Sort Order
          default: desc
        page:
          type: integer
          title: Page
          default: 1
        limit:
          type: integer
          title: Limit
          default: 20
      type: object
      title: FilterRequest
    routes__crm__contact_routes__CompanyLink:
      properties:
        company_ids:
          items:
            type: string
          type: array
          title: Company Ids
        role:
          anyOf:
          - type: string
          - type: 'null'
          title: Role
          default: employee
        is_primary:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Primary
          default: false
        primary_company_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Primary Company Id
      type: object
      required:
      - company_ids
      title: CompanyLink
    routes__crm__contact_routes__DealLink:
      properties:
        deal_ids:
          items:
            type: string
          type: array
          title: Deal Ids
        role:
          anyOf:
          - type: string
          - type: 'null'
          title: Role
          default: other
        is_primary:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Primary
          default: false
      type: object
      required:
      - deal_ids
      title: DealLink
    routes__crm__contact_routes__FilterCondition:
      properties:
        entity:
          anyOf:
          - type: string
          - type: 'null'
          title: Entity
          default: contacts
        field:
          type: string
          title: Field
        operator:
          type: string
          title: Operator
        value:
          title: Value
        field_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Field Type
      type: object
      required:
      - field
      - operator
      - value
      title: FilterCondition
    routes__crm__contact_routes__FilterGroup:
      properties:
        conditions:
          items:
            $ref: '#/components/schemas/routes__crm__contact_routes__FilterCondition'
          type: array
          title: Conditions
        condition_connector:
          type: string
          title: Condition Connector
          default: AND
      type: object
      required:
      - conditions
      title: FilterGroup
    routes__crm__contact_routes__FilterRequest:
      properties:
        filters:
          items:
            $ref: '#/components/schemas/routes__crm__contact_routes__FilterCondition'
          type: array
          title: Filters
          default: []
        logic:
          type: string
          title: Logic
          default: AND
        filter_groups:
          anyOf:
          - items:
              $ref: '#/components/schemas/routes__crm__contact_routes__FilterGroup'
            type: array
          - type: 'null'
          title: Filter Groups
        group_connector:
          anyOf:
          - type: string
          - type: 'null'
          title: Group Connector
          default: AND
        sort_by:
          anyOf:
          - type: string
          - type: 'null'
          title: Sort By
        sort_order:
          anyOf:
          - type: string
          - type: 'null'
          title: Sort Order
          default: desc
        page:
          type: integer
          title: Page
          default: 1
        limit:
          type: integer
          title: Limit
          default: 20
      type: object
      title: FilterRequest
    routes__crm__deal_routes__CompanyLink:
      properties:
        company_ids:
          items:
            type: string
          type: array
          title: Company Ids
        is_primary:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Primary
          default: false
        primary_company_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Primary Company Id
      type: object
      required:
      - company_ids
      title: CompanyLink
    routes__crm__deal_routes__FilterCondition:
      properties:
        field:
          type: string
          title: Field
        operator:
          type: string
          title: Operator
        value:
          title: Value
      type: object
      required:
      - field
      - operator
      - value
      title: FilterCondition
    routes__crm__deal_routes__FilterRequest:
      properties:
        filters:
          items:
            $ref: '#/components/schemas/routes__crm__deal_routes__FilterCondition'
          type: array
          title: Filters
          default: []
        logic:
          type: string
          title: Logic
          default: AND
        sort_by:
          anyOf:
          - type: string
          - type: 'null'
          title: Sort By
        sort_order:
          anyOf:
          - type: string
          - type: 'null'
          title: Sort Order
          default: desc
        page:
          type: integer
          title: Page
          default: 1
        limit:
          type: integer
          title: Limit
          default: 20
      type: object
      title: FilterRequest
    routes__crm__export_routes__AsyncExportRequest:
      properties:
        entity_type:
          type: string
          title: Entity Type
        filters:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Filters
      type: object
      required:
      - entity_type
      title: AsyncExportRequest
    routes__crm__scoring_routes__FilterCondition:
      properties:
        field:
          type: string
          title: Field
        operator:
          type: string
          title: Operator
        value:
          title: Value
        field_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Field Type
          default: text
      type: object
      required:
      - field
      - operator
      - value
      title: FilterCondition
      description: Single filter condition
    routes__crm__scoring_routes__FilterGroup:
      properties:
        id:
          anyOf:
          - type: string
          - type: 'null'
          title: Id
        entity:
          type: string
          title: Entity
          default: contacts
        conditions:
          items:
            $ref: '#/components/schemas/routes__crm__scoring_routes__FilterCondition'
          type: array
          title: Conditions
        condition_connector:
          type: string
          title: Condition Connector
          default: AND
      type: object
      required:
      - conditions
      title: FilterGroup
      description: Group of filter conditions
    routes__crm__segment_routes__FilterCondition:
      properties:
        id:
          anyOf:
          - type: string
          - type: 'null'
          title: Id
        entity:
          anyOf:
          - type: string
          - type: 'null'
          title: Entity
        field:
          type: string
          title: Field
        operator:
          type: string
          title: Operator
        value:
          title: Value
        field_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Field Type
      type: object
      required:
      - field
      - operator
      - value
      title: FilterCondition
    routes__crm__segment_routes__FilterGroup:
      properties:
        id:
          type: string
          title: Id
        conditions:
          items:
            $ref: '#/components/schemas/routes__crm__segment_routes__FilterCondition'
          type: array
          title: Conditions
        condition_connector:
          type: string
          title: Condition Connector
          default: AND
        nested_groups:
          anyOf:
          - items:
              $ref: '#/components/schemas/routes__crm__segment_routes__FilterGroup'
            type: array
          - type: 'null'
          title: Nested Groups
      type: object
      required:
      - id
      - conditions
      title: FilterGroup
    routes__crm__task_routes__CommentCreate:
      properties:
        comment_text:
          type: string
          title: Comment Text
          description: Comment text
          default: ''
        parent_comment_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Parent Comment Id
          description: Parent comment ID for replies
        mentions:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Mentions
          description: List of mentioned user emails
          default: []
        attachments:
          anyOf:
          - items:
              $ref: '#/components/schemas/CommentAttachment'
            type: array
          - type: 'null'
          title: Attachments
          description: List of attachments
          default: []
      type: object
      title: CommentCreate
      description: Model for creating a comment
    routes__crm__task_routes__CommentUpdate:
      properties:
        comment_text:
          type: string
          minLength: 1
          title: Comment Text
          description: Updated comment text
        mentions:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Mentions
          description: Updated mentions list
        attachments:
          anyOf:
          - items:
              $ref: '#/components/schemas/CommentAttachment'
            type: array
          - type: 'null'
          title: Attachments
          description: Updated attachments list
      type: object
      required:
      - comment_text
      title: CommentUpdate
      description: Model for updating a comment
    routes__integrations__integration_routes__IntegrationUpdate:
      properties:
        integration_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Integration Name
        configuration:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Configuration
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
        is_default:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Default
      type: object
      title: IntegrationUpdate
    routes__knowledge_base__kb_routes__SearchRequest:
      properties:
        query:
          type: string
          title: Query
          description: Search query
        top_k:
          anyOf:
          - type: integer
            maximum: 50.0
            minimum: 1.0
          - type: 'null'
          title: Top K
          description: Number of results
          default: 5
        metadata_filters:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata Filters
          description: Metadata filters
        similarity_threshold:
          anyOf:
          - type: number
            maximum: 1.0
            minimum: 0.0
          - type: 'null'
          title: Similarity Threshold
          description: Similarity threshold
          default: 0.7
      type: object
      required:
      - query
      title: SearchRequest
    routes__knowledge_base__kb_templates_routes__ApplyTemplateRequest:
      properties:
        template_key:
          type: string
          title: Template Key
          description: Template key to apply
      type: object
      required:
      - template_key
      title: ApplyTemplateRequest
    routes__marketing__template_preview_routes__TemplatePreviewRequest:
      properties:
        channel:
          $ref: '#/components/schemas/ChannelType'
        template_content:
          type: string
          title: Template Content
        variables:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Variables
        contact_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Contact Id
        format:
          $ref: '#/components/schemas/OutputFormat'
          default: text
        subject_template:
          anyOf:
          - type: string
          - type: 'null'
          title: Subject Template
      type: object
      required:
      - channel
      - template_content
      title: TemplatePreviewRequest
      description: Request model for template preview
    routes__marketing__template_search_routes__SearchRequest:
      properties:
        query:
          type: string
          title: Query
          description: Search query
          default: ''
        filters:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Filters
          description: Search filters
        page:
          type: integer
          minimum: 1.0
          title: Page
          description: Page number
          default: 1
        page_size:
          type: integer
          maximum: 100.0
          minimum: 1.0
          title: Page Size
          description: Results per page
          default: 20
        sort_field:
          type: string
          title: Sort Field
          description: Sort field
          default: relevance
        sort_order:
          type: string
          title: Sort Order
          description: Sort order
          default: desc
        ranking_weights:
          anyOf:
          - additionalProperties:
              type: number
            type: object
          - type: 'null'
          title: Ranking Weights
          description: Custom ranking weights
      type: object
      title: SearchRequest
      description: Template search request
    routes__my_space__template_routes__ApplyTemplateRequest:
      properties:
        template_id:
          type: string
          title: Template Id
          description: ID of the template to apply
        customizations:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Customizations
          description: Custom modifications to the template
          default: {}
      type: object
      required:
      - template_id
      title: ApplyTemplateRequest
    routes__my_space__template_routes__TemplateResponse:
      properties:
        id:
          type: string
          title: Id
        template_name:
          type: string
          title: Template Name
        industry:
          type: string
          title: Industry
        entity_type:
          type: string
          title: Entity Type
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        icon:
          type: string
          title: Icon
        difficulty_level:
          type: string
          title: Difficulty Level
        is_popular:
          type: boolean
          title: Is Popular
        usage_count:
          type: integer
          title: Usage Count
        field_count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Field Count
          default: 0
      type: object
      required:
      - id
      - template_name
      - industry
      - entity_type
      - description
      - icon
      - difficulty_level
      - is_popular
      - usage_count
      title: TemplateResponse
    routes__prompts__prompt_marketplace_routes__PromptInstallRequest:
      properties:
        marketplace_prompt_id:
          type: string
          title: Marketplace Prompt Id
        install_mode:
          anyOf:
          - type: string
          - type: 'null'
          title: Install Mode
          default: create_new
      type: object
      required:
      - marketplace_prompt_id
      title: PromptInstallRequest
    routes__public__external_api_routes__EventData:
      properties:
        event_type:
          type: string
          title: Event Type
        event_data:
          additionalProperties: true
          type: object
          title: Event Data
        user_id:
          anyOf:
          - type: string
          - type: 'null'
          title: User Id
        contact_email:
          anyOf:
          - type: string
          - type: 'null'
          title: Contact Email
        timestamp:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Timestamp
      type: object
      required:
      - event_type
      - event_data
      title: EventData
      description: Generic event data for tracking
    routes__public__tracking_routes__EventData:
      properties:
        visitor_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Visitor Id
        session_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Session Id
        category:
          type: string
          title: Category
        action:
          type: string
          title: Action
        label:
          anyOf:
          - type: string
          - type: 'null'
          title: Label
        value:
          anyOf:
          - type: number
          - type: 'null'
          title: Value
        page_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Page Url
        element_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Element Id
        element_class:
          anyOf:
          - type: string
          - type: 'null'
          title: Element Class
        element_text:
          anyOf:
          - type: string
          - type: 'null'
          title: Element Text
        occurred_at:
          anyOf:
          - type: string
          - type: 'null'
          title: Occurred At
        properties:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Properties
      type: object
      required:
      - category
      - action
      title: EventData
servers:
- url: https://api.expedify.ai
  description: Production
- url: https://staging-api.expedify.ai
  description: Staging
