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

# List chats for an agent

> Retrieve a list of chats for the specified agent with optional filters



## OpenAPI

````yaml get /api/agents/{agentId}/chats
openapi: 3.1.0
info:
  title: Strada Voice API
  version: 1.0.0
  description: API for managing voice calls
servers:
  - url: https://api.getstrada.com
    description: Production server
security: []
paths:
  /api/agents/{agentId}/chats:
    get:
      tags:
        - Chats
      summary: List chats for an agent
      description: Retrieve a list of chats for the specified agent with optional filters
      parameters:
        - name: agentId
          in: path
          required: true
          schema:
            type: string
          description: ID of the agent to list chats for
        - name: createdAtGt
          in: query
          schema:
            type: string
            format: date-time
        - name: createdAtLt
          in: query
          schema:
            type: string
            format: date-time
        - name: exclude
          in: query
          schema:
            type: array
            items:
              type: string
              enum:
                - summary
          style: form
          explode: true
      responses:
        '200':
          description: Successfully retrieved chats
          content:
            application/json:
              schema:
                type: object
                properties:
                  chats:
                    type: array
                    items:
                      $ref: '#/components/schemas/Chat'
              example:
                chats:
                  - chatId: chat_123abc
                    agentId: agent_456def
                    customerUniqueId: customer_789ghi
                    createdAt: '2024-01-15T10:30:00Z'
                    status: active
                    summary: >-
                      Customer inquired about order status and received tracking
                      information
                    transcript:
                      messages:
                        - role: user
                          content: Hello, I need help with my order
                          createdAt: '2024-01-15T10:30:00Z'
                        - role: bot
                          content: >-
                            I'd be happy to help you with your order. Could you
                            please provide your order number?
                          createdAt: '2024-01-15T10:30:05Z'
                        - role: user
                          content: It's ORD-12345
                          createdAt: '2024-01-15T10:30:20Z'
                        - role: tool
                          toolCallId: call_123abc
                          toolName: getOrderStatus
                          toolArguments: '{"orderId":"ORD-12345"}'
                          toolResult: '{"status":"shipped","trackingNumber":"TRK-789"}'
                          createdAt: '2024-01-15T10:30:25Z'
                        - role: bot
                          content: >-
                            Your order has been shipped! The tracking number is
                            TRK-789.
                          createdAt: '2024-01-15T10:30:30Z'
                        - role: agent
                          content: I can help you further with that
                          agentName: John Smith
                          createdAt: '2024-01-15T10:35:10Z'
                    chatVariables:
                      customerId: '12345'
                      source: website
        '400':
          description: Bad request - invalid query parameters
        '403':
          description: Forbidden - invalid authentication or authorization
      security:
        - bearerAuth: []
components:
  schemas:
    Chat:
      type: object
      properties:
        chatId:
          type: string
        agentId:
          type: string
        customerUniqueId:
          type: string
        createdAt:
          type: string
          format: date-time
        handedOffAt:
          type: string
          format: date-time
        terminatedAt:
          type: string
          format: date-time
        abandonedAt:
          type: string
          format: date-time
        summary:
          type: string
        analysis:
          type: object
          additionalProperties: true
        transcript:
          type: object
          properties:
            messages:
              type: array
              items:
                $ref: '#/components/schemas/ChatMessage'
        chatVariables:
          type: object
          additionalProperties: true
        status:
          type: string
          enum:
            - active
            - handedOff
            - terminated
            - abandoned
        csatIsSatisfied:
          type: boolean
          description: Customer satisfaction indicator
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata associated with the chat
      required:
        - chatId
        - agentId
        - createdAt
        - status
    ChatMessage:
      type: object
      properties:
        role:
          type: string
          enum:
            - bot
            - user
            - tool
            - agent
        content:
          type: string
        createdAt:
          type: string
          format: date-time
        toolCallId:
          type: string
        toolName:
          type: string
        toolArguments:
          type: string
        toolResult:
          type: string
        metadata:
          type: object
          additionalProperties: true
        agentName:
          type: string
        eventType:
          type: string
          enum:
            - zendesk:transfer
            - conversation:join
            - conversation:leave
        userName:
          type: string
      description: >-
        A message in the chat transcript. Can be a user message, bot message,
        tool call, agent message, or Zendesk event. The structure varies based
        on the role.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: API Key authentication

````