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
/api/v1/userFaceSwapTask/addCreate a face swap task with video, face image, and optional cover image. ### Request - Send a valid bearer token. The server evaluates the operation in the authenticated caller's access context. - Send an `application/json` body. Required fields: `name`, `video_url`, `face_url`. - API-token callers may include `webhook_url` and `webhook_token` for best-effort terminal-state notifications; ordinary JWT/cookie calls ignore these fields. ### Behavior - This is an asynchronous operation: a successful submission creates a task and returns before processing finishes. - Persist the returned task identifier and use the corresponding detail or list operation to observe progress. - Treat the detail endpoint as the source of truth even when webhook delivery is enabled. ### Response - A `200` response confirms task acceptance; it does not by itself mean media generation has completed. - Retain the returned identifier and wait for a documented terminal status before using output URLs. - JSON object responses, including error responses, normally carry a top-level `trace_id` string for this request; include it when contacting support. It is not a task identifier. - Do not infer undocumented fields or statuses; clients should tolerate additional response properties. ### Errors - `400` — Bad Request - Invalid parameters. - `401` — Unauthorized - Invalid or missing JWT token. ### Related Operations - `GET /api/v1/userFaceSwapTask/records` — Get user's face swap task records. - `GET /api/v1/userFaceSwapTask/{_id}` — Get face swap task details. - `DELETE /api/v1/userFaceSwapTask/{_id}` — Delete face swap task. Authentication: set header Authorization: Bearer <token> (supports user JWT or sk_ API token).
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Name of the face swap task |
| video_url | string | Yes | URL of the video to swap face in |
| face_url | string | Yes | URL of the face image to swap with |
| cover_url | string | No | Optional cover image URL |
| model_version | enum: v1 | v2 | No | Face swap model version: v1 (JAH pipeline, default), v2 (ComfyUI, image only) |
| minor_suspected_skip | boolean | No | Set to true when retrying after error code 1004 to confirm and bypass the suspected-minor soft block.; default: false |
| webhook_url | string | No | HTTPS 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.; maxLength: 2048 |
| webhook_token | string | No | Optional plaintext token returned in the X-A2e-Webhook-Token header so receivers can verify the request originated from a2e.; maxLength: 256 |
Request schema and conditional rules
{
"allOf": [
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of the face swap task",
"example": "My Face Swap Video"
},
"video_url": {
"type": "string",
"description": "URL of the video to swap face in",
"example": "https://example.com/video.mp4"
},
"face_url": {
"type": "string",
"description": "URL of the face image to swap with",
"example": "https://example.com/face.jpg"
},
"cover_url": {
"type": "string",
"description": "Optional cover image URL",
"example": "https://example.com/cover.jpg"
},
"model_version": {
"type": "string",
"enum": [
"v1",
"v2"
],
"description": "Face swap model version: v1 (JAH pipeline, default), v2 (ComfyUI, image only)",
"example": "v1"
},
"minor_suspected_skip": {
"type": "boolean",
"default": false,
"description": "Set to true when retrying after error code 1004 to confirm and bypass the suspected-minor soft block."
}
},
"required": [
"name",
"video_url",
"face_url"
]
},
{
"$ref": "#/components/schemas/WebhookInput"
}
]
}Response Fields
- code: integer
- data: object
- data._id: string
- Task ID
- data.name: string
- Task name
- data.duration: number
- Video duration in seconds
- data.video_url: string
- Video URL
- data.face_url: string
- Face image URL
- data.current_status: string
- Current processing status
- data.cover_url: string
- Cover image URL
- data.coins: number
- Cost in coins
- trace_id: string
- Trace ID of this HTTP request. Include it when contacting support about this request. It is generated per request and is not a task identifier; use the returned task `_id` to query results.
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"
}'Related Endpoints
/api/v1/userFaceSwapTask/{_id}Get face swap task details
/api/v1/userFaceSwapTask/addCreate a new face swap task
/api/v1/userFaceSwapTask/recordsGet user's face swap task records
/api/v1/userFaceSwapTask/statusGet user's face swap task status
/api/v1/userFaceSwapTask/batchDetailBatch query task details
/api/v1/userFaceSwapTask/{_id}Delete face swap task
Responses
Face swap task created successfully
Bad Request - Invalid parameters
Unauthorized - Invalid or missing bearer token