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

# 预览 Kling 视频选区

> 通过 CometAPI 使用 Preview Selected Video Area 端点，为 Kling 多模态视频编辑中选定的区域快速渲染预览。

使用此端点可在提交最终多模态编辑任务之前，预览所选区域。

## 为什么预览很重要

* 它可以让你确认选点覆盖了目标对象或区域
* 它有助于在你消耗一次生成调用前发现错误的蒙版
* 它是在选区编辑与最终任务创建之间最安全的检查点

## 工作流中的作用

<Steps>
  <Step title="Initialize the session">
    从 [Initialize Video for Editing](./initialize-video-for-editing) 开始，并将返回的 `session_id` 保持在同一账号下。
  </Step>

  <Step title="Add selection points">
    使用 [Add Video Selection](./add-video-selection)，直到区域接近正确。
  </Step>

  <Step title="Preview before generating">
    调用此端点，然后仅在选区看起来正确后再继续到 [Create Task](./create-task)。
  </Step>
</Steps>

<Tip>
  有关完整参数参考，请参阅 [Kling API documentation](https://kling.ai/document-api/apiReference/model/multiElements)。
</Tip>


## OpenAPI

````yaml api/openapi/video/kling/multimodal-video-editing/post-preview-selected-video-area.openapi.json POST /kling/v1/videos/multi-elements/preview-selection
openapi: 3.1.0
info:
  title: Preview Selected Video Area API
  version: 1.0.0
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /kling/v1/videos/multi-elements/preview-selection:
    post:
      summary: Preview Selected Video Area
      operationId: preview_selected_video_area
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - session_id
              properties:
                session_id:
                  type: string
                  description: Session id returned by the video initialization endpoint.
              default:
                session_id: <session_id>
            examples:
              Default:
                summary: Default
                value:
                  session_id: <session_id>
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - message
                properties:
                  code:
                    type: integer
                    description: Response code. `0` means the request succeeded.
                  message:
                    type: string
                    description: Response message.
                  data:
                    type: object
                    description: Route-specific response payload when present.
                    additionalProperties: true
                additionalProperties: true
      x-codeSamples:
        - lang: Shell
          label: Default
          source: >
            curl
            https://api.cometapi.com/kling/v1/videos/multi-elements/preview-selection
            \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                  "session_id": "<session_id>"
                }'
        - lang: Python
          label: Default
          source: |
            import os
            import requests

            response = requests.post(
                "https://api.cometapi.com/kling/v1/videos/multi-elements/preview-selection",
                headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
                json={
                  "session_id": "<session_id>"
                },
            )

            result = response.json()
            print(result.get("code"), result.get("data"))
        - lang: JavaScript
          label: Default
          source: >
            const response = await
            fetch("https://api.cometapi.com/kling/v1/videos/multi-elements/preview-selection",
            {
              method: "POST",
              headers: {
                Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
                "Content-Type": "application/json",
              },
              body: JSON.stringify({
                "session_id": "<session_id>"
              }),
            });


            const result = await response.json();

            console.log(result.code, result.data);
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication. Use your CometAPI key.

````