---
title: "Face Swap Video"
method: POST
path: "/v1/face-swap"
tags: ["Video Projects"]
---

# Face Swap Video

`POST /v1/face-swap`

**What this API does**

Create the same Face Swap you can make in the browser, but programmatically, so you can automate it, run it at scale, or connect it to your own app or workflow.
    
**Good for**
- Automation and batch processing  
- Adding face swap into apps, pipelines, or tools  

**How it works (3 steps)**
1) Upload your inputs (video, image, or audio) with [Generate Upload URLs](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls) and copy the `file_path`.  
2) Send a request to create a face swap job with the basic fields.  
3) Check the job status until it's `complete`, then download the result from `downloads`.

**Key options**
- Inputs: see the request schema for endpoint-specific assets  
- Resolution: free users default to 480p; higher plans unlock HD and larger sizes  
- Extra fields: see the request schema for endpoint-specific options  

**Cost**  
Credits are only charged for the frames that actually render. You'll see an estimate when the job is queued, and the final total after it's done.

For detailed examples, see the [product page](https://magichour.ai/products/face-swap).

## Request body

- object
  - `name` string — Give your video a custom name for easy identification.
  - `start_seconds` number, float, required — Start time of your clip (seconds). Must be ≥ 0.
  - `end_seconds` number, float, required — End time of your clip (seconds). Must be greater than start_seconds.
  - `style` object — Style of the face swap video.
    - `version` 'v1' | 'v2' | 'default' — * `v1` - May preserve skin detail and texture better, but weaker identity preservation. * `v2` - Faster, sharper, better handling of hair and glasses. stronger identity preservation. * `default` - Use the version we recommend, which will change over time. This is recommended unless you need a specific earlier version. This is the default behavior.
  - `assets` object, required — Provide the assets for face swap. For video, The `video_source` field determines whether `video_file_path` or `youtube_url` field is used
    - `face_swap_mode` 'all-faces' | 'individual-faces' — Choose how to swap faces: **all-faces** (recommended) — swap all detected faces using one source image (`source_file_path` required) +- **individual-faces** — specify exact mappings using `face_mappings`
    - `image_file_path` string — The path of the input image with the face to be swapped. The value is required if `face_swap_mode` is `all-faces`. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details.
    - `face_mappings` object[] — This is the array of face mappings used for multiple face swap. The value is required if `face_swap_mode` is `individual-faces`.
      - `original_face` string, required — The face detected from the image in `target_file_path`. The file name is in the format of `<face_frame>-<face_index>.png`. This value is corresponds to the response in the [face detection API](https://docs.magichour.ai/api-reference/files/get-face-detection-details). * The face_frame is the frame number of the face in the target image. For images, the frame number is always 0. * The face_index is the index of the face in the target image, starting from 0 going left to right.
      - `new_face` string, required — The face image that will be used to replace the face in the `original_face`. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details.
    - `video_source` 'file' | 'youtube', required — Choose your video source.
    - `video_file_path` string — Your video file. Required if `video_source` is `file`. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details.
    - `youtube_url` string, uri — YouTube URL (required if `video_source` is `youtube`).

## Response `200`

Success

- object — Success
  - `id` string, required — Unique ID of the video. Use it with the [Get video Project API](https://docs.magichour.ai/api-reference/video-projects/get-video-details) to fetch status and downloads.
  - `credits_charged` integer, required — The amount of credits deducted from your account to generate the video. If the status is not 'complete', this value is an estimate and may be adjusted upon completion based on the actual FPS of the output video. If video generation fails, credits will be refunded, and this field will be updated to include the refund.

## Other responses

- `400` — Invalid Request
- `401` — Unauthorized
- `402` — Payment Required
- `404` — Not Found
- `422` — Unprocessable Entity

---

[API](https://skmtc.net/magichourhq/apis/magic-hour-api.md) · [All operations](https://skmtc.net/magichourhq/apis/magic-hour-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/magichourhq/magic-hour-api/revisions/d03d90b0b8e0/schema)
