FaceSwap
Couple Swap

API for Couple Face Swapper

Authentication

An API key is required for all requests. You can generate an API key from the developers tab in your dashboard.

Header Attributes

ParameterValue
X-sourceweb
X-api-keyYOUR_API_KEY

Couple Face Swap

Request URL

MethodURL
POSThttp://aiapi.aiphotocraft.com/api/faceswap/faceswap2 (opens in a new tab)

Body Parameters

ParameterTypeDescriptionRequired
srcimagefileSource image for swapYes*
targetimagefileTarget image for swapYes*
swap_indexstringTuple of indexes to swap (Example: "2,1")No
enhancestringEither 'true' or 'false'. Enhance the result after swapYes*

*Required parameters

Face Position and Swap Index

By default, the API swaps faces based on position (left-to-left, right-to-right). This means:

  • If both images have similar face positioning (e.g., female on left, male on right in both images), no swap_index is needed.
  • If face positions differ between images (e.g., female on left in source but on right in target), you should use swap_index=2,1 to correctly swap the faces.

The swap_index parameter controls which face in the target image gets mapped to which face in the source image:

  • Default (no swap_index): Maps in position order (1→1, 2→2)
  • swap_index=2,1: Reverses the mapping (1→2, 2→1)

Response

The API returns the processed image with the faces swapped according to the specified parameters.

Response Content Type

application/json

Response Codes

CodeDescription
201Swap successful
400Bad request

Error Handling

The API will return appropriate error codes and messages if there's an issue with your request.

Example

curl -X POST \
  http://aiapi.aiphotocraft.com/api/faceswap/faceswap2 \
  -H 'X-source: web' \
  -H 'X-api-key: YOUR_API_KEY' \
  -F 'srcimage=@/path/to/source.jpg' \
  -F 'targetimage=@/path/to/target.jpg' \
  -F 'swap_index=2,1' \
  -F 'enhance=true'