Skip to main content

Multiple Face Swap Endpoint

Overview

The Multiple Face Swap endpoint allows swapping all detected faces in a single image with faces from a target image.

Open in Playground 🚀

Request

--request POST 'https://modelslab.com/api/v6/deepfake/multiple_face_swap' \

Make a POST request to https://modelslab.com/api/v6/deepfake/multiple_face_swap endpoint and pass the required parameters in the request body.

Body Attributes

ParameterDescriptionValues
keyYour API Key used for request authorization.API key
init_imageThe initial image that contains the faces to be swapped.URL to image
target_imageThe target image that contains the faces to replace those in the initial image.URL to image
webhookA URL to receive a POST API call once the image generation is complete.URL
watermarkIndicates if the generated result should include a watermark. Defaults to true.TRUE or FALSE
track_idAn ID included in the webhook response to identify the request.Integral value
Open in Playground 🚀

Example

Body

Body
{
"key": "",
"init_image":"https://i.pinimg.com/564x/4c/6a/d0/4c6ad0f74a3a251344cb115699a9a7c9.jpg",
"target_image":"https://i.pinimg.com/564x/11/ac/0d/11ac0ddaf6962e395f30abc61043393e.jpg",
"webhook": null,
"track_id": null
}

Request

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"key": "",
"init_image":"https://i.pinimg.com/564x/4c/6a/d0/4c6ad0f74a3a251344cb115699a9a7c9.jpg",
"target_image":"https://i.pinimg.com/564x/11/ac/0d/11ac0ddaf6962e395f30abc61043393e.jpg",
"webhook": null,
"track_id": null
});

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

fetch("https://modelslab.com/api/v6/deepfake/multiple_face_swap", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Response

Example Response
{
"status": "success",
"generationTime": 1.05,
"id": 117356534,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/3c17fd3b-22e9-45f0-ab4b-7788c1af89a2.jpg"
],
"proxy_links": [
"https://cdn2.stablediffusionapi.com/generations/3c17fd3b-22e9-45f0-ab4b-7788c1af89a2.jpg"
],
"meta": {
"file_prefix": "3c17fd3b-22e9-45f0-ab4b-7788c1af89a2",
"init_image": "https://i.pinimg.com/564x/4c/6a/d0/4c6ad0f74a3a251344cb115699a9a7c9.jpg",
"model_save_format": "jpg",
"seed": 909604405,
"target_image": "https://i.pinimg.com/564x/11/ac/0d/11ac0ddaf6962e395f30abc61043393e.jpg",
"temp": "no",
"watermark": "yes",
"watermark_image": null
}
}