Raw HTTP · multipart/form-data

FaceSwapAI REST API cURL examples

Use cURL to inspect the exact production request shape before wrapping it in an application client. Generation requests require a bearer key and consent=true.

Submit

Create an image task

The response contains a task ID, not the final media. Parse it, then call the matching route with a taskId query parameter.

  • Use --fail-with-body to retain API error details.
  • Keep the key in an environment variable.
  • Send actual file parts with @path.
  • Do not retry a generation POST blindly after an ambiguous network failure.
image-swap.shView source
curl --fail-with-body --request POST \
  https://faceswapai.com/api/v1/face-swap/image \
  --header "Authorization: Bearer $FACESWAPAI_API_KEY" \
  --form "sourceImage=@source.jpg" \
  --form "targetImage=@target.jpg" \
  --form "consent=true"

Poll

Read task state from the matching route

Task statusView source
curl --fail-with-body \
  "https://faceswapai.com/api/v1/face-swap/image?taskId=TASK_ID" \
  --header "Authorization: Bearer $FACESWAPAI_API_KEY"