> For the complete documentation index, see [llms.txt](https://documentation.deep-image.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.deep-image.ai/common-usecases/face-swap.md).

# Face swap

Face swapping API can be used for replacing the face on the original image with another one.

```json
{
    "url": "original_image",
    "background": {
        "generate": {
            "adapter_type": "face",
            "avatar_generation_type": "creative_img2img",
            "ip_image2": "replacement_face_url"
        }
    }
}
```

### Whole head swap

By default, face swap replaces the face area only.

To swap the whole head, set `background.generate.generation_type` to `"head_swap"`.

This works well when hairstyle, head shape, or head position should also change.

```json
{
    "url": "original_image",
    "background": {
        "generate": {
            "adapter_type": "face",
            "avatar_generation_type": "creative_img2img",
            "generation_type": "head_swap",
            "ip_image2": "replacement_face_url"
        }
    }
}
```

Let's swap a head from this photo to another:

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FtfcwZ7xYZOAgRRyJoc4Z%2Fpexels-rubaitulazad-18192886.jpg?alt=media&amp;token=09a4dde3-7f23-4ed4-81c1-66b4cadd4c58" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2Fw7lgTEbY0CLNV2k6Uejj%2Fpexels-tamang-8158816.jpg?alt=media&amp;token=bd21d764-a43d-45e3-b049-52c1b10d6fff" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2F9fddY23aVyf85K4Qjmow%2Fpexels-tamang-8158816-6b62f2f2-6968-11f1-825f-9622b73d18e1.jpg?alt=media&amp;token=59f2f825-a6d8-40e2-8a25-4279dbe4b295" alt=""><figcaption></figcaption></figure>
