Documentation
Face Swap

Face Swap

POST
https://api.imaginepro.ai/api/v1/midjourney/faceswap

You can perform a face swap from one image to another. Both images must contain one face, otherwise it will only take the left most face as input.

For faceswap in group photo or video, you can check the specific ChangeFace service.

Faceswap example

  • Please make sure the image is not huge, file size less than 5MB is recommended.

POST /api/v1/midjourney/faceswap

Sample Request

{
  "source": "https://pix2.tvzhe.com/thumb/star/0/121/260x346.jpg",
  "target": "https://pix2.tvzhe.com/thumb/star/0/202/260x346.jpg"
}

Request Body

NameTypeRequiredDescription
sourcestringyesThis is the URL for the face that you would like to use on the target. You cannot use URLS served by Midjourney (ie. cdn.midjourney) image.
targetstringyesThis is the URL for the image that you would like to swap the face on. You cannot use URLS served by Midjourney (ie. cdn.midjourney) image.
webhookOverridestringnothe webhook you would like to receive the progress, etc
refstringnonone

source

This is the URL for the face that you would like to use on the target. You cannot use URLS served by Midjourney (ie. cdn.midjourney) image. If you don't know where to upload your image, you can use this tool (opens in a new tab) to upload your image to our server, and copy the image URL.

target

This is the URL for the image that you would like to swap the face on. You cannot use URLS served by Midjourney (ie. cdn.midjourney) image. If you don't know where to upload your image, you can use this tool (opens in a new tab) to upload your image to our server, and copy the image URL.

ref (optional)

You can optionally pass ref in your command - which can be used useful when using webhooks You might want to do this to pass some simple metadata through to your webhook.

webhookOverride (optional)

You can optionally pass webhookOverride that will route a response to a webhook of your choosing. Please note that using a webhook is completely optional. You are welcome to use the GET Message endpoint to retrieve responses.

Sample Response

{
  "success": true,
  "messageId": "your-message-id",
  "createdAt": "2023-08-01T14:03:01.817Z"
}

Response Body

NameTypeDescription
successbooleana boolean value for the generation job creation status
messageIdstringthe messageId for querying the progress later
createdAtstringtimestamp of the task creation
errorstringerror message if any

Examples

const axios = require("axios")
 
const config = {
  method: "post",
  url: "https://api.imaginepro.ai/api/v1/midjourney/faceswap",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer <your-token>",
  },
  data: {
    source: "https://pix2.tvzhe.com/thumb/star/0/121/260x346.jpg",
    target: "https://pix2.tvzhe.com/thumb/star/0/202/260x346.jpg",
  },
}
 
axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data))
  })
  .catch(function (error) {
    console.log(error)
  })