Apply Lip Sync to Video

April 18, 2025

Table of contents

  1. Request Headers
  2. Request Body
  3. Responses
  4. Model
  5. Examples
  6. Try It

This endpoint applies lip sync to a video using an audio file, making the character in the video appear to speak the audio.

https://api.useapi.net/v1/kling/videos/lipsync

Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
Request Body
{
  "email": "[email protected]",
  "video": "https://example.com/video.mp4",
  "audio": "https://example.com/audio.mp3",
  "replyUrl": "https://your-callback-url.com/webhook",
  "replyRef": "your-reference-id"
}
  • email is optional when only one account configured. However, if you have multiple accounts configured, this parameter becomes required.
  • video is required, URL to the video that contains a face to sync with. Videos can be uploaded using POST /assets and the returned URLs can be used here.
  • audio is required, URL to the audio file containing speech. Audio can be uploaded using POST /assets.
  • maxJobs is optional, range from 1 to 10. Specifies the maximum number of concurrent jobs.
  • replyUrl is optional, a callback URL to receive results when completed.
  • replyRef is optional, a reference identifier for the callback.

Notes:

  • The video should contain a clear frontal view of a face with lip movements.
  • Supported audio formats include MP3, WAV, and other common audio formats.
  • If the audio is shorter than the video, the excess video will be muted. If it’s longer, the excess audio will be discarded.
Responses
  • 200 OK

    {
      "id": 12345678,
      "created": 1712345678000,
      "status": "submitted",
      "status_final": false,
      "type": "m2v_video_lip_sync",
      "taskInfo": {
        "inputs": [
          {
            "name": "video",
            "url": "https://example.com/video.mp4"
          },
          {
            "name": "audio",
            "url": "https://example.com/audio.mp3"
          }
        ],
        "arguments": [
          {
            "name": "__filename",
            "value": "audio.mp3"
          },
          {
            "name": "__isLocalAudio",
            "value": "true"
          }
        ]
      },
      "scheduled": true
    }
    
  • 400 Bad Request

    {
      "error": "Parameter video is required"
    }
    
  • 401 Unauthorized

    {
      "error": "Unauthorized",
      "code": 401
    }
    

When successful, the response includes a task ID which can be used to check the status using GET /tasks/{task_id}.

Model
{ // TypeScript, all fields are optional
  id: number          // Task ID
  created: number     // Creation timestamp in milliseconds
  status: string      // Task status: "submitted", "processing", "failed", or "succeed"
  status_final: boolean // Whether this is the final status of the task
  type: string        // Task type, typically "m2v_video_lip_sync"
  taskInfo: {
    inputs: Array<{
      name: string    // Input name ("video" or "audio")
      url: string     // Input URL
    }>
    arguments: Array<{
      name: string    // Argument name
      value: string   // Argument value
    }>
  }
  scheduled: boolean  // Whether the task is scheduled
}
Examples
  • curl -X POST "https://api.useapi.net/v1/kling/videos/lipsync" \
       -H "Content-Type: application/json" \
       -H "Authorization: Bearer …" \
       -d '{
         "email": "[email protected]",
         "video": "https://example.com/video.mp4",
         "audio": "https://example.com/audio.mp3"
       }'
    
  • const token = "API token";
    const email = "Previously configured account email";
    const apiUrl = "https://api.useapi.net/v1/kling/videos/lipsync"; 
    const response = await fetch(apiUrl, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "Authorization": `Bearer ${token}`,
      },
      body: JSON.stringify({
        email: email,
        video: "https://example.com/video.mp4",
        audio: "https://example.com/audio.mp3"
      })
    });
    const result = await response.json();
    console.log("response", {response, result});
    
  • import requests
    token = "API token"
    email = "Previously configured account email"
    apiUrl = "https://api.useapi.net/v1/kling/videos/lipsync"
    headers = {
        "Content-Type": "application/json", 
        "Authorization" : f"Bearer {token}"
    }
    data = {
        "email": email,
        "video": "https://example.com/video.mp4",
        "audio": "https://example.com/audio.mp3"
    }
    response = requests.post(apiUrl, headers=headers, json=data)
    print(response, response.json())
    
Try It