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

# End a conversation

> End a conversation. This endpoint allows agents to mark a conversation as resolved. If userId is not provided, the system will use the agent assigned to the chat, or if no agent is assigned, it will use the workspace owner associated with the API token.



## OpenAPI

````yaml post /api/v2/conversations/{conversationId}/end
openapi: 3.0.1
info:
  title: LiveChatAI API v2
  description: >-
    LiveChatAI API v2 - Build powerful AI-powered customer support experiences.
    This API follows REST principles with predictable, resource-oriented URLs,
    JSON responses, and standard HTTP methods.
  version: 2.0.0
servers:
  - url: https://app.livechatai.com
    description: Production server
security:
  - bearerAuth: []
paths:
  /api/v2/conversations/{conversationId}/end:
    post:
      tags:
        - Conversations
      summary: End a conversation
      description: >-
        End a conversation. This endpoint allows agents to mark a conversation
        as resolved. If userId is not provided, the system will use the agent
        assigned to the chat, or if no agent is assigned, it will use the
        workspace owner associated with the API token.
      parameters:
        - in: path
          name: conversationId
          schema:
            type: string
            example: chat_1234567890
          required: true
          description: Unique identifier of the conversation to end
      requestBody:
        required: false
        description: Optional user ID who is ending the conversation
        content:
          application/json:
            schema:
              type: object
              properties:
                userId:
                  type: string
                  example: user_1234567890
                  description: >-
                    ID of the user ending the conversation (optional). If not
                    provided, uses the agent assigned to the chat, or the
                    workspace owner if no agent is assigned.
      responses:
        '200':
          description: Conversation resolved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  message:
                    type: string
                    example: Conversation resolved successfully
                  data:
                    type: object
                    properties:
                      conversationId:
                        type: string
                        example: chat_1234567890
                        description: ID of the conversation
                      userId:
                        type: string
                        example: user_1234567890
                        description: ID of the user who resolved the conversation
                      contactId:
                        type: string
                        example: contact_1234567890
                        description: ID of the contact in the conversation
        '400':
          description: Bad request - Invalid parameters
        '401':
          description: Unauthorized access
        '403':
          description: Access denied - Workspace suspended
        '404':
          description: Conversation not found or access denied
        '500':
          description: Internal server error occurred
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````