Face Swap with File Array
POST /api/images/swap_files
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.
Use this when both the selfie and the model images are available as files on the client side.
It is especially useful in offline or desktop apps where all images are local, or where upload URLs are not practical.
๐ 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 |
|---|---|---|
files | array | Array of image files including the selfie and models. |
app | integer | Application ID initiating the request. |
Example cURLโ
curl -X POST https://api.storyface.ai/api/images/swap_files \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F "files=@/path/to/selfie.jpg" \
-F "files=@/path/to/model1.jpg" \
-F "files=@/path/to/model2.jpg" \
-F "app=123"
The first image in the array is interpreted as the source face (selfie). The rest are used as target models for the face swap.
๐ค 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" } |
Each uploaded file must be under 10MB. Larger files will be rejected with a 400 error.
๐งช Test this Endpointโ
We're working on embedding a React-based API tester for real-time interaction.
This documentation will include an interface to try out this endpoint without external tools.