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

# List chats

> Retrieve a paginated list of chats for the current user or agent.



## OpenAPI

````yaml https://app.cotool.ai/api/docs/openapi.json get /api/chats
openapi: 3.1.0
info:
  title: Cotool API
  version: 1.0.0
  description: >-
    # Cotool API Documentation


    The Cotool API allows you to interact with the Cotool platform
    programmatically, enabling you to build powerful integrations and automate
    your workflows.


    ## Getting an API Key


    Follow these steps to generate your API key:


    1. **Log in** to the Cotool web interface

    2. **Navigate** to `/settings/api-keys`

    3. **Click** "Generate Key"

    4. **Copy and store** your API key securely ⚠️ *It won't be shown again*


    ## API Key Authentication


    For programmatic access and integrations, use your API key with the
    Authorization header:


    ```http

    Authorization: Bearer your_api_key_here

    ```


    ```bash

    curl -X GET "https://app.cotool.ai/api/endpoint" \
      -H "Authorization: Bearer your_api_key_here" \
      -H "Content-Type: application/json"
    ```
servers:
  - url: https://app.cotool.ai
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /api/chats:
    get:
      tags:
        - Chat
      summary: List chats
      description: Retrieve a paginated list of chats for the current user or agent.
      parameters:
        - in: query
          name: limit
          schema:
            type: integer
            minimum: 1
            maximum: 100
          required: true
        - in: query
          name: offset
          schema:
            type: integer
            minimum: 0
          required: true
        - in: query
          name: search
          schema:
            type: string
            minLength: 1
            maxLength: 200
        - in: query
          name: titleOnly
          schema:
            type: string
        - in: query
          name: pinnedOnly
          schema:
            type: string
        - in: query
          name: excludePinned
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  chats:
                    type: array
                    items:
                      $ref: '#/components/schemas/Chat'
                  totalCount:
                    type: integer
                  feedbackByEvent:
                    type: object
                    additionalProperties:
                      type: object
                      properties:
                        label:
                          type: string
                          enum:
                            - up
                            - down
                        createdAt:
                          type: string
                      required:
                        - label
                        - createdAt
                required:
                  - chats
                  - totalCount
        '400':
          description: Bad request — input validation failed or the request was malformed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '401':
          description: Unauthorized — missing or invalid API key / session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden — the authenticated user lacks the required permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PermissionError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-codeSamples:
        - lang: shell
          label: cURL
          source: |-
            curl -X GET "https://app.cotool.ai/api/chats" \
              -H "Authorization: Bearer YOUR_API_KEY" \
              -H "Content-Type: application/json"
components:
  schemas:
    Chat:
      type: object
      properties:
        id:
          type: string
          description: Unique chat identifier
        userId:
          type:
            - string
            - 'null'
          description: User who owns this chat (null for agent or detection chats)
        agentId:
          type:
            - string
            - 'null'
          description: Agent who owns this chat (null for user or detection chats)
        detectionId:
          type:
            - string
            - 'null'
          description: Detection this chat belongs to (null for user or agent chats)
        parentChatId:
          type:
            - string
            - 'null'
          description: Parent chat for nested sub-agent chats (null for top-level chats)
        organizationId:
          type: string
          description: Organization this chat belongs to
        title:
          type:
            - string
            - 'null'
          description: Chat title
        createdAt:
          type: string
          description: When the chat was created
          format: date-time
          example: '2025-06-17T12:34:56.789Z'
        updatedAt:
          type: string
          description: When the chat was last updated
          format: date-time
          example: '2025-06-17T12:34:56.789Z'
        experience:
          type: string
          enum:
            - chat
            - write-detection
          description: The type of chat experience. Default is "chat".
        detectionPlatform:
          type:
            - string
            - 'null'
          enum:
            - panther
            - sublime
            - scanner
            - datadog
            - splunk
            - sentinelone
            - elastic
            - sumologic
            - runreveal
            - null
          description: >-
            The detection platform for write-detection chats (e.g., scanner,
            splunk, panther). Null for regular chats.
        modelAlias:
          description: >-
            Model alias used for this chat. Must be a valid model from the
            registry: anthropic:chat:sonnet-4.6, anthropic:chat:sonnet-4.5,
            anthropic:chat:opus-4.8, anthropic:chat:opus-4.6,
            anthropic:chat:opus-4.5, anthropic:chat:latest-no-reasoning,
            anthropic:chat:latest, anthropic:chat:opus-4.1, anthropic:chat:opus,
            google:chat:latest, openai:chat:gpt-5.5, openai:chat:gpt-5.4,
            openai:chat:gpt-5.3-codex, openai:chat:gpt-5.2-codex,
            openai:chat:gpt-5.2, openai:chat:gpt-5.1, openai:chat:gpt-5,
            openai:chat:latest, openai:chat:4o, openai:chat:o3
        triggerId:
          type:
            - string
            - 'null'
          description: ID of the trigger that created this chat
        triggerName:
          type:
            - string
            - 'null'
          description: Name of the trigger
        triggerSource:
          type:
            - string
            - 'null'
          description: Source of the trigger (e.g., api, manual, jira, cron, slack)
        triggerDescription:
          type:
            - string
            - 'null'
          description: Description of the trigger
        status:
          type: string
          enum:
            - queued
            - running
            - waiting
            - done
            - error
            - interrupted
          description: >-
            Chat execution status: queued (created but not yet claimed), running
            (actively executing), waiting (awaiting user response), done
            (completed), error (failed), interrupted (stopped by user)
        statusMessage:
          type:
            - string
            - 'null'
          description: >-
            Additional status context, typically error messages for error status
            or waiting prompt details
        result:
          oneOf:
            - $ref: '#/components/schemas/JsonValue'
            - type: 'null'
          description: Structured chat result data that matches the agent schema
        structuredOutputSchema:
          oneOf:
            - $ref: '#/components/schemas/CotoolJsonSchema'
            - type: 'null'
          description: The schema used to generate the structured output result
        shareToken:
          type:
            - string
            - 'null'
          format: uuid
          description: Share token for this chat (null if not shared)
        isPinned:
          type: boolean
          description: >-
            Whether the chat is pinned by its owner. Pinned chats appear in a
            dedicated section in the sidebar.
        evalScore:
          type:
            - number
            - 'null'
          description: LLM judge evaluation score (0-100)
        evalExplanation:
          type:
            - string
            - 'null'
          description: Explanation for the evaluation score
        evalBulletSummary:
          type:
            - array
            - 'null'
          items:
            type: string
          description: Bullet point summary of the evaluation
        criticalIssue:
          type:
            - object
            - 'null'
          properties:
            category:
              type: string
              enum:
                - authentication
                - connectivity
                - missing_data
                - permission
                - configuration
                - service_unavailable
              description: >-
                Category of the critical issue (see: authentication,
                connectivity, missing_data, permission, configuration,
                service_unavailable)
            explanation:
              type: string
              description: One sentence explaining what went wrong
          required:
            - category
            - explanation
          description: Critical external blocker detected by LLM judge evaluation
        acceptanceCriteriaResults:
          type:
            - array
            - 'null'
          items:
            type: object
            properties:
              criterion:
                type: string
                description: The acceptance criterion being evaluated
              met:
                type: boolean
                description: Whether the agent run satisfied this acceptance criterion
              explanation:
                type: string
                description: Brief explanation of why the criterion was or was not met
            required:
              - criterion
              - met
              - explanation
          description: >-
            Per-criterion acceptance criteria evaluation results from the LLM
            judge
      required:
        - id
        - organizationId
        - title
        - createdAt
        - updatedAt
        - experience
        - modelAlias
        - status
      description: A chat conversation between a user/agent and the AI system
    ValidationError:
      type: object
      properties:
        error:
          type: string
          description: Error message describing what went wrong
        issues:
          type: array
          description: >-
            Detailed validation issues, present when request or response schema
            validation fails
          items:
            type: object
            additionalProperties: true
      required:
        - error
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message describing what went wrong
      required:
        - error
    PermissionError:
      type: object
      properties:
        error:
          type: string
          description: Error message describing what went wrong
        missingPerms:
          type: array
          description: Permissions the authenticated user is missing for this operation
          items:
            type: string
      required:
        - error
    JsonValue:
      anyOf:
        - type: string
        - type: number
        - type: boolean
        - type: 'null'
        - type: array
          items:
            $ref: '#/components/schemas/JsonValue'
        - type: object
          additionalProperties:
            $ref: '#/components/schemas/JsonValue'
      description: A JSON value (string, number, boolean, null, array, or object)
    CotoolJsonSchema:
      type: object
      properties:
        type:
          type: string
          enum:
            - string
            - number
            - boolean
            - 'null'
            - object
            - array
        title:
          type: string
        description:
          type: string
        properties:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/CotoolJsonSchema'
        items:
          $ref: '#/components/schemas/CotoolJsonSchema'
        required:
          type: array
          items:
            type: string
        enum:
          type: array
          items:
            type: string
        additionalProperties:
          type: boolean
        x-cotool:
          type: object
          properties:
            presetId:
              type: string
              enum:
                - classification
                - markdown
                - templatedReport
                - toolCallEvidence
            viewerId:
              type: string
          additionalProperties:
            $ref: '#/components/schemas/JsonValue'
      required:
        - type
      description: >-
        A JSON Schema definition with Cotool-specific extensions for structured
        output presets
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        API Key authentication for programmatic access. Include your API key in
        the Authorization header as: `Bearer your_api_key_here`

````