Face Manipulation API Documentation
This page documents the Face Manipulation endpoints, including batch couple face swap and face enhancement. Use these APIs to automate advanced face processing inside your own products.
Introduction
The Face Manipulation APIs are built for photo apps, social tools, and creative products that need high‑quality face swaps and restorations. You can process single images or full batches with a single request.
You can use these APIs to:
- Swap couple faces at scale while respecting gender consistency.
- Automatically enhance facial details in low‑quality photos.
All endpoints share the same base URL and authentication scheme shown below.
Base URL
https://taiapi.aiphotocraft.com/Authentication
All Face Manipulation requests require an API key. You can create and manage your keys inside the Developer Dashboard.
API Key Header
Include your key in the following header:
X-Api-Key: YOUR_API_KEYExample Request
curl -X POST "https://taiapi.aiphotocraft.com/api/enhance_face" \ -H "X-Api-Key: YOUR_API_KEY" \ -H "accept: application/json" \ -H "Content-Type: multipart/form-data" \ -F "image=@face.jpg;type=image/jpeg"
Keep your API key private
Never expose your key in public client‑side code. Route all Face Manipulation API calls through a secure backend or serverless function.
Face Manipulation Endpoints
Batch Couple Face Swap
/api/batch_couple_faceswapBatch couple face swap with gender detection. Automatically detects gender of faces in source images and swaps male with male, female with female. The reverse flag is ignored. Always enqueues a background job and returns task_id.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| femaleImage | string (body) | Required | URL of the female reference image. |
| maleImage | string (body) | Required | URL of the male reference image. |
| srcImages | array (body) | Required | Array of source images to process. Each item contains 'image' (URL string) and 'reverse' (boolean, currently ignored). |
Task Status Endpoint
/api/task-status/{task_id}Get the status of a task and retrieve the processed image URL.
| Name | Type | Required | Description |
|---|---|---|---|
| task_id | string (path) | Required | The ID of the task to get the status for. |
Example Request
curl -X GET "https://taiapi.aiphotocraft.com/api/task-status/{task_id}"-H "accept: application/json"-H "X-Api-Key: YOUR_API_KEY"
Example Response
{
"image_url": "https://taiapi.aiphotocraft.com/results/swapped_image.jpg"
}Response Status Codes
| Status Code | Description |
|---|---|
| 200 | Successfully retrieved task status. |
| 400 | Bad request. |
| 401 | Unauthorized. |
Examples
import requests
url = "https://taiapi.aiphotocraft.com/api/batch_couple_faceswap"
headers = {
"X-Api-Key": "YOUR_API_KEY",
"accept": "application/json",
"Content-Type": "application/json",
}
data = {
"femaleImage": "https://example.com/female.jpg",
"maleImage": "https://example.com/male.jpg",
"srcImages": [
{
"image": "https://example.com/couple1.jpg",
"reverse": True
}
]
}
response = requests.post(url, headers=headers, json=data)
print(response.status_code, response.text)Enhance Face
/api/enhance_faceEnhance an image that contains a face. Upload a single image and receive an enhanced version with improved quality. Returns a task_id for async processing.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| image | file (formData) | Required | Image with face to enhance. |
Task Status Endpoint
/api/task-status/{task_id}Get the status of a task and retrieve the processed image URL.
| Name | Type | Required | Description |
|---|---|---|---|
| task_id | string (path) | Required | The ID of the task to get the status for. |
Example Request
curl -X GET "https://taiapi.aiphotocraft.com/api/task-status/{task_id}"-H "accept: application/json"-H "X-Api-Key: YOUR_API_KEY"
Example Response
{
"image_url": "https://taiapi.aiphotocraft.com/results/swapped_image.jpg"
}Response Status Codes
| Status Code | Description |
|---|---|
| 200 | Successfully retrieved task status. |
| 400 | Bad request. |
| 401 | Unauthorized. |
Examples
import requests
url = "https://taiapi.aiphotocraft.com/api/enhance_face"
headers = {
"X-Api-Key": "YOUR_API_KEY",
"accept": "application/json",
}
files = {
"image": ("face.jpg", open("face.jpg", "rb"), "image/jpeg"),
}
response = requests.post(url, headers=headers, files=files)
print(response.status_code, response.text)