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

# List Chats

> List chats with optional search and pagination



## OpenAPI

````yaml GET /v2/chats
openapi: 3.1.0
info:
  title: TextQL v2 API
  version: '2.0'
  description: >
    REST API for TextQL platform operations. All endpoints require Bearer token
    authentication.
servers:
  - url: https://app.textql.com
security:
  - bearerAuth: []
tags:
  - name: Chat
    description: Create and manage AI chat sessions
  - name: Connectors
    description: List available data connectors
  - name: Playbooks
    description: Create, configure, and run automated playbooks
  - name: Sandcastles
    description: Manage Python sandbox environments for code execution
  - name: Changes
    description: Review, approve, and deny Context Library changes
paths:
  /v2/chats:
    get:
      tags:
        - Chat
      summary: List Chats
      description: >-
        List chats with optional search and pagination. Returns chats owned by
        the authenticated API key.
      operationId: v2.listChats
      parameters:
        - name: limit
          in: query
          schema:
            type: integer
            format: int32
            default: 20
            minimum: 1
            maximum: 100
          description: Maximum number of chats to return (default 20, max 100)
        - name: offset
          in: query
          schema:
            type: integer
            format: int32
            minimum: 0
          description: Number of chats to skip
        - name: search_term
          in: query
          schema:
            type: string
          description: Filter chats by summary or first message content
        - name: sort_by
          in: query
          schema:
            type: string
            enum:
              - name
              - created_at
              - updated_at
            default: updated_at
          description: Field to sort by
        - name: sort_direction
          in: query
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
          description: Sort direction
      responses:
        '200':
          description: Paginated list of chats
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListChatsResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    ListChatsResponse:
      type: object
      required:
        - chats
        - total_count
      properties:
        chats:
          type: array
          items:
            $ref: '#/components/schemas/ChatSummary'
        total_count:
          type: integer
          format: int32
    ChatSummary:
      type: object
      required:
        - id
      properties:
        id:
          type: string
          format: uuid
        summary:
          type: string
          description: Chat title or summary
        timestamp:
          type: string
          format: date-time
          description: When the chat was created
        updated_at:
          type: string
          format: date-time
          description: When the chat was last updated
        creator_email:
          type: string
          description: Email of the user who created the chat
        preview:
          type: string
          description: Snippet of the first user message (up to 200 characters)
        source:
          type: string
          description: Chat source (e.g. thread, playbook, slack, feed)
        model:
          type: string
          description: LLM model name (e.g. default, sonnet_4, opus_4)
        is_running:
          type: boolean
          description: Whether the chat is currently processing a request
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Machine-readable error code
              enum:
                - invalid_request
                - unauthenticated
                - permission_denied
                - not_found
                - conflict
                - rate_limit_exceeded
                - internal
                - timeout
                - cancelled
                - execution_failed
                - no_report
            message:
              type: string
              description: Human-readable error message
  responses:
    Unauthorized:
      description: Missing or invalid authentication
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: unauthenticated
              message: Authentication required
    Forbidden:
      description: Insufficient permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: permission_denied
              message: Insufficient permissions
    RateLimited:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: rate_limit_exceeded
              message: Rate limit exceeded
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: internal
              message: Internal server error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key or JWT token

````