API Reference (Legacy)
Swap Face

Swap Face

API GenerateSwapFace

Introduction

⚠️

This interface is no longer maintained.

This interface is used for Swapping Face

Request

Parameter NameTypeDescriptionRequired
ActionstringThe corresponding API command name, the current API is GenerateSwapFace
PublicKeystringUser's public key, can be obtained from User Center (opens in a new tab)
SignaturestringUser signature generated based on public key and API command, see Signature
request_uuidstringRequest UUID, randomly generated using UUID generation method
ModelTypestringModel type, reference value: combined_modelcustom_model. To use the official model provided by PICPIK, you need to fill in combined_model, and to use a self-trained or uploaded model, you need to fill in custom_model
MainModelIdintMain model ID, if ModelType is combined_model, fill in the Id of SystemPreInstallModels, otherwise fill in the Id of SelfMainModels
StepsintIteration steps 1~150
ReferenceImagestringReference image base64
FaceImagestringFace image base64
FaceIndexintIndex of faces in pictures, start with 1
UseCustomMainModelVaeboolUsing main model VAE ,true means use main model VAE,default false

Request Example

{
    "Action":"GenerateSwapFace",
    "PublicKey":"ALLak9M4cNdHXKOJAJJ4k8Hh1hZS2EgJF1D0FlPwfl",
    "request_uuid":"b91fcfbe-bb35-47ce-a168-bd6252c75270",
    "Signature":"4b0e2666680e03641c1ad2eb3863d2089e67995b",
    "ModelType":"combined_model",
    "MainModelId":1,
    "Steps":20,
    "ReferenceImage":"data:image/jpeg;base64,xxx",
    "FaceImage":"data:image/jpeg;base64,xxx",
    "FaceIndex":1
}

Response

Parameter NameTypeDescriptionRequired
RetCodeintReturn status code, 0 for successful return, non-zero for failure
ActionstringOperation command name
MessagestringReturn error message, provide detailed description when RetCode is non-zero
TaskUIDstringTask UID, used to query task details and get results

Response Example

{
    "Action":"",
    "RetCode":0,
    "Message":"",
    "TaskUID":"cjr997tleg738lelk3n0"
}