---
title: "Character Replace"
method: POST
path: "/v1/character-replace"
tags: ["Video Projects"]
---

# Character Replace

`POST /v1/character-replace`

**What this API does**

Create the same Character Replace 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 character replace 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 character replace job with the basic fields.  
3) Check the job status until it's `complete`, then download the result from `downloads`.

**Key options**
- Inputs: usually a file, sometimes a YouTube link, depending on project type  
- Resolution: free users are limited to 576px; higher plans unlock HD and larger sizes  
- Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt  

**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/character-replace).

## Request body

- object
  - `name` string — Give your video a custom name for easy identification.
  - `start_seconds` number, float — 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.
  - `resolution` '480p' | '720p' — Output video resolution. Defaults to 480p, the lowest resolution available on your plan.
  - `assets` object, required — Source video and reference character image for the job.
    - `video_file_path` string, required — Source video containing the subject to replace or animate. 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.
    - `image_file_path` string, required — Reference character image used as the replacement or animation target. 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.
  - `style` object — Optional style controls for replace vs animate mode and subject selection.
    - `mode` 'replace' | 'animate' — Processing mode. `replace` swaps the detected subject with your reference character. `animate` transfers motion from the video onto your character image.
    - `selection_mode` 'auto' | 'point' — How to locate the subject in the source video. `auto` detects a person automatically. `point` uses your `points` to mark the subject. Defaults to `auto`.
    - `points` object[] — On-frame markers for manual subject selection. Required when `selection_mode` is `point`. Ignored when `selection_mode` is `auto` or omitted.
      - `position_x` integer, required — Horizontal pixel coordinate in the source video frame at `time_seconds`, measured from the left edge.
      - `position_y` integer, required — Vertical pixel coordinate in the source video frame at `time_seconds`, measured from the top edge.
      - `time_seconds` number, float, required — Timestamp on the source video timeline in seconds. Uses the same clock as `start_seconds` and `end_seconds`.

## 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/versions/941298cfb29f/schema)
