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

# Identify faces for Kling lip-sync

> Use Kling Lip-Sync API (POST /kling/v1/videos/identify-face) to detect faces in a video and drive accurate lip-sync video generation workflows.

Use this endpoint to identify faces in a source video before you run a downstream lip-sync workflow.

## What this route returns

* A `session_id` that groups the current face-detection result
* A `face_data` array with one or more detected faces
* Per-face metadata such as `face_id`, preview image, and time range

## When to use it

* Send exactly one source: `video_id` for a completed Kling video, or `video_url` for a hosted MP4 or MOV
* Before you build a lip-sync request for a video with multiple people on screen
* When you need to choose a specific face instead of relying on auto-selection
* When you want to preview face coverage before starting a more expensive task

<Tip>
  For the complete parameter reference, see the [official Kling documentation](https://kling.ai/document-api/apiReference/model/lipSync).
</Tip>


## OpenAPI

````yaml api/openapi/video/kling/post-lip-sync.openapi.json POST /kling/v1/videos/identify-face
openapi: 3.1.0
info:
  title: Lip-Sync API
  version: 1.0.0
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /kling/v1/videos/identify-face:
    post:
      summary: Lip-Sync
      operationId: lip_sync
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                video_id:
                  type: string
                  description: >-
                    Kling video id from a completed task. Send either video_id
                    or video_url.
                video_url:
                  type: string
                  description: Public MP4 or MOV URL. Send either video_id or video_url.
              default:
                video_url: https://your-video-host/source.mp4
              oneOf:
                - required:
                    - video_id
                - required:
                    - video_url
            examples:
              Default:
                summary: Identify faces from a video URL
                value:
                  video_url: https://your-video-host/source.mp4
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - message
                  - request_id
                  - data
                properties:
                  code:
                    type: integer
                  message:
                    type: string
                  request_id:
                    type: string
                  data:
                    type: object
                    required:
                      - session_id
                      - face_data
                    properties:
                      session_id:
                        type: string
                      face_data:
                        type: array
                        items:
                          type: object
                          properties:
                            face_id:
                              type: string
                            face_image:
                              type: string
                            start_time:
                              type: integer
                            end_time:
                              type: integer
      x-codeSamples:
        - lang: Shell
          label: Default
          source: |
            curl https://api.cometapi.com/kling/v1/videos/identify-face \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                  "video_url": "https://your-video-host/source.mp4"
                }'
        - lang: Python
          label: Default
          source: |
            import os
            import requests

            response = requests.post(
                "https://api.cometapi.com/kling/v1/videos/identify-face",
                headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
                json={
                  "video_url": "https://your-video-host/source.mp4"
                },
            )

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


            const result = await response.json();

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

````