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

# Send a message to a debug chat session



## OpenAPI

````yaml api-reference/data/openapi.json POST /v1/agents/{agentId}/debug-chat/{conversationId}
openapi: 3.1.0
info:
  title: Data API
  version: 1.0.9
  description: Query conversations, recordings, annotations, notes, and debug chat.
servers:
  - url: https://api.us.poly.ai
  - url: https://api.eu.poly.ai
  - url: https://api.uk.poly.ai
  - url: https://api.studio.poly.ai
security:
  - polyApiKey: []
paths:
  /v1/agents/{agentId}/debug-chat/{conversationId}:
    parameters:
      - name: agentId
        in: path
        required: true
        schema:
          type: string
      - name: conversationId
        in: path
        required: true
        schema:
          type: string
    post:
      tags:
        - Debug Chat
      summary: Send a message to a debug chat session
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RespondDebugChatBody'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DebugChatResponse'
        '400':
          description: Validation error
        '401':
          description: Unauthorized – missing or invalid API key
        '403':
          description: Forbidden – insufficient permissions
        '404':
          description: Resource not found
components:
  schemas:
    RespondDebugChatBody:
      description: |-
        A user turn sent into an existing debug chat session, with the
        runtime overrides that apply to this message.
      type: object
      properties:
        clientEnv:
          description: Client environment (sandbox, pre-release, live)
          type: string
        asrLangCode:
          description: ASR language code (e.g. en-US). Defaults to server config.
          type: string
        ttsLangCode:
          description: TTS language code (e.g. en-US). Defaults to server config.
          type: string
        message:
          description: User input message
          default: ''
          type: string
        metadata:
          description: User input metadata
          type: object
      required:
        - clientEnv
    DebugChatResponse:
      description: |-
        A chat turn's result: the agent's reply text, the conversation's
        updated state, and whether the conversation has ended.
      type: object
      properties:
        conversationId:
          type: string
        userInput:
          type: string
        response:
          type: string
        metadata:
          $ref: '#/components/schemas/ChatMetadataResponse'
        conversationEnded:
          type: boolean
        delayedResponse:
          type: boolean
      required:
        - conversationId
        - userInput
        - response
        - metadata
        - conversationEnded
        - delayedResponse
    ChatMetadataResponse:
      description: Metadata returned with each chat response.
      type: object
      properties:
        state:
          type: object
        currentNode:
          type: string
        nodeTrace:
          type: array
          items:
            type: string
        metrics:
          type: object
        functionEvents:
          type: array
          items: {}
        handoffDestination:
          type: string
        retrievedTopics:
          type: array
          items:
            type: string
        retrievedSources:
          type: array
          items:
            type: string
        citedTopic:
          type: string
        inFlow:
          type: string
        inStep:
          type: string
        llmRequests:
          type: array
          items:
            type: object
        asrLangCode:
          type: string
        ttsLangCode:
          type: string
      required:
        - state
        - currentNode
        - nodeTrace
        - metrics
        - functionEvents
  securitySchemes:
    polyApiKey:
      type: apiKey
      in: header
      name: X-API-KEY

````