> For the complete documentation index, see [llms.txt](https://docs.nudify.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nudify.me/generations/video-faceswap.md).

# Video Faceswap

Face Swap allows you to replace a face inside a target video using a source face image. The system automatically handles facial alignment, lighting matching, and blending to produce a natural looking result.

The process is asynchronous. After submitting a request, the API returns a jobId. You can then retrieve the final result using either a webhook callback or a job status request.

### Model

```
nudifyme/video/faceswap
```

### Pricing

```
0.10 / second
```

### Create Video Face Swap Job

Use this [endpoint](/api/generate.md#post-generate) to start a new face swap generation job.

<table><thead><tr><th width="225">Input</th><th>Description</th></tr></thead><tbody><tr><td>input.videoUrl</td><td>The target video where the new face will be applied.</td></tr><tr><td>input.faceUrl</td><td>The source face image that will be extracted and blended into the target image.</td></tr><tr><td>input.advanced</td><td>Optional boolean that enables occlusion aware face swap processing. Helps when the face is partially covered by hands, hair, or objects.</td></tr></tbody></table>

#### Example Request

```javascript
const response = await fetch(
  'https://api.deepixels.co/v1/generate',
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': 'YOUR_API_KEY'
    },
    body: JSON.stringify({
      model: 'nudifyme/video/faceswap',
      input: {
        videoUrl: 'https://s3.media.deepixels.co/gprod/models/6b8a58c1-54d4-4c2a-8b28-4803898afb33/office.mp4',
        faceUrl: 'https://images.pexels.com/photos/2661256/pexels-photo-2661256.jpeg',
        advanced: true
      },
      webhook: 'YOUR_WEBHOOK_URL'
    })
  }
);

const data = await response.json();

console.log(data);
```

#### Job Creation Response

```json
{
  "jobId": "4ab2d17f-0396-4997-9c84-86c8320ccab9",
  "status": "created"
}
```

### Getting Final Results

When processing is complete, the final job result can be received in either of the following ways:

* By sending a GET request to the job status [endpoint](/api/generate.md#get-get)
* Automatically via webhook if a webhook URL was provided during job creation

Both methods return the same response payload.

```json
{
  "jobId": "4ab2d17f-0396-4997-9c84-86c8320ccab9",
  "model": "nudifyme/video/faceswap",
  "status": "completed",
  "input": {
    "faceUrl": "https://images.pexels.com/photos/2661256/pexels-photo-2661256.jpeg",
    "videoUrl": "https://s3.media.deepixels.co/gprod/models/6b8a58c1-54d4-4c2a-8b28-4803898afb33/office.mp4",
    "advanced": true
  },
  "webhook": "https://webhook.site/79d709be-4dcf-42ff-81e4-6cbe63b16e9b",
  "output": {
    "videoUrl": "https://s3.media.deepixels.co/cage/files/b/0a8e8574/fxpShDkN_NLEpvM5vbKsk_result.mp4"
  },
  "date": 1771124345358
}
```

<table><thead><tr><th width="225">Input</th><th>Description</th></tr></thead><tbody><tr><td>output.videoUrl</td><td>String. URL of the generated video output.</td></tr></tbody></table>
