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

# Search Sessions

> Search the sessions shown on the Sessions page, with cursor pagination.

Filtering by case requires the case add-ons entitlement.



## OpenAPI

````yaml https://platform.tracecat.com/api/openapi.json get /workspaces/{workspace_id}/agent/sessions/search
openapi: 3.1.0
info:
  title: Tracecat API
  summary: Tracecat API
  description: The open source AI automation platform for security teams and agents.
  termsOfService: >-
    https://docs.google.com/document/d/e/2PACX-1vQvDe3SoVAPoQc51MgfGCP71IqFYX_rMVEde8zC4qmBCec5f8PLKQRdxa6tsUABT8gWAR9J-EVs2CrQ/pub
  contact:
    name: Tracecat Founders
    email: founders@tracecat.com
  license:
    name: AGPL-3.0
    url: https://www.gnu.org/licenses/agpl-3.0.html
  version: '1'
servers:
  - url: /api
security: []
tags:
  - name: public
    description: Public facing endpoints
  - name: workflows
    description: Workflow management
  - name: actions
    description: Action management
  - name: triggers
    description: Workflow triggers
  - name: secrets
    description: Secret management
  - name: variables
    description: Workspace variable management
paths:
  /workspaces/{workspace_id}/agent/sessions/search:
    get:
      tags:
        - agent-sessions
      summary: Search Sessions
      description: |-
        Search the sessions shown on the Sessions page, with cursor pagination.

        Filtering by case requires the case add-ons entitlement.
      operationId: agent-sessions-search_sessions
      parameters:
        - name: workspace_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Workspace Id
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 200
            minimum: 1
            default: 20
            title: Limit
        - name: cursor
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Cursor
        - name: reverse
          in: query
          required: false
          schema:
            type: boolean
            default: false
            title: Reverse
        - name: order_by
          in: query
          required: false
          schema:
            anyOf:
              - enum:
                  - created_at
                  - updated_at
                type: string
              - type: 'null'
            description: Column to order by. Defaults to created_at.
            title: Order By
          description: Column to order by. Defaults to created_at.
        - name: sort
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                enum:
                  - asc
                  - desc
              - type: 'null'
            description: Sort direction. Defaults to desc.
            title: Sort
          description: Sort direction. Defaults to desc.
        - name: search
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 200
              - type: 'null'
            description: Case-insensitive search on session title
            title: Search
          description: Case-insensitive search on session title
        - name: case_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            description: Only root sessions associated with this case
            title: Case Id
          description: Only root sessions associated with this case
        - name: status
          in: query
          required: false
          schema:
            anyOf:
              - type: array
                uniqueItems: true
                items:
                  $ref: '#/components/schemas/AgentSessionStatusGroup'
              - type: 'null'
            description: Only sessions in one of these statuses
            title: Status
          description: Only sessions in one of these statuses
        - name: entity_type
          in: query
          required: false
          schema:
            anyOf:
              - $ref: '#/components/schemas/AgentSessionEntity'
              - type: 'null'
            description: Only sessions of this entity type
            title: Entity Type
          description: Only sessions of this entity type
        - name: created_by
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            description: Only sessions created by this user
            title: Created By
          description: Only sessions created by this user
        - name: agent_preset_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            description: Only sessions that run this agent preset
            title: Agent Preset Id
          description: Only sessions that run this agent preset
        - name: created_after
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: Only sessions created at or after this time (ISO 8601)
            title: Created After
          description: Only sessions created at or after this time (ISO 8601)
        - name: updated_after
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: Only sessions updated at or after this time (ISO 8601)
            title: Updated After
          description: Only sessions updated at or after this time (ISO 8601)
        - name: created_before
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: Only sessions created at or before this time (ISO 8601)
            title: Created Before
          description: Only sessions created at or before this time (ISO 8601)
        - name: updated_before
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: Only sessions updated at or before this time (ISO 8601)
            title: Updated Before
          description: Only sessions updated at or before this time (ISO 8601)
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/CursorPaginatedResponse_AgentSessionSearchItem_
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyCookie: []
        - ServiceAccountApiKeyBearer: []
components:
  schemas:
    AgentSessionStatusGroup:
      type: string
      enum:
        - approval_required
        - running
        - error
        - completed
      title: AgentSessionStatusGroup
      description: |-
        Display status of a listed session.

        Derived from approval state and live workflow execution status, so
        membership cannot be expressed as a pure SQL filter.
    AgentSessionEntity:
      type: string
      enum:
        - case
        - agent_preset
        - agent_preset_builder
        - copilot
        - workflow
        - approval
        - external_channel
      title: AgentSessionEntity
      description: |-
        The type of entity associated with an agent session.

        Determines the context and behavior of the session:
        - CASE: Chat attached to a Case entity for investigation
        - AGENT_PRESET: Live chat testing a preset configuration
        - AGENT_PRESET_BUILDER: Builder chat for editing/configuring a preset
        - WORKSPACE_CHAT: Workspace-level chat assistant (wire value: copilot)
        - WORKFLOW: Workflow-initiated agent run (from action)
        - APPROVAL: Approval continuation (hidden from main chat list)
        - EXTERNAL_CHANNEL: External channel session (e.g. Slack thread)
    CursorPaginatedResponse_AgentSessionSearchItem_:
      properties:
        items:
          items:
            $ref: '#/components/schemas/AgentSessionSearchItem'
          type: array
          title: Items
        next_cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Next Cursor
          description: Cursor for next page
        prev_cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Prev Cursor
          description: Cursor for previous page
        has_more:
          type: boolean
          title: Has More
          description: Whether more items exist
          default: false
        has_previous:
          type: boolean
          title: Has Previous
          description: Whether previous items exist
          default: false
        total_estimate:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total Estimate
          description: Estimated total count from table statistics
      type: object
      required:
        - items
      title: CursorPaginatedResponse[AgentSessionSearchItem]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AgentSessionSearchItem:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: Session ID
        type:
          $ref: '#/components/schemas/AgentSessionItemType'
          description: Type of item
        title:
          type: string
          title: Title
          description: Display title
        preview:
          type: string
          title: Preview
          description: Preview text
        status:
          $ref: '#/components/schemas/AgentSessionItemStatus'
          description: Item status
        status_group:
          $ref: '#/components/schemas/AgentSessionStatusGroup'
          description: Display status, as accepted by the status filter
        unread:
          type: boolean
          title: Unread
          description: Whether the item is unread
        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
        workflow:
          anyOf:
            - $ref: '#/components/schemas/WorkflowSummary'
            - type: 'null'
          description: Associated workflow
        trigger:
          anyOf:
            - $ref: '#/components/schemas/TriggerSummary'
            - type: 'null'
          description: >-
            Trigger that started the agent_preset session when the caller has
            trigger:read; id, name, and kind are set only when the caller can
            read that trigger in this workspace and are None otherwise
        created_by:
          anyOf:
            - $ref: '#/components/schemas/UserSummary'
            - type: 'null'
          description: >-
            User who created the source entity (None for automation-initiated
            items)
        source_id:
          type: string
          format: uuid
          title: Source Id
          description: ID of the source entity
        source_type:
          type: string
          title: Source Type
          description: Type of source entity (e.g., agent_session)
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Type-specific metadata
        channel_thread:
          anyOf:
            - $ref: '#/components/schemas/SessionChannelThread'
            - type: 'null'
          description: The channel of the session's linked provider thread, if any
      type: object
      required:
        - id
        - type
        - title
        - preview
        - status
        - status_group
        - unread
        - created_at
        - updated_at
        - source_id
        - source_type
      title: AgentSessionSearchItem
      description: One session in a session search result.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    AgentSessionItemType:
      type: string
      enum:
        - approval
        - agent_run
      title: AgentSessionItemType
      description: Types of session search items.
    AgentSessionItemStatus:
      type: string
      enum:
        - pending
        - completed
        - failed
      title: AgentSessionItemStatus
      description: Status of a session search item.
    WorkflowSummary:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: Workflow ID
        title:
          type: string
          title: Title
          description: Workflow title
        alias:
          anyOf:
            - type: string
            - type: 'null'
          title: Alias
          description: Workflow alias
        wf_exec_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Wf Exec Id
          description: >-
            Execution ID of the workflow run that last started a turn on the
            session; None for sessions recorded before runs were tracked
      type: object
      required:
        - id
        - title
      title: WorkflowSummary
      description: Summary of a workflow for session item context.
    TriggerSummary:
      properties:
        id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Id
          description: Trigger ID, or None if the trigger cannot be read in this workspace
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: >-
            Trigger name, or None if the trigger cannot be read in this
            workspace
        kind:
          anyOf:
            - $ref: '#/components/schemas/TriggerKind'
            - type: 'null'
          description: >-
            Trigger kind, or None if the trigger cannot be read in this
            workspace
      type: object
      title: TriggerSummary
      description: >-
        Summary of the trigger that started an ``agent_preset`` session.


        ``id``, ``name``, and ``kind`` are populated only when the trigger
        exists

        in the caller's workspace and the caller can read it; otherwise all
        three

        are ``None``.
    UserSummary:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: User ID
        email:
          type: string
          title: Email
          description: User email
        first_name:
          anyOf:
            - type: string
            - type: 'null'
          title: First Name
          description: User first name
        last_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Name
          description: User last name
      type: object
      required:
        - id
        - email
      title: UserSummary
      description: Summary of a user for session item context.
    SessionChannelThread:
      properties:
        bot_id:
          type: string
          format: uuid
          title: Bot Id
          description: Channel bot the thread is linked on
        provider:
          $ref: '#/components/schemas/ChannelBotProvider'
          description: The bot's provider
        provider_channel_id:
          type: string
          title: Provider Channel Id
          description: The provider's channel ID
        provider_bot_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Provider Bot User Id
          description: The bot's own provider user ID, as mentions name it
        thread_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Thread Url
          description: Link that opens the thread in the provider, when one can be built
      type: object
      required:
        - bot_id
        - provider
        - provider_channel_id
      title: SessionChannelThread
      description: The provider channel a session's linked thread is in.
    TriggerKind:
      type: string
      enum:
        - object_storage
        - schedule
        - webhook
        - case_trigger
        - table
      title: TriggerKind
      description: What a trigger listens to. Each kind has its own source and config.
    ChannelBotProvider:
      type: string
      enum:
        - slack
      title: ChannelBotProvider
  securitySchemes:
    APIKeyCookie:
      type: apiKey
      in: cookie
      name: fastapiusersauth
    ServiceAccountApiKeyBearer:
      type: http
      description: Tracecat service account API key.
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.