API Notes
head_swap replaces the full head, including the face, hair, contour, and ears. Use face_swap when only the facial region should be replaced
head_swap accepts only the documented fields under input[0].params. Unknown fields are rejected
head_swap is billed using the public model ID. The final charge is returned in the task usage object
Authentication
authorization string required
All APIs require authentication via Bearer Token.
Get API Key:
Visit API Key Management Page to get your API Key.
Usage:
Add to request header:
Authorization: Bearer YOUR_API_KEY
Parameters
model string required
Model ID used for the request
Value: head_swap
input array required
Input array. Provide one object and put model parameters under input[0].params
params
objectrequiredHead Swap parameters
image
stringrequiredTarget image whose head will be replaced. Supports an HTTP or HTTPS URL, or Base64-encoded image data
head_image
stringrequiredReference head image to place onto the target. Supports an HTTP or HTTPS URL, or Base64-encoded image data
seed
integerRandom seed. Use
0or omit the field for random generationRange:
0-2147483647
Polling
Since result generation takes time, you need to poll the task status after creating the task.
The initial response only returns information such as the task ID and initial status. The final result must be obtained by polling the task status endpoint using the task ID.
See the examples on the right for polling requests and responses.
Response Format
error object
Error information, only present when status is failed
code
stringError code
message
stringDetailed error message
output array
Generation results, only present when status is completed
content
arrayList of generated resource content
type
stringResource type
Value:
image|videourl
stringProcessed resource URL
jobId
stringRemote task ID
usage object
Usage statistics, only present when status is completed
cost
stringTotal cost in USD
discount
numberDiscount amount
metadata object
Metadata information