our logo

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_KEY

Example 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

POST/api/batch_couple_faceswap

Batch 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

NameTypeRequiredDescription
femaleImagestring (body)RequiredURL of the female reference image.
maleImagestring (body)RequiredURL of the male reference image.
srcImagesarray (body)RequiredArray of source images to process. Each item contains 'image' (URL string) and 'reverse' (boolean, currently ignored).

Task Status Endpoint

GET/api/task-status/{task_id}

Get the status of a task and retrieve the processed image URL.

NameTypeRequiredDescription
task_idstring (path)RequiredThe 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 CodeDescription
200Successfully retrieved task status.
400Bad request.
401Unauthorized.

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

POST/api/enhance_face

Enhance 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

NameTypeRequiredDescription
imagefile (formData)RequiredImage with face to enhance.

Task Status Endpoint

GET/api/task-status/{task_id}

Get the status of a task and retrieve the processed image URL.

NameTypeRequiredDescription
task_idstring (path)RequiredThe 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 CodeDescription
200Successfully retrieved task status.
400Bad request.
401Unauthorized.

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)