AI Face Swap
AI Face Swap
AI Face Swap API
AI Face Swap API swaps a source face onto a target image and returns an asynchronous task ID for result retrieval.
POST
AI Face Swap
Request
- URL:
https://www.ailabapi.com/api/portrait/editing/ai-face-swap - Method:
POST - Content-Type:
multipart/form-data
API Information
| Field | Value |
|---|---|
| API Name | AI Face Swap |
| API URL | /api/portrait/editing/ai-face-swap |
| Documentation URL | /docs/ai-portrait/editing/ai-face-swap |
| Unique Identification | portrait_ai_face_swap |
Image requirements
| Field | Requirements |
|---|---|
image_target | Image format: JPEG/JPG/PNG, Image size: No more than 5 MB., Image resolution: Less than 4096x4096px. |
image_template | Image format: JPEG/JPG/PNG, Image size: No more than 5 MB., Image resolution: Less than 4096x4096px. |
Headers
| Field | Required | Type | Description |
|---|---|---|---|
ailabapi-api-key | YES | string | Application API KEY. Get API KEY |
Body
| Field | Required | Type | Description |
|---|---|---|---|
image_target | YES | file | Target portrait image. The face in this image will be replaced. |
image_template | YES | file | Template portrait image that provides the face to swap. |
Response
Public Response Fields
Viewing Public Response Fields and Error CodesBusiness Response Fields
| Field | Type | Scope | Description |
|---|---|---|---|
task_type | string | async | Task Type. “async: Asynchronous tasks. |
task_id | string | Asynchronous task ID. Please use this field when calling the Querying Async Task Results API. |
Response Example
Querying Async Task Results Response
Public Response Fields
Viewing Public Response Fields and Error CodesBusiness Response Fields
| Field | Type | Scope | Description |
|---|---|---|---|
task_status | integer | 0, 1, 2 | Asynchronous task status. 0`: The task is queued.` 1: Asynchronous processing. “2: Processing was successful. |
data | object | The result payload returned by the asynchronous task. | |
+image | string | Result image URL. |
Response Example
Authorizations
API Key for authentication
Body
multipart/form-data
The image to be modified. The face in this image will be replaced.
- Image format:
JPEGJPGPNG - Image size: No more than 5 MB.
- Image resolution: Less than 4096x4096px.
The image that provides the face to use.
- Image format:
JPEGJPGPNG - Image size: No more than 5 MB.
- Image resolution: Less than 4096x4096px.
Response
200 - application/json
Success
The response is of type object.

