> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thena.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Search Web Chat Threads

> Search web chat threads (anonymous user threads) for a specific agent.

Searches across:
- Widget user name
- Widget user email
- Chat thread title
- Chat thread messages

Filters:
- Sort by newest/oldest
- Filter by feedback type (any, positive, negative)
- Filter by ticket presence
- Filter by platform connection



## OpenAPI

````yaml get /api/v1/chat/{agent_id}/web-threads/search
openapi: 3.1.0
info:
  title: ThenaAgentStudio
  description: |2-

        ThenaCrew AI CRM Renewal System

        An intelligent platform to automate customer renewal insights and communications through multi-agent workflows.

        Key Features:
        * AI-powered renewal analysis
        * Personalized communication generation
        * Automated opportunity tracking
        * Multi-agent workflow orchestration
        
  version: 1.0.0
servers:
  - url: https://agent-studio.thena.ai
    description: Production server
  - url: http://localhost:8008
    description: Local development server
security:
  - ApiKeyAuth: []
tags:
  - name: Agents
    description: Agent management endpoints
  - name: Chat
    description: Chat and messaging endpoints
paths:
  /api/v1/chat/{agent_id}/web-threads/search:
    get:
      tags:
        - Chat
        - Chat
      summary: Search Web Chat Threads
      description: |-
        Search web chat threads (anonymous user threads) for a specific agent.

        Searches across:
        - Widget user name
        - Widget user email
        - Chat thread title
        - Chat thread messages

        Filters:
        - Sort by newest/oldest
        - Filter by feedback type (any, positive, negative)
        - Filter by ticket presence
        - Filter by platform connection
      operationId: search_web_chat_threads_api_v1_chat__agent_id__web_threads_search_get
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: Agent Id
        - 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
            maximum: 50
            minimum: 1
            description: Number of search results to return
            default: 10
            title: Limit
          description: Number of search results to return
        - name: offset
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
            description: Number of search results to skip
            default: 0
            title: Offset
          description: Number of search results to skip
        - name: sort_by
          in: query
          required: false
          schema:
            type: string
            description: 'Sort by: ''newest'' or ''oldest'''
            default: newest
            title: Sort By
          description: 'Sort by: ''newest'' or ''oldest'''
        - name: feedback_filter
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: 'Filter by feedback: ''any'', ''positive'', ''negative'', or None for all'
            title: Feedback Filter
          description: 'Filter by feedback: ''any'', ''positive'', ''negative'', or None for all'
        - name: has_ticket
          in: query
          required: false
          schema:
            anyOf:
              - type: boolean
              - type: 'null'
            description: Filter threads that have a ticket ID
            title: Has Ticket
          description: Filter threads that have a ticket ID
        - name: connected_to_platform
          in: query
          required: false
          schema:
            anyOf:
              - type: boolean
              - type: 'null'
            description: Filter threads that are connected to platform
            title: Connected To Platform
          description: Filter threads that are connected to platform
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/EnhancedWebChatThread'
                title: >-
                  Response Search Web Chat Threads Api V1 Chat  Agent Id  Web
                  Threads Search Get
        '401':
          description: Unauthorized - Invalid or missing JWT token
        '403':
          description: Forbidden - Insufficient permissions
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal server error
      security:
        - ApiKeyAuth: []
components:
  schemas:
    EnhancedWebChatThread:
      properties:
        id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Id
        agent_id:
          type: string
          format: uuid
          title: Agent Id
        user_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: User Id
        anon_user_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Anon User Id
        organization_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Organization Id
        title:
          type: string
          title: Title
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
        messages:
          anyOf:
            - items:
                $ref: '#/components/schemas/ChatMessage'
              type: array
            - type: 'null'
          title: Messages
        widget_user:
          anyOf:
            - $ref: '#/components/schemas/WidgetUserData'
            - type: 'null'
        message_count:
          type: integer
          title: Message Count
          default: 0
        ticket_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Ticket Id
        chat_history_parent_comment_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Chat History Parent Comment Id
        connected_to_platform:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Connected To Platform
      type: object
      required:
        - agent_id
        - title
      title: EnhancedWebChatThread
      description: >-
        Enhanced web chat thread model that includes widget user data and
        message count.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ChatMessage:
      properties:
        id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Id
        thread_id:
          type: string
          format: uuid
          title: Thread Id
        content:
          type: string
          title: Content
        content_html:
          anyOf:
            - type: string
            - type: 'null'
          title: Content Html
        role:
          type: string
          pattern: ^(user|assistant|system|tool)$
          title: Role
        tool_calls:
          anyOf:
            - items:
                $ref: '#/components/schemas/ToolCall'
              type: array
            - type: 'null'
          title: Tool Calls
        attachments:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Attachments
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
        feedback:
          anyOf:
            - $ref: '#/components/schemas/backend__models__chat__ChatMessageFeedback'
            - type: 'null'
      type: object
      required:
        - thread_id
        - content
        - role
      title: ChatMessage
      description: Model for individual chat messages.
    WidgetUserData:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        user_name:
          anyOf:
            - type: string
            - type: 'null'
          title: User Name
        user_email:
          anyOf:
            - type: string
            - type: 'null'
          title: User Email
        verified_user_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Verified User Name
        verified_user_email:
          anyOf:
            - type: string
            - type: 'null'
          title: Verified User Email
        ip_address:
          anyOf:
            - type: string
            - type: 'null'
          title: Ip Address
        verified:
          type: boolean
          title: Verified
          default: false
        identified_by_tool:
          type: boolean
          title: Identified By Tool
          default: false
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
      type: object
      required:
        - id
      title: WidgetUserData
      description: Model for widget user data from the widget_user table.
    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
    ToolCall:
      properties:
        tool_name:
          type: string
          title: Tool Name
        arguments:
          additionalProperties: true
          type: object
          title: Arguments
        result:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Result
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        start_time:
          type: string
          format: date-time
          title: Start Time
        end_time:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: End Time
      type: object
      required:
        - tool_name
        - arguments
        - start_time
      title: ToolCall
      description: Model for tool/function calls made during chat.
    backend__models__chat__ChatMessageFeedback:
      properties:
        id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Id
        human_message_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Human Message Id
        ai_message_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Ai Message Id
        flow_execution_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Flow Execution Id
        user_id:
          type: string
          format: uuid
          title: User Id
        organization_id:
          type: string
          format: uuid
          title: Organization Id
        feedback_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Feedback Type
        issue_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Issue Type
        comment:
          anyOf:
            - type: string
            - type: 'null'
          title: Comment
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
      type: object
      required:
        - user_id
        - organization_id
      title: ChatMessageFeedback
      description: Simplified model for chat message feedback (excluding Portkey fields).
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````