> ## 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

> Send a user turn into an existing debug chat session and return the agent's response. Served from api.{region}.poly.ai.



## OpenAPI

````yaml POST /v1/agents/{agentId}/debug-chat/{conversationId}
openapi: 3.0.1
info:
  title: PolyAI Conversations API v3
  description: >-
    Query conversations, recordings, and debug chat for a PolyAI agent.


    Compared to v1, v3:

    - Exposes additional turn-level fields (latency, translated_user_input,
    english_agent_response).

    - Normalizes empty text fields as empty strings rather than null.
  license:
    name: MIT
  version: 3.0.0
servers:
  - url: https://api.us-1.platform.polyai.app
    description: US base url
  - url: https://api.uk-1.platform.polyai.app
    description: UK base url
  - url: https://api.euw-1.platform.polyai.app
    description: EUW base url
security:
  - ApiKeyAuth: []
tags:
  - name: Conversations
    description: Query conversations and audio recordings.
  - name: Debug Chat
    description: Create and respond to debug chat sessions for testing an agent.
paths:
  /v1/agents/{agentId}/debug-chat/{conversationId}:
    post:
      tags:
        - Debug Chat
      summary: Send a message to a debug chat session
      description: >-
        Sends a user turn into an existing debug chat session and returns the
        agent's response.


        **Host:** this endpoint is served from `api.{region}.poly.ai` — *not*
        the `api.{region}-1.platform.polyai.app` host used by the
        list-conversations and audio endpoints.
      parameters:
        - name: agentId
          in: path
          description: Agent ID.
          required: true
          schema:
            type: string
        - name: conversationId
          in: path
          description: >-
            Debug chat session conversation ID returned by `POST
            /v1/agents/{agentId}/debug-chat`.
          required: true
          schema:
            type: string
      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':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalError'
      servers:
        - url: https://api.us.poly.ai
          description: US base url
        - url: https://api.eu.poly.ai
          description: EU base url
        - url: https://api.uk.poly.ai
          description: UK base url
        - url: https://api.studio.poly.ai
          description: Studio base url
components:
  schemas:
    RespondDebugChatBody:
      type: object
      description: >-
        A user turn sent into an existing debug chat session, with the runtime
        overrides that apply to this message.
      required:
        - clientEnv
      properties:
        clientEnv:
          type: string
          description: Client environment (`sandbox`, `pre-release`, `live`).
          enum:
            - sandbox
            - pre-release
            - live
        asrLangCode:
          type: string
          description: ASR language code (e.g. `en-US`). Defaults to server config.
        ttsLangCode:
          type: string
          description: TTS language code (e.g. `en-US`). Defaults to server config.
        message:
          type: string
          description: User input message.
          default: ''
        metadata:
          type: object
          description: User input metadata.
    DebugChatResponse:
      type: object
      description: >-
        A chat turn's result: the agent's reply text, the conversation's updated
        state, and whether the conversation has ended.
      required:
        - conversationId
        - userInput
        - response
        - metadata
        - conversationEnded
        - delayedResponse
      properties:
        conversationId:
          type: string
          description: ID of the debug chat session.
        userInput:
          type: string
          description: User input that produced this response.
        response:
          type: string
          description: Agent's reply text.
        metadata:
          $ref: '#/components/schemas/ChatMetadataResponse'
        conversationEnded:
          type: boolean
          description: Whether the conversation has ended after this turn.
        delayedResponse:
          type: boolean
          description: >-
            Whether the agent's response was delayed (e.g. awaiting a
            long-running tool).
    ChatMetadataResponse:
      type: object
      description: Metadata returned with each chat response.
      properties:
        asrLangCode:
          type: string
          description: ASR language code (e.g. `en-US`).
        ttsLangCode:
          type: string
          description: TTS language code (e.g. `en-US`).
        agentResponseAudioUrl:
          type: string
          description: >-
            URL to the synthesized audio for the agent response, when
            applicable.
    Error:
      type: object
      properties:
        error_message:
          description: Reason for error.
          type: string
  responses:
    BadRequest:
      description: Bad Request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Unauthorized.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Not Found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalError:
      description: Internal Server Error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Contact your PolyAI representative.

````