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 reviewed July 18, 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.
Machine contractOpenAPI 3.1Download openapi.json

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 '[email protected]' \
  --form '[email protected]'

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.

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

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 are requests billed?

Photo tasks cost 2 credits; batch and group-photo requests scale by output or selected face; video and GIF requests use the duration formulas above. Failed processing tasks are refunded.

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