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

# End Chat Session

> **Legacy — will be deprecated soon. Use the [Chat v1](/api-reference/endpoint/chat/support) `close` command (`POST /v1/chat/session/:id/support` with `{ "command": "close" }`) for new integrations.**

Closes an active chat session and returns an AI-generated summary of the conversation.



## OpenAPI

````yaml POST /chat_sessions/{id}/close_session
openapi: 3.1.0
info:
  title: OSVI AI API
  description: REST API for the OSVI AI voice and chat platform
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.osvi.ai
security:
  - ApiToken: []
paths:
  /chat_sessions/{id}/close_session:
    post:
      summary: End a chat session
      description: >-
        **Legacy — will be deprecated soon. Use the [Chat
        v1](/api-reference/endpoint/chat/support) `close` command (`POST
        /v1/chat/session/:id/support` with `{ "command": "close" }`) for new
        integrations.**


        Closes an active chat session and returns an AI-generated summary of the
        conversation.
      parameters:
        - name: id
          in: path
          required: true
          description: The session ID to close.
          schema:
            type: string
            example: 4718a326-417b-4dda-90d0-21fd65a11cb8
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - agent_uuid
              properties:
                agent_uuid:
                  type: string
                  description: Unique identifier of the agent handling the session.
                  example: agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og
      responses:
        '200':
          description: Session closed
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      session_id:
                        type: string
                        example: 4718a326-417b-4dda-90d0-21fd65a11cb8
                      summary:
                        type: string
                        description: AI-generated summary of the conversation.
                        example: >-
                          The user asked about business hours. The agent
                          confirmed hours are Monday–Friday 9 AM–6 PM IST.
        '401':
          description: Invalid or missing API token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatErrorUnauthorized'
      deprecated: true
components:
  schemas:
    ChatErrorUnauthorized:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          example: Invalid API token
  securitySchemes:
    ApiToken:
      type: apiKey
      in: header
      name: API-Token
      description: >-
        16-character API token associated with your OSVI account. Find it in
        your dashboard under Settings → API.

````