Deprecated
API Reference (Legacy)
Swap Face

Swap Face

Action 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"
}