Developer Docs/Face Swap API

Face Swap API

Build Face Swap integrations with A2E. Review authentication, request parameters, task creation, status, and result endpoints.

Overview

Swap faces between a source and a target image or video with identity-preserving blending. Handles diverse lighting, pose, and expression conditions.

Primary Endpoint

POST/api/v1/userFaceSwapTask/add

Create a new face swap task

Request Parameters

NameTypeRequiredDescription
namestringYesName of the face swap task
video_urlstringYesURL of the video to swap face in
face_urlstringYesURL of the face image to swap with
cover_urlstringNoOptional cover image URL
model_versionenum: v1 | v2NoFace swap model version: v1 (JAH pipeline, default), v2 (ComfyUI, image only)
webhook_urlstringNoHTTPS URL to receive task.completed / task.failed notifications. Best-effort delivery, single attempt, no retries; clients should treat the detail API as the source of truth.
webhook_tokenstringNoOptional plaintext token returned in the X-A2e-Webhook-Token header so receivers can verify the request originated from a2e.

Request Example

curl -X POST "https://www.a2e.com.cn/api/v1/userFaceSwapTask/add" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "My Face Swap Video",
  "video_url": "https://example.com/video.mp4",
  "face_url": "https://example.com/face.jpg",
  "cover_url": "https://example.com/cover.jpg",
  "model_version": "v1",
  "webhook_url": "https://your-server.example.com/a2e/webhook",
  "webhook_token": "a-shared-secret"
}'

Related Endpoints

POST/api/v1/userFaceSwapImage/add

Add a new face image for face swapping

GET/api/v1/userFaceSwapImage/records

Get user's face swap image records

DELETE/api/v1/userFaceSwapImage/{_id}

Remove a face swap image

POST/api/v1/userFaceSwapPreview/add

Create a new face swap preview task

GET/api/v1/userFaceSwapPreview/status

Get face swap preview status

POST/api/v1/userFaceSwapTask/add

Create a new face swap task

GET/api/v1/userFaceSwapTask/records

Get user's face swap task records

GET/api/v1/userFaceSwapTask/status

Get user's face swap task status

POST/api/v1/userFaceSwapTask/batchDetail

Batch query task details

GET/api/v1/userFaceSwapTask/{_id}

Get face swap task details

DELETE/api/v1/userFaceSwapTask/{_id}

Delete face swap task

Responses

200

Face swap task created successfully

400

Bad Request - Invalid parameters

401

Unauthorized - Invalid or missing bearer token