MuseSpark
MuseSpark
Models & toolsTools

Video Face Swap API guide

Video Face Swap API: Replace a face in a video using a face reference and optional target selection.

Model overview

Replace a face in a video using a face reference and optional target selection.

API integration

DocumentationValue
API invocation identifiervideo-face-swap
IntegrationAsync task API

Use this invocation identifier in API requests. Check your authorized model catalog for access. Follow the Quickstart for your first complete call.

Request parameters

Studio presets describe the form setup, not guaranteed server defaults. Send preset values explicitly to reproduce them.

videostringNon-nullRequired

The video that contains the face to be replaced.

face_imagestringNon-nullRequired

The face image as reference.

target_genderstringNon-nullOptional

Only swap target faces matching this gender. 'all' swaps regardless of gender.

Allowed values: "all", "male", "female".

Studio preset: "all".

target_indexintegerNon-nullOptional

Use 0 for the largest face, 1 for the next target face, and so on.

Value: minimum 0; maximum 10.

Studio preset: 0.

No parameters match. Clear the search or reset the filters.

Model rules

Parameter meaning

  • target_index selects a face when multiple faces are detected: 0 is the largest, 1 the next largest.

Request examples

Replace example media URLs and YOUR_... input identifiers with your own valid resources. Examples are checked against the exported item schema; media access and paid execution are separate runtime checks.

Set MUSESPARK_API_KEY and a stable MUSESPARK_REQUEST_ID before submitting. Preserve the request ID for retries of the same request and use a new ID for new work. Python examples use requests; JavaScript examples use Node.js 20 or later. The standalone Quickstart includes task polling and recovery.

Replace the largest face in a video

curl --fail-with-body 'https://api.musespark.ai/api/v1/openapi/task' \
  -H "Authorization: Bearer $MUSESPARK_API_KEY" \
  -H "X-Idempotency-Key: $MUSESPARK_REQUEST_ID" \
  -H 'Content-Type: application/json' \
  -d '{
  "item_key": "video-face-swap",
  "parameters": {
    "target_index": 0,
    "target_gender": "all",
    "video": "https://example.com/adult-interview.mp4",
    "face_image": "https://example.com/adult-face-reference.jpg"
  }
}'

Parameters used: target_index · target_gender · video · face_image.

Output

The intended result is a processed or generated video asset.

Creation returns a task ID inside data. Poll that task until completion, then save data.result.output_urls and any data.result.batch_results. See the task lifecycle for terminal states, result retention, and errors.

Troubleshooting

The input does not match the intended operation. target_index selects a face when multiple faces are detected: 0 is the largest, 1 the next largest.

target_index

For rejected inputs, check the field type, accepted values, and conditional requirements in Request parameters and Model rules. Correct the affected fields before submitting again.

If creation times out, preserve the request identity and any known task ID. Follow Errors, timeouts and retries before submitting again.

The public input snapshot was exported on 2026-11-09. Current prices and availability are listed in the model center.