Face Swap API
Add photo and video face swap to your own product with a simple REST API. Submit a job, poll for the result, get a hosted output URL.
API access is included with every subscription plan. Requests use the same credits as the web app: no separate API bill.
How it works
1
Create an API key
Subscribe to any plan, then create a key in your dashboard under API Keys. The key is shown once, so store it safely.
2
Upload your media
Request a presigned upload URL, then PUT your source face and target image or video to it.
3
Swap and poll
Submit the face swap job, then poll the task until the status is succeeded and download the output URL.
Authentication
Send your API key in the x-api-key header with every request. Keys belong to your account and spend your account credits. Keep them secret and rotate them from the dashboard if they leak.
x-api-key: adf_YOUR_API_KEYEndpoints
POST /api/v1/uploads
Create a presigned upload URL for a source or target file. PUT the file to uploadUrl with the same Content-Type, then use url in the face swap request. Supported types: JPEG, PNG, WebP, MP4, QuickTime, WebM.
curl -X POST https://aideepfake.io/api/v1/uploads \
-H "x-api-key: adf_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"fileName": "target.jpg", "contentType": "image/jpeg"}'
# → { "success": true, "data": { "uploadUrl": "...", "url": "https://...", "expiresIn": 600 } }
curl -X PUT "UPLOAD_URL_FROM_RESPONSE" \
-H "Content-Type: image/jpeg" \
--data-binary @target.jpgPOST /api/v1/face-swap
Start a face swap job. An image swap costs 15 credits and a video swap costs 20 credits, the same prices as the web app. Set targetType to image or video. Optional fields: faceEnhance, frameEnhance, watermark and targetDurationSeconds for videos.
curl -X POST https://aideepfake.io/api/v1/face-swap \
-H "x-api-key: adf_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sourceUrl": "https://.../source.jpg",
"targetUrl": "https://.../target.jpg",
"targetType": "image"
}'
# → { "success": true, "data": { "taskId": "...", "creditsCost": 15 } }Video limits: up to 300 seconds for a plain swap, up to 90 seconds when faceEnhance or frameEnhance is on.
GET /api/v1/face-swap/{taskId}
Poll the task status. The status field moves from processing to succeeded or failed. On success, outputUrl holds the hosted result. Failed jobs are refunded automatically.
curl https://aideepfake.io/api/v1/face-swap/TASK_ID \
-H "x-api-key: adf_YOUR_API_KEY"
# → { "success": true, "data": { "taskId": "...", "status": "succeeded",
# "outputUrl": "https://...", "targetType": "image" } }GET /api/v1/credits
Read your current credit balance and plan before you submit jobs.
curl https://aideepfake.io/api/v1/credits \
-H "x-api-key: adf_YOUR_API_KEY"
# → { "success": true, "data": { "credits": 1000, "subscriptionCredits": 985,
# "oneTimeCredits": 15, "planId": "...", "currentPeriodEnd": "..." } }Pricing and quota
The API has no separate price sheet. Every request spends the credits from your subscription plan: 15 credits per image swap and 20 credits per video swap, exactly like the web app. Your monthly credit quota is set by your plan.
Compare plansError codes
| HTTP | Code | Meaning |
|---|---|---|
| 401 | INVALID_API_KEY | The API key is missing, invalid, disabled or expired. |
| 403 | API_REQUIRES_SUBSCRIPTION | The account has no active subscription. Subscribe to a plan to use the API. |
| 402 | INSUFFICIENT_CREDITS | The account has too few credits for this job. Upgrade the plan or buy a credit pack. |
| 400 | VIDEO_TOO_LONG | The video is longer than the duration limit for the selected options. |
| 429 | RATE_LIMITED | Too many requests. Slow down and retry after a short wait. |
Frequently asked questions
Who can use the face swap API?
Every account with an active subscription plan. Free accounts can use the web app but not the API.
What do API requests cost?
The same as the web app: 15 credits per image swap and 20 credits per video swap. Requests draw from the same credit balance as your web usage.
Does the API support video face swap?
Yes. Set targetType to video. Plain video swaps accept up to 300 seconds; swaps with face or frame enhancement accept up to 90 seconds.
How do I get the result?
Poll GET /api/v1/face-swap/{taskId} until status is succeeded. The response carries an outputUrl with the hosted result file.
What happens when a job fails?
Failed jobs are refunded automatically. The status response carries an error field with the reason.
What happens when my subscription ends?
Your API keys stop working immediately. They start working again when you resubscribe: you do not need new keys.
Start building
Create your API key and run your first face swap in minutes.
Create an API key