Body Swap API for Developers

Body Swap API

Replace a person in an image while preserving the scene through the Magic Hour API.

Free credits on signup
Transparent per-credit pricing
Official SDKs
Asynchronous jobs
Auto-scaling

Trusted by teams at

Everything You Need to Ship Body Swap

Build reliable body swapping into your product without managing model infrastructure.

Production-Ready Output
Create consistent body swapping results through one documented endpoint.
Asynchronous Processing
Submit jobs, poll status, and retrieve outputs without blocking your application.
Fast Integration
Use REST directly or start with official Python, Node.js, Go, and Rust SDKs.
Commercial Workflows
Build customer-facing applications with predictable usage-based pricing.

Integrate in 3 Steps

Add body swapping to your application in three steps.

1
Get an API Key
Create a Magic Hour account and copy your key from the Developer dashboard.
2
Submit a Request
Upload any required assets and send the documented body swapping request.
3
Retrieve the Result
Poll the project endpoint or use webhooks, then download the completed output.
Get Started Free

Code Examples

Body Swap in a few lines of code. Install an SDK or use the REST API directly.

from magic_hour import Client
from os import getenv

client = Client(token=getenv("MAGIC_HOUR_API_KEY"))
res = client.v1.body_swap.generate(
    assets={
        "person_file_path": "/path/to/person.png",
        "scene_file_path": "/path/to/scene.png",
    },
    resolution="1k",
    name="My Body Swap image",
    wait_for_completion=True,
    download_outputs=True,
    download_directory=".",
)
API Docs

Estimate Your API Costs

Every generation uses credits. Prepay with a subscription or one-time credit packs, or request usage-based billing for monthly invoicing and volume discounts.
Quantity / month
0 seconds
seconds
Recommended plan
Creator Yearly
$144
/year
144,000 credits per year
Up to 1.7 hours of video
Up to 28,800 images
PRO YEARLY covers your usage
Estimated usage
0credits / month
Included
25,000credits / month
Remaining headroom
25,000credits / month
TOTAL BILL
$300
/year

Body Swap API Pricing

Subscription plans for standard usage.

Need usage-based billing?

Email us or message us in Intercom for monthly billing with graduated volume discounts.

Built for Builders

See how developers use the Body Swap API to power real products.

Fashion Previews
Add body swapping to fashion previews.
Creative Composites
Automate body swapping for creative composites.
Campaign Visuals
Create scalable campaign visuals with the API.
Try before integrating

Try Body Swap Free — No Code Required

Test quality first with the free tool, then plug the same output quality into your app with the API when you are ready.

Body Swap API FAQ

Get an API key, follow the Body Swap endpoint documentation, submit the required inputs, and retrieve the completed project.

Yes. New accounts receive free credits for testing. Paid plans and usage-based billing support production workloads.

Magic Hour provides official SDKs for Python, Node.js, Go, and Rust, plus direct REST access.

Start Building with the Body Swap API

Free credits on signup. SDKs for Python, Node.js, Go, and Rust. Production-ready in minutes.