Skip to main content

Multiple Face Swap Endpoint

Overview

Multiple Face Swap endpoint allows swapping faces in all detected faces within a single image.

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

ParameterDescription
keyYour API Key used for request authorization.
init_imageThe first image containing a face to be swapped
target_imageThe second image containing a face to replace the first image
watermarkOptional. If you want your generated result to have a watermark. Default true
webhookSet an URL to get a POST API call once the image generation is complete.
track_idThis ID is returned in the response to the webhook API call. This will be used to identify the webhook request.

Example

Body

Body
{
"key": "",
"init_image":"https://i.pinimg.com/564x/41/c6/01/41c6012b834929a6d3e5844e2eae6cc3.jpg",
"target_image":"https://i.ibb.co/nMGsWtM/b7c06348c220b7eb6ef26fd51e5b7cba.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/41/c6/01/41c6012b834929a6d3e5844e2eae6cc3.jpg",
"target_image":"https://i.ibb.co/nMGsWtM/b7c06348c220b7eb6ef26fd51e5b7cba.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": 2.08,
"id": 277,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/41f9195c-7250-417e-90c1-033c2550f0ba.jpg"
],
"proxy_links": [
"https://cdn2.stablediffusionapi.com/generations/41f9195c-7250-417e-90c1-033c2550f0ba.jpg"
],
"meta": {
"H": 1124,
"W": 564,
"file_prefix": "41f9195c-7250-417e-90c1-033c2550f0ba",
"init_image": "https://i.pinimg.com/564x/41/c6/01/41c6012b834929a6d3e5844e2eae6cc3.jpg",
"model_save_format": "jpg",
"n_samples": 1,
"seed": 4226452439,
"steps": 25,
"target_image": "https://i.ibb.co/nMGsWtM/b7c06348c220b7eb6ef26fd51e5b7cba.jpg",
"temp": "no",
"watermark": "yes",
"watermark_image": null
}
}