Skip to main content
POST
Request Headers
Use images for reference-image batches or mappings for per-face selection. When mappings is supplied it takes precedence; top-level face indexes apply only to the images shortcut. Multi-person targets combine mappings into one primary task and each target face can appear only once. multi_shot=true requires a single-person target and at most 12 references (four outputs per primary task).
Body Attributes Response Attributes

Request examples

Select a scenario below or in the request sample to view matching request and response examples. URLs, IDs and model selections are illustrative; replace them with accessible resources, completed analyses and models available to your account. Response credit values are examples, not price quotations. Poll each returned _id until completion.
Body
For input limits, billing, callbacks, and error codes, see the Hair Swap V5 overview.

Authorizations

x-api-key
string
header
required

Body

application/json
target_url
string<uri>
required

Public target portrait image URL.

mappings
object[]
required

1–50 per-face mappings (at most 12 when multi_shot=true). Takes precedence over images. Each target face can appear once for a multi-person target.

Required array length: 1 - 50 elements
images
string<uri>[]

1–50 reference URLs (at most 12 when multi_shot=true). Supply images or mappings; mappings takes precedence.

Required array length: 1 - 50 elements
multi_shot
boolean

Generate three additional hairstyle views; defaults to false. Single-person targets only.

target_face_index
integer

Zero-based face index for the images shortcut; defaults to 0. When using mappings, set the index on each mappings[] object instead.

Required range: x >= 0
source_face_index
integer

Zero-based face index for the images shortcut; defaults to 0. When using mappings, set the index on each mappings[] object instead.

Required range: x >= 0
model_name
string

Defaults to akool/hair-swap.

webhookUrl
string<uri>

Optional final-state callback URL; follow the Webhook guide.

Response

200 - application/json

Business response. Code 1000 means the request succeeded; inspect task status or data.errors for generation/submission outcomes.

code
integer
Example:

1000

msg
string
Example:

"OK"

data
object