Multiple Face Swap API documentation
Replace multiple distinct faces in one target photo in a single operation. Detection runs inside the task and returns NEEDS_INPUT with indexed previews when mappings are not explicit. The image is billed once, not once per mapping.
Endpoints
| Contract item | Value |
|---|---|
| Capability | multiple-face-swap |
| Submit | POST https://vidmage.ai/api/v1/multiple-face-swap/submit |
| Query | POST https://vidmage.ai/api/v1/multiple-face-swap/query |
| Task identifier | taskId |
| Result field | imageUrl |
Authenticate with Authorization: Bearer YOUR_API_KEY. Save the task identifier and query the same capability. Use a stable Idempotency-Key for submission retries.
Product guide: AI Multi Face Swap API for Photos and Videos
Parameters and input rules
| Field | Type | Required | Default | Meaning and limits |
|---|---|---|---|---|
targetImageUrl | string | Yes | Not specified | Publicly reachable URL of the target photo. |
faceMappings | object[] | Yes | Not specified | One to 20 reference mappings. Omit targetFaceIndex/referenceFaceIndex until get_task_result returns indexed previews, or provide explicit stable indexes. Minimum items: 1Maximum items: 20 |
faceMappings item fields
| Field | Type | Required | Default | Meaning and limits |
|---|---|---|---|---|
targetFaceIndex | integer | No | Not specified | Optional explicit zero-based target face index. Minimum: 0Maximum: 99 |
referenceFaceImageUrl | string | Yes | Not specified | Publicly reachable reference-face image URL. |
referenceFaceIndex | integer | No | Not specified | Optional explicit zero-based face index in the reference image. Minimum: 0Maximum: 99 |
Example request
{
"targetImageUrl": "https://vidmage.ai/assets/images/ai-tools/close-up-group-people.webp",
"faceMappings": [
{
"referenceFaceImageUrl": "https://vidmage.ai/assets/images/samples/smiling-man-sweater.webp"
}
]
}# Set VIDMAGE_IDEMPOTENCY_KEY to a unique value for this task; preserve it for transport retries.
curl -X POST "https://vidmage.ai/api/v1/multiple-face-swap/submit" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: ${VIDMAGE_IDEMPOTENCY_KEY}" \
-H "Content-Type: application/json" \
-d '{"targetImageUrl":"https://vidmage.ai/assets/images/ai-tools/close-up-group-people.webp","faceMappings":[{"referenceFaceImageUrl":"https://vidmage.ai/assets/images/samples/smiling-man-sweater.webp"}]}'
# -> { "success": true, "taskId": "...", "creditsRequired": ..., "creditsConsumed": 0, "usageDeferred": true }Task results and recovery
URL of the completed photo with all requested face mappings applied. Read imageUrl from the completed query response. Preserve taskId while the task is running.
curl -X POST "https://vidmage.ai/api/v1/multiple-face-swap/query" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "taskId": "TASK_ID_FROM_SUBMIT" }'
# -> { "success": true, "data": { "status": "...", "imageUrl": "https://..." } }Submission authorizes this task; provider work and billing can advance during queries. Initial creditsConsumed: 0 does not mean the task is free. A timeout is not a confirmed failure. Recover the existing task instead of resubmitting.
For face selection and error recovery, follow Task lifecycle. MCP uses the normalized taskId argument in get_task_result, including capabilities whose REST identifier is requestId.
Credits
| Component / option | Rate | Minimum |
|---|---|---|
| Per request | 1 credits / image | — |
A fixed credit charge applies to this API request.
Use the Playground or the MCP credit estimator for your exact inputs. Credits and billing.
