The Developer APIs are still in beta and may change at any time. At this stage, they are better suited to personal testing and experimentation and are not yet recommended for production use.
Playground
Replace one tracked face in a target video with a face from a reference photo. Detection, landmark tracking, and result parsing are handled automatically.
POST /api/v1/video-face-swap/submit → /queryAPI access is available to subscribers only. Your subscription credits are shared across the website and the API.
View plansZero-based index of the tracked target face to replace.
Zero-based index of the detected face to use from the reference photo.
#!/usr/bin/env bash
set -euo pipefail
SUBMIT_RESPONSE="$(curl --fail-with-body --silent --show-error -X POST "https://vidmage.ai/api/v1/video-face-swap/submit" \
-H "Authorization: Bearer ${VIDMAGE_API_KEY}" \
-H "Content-Type: application/json" \
--data-raw '{
"targetVideoUrl": "https://vidmage.ai/assets/models/hailuo-ai-video-generator/skincare-ad.mp4",
"referenceFaceImageUrl": "https://vidmage.ai/assets/images/samples/smiling-man-sweater.webp"
}')"
TASK_ID="$(printf '%s' "$SUBMIT_RESPONSE" | jq -er '.["taskId"]')"
while true; do
QUERY_RESPONSE="$(curl --fail-with-body --silent --show-error -X POST "https://vidmage.ai/api/v1/video-face-swap/query" \
-H "Authorization: Bearer ${VIDMAGE_API_KEY}" \
-H "Content-Type: application/json" \
--data-raw "{\"taskId\":\"${TASK_ID}\"}")"
STATUS="$(printf '%s' "$QUERY_RESPONSE" | jq -r '(.status // .data.status // "") | ascii_downcase')"
case "$STATUS" in
success|succeeded|completed)
printf '%s' "$QUERY_RESPONSE" | jq -r '(.result // .["videoUrl"] // .data["videoUrl"] // empty)'
break
;;
failed|error)
printf '%s' "$QUERY_RESPONSE" | jq -r '(.message // .error // .data.error // "Task failed")' >&2
exit 1
;;
esac
sleep 5
done