Skip to main content
POST
Generate Video Face Swap
GIF Face Swap uses the same endpoint as Video Face Swap. Pass a GIF link as reference_video and you get a face-swapped GIF back.
The response returns data.img_uuid. Poll Task Detail or use a callback to get the result.

Request

Leave out start_time and end_time to swap the whole GIF. Set output_format: "mp4" to get a video instead, for example when the range is longer than 30 seconds.

Limits

Pricing

Billed by the actual length of the range, with the same rates as Video Face Swap (1 token = $0.02 USD). Anything shorter than 2 seconds is billed as 2 seconds. There is no extra charge for GIF output. Totals are rounded to whole tokens. Examples at upscaler: 1:
  • A 1.2-second GIF costs 2 tokens ($0.04).
  • A 4-second GIF costs 4 tokens ($0.08).
To quote a GIF, use the model name mx-video-face-swap and include the GIF link plus the range:

Output

  • The GIF loops forever and keeps the frame rate of the source, capped at 15 fps.
  • Size: never larger than the source GIF, and at most 480 pixels wide and 854 pixels tall.
  • The result keeps the duration of the requested range.
  • Because the output is at most 480 pixels wide, upscaler: 2 rarely makes a visible difference for GIFs.

Result

In Task Detail and callbacks, a GIF result has type: "image" and a .gif link. Show it with an <img> tag.
With output_format: "mp4" the result is a normal video: type: "video" and an .mp4 link.

Multiple people

To swap several people in one GIF, scan it first with Video Face Scan, then follow the multi-person face swap steps. The GIF rules on this page still apply.

Headers

Authorization
string
required

Body

application/json
upscaler
enum<integer>
required

Convert video resolution, 1 -> 720p, 2-> 1080p (1.5x price)

Available options:
1,
2
start_time
number
required

The start time of the conversion (in seconds). Optional when reference_video is a GIF (default 0).

Required range: 0 <= x <= 120
end_time
number
required

Conversion end time (in seconds). Optional when reference_video is a GIF (default: end of the GIF). For videos the range must be 2-120 seconds; for GIFs it can be shorter than 2 seconds (billed as 2).

Required range: 0 <= x <= 120
reference_video
string

Target video or GIF URL. Supported: .mp4, .mov, .avi, .wmv, .flv, .webm (max 100MB) and .gif (max 20MB, at least 2 frames). The format is taken from the extension in the URL path. Required for single-person swaps. Ignored when scan_id is set (the scanned video is used).

reference_img
string

Face image URL (the face to put into the video), max 10 MB. Required for single-person swaps. Ignored when scan_id is set (use faces instead).

scan_id
string

Optional. Multi-person mode: the img_uuid returned by POST /api/v1/videofaceswap/scan. The scan must belong to your account, have finished successfully and be less than 7 days old. Must be sent together with faces.

Example:

"8d3f2a61-5b7c-4e0a-9f12-3c4d5e6f7a8b"

faces
object[]

Optional. Multi-person mode: which scanned people to swap and with which face. 1-6 entries, each person at most once. People not listed stay unchanged. The same reference_img can be used for several people (for example, when the scan split one person into two groups). Must be sent together with scan_id.

Required array length: 1 - 6 elements
enhance_face
boolean

enable (1.5x price)

output_format
enum<string>

Optional. Result format. Defaults to gif when reference_video is a .gif, otherwise mp4. GIF output is limited to 30 seconds, loops, keeps the source frame rate up to 15 fps and fits within 480×854. GIF results are returned with type "image".

Available options:
mp4,
gif
custom_callback_url
string<uri>

Optional. A publicly accessible HTTPS URL. When the task status changes (processing / success / failed), GoEnhance sends a POST request to this URL. The request body is identical to the response of GET /api/v1/jobs/detail. If your server does not respond with HTTP 200, the notification is retried up to 3 times, with a 3-second timeout per attempt.

Example:

"https://your-server.com/goenhance/callback"

Response

code
integer
required
msg
string
required
data
object
required