Face Swap with Model ID Array
POST /api/images/swap_file_ids
This endpoint enables the swapping of faces between an image containing a face uploaded from the client device and a set of model images also uploaded as files. The processed results are stored and returned as an array of URLs.
Best for scenarios where the model library is already preloaded and identified by unique IDs.
Using model IDs avoids the need to upload model images with every request, reducing bandwidth and increasing processing speed.
๐ Authenticationโ
This endpoint requires a valid Bearer Token in the Authorization header.
Authorization: Bearer YOUR_API_TOKEN
๐ฅ Requestโ
Content-Type: multipart/form-data
| Field | Type | Description |
|---|---|---|
face | file | The selfie image to use as the source face. |
model_ids | string | Comma-separated list of model IDs from the database. |
app | integer | The application ID initiating the request. |
Example cURLโ
curl -X POST https://api.storyface.ai/api/images/swap_file_ids \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F "face=@/path/to/selfie.jpg" \
-F "model_ids=12,45,102" \
-F "app=123"
Ensure the provided model IDs are valid and belong to your application context. Invalid IDs will result in an error response.
๐ค Responseโ
{
"urls": [
"https://cdn.storyface.ai/images/swap_result_1.jpg",
"https://cdn.storyface.ai/images/swap_result_2.jpg"
]
}
โ ๏ธ Error Responsesโ
| Status | Description | Example |
|---|---|---|
| 400 | Bad request | { "field": "field error message" } |
| 500 | Internal server error | { "general": "Internal server error" } |
The selfie image (face) must be a valid JPEG or PNG and under 10MB in size.
๐งช Test this Endpointโ
An interactive test component will be embedded soon to allow real-time testing from this documentation.
This documentation will include an interface to try out this endpoint without external tools.