Skip to main content

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 endpoint

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

FieldTypeDescription
filesarrayArray of image files including the selfie and models.
appintegerApplication 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"
caution

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โ€‹

StatusDescriptionExample
400Bad request{ "field": "field error message" }
500Internal server error{ "general": "Internal server error" }
danger

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.

Coming Soon

This documentation will include an interface to try out this endpoint without external tools.