typerequired "image" | "multi_face_image" | "gif" | "video" | Discriminator. Accepts image, multi_face_image, gif, and video. multi_face_image uses per-face source mappings to mirror the web multi-face image flow. |
source_url string (URL, https only) | Required for image, gif, and single-source video; omitted when face_swaps provides per-face source_url mappings. Public HTTPS URL of the face image to swap in. Fetched server-side through the SSRF guard (DoH-resolved, blocks private/loopback/link-local/cloud-metadata ranges). |
target_urlrequired string (URL, https only) | Public HTTPS URL of the target image, GIF, or video. MIME and size enforced server-side: ≤ image cap for type=image, ≤ GIF cap for type=gif, ≤ video cap for type=video. |
target_face_index integer ≥ 0 | Optional. Index of the target face to replace when the target contains multiple faces. |
enable_face_enhancer boolean | Optional. Run the face-enhancer post-processor on the result. |
reference_frame_time_seconds number ≥ 0 | type=gif or type=video. Seconds into the moving target to source the reference face match from. |
duration_seconds number > 0 | type=gif or type=video. Caller-declared duration used by the pricing helper. |
file_size_bytes integer > 0 | type=gif or type=video. Caller-declared byte size used by the pricing helper. |
keep_audio boolean | type=video only. Defaults to true, matching the web video swap flow that preserves the original audio track. |
face_swaps array | type=multi_face_image: required array of { face_index, source_url, enable_face_enhancer? }. type=video: optional array of { frame_time_seconds, face_index, source_url } for web-style multi-face video swaps. When omitted for video, source_url drives a single-face swap. |
webhook_url string (URL, https only) | Optional. HTTPS URL the platform POSTs the terminal-state webhook to. Validated with the same SSRF guard as media URLs at create time. |
metadata object | Optional opaque key/value bag echoed back on the swap object. Not interpreted by the platform. |