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

# 关闭会话

> 请求关闭会话。响应可能返回 `closing`；请使用查询会话接口确认状态已变为 `closed`。

> [accordion] 错误
>
> 会话端点可能返回的错误码请参阅[会话错误](https://docs.vivix.ai/cn/streaming-avatar/api-references/sessions#errors)。


## OpenAPI

````yaml cn/streaming-avatar/api-references/openapi.json POST /v1/realtime-avatar/sessions/{session_id}/close
openapi: 3.1.0
info:
  title: Vivix Streaming Avatar API 中文参考
  version: 1.0.0
  description: Streaming Avatar 会话、音色和角色的 REST 接口。
servers:
  - url: https://api.vivix.ai
security:
  - bearerAuth: []
paths:
  /v1/realtime-avatar/sessions/{session_id}/close:
    post:
      summary: 关闭会话
      description: 请求关闭会话。响应可能返回 `closing`；请使用查询会话接口确认状态已变为 `closed`。
      operationId: closeSession
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
          description: 要关闭的 Streaming Avatar 会话 ID。
          example: avatar-session-123
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                close_reason:
                  type: string
                  description: 由调用方定义的原因，将存储为会话关闭原因。
            example:
              close_reason: user_requested
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - message
                  - data
                properties:
                  code:
                    type: integer
                    description: 成功时为 `0`；其他值均为错误码。
                  message:
                    type: string
                    description: '`success`，或英文错误说明。'
                  data:
                    type: object
                    properties:
                      session_id:
                        type: string
                        description: 正在关闭的角色会话 ID。
                      status:
                        type: string
                        description: 关闭状态。关闭过程仍在进行时返回 `closing`，完成后返回 `closed`。
                    required:
                      - session_id
                      - status
              example:
                code: 0
                message: success
                data:
                  session_id: avatar-session-123
                  status: closed
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 你的 Vivix API 密钥。请仅保存在服务端。

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.