API Reference
Switch Face

Switch Face

Action SwitchFace

Introduction

This interface is used for human face replacement.

Request

Parameter NameTypeDescriptionRequired
ActionStringThe corresponding API instruction name
PublicKeyStringUser's public key, which can be obtained from the PICPIK User Center (opens in a new tab)
SignatureStringUser's signature generated based on the public key and API instruction, see Signature for details
request_uuidStringRequest UUID, randomly generated by using the UUID generation method. This parameter can be utilized to manage the requests of your business and clients.
Parameter NameTypeDescriptionRequired
RawImageBase64The raw image encoded in Base64
RawFaceIndexIntThe index of a face in the raw image to be replaced (1~100). Default: 1
NewFaceImageBase64The new face image encoded in Base64

Request Example

{
	"Action": "SwitchFace",
	"PublicKey": "ALLak9M4cNdHXKOJAJJ4k8Hh1hZS2EgJF1D0FlPwfl",
	"Signature": "e5f881d1b60b8fbcbdfb0621c4f25834f24121dd",
	"request_uuid": "0ec48649-44d1-49ed-80ab-9c905dd7a65b",
	"RawImage": "data:image/jpeg;base64,xxx",
	"NewFaceImage": "data:image/jpeg;base64,bbb",
	"RawFaceIndex": 1
}

Response

Field NameTypeDescriptionRequired
RetCodeIntReturn status code: 0 indicates a successful return, while non-zero indicates a failure
ActionStringInstruction name
MessageStringThe error message is returned when RetCode is non-zero, providing a detailed description
request_uuidStringReturns the UUID that was included in the request
Parameter NameTypeDescriptionRequired
TaskUIDStringTask UID, used to query task details and get results

Response Example

{
	"Action": "RestoreFaces",
	"RetCode": 0,
	"Message": "",
	"request_uuid": "8482d350-04f9-421b-817b-1d98b3a4dcfa",
	"TaskUID": "cktlm6lrh4miq8ng9nf0"
}