Swap Face For Video

POSThttps://api.newportai.com/api/async/swap_face_for_video

The Swap Face For Video API enables seamless facial replacement within video content. It accurately transfers facial features, expressions, and movements from a source image to a target video, creating highly realistic and dynamic face-swapped results.

  • Submit a POST request to the Swap Face For Video API to obtain a taskId.
  • Submit a POST request to the Polling API to retrieve the face-swapped video result.
  • Configure a Callback URL to receive results automatically on completion.

Request Headers

Content-Type string Required

Enum: application/json

Authorization string Required

Bearer authentication token. Example: Bearer {{APIKey}}.

Request Body

srcVideoUrl string Required

The URL of the source video. Constraints: Video duration must be within 5 minutes. Note: All detectable faces within the video will be replaced by the source face.

srcImageUrl string Required

The URL of the image providing the source face. If the image contains multiple faces, one will be selected at random for the swap.

Response

code integer

Returns 0 for success, or a specific error code.

message string

Returns "success" or a descriptive error message.

data object
taskId string

The unique identifier for the task. Use this ID with the Polling API to retrieve the generated output.

Errors

10192Illegal param

Polling

Use the Polling API to retrieve the processing results.

Callback

Alternatively, you can enable Callback to receive task results automatically upon completion.

0Task Completed
{
  "code": 0,
  "message": "success",
  "data": {
    "task": {
      "taskId": "a2ec2894eed947e2a17cee86e858da17",
      "status": 3,
      "executionTime": 17232,
      "expire": 1769586737611,
      "taskType": "swap_face_for_video"
    },
    "videos": [
      {
        "videoType": "mp4",
        "videoUrl": "https://dreamface-resource-aigc.oss-us-east-1.aliyuncs.com/dreamapi/o/2026-01-26/f19ec50fc7ca418aafa918f57298ce76.mp4"
      }
    ]
  }
}
Request
cURL
curl -X POST 'https://api.newportai.com/api/async/swap_face_for_video' \
  -H "Authorization: Bearer {{key}}" \
  -H 'Content-Type: application/json' \
  -d '{
  "srcVideoUrl": "https://d2t5pyzt5qvy2d.cloudfront.net/api/static_resource/prod/default/mq0MSmKgPGQQsxS9UovqH.mp4",
  "srcImageUrl": "https://d2t5pyzt5qvy2d.cloudfront.net/api/static_resource/prod/default/INj5UrnnrKIzCR1uYBWv0.png"
}'
0Successful
{
  "code": 0,
  "message": "success",
  "data": {
    "taskId": "89b7136b8ff84cc38d22a3cea043a9df"
  }
}