Production API reference

DeepSwapAI face swap API

Build photo, batch, mapped group-photo, video, and GIF face swap workflows against the same production endpoints used by DeepSwapAI.com. This reference documents the current request fields, limits, costs, task lifecycle, and error behavior.

By DeepSwapAI Product TeamAPI contract, client examples, and source landscape reviewed July 28, 2026Verified API reference

HTTPS, multipart uploads, JSON task states

Use the production origin https://deepswapai.com. Every documented generation route accepts a Bearer API key, returns a taskId, and exposes task status through GET on that same route.

AuthenticationBearer API keyKeys are shown once and stored only as SHA-256 hashes.
CompletionPoll by taskIdTerminal states: COMPLETED, FAILED, or CANCELLED.
Concurrency1 active generationA second active generation returns HTTP 429.
Client assetsOpenAPI + PostmanOpenAPI 3.1 ยท Postman collection

Submit a photo task, then poll it

  1. Verify the account email. New generation requests require a verified account.
  2. Create an API key. Use the key manager below and save the key when it is shown.
  3. Submit multipart media. Keep the returned taskId.
  4. Poll the same route. Stop at COMPLETED, FAILED, or CANCELLED.

1. Create the task

curl --request POST 'https://deepswapai.com/api/ai-tasks' \
  --header 'Authorization: Bearer $DEEPSWAPAI_API_KEY' \
  --form 'sourceImage=@identity.jpg' \
  --form 'targetImage=@scene.jpg'

Accepted response

{
  "taskId": "b6de3ea5-52ef-41a5-8a4b-276cf548dd9c",
  "status": "PENDING"
}

2. Poll the task

curl --get 'https://deepswapai.com/api/ai-tasks' \
  --header 'Authorization: Bearer $DEEPSWAPAI_API_KEY' \
  --data-urlencode 'taskId=b6de3ea5-52ef-41a5-8a4b-276cf548dd9c'

Current completion contract: polling is supported. Webhook callbacks and official language SDKs are not currently published.

Designing the orchestration around this contract? Use the face swap pipeline architecture guide for validation, task states, retries, settlement, observability, and retention boundaries.

Start with Node.js 20 or Python

Both examples create one photo task and poll the documented endpoint until a terminal state. Set DEEPSWAPAI_API_KEY, keep the key on the server, and replace the two local file names. Python requires the requests package; the Node.js example uses built-in web APIs.

import { openAsBlob } from 'node:fs';

const apiKey = process.env.DEEPSWAPAI_API_KEY;
if (!apiKey) throw new Error('Set DEEPSWAPAI_API_KEY first.');

async function apiRequest(path, options = {}) {
  const response = await fetch(`https://deepswapai.com${path}`, {
    ...options,
    headers: {
      Authorization: `Bearer ${apiKey}`,
      Accept: 'application/json',
      ...options.headers,
    },
  });
  const payload = await response.json();
  if (!response.ok) throw new Error(payload.error || 'API request failed');
  return payload;
}

const form = new FormData();
form.append('sourceImage', await openAsBlob('identity.jpg'), 'identity.jpg');
form.append('targetImage', await openAsBlob('scene.jpg'), 'scene.jpg');

const task = await apiRequest('/api/ai-tasks', { method: 'POST', body: form });
const terminal = new Set(['COMPLETED', 'FAILED', 'CANCELLED']);
let state = task;
while (!terminal.has(state.status)) {
  await new Promise((resolve) => setTimeout(resolve, 3000));
  state = await apiRequest(`/api/ai-tasks?taskId=${encodeURIComponent(task.taskId)}`);
}
console.log(state);

Support boundary: these are plain HTTP examples and a Postman collection, not official SDKs. The OpenAPI file remains the machine-readable source of truth.

Create and revoke keys without leaving the reference

Key management uses your signed-in DeepSwapAI account session. A new secret is displayed once. Store it in a server-side secret manager; never place it in browser code, mobile binaries, public repositories, logs, or support messages.

Account API keysLoaded only when you open this tool.

Not connected.

Choose the endpoint that matches the output unit

WorkflowPOST and GET pathCredit unitPrimary limits
Photo/api/ai-tasks2 per task30 MB per image
Batch photo/api/ai-tasks/batch-face-swap2 per generated output20 images, 30 MB each, 200 MB total
Mapped group photo/api/ai-tasks/multi-face-swap2 per replacement face10 faces, 30 MB each, 120 MB total
Video/api/ai-tasks/video720p: 2/s; 1080p: 5/s300 seconds, 200 MB target
GIF / short clip/api/ai-tasks/gif3/s, 10 minimum30 seconds, 100 MB target

What does one face swap API generation cost?

The API uses the same one-time credit balance as the browser workflows. The USD figures below are credit-value equivalents: workflow credits multiplied by the selected package price and divided by that package's credits. Checkout sells complete packages, not individual generation requests, and the live credit-plan endpoint is the current price source.

01

2-credit image unit

$0.064-$0.100 for one photo task, batch output, or mapped group face.

02

720p video minimum

6 credits, equivalent to $0.192-$0.300. Each rounded-up second uses 2 credits.

03

1080p video minimum

15 credits, equivalent to $0.480-$0.749. Each rounded-up second uses 5 credits.

04

GIF minimum

10 credits, equivalent to $0.320-$0.500. Each rounded-up second uses 3 credits.

Billable exampleCreditsBasic
$9.99 / 200
Standard
$24.99 / 700
Premium
$79.99 / 2500
One photo task, batch output, or mapped group face 2 $0.100$0.071$0.064
60-second 720p video 120 $5.99$4.28$3.84
60-second 1080p video 300 $14.99$10.71$9.60
10-second GIF 30 $1.50$1.07$0.96

How to use these figures: compare the output unit first, then the package. For example, a 60-second 720p task uses 120 credits, while the same duration at 1080p uses 300 credits. Taxes, payment-currency conversion, and the final checkout total are not included in the equivalent. Use the exact task calculator and current package table before funding an integration.

Compare six published face swap API contracts

The table normalizes what each provider currently publishes about media inputs, request transport, multiple-face or batch behavior, completion, client assets, machine-readable contracts, pricing units, and output availability. It does not turn unlike credit, frame, second, resolution, face-count, or subscription units into a false price ranking.

06

API records

Six provider contracts reviewed under the same field definitions.

21

Official source URLs

API references, pricing pages, integration guides, and retention statements.

00

Output tests

No generation, quality, speed, latency, reliability, or safety ranking.

Official-source face swap API contract landscape, reviewed July 28, 2026
ProviderMedia and inputMapping and completionClients and specificationPublished pricing and output window
DeepSwapAIReviewed Photo, batch photo, mapped group photo, video, and GIF or short clip.Multipart file uploads over HTTPS. Up to 20 photos per batch and up to 10 explicitly mapped faces in one group photo. Video applies one reference to the primary on-camera person.Create returns a taskId; poll GET on the matching workflow endpoint. No webhook callback is published. Runnable Node.js 20 and Python HTTP examples plus a Postman collection. No official language SDK is published.Public OpenAPI 3.1 document and Postman collection. 2 credits per photo output or mapped face; 720p video 2 credits per rounded-up second with a 6-credit minimum; 1080p 5 credits per second with a 15-credit minimum; GIF 3 credits per second with a 10-credit minimum. Credits are sold in one-time packs.Uploads and generated media are removed from DeepSwapAI servers within 24 hours.
Magic HourReviewed Photo and video; GIF is accepted on the video path; multiple-face mappings are documented.Magic Hour upload paths or supported public media URLs. Multiple source-to-target face mappings are documented. A single multi-file photo-batch request contract was not confirmed in the reviewed sources.Polling and signed webhook events are documented. Official Python, Node.js or TypeScript, Go, and Rust SDKs are documented.Public API reference is available; a downloadable consolidated OpenAPI file was not confirmed in the reviewed sources. Face Swap Photo is published at 5 credits. Video usage is estimated and finalized from rendered frames. Subscription and usage-based billing options are documented.Files uploaded to Magic Hour storage are documented as automatically deleted after 7 days.
PiAPIReviewed Image and MP4 video face swap.Image URLs or base64 strings for image tasks; media URLs for video tasks. Image tasks replace the largest detected face. Video tasks document indexed single- or multiple-face mappings. A multi-file image batch contract was not confirmed.Asynchronous task ID with task retrieval; optional webhook configuration is present in the image task contract. A first-party Postman tutorial and generated request examples are available. An official maintained language SDK was not confirmed.The image reference exposes an OpenAPI 3.0.1 operation definition. A standalone consolidated specification was not confirmed. The image endpoint reference publishes $0.01 per generation and the video reference publishes $0.004 per frame. The provider face swap product page separately publishes $0.02 per call; this official-source conflict is unresolved.The output-storage documentation publishes a 3-day storage period for API output images. A separate video-output period was not confirmed.
FacemintReviewed Image, GIF, and video face swap.Media URLs in JSON task requests. Video pricing documents face-count, resolution, and enhancement multipliers. A dedicated multi-file batch request was not confirmed.Task creation, task information, cancellation, and callbacks are documented. HTTP and cURL examples are published. An official maintained language SDK was not confirmed.A downloadable OpenAPI or equivalent machine-readable specification was not confirmed in the reviewed sources. $0.002 per image, $0.002 per 100 KB of GIF input, and a $0.0045 per second base video rate before documented face-count, resolution, and enhancement multipliers. The pricing page says callbacks are free.A fixed upload or output retention window was not confirmed in the reviewed API and pricing pages.
SupaworkReviewed Single- and multiple-face image and video tasks.Public media URLs in JSON requests. Single- and multiple-face modes are documented, and task_list supports several tasks in one request.A callback URL is required. The documentation describes callback retries and status payloads. HTTP and cURL examples are published. An official maintained language SDK was not confirmed.A downloadable OpenAPI or equivalent machine-readable specification was not confirmed in the reviewed sources. Image tasks publish 5 credits for single-face and 10 credits for multiple-face. Video tasks publish 5 to 20 credits per second depending on single or multiple face and enhancement.The documented result URL is valid for 2 hours.
WaveSpeedAIReviewed Video face swap for the reviewed model.Public face-image and video URLs in a JSON prediction request. A target face index selects one detected face for a run. A multi-file batch or several mapped replacements in one request was not confirmed.Create returns a prediction ID; poll the prediction endpoint for status and output. cURL, Node.js, and Python request examples are published. Those examples were not classified as official maintained SDKs.A downloadable OpenAPI or equivalent machine-readable specification was not confirmed in the reviewed sources. $0.01 per second with a 5-second minimum for the reviewed video face swap model.A fixed output retention period was not confirmed in the reviewed model and API pages.
Evidence boundary: Manual review of current official sources. No generation request was run, no output was scored, and no provider was ranked for quality, latency, reliability, safety, or overall value. Not confirmed means the reviewed sources did not establish the field, not that the capability is absent. Prices must be normalized to the same representative task before comparison. PiAPI's current official sources publish both $0.01 per image generation and $0.02 per call; both statements remain visible because the provider has not reconciled them in the reviewed pages.

Official sources and row notes

Open each provider record to inspect the exact first-party pages used. Product behavior and pricing can change after the row review date.

DeepSwapAI5 official sources

First-party API reference, machine-readable contract, client collection, pricing, and privacy policy. No generation request was made for this review.

Magic Hour5 official sources

The photo and video paths use different units. Product, SDK, event, and storage statements are preserved without inferring an output-quality or speed result.

PiAPI5 official sources

Both official image-price statements are retained. Video cost is frame-based and cannot be compared directly with a per-call image amount.

Facemint2 official sources

The video base rate changes with published multipliers, so it is not a final representative task price by itself.

Supawork2 official sources

Image and video credit units are provider-specific; video enhancement and multiple-face choices change the rate.

WaveSpeedAI2 official sources

The reviewed model publishes a 10-minute maximum. No generation, latency, reliability, or output-quality test was run.

Version-pinned public mirror: the publisher-controlled open research repository preserves these exact bytes at commit ad050132548fac988c5a6e62331bb58f70ebe708. The Software Heritage snapshot independently preserves the release repository state. Neither mirror is an independent API audit or endorsement.

POST /api/ai-tasks

2 credits

Send sourceImage as the identity reference and targetImage as the scene to preserve. Optional numeric fields are faceRestoreVisibility and restoreVisibility. JPEG/JPG, PNG, WebP, GIF, BMP, HEIC, and HEIF inputs are accepted after content validation; each file can be up to 30 MB.

Poll: GET /api/ai-tasks?taskId=...

POST /api/ai-tasks/batch-face-swap

2 credits / output

Use mode=singleToMulti with exactly one repeated sourceImages field and one or more targetImages fields. Use mode=multiToSingle with one or more sourceImages fields and exactly one targetImages field.

The request can contain no more than 20 images, 30 MB each and 200 MB combined. Accepted formats are JPEG, PNG, WebP, AVIF, HEIC, and HEIF.

Poll: GET /api/ai-tasks/batch-face-swap?taskId=...

POST /api/ai-tasks/multi-face-swap

2 credits / face

Send the group photo as sourceImage. Add replacement identities in contiguous fields from targetFace0 through targetFace9. Optional faceBox0 through faceBox9 values are JSON objects with x, y, width, and height.

Either map every replacement face or omit every face box. JPEG, PNG, and WebP are accepted, with a 30 MB per-file and 120 MB total limit.

Poll: GET /api/ai-tasks/multi-face-swap?taskId=...

POST /api/ai-tasks/video

720p or 1080p

Send sourceImage, targetVideo, and optional quality set to 720p or 1080p. The default is 1080p. The reference image can be up to 30 MB; MP4, MOV, and WebM targets can be up to 200 MB and 300 seconds.

Measured duration is rounded up. 720p costs 2 credits per second with a 6-credit minimum. 1080p costs 5 credits per second with a 15-credit minimum.

Poll: GET /api/ai-tasks/video?taskId=...

POST /api/ai-tasks/gif

3 credits / second

Send sourceImage and targetGif. The target can be GIF, MP4, or WebM, up to 100 MB and 30 seconds. The reference image can be up to 30 MB. Duration is rounded up and billed at 3 credits per second with a 10-credit minimum.

Poll: GET /api/ai-tasks/gif?taskId=...

Keep the taskId and stop at a terminal state

PENDINGPROCESSINGCOMPLETEDor FAILED / CANCELLED

Use the same API key to poll a task. A taskId can only be read by its owning account. Poll at a measured interval rather than in a tight loop. The response includes the task type, current status, credit cost, timestamps, parameters, and a result object when available.

Handle status codes before retrying

StatusMeaningClient action
400Invalid field, media, mapping, size, duration, or taskId.Correct the request; do not retry unchanged.
401Missing or invalid Bearer API key.Replace or recreate the key.
402Insufficient account credits.Add credits, then submit a new task.
403Account email is not verified.Complete email verification.
404The taskId does not belong to this account.Check the route, key, and taskId.
429Key limit exceeded or another generation is active.Honor Retry-After when supplied and use backoff.
500The request could not be accepted or read.Retry later with bounded exponential backoff.

API-key limits can vary by environment or account. When the per-key limit is exhausted, the response supplies Retry-After, X-RateLimit-Limit, and X-RateLimit-Remaining. Separate account-level protection allows one active generation at a time.

Credits settle with the task; trial image identity remains visible

Generation credits are reserved with the task and failed processing tasks are refunded automatically. Reward credits do not count as a paid purchase.

Until the account has a PAID or COMPLETED credit order, every delivered trial image export contains DeepSwapAI.com and the account's 100% complete email address. Every character is visible: the email is never masked, shortened, hashed, or omitted. A trial image cannot be delivered without that complete-email watermark.

After a completed one-time credit purchase, future image exports are watermark-free. Existing trial files do not change retroactively. This statement applies only to image exports and does not describe GIF or video watermark behavior. Review the complete export policy and current credit pricing.

Current integration boundaries

Does the API support webhooks?

No. Submit the task, retain its taskId, and poll GET on the same workflow endpoint until a terminal status.

Is there an official SDK?

No official language SDK is currently published. Use any server-side HTTP client that supports Bearer headers, multipart form data, and JSON.

How much does one DeepSwapAI API generation cost?

A photo task uses 2 credits, currently equivalent to about $0.064-$0.100 depending on the full credit pack. Batch and group-photo requests scale by output or selected face; video and GIF requests use the duration formulas above. Polling GET requests do not create another generation charge. Failed processing tasks are refunded.

Can published face swap API prices be compared directly?

No. Provider units differ by call, frame, second, resolution, face count, enhancement, subscription, or credit pack. Compare one identical representative task and retain any official-source conflicts.

Does the contract landscape identify the best face swap API?

No. It records public contract evidence only. No generation request was run and no provider was ranked for output quality, latency, reliability, safety, or value.

Do trial images contain a watermark?

Yes. Before a paid order, delivered trial image exports contain DeepSwapAI.com and the account's complete unmasked email. Payment changes future image exports only; this rule does not describe GIF or video behavior.

Ready to run the production contract?

Create a key, verify the account email, and add enough one-time credits for the workflow you plan to submit.

Add API credits