tencent cloud

Feedback

CreatePerson

Last updated: 2023-02-27 15:22:50

1. API Description

Domain name for API request: iai.tencentcloudapi.com.

This API is used to create a person and add face, name, gender, and other related information.

  • Please use the signature algorithm v3 to calculate the signature in the common parameters, that is, set the SignatureMethod parameter to TC3-HMAC-SHA256.
We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CreatePerson.
Version Yes String Common Params. The value used for this API: 2020-03-03.
Region No String Common Params. This parameter is not required for this API.
GroupId Yes String ID of the group to join, which is the GroupId in the CreateGroup API.
PersonName Yes String Person name, which can contain 1 to 60 characters and is modifiable and repeatable.
PersonId Yes String Person ID, which is unmodifiable, must be unique under a Tencent Cloud account, and can contain letters, digits, and special symbols (-%@#&_) of up to 64 B.
Gender No Integer 0: empty; 1: male; 2: female.
PersonExDescriptionInfos.N No Array of PersonExDescriptionInfo Content of person description field, which is a key-value pair, can contain 0 to 60 characters, and is modifiable and repeatable.
Image No String Base64-encoded image data, which cannot exceed 5 MB.
The long side cannot exceed 4,000 px for images in JPG format or 2,000 px for images in other formats.
PNG, JPG, JPEG, and BMP images are supported, while GIF images are not.
Url No String Image URL. The image cannot exceed 5 MB in size after being Base64-encoded.
The long side cannot exceed 4,000 px for images in JPG format or 2,000 px for images in other formats.
Either Url or Image must be provided; if both are provided, only Url will be used.
We recommend storing the image in Tencent Cloud, as a Tencent Cloud URL can guarantee higher download speed and stability.
The download speed and stability of non-Tencent Cloud URLs may be low.
PNG, JPG, JPEG, and BMP images are supported, while GIF images are not.
UniquePersonControl No Integer This parameter is used to control the judgment whether the face contained in the image in Image or Url corresponds to an existing person in the group.
If it is judged that a duplicate person exists in the group, no new person will be created, and information of the suspected duplicate person will be returned.
Otherwise, the new person will be created.
0: do not judge, i.e., the person will be created no matter whether a duplicate person exists in the group.
1: low duplicate person judgment requirement (1% FAR);
2: average duplicate person judgment requirement (0.1% FAR);
3: high duplicate person judgment requirement (0.01% FAR);
4: very high duplicate person judgment requirement (0.001% FAR).
Default value: 0.
Note: the higher the requirement, the lower the probability of duplicate person. The FARs corresponding to different requirements are for reference only and can be adjusted as needed.
QualityControl No Integer Image quality control.
0: no control.
1: low quality requirement. The image has one or more of the following problems: extreme blurriness, covered eyes, covered nose, and covered mouth.
2: average quality requirement. The image has at least three of the following problems: excessive brightness, excessive dimness, blurriness or average blurriness, covered eyebrows, covered cheeks, and covered chin.
3: high-quality requirement. The image has one to two of the following problems: excessive brightness, excessive dimness, average blurriness, covered eyebrows, covered cheeks, and covered chin.
4: very high-quality requirement. The image is optimal in all dimensions or only has a slight problem in one dimension.
Default value: 0.
If the image quality does not meet the requirement, the returned result will prompt that the detected image quality is unsatisfactory.
NeedRotateDetection No Integer Whether to enable the support for rotated image recognition. 0: no; 1: yes. Default value: 0. When the face in the image is rotated and the image has no EXIF information, if this parameter is not enabled, the face in the image cannot be correctly detected and recognized. If you are sure that the input image contains EXIF information or the face in the image will not be rotated, do not enable this parameter, as the overall time consumption may increase by hundreds of milliseconds after it is enabled.

3. Output Parameters

Parameter Name Type Description
FaceId String Unique ID of face image.
FaceRect FaceRect Position of detected face frame.
Note: this field may return null, indicating that no valid values can be obtained.
SimilarPersonId String PersonId of suspected duplicate person.
This parameter is meaningful only if the UniquePersonControl parameter is not 0 and there is a suspected duplicate person in the group.
FaceModelVersion String Algorithm model version used for face recognition.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Creating person

Input Example

https://iai.tencentcloudapi.com/?Action=CreatePerson
&GroupId=ZhuYuanDormitoryNo1
&PersonName=Junly
&PersonId=2001
&Gender=1
&Url=http://test.image.myqcloud.com/testB.jpg
&PersonExDescriptionInfos.0.PersonExDescriptionIndex=0
&PersonExDescriptionInfos.0.PersonExDescription=School of Computer Science
&PersonExDescriptionInfos.1.PersonExDescriptionIndex=1
&PersonExDescriptionInfos.1.PersonExDescription=Software Engineering
&PersonExDescriptionInfos.2.PersonExDescriptionIndex=2
&PersonExDescriptionInfos.2.PersonExDescription=Class of 2015
&PersonExDescriptionInfos.3.PersonExDescriptionIndex=3
&PersonExDescriptionInfos.3.PersonExDescription=3150808
&<Common request parameters>

Output Example

{
    "Response": {
        "FaceId": "3454816969590585885",
        "SimilarPersonId": "",
        "FaceRect": {
            "X": 172,
            "Y": 122,
            "Width": 178,
            "Height": 228
        },
        "FaceModelVersion": "3.0",
        "RequestId": "738a2fb0-bd4b-4cf6-9c91-18d50978d76b"
    }
}

Example2 Creating person - 2

This example shows you how to create persons.

Input Example

https://iai.tencentcloudapi.com/?Action=CreatePerson
&GroupId=TencentShenZhenEmployee
&PersonName=evanliao
&PersonId=1001
&Gender=1
&Url=http://test.image.myqcloud.com/testA.jpg
&PersonExDescriptionInfos.0.PersonExDescriptionIndex=0
&PersonExDescriptionInfos.0.PersonExDescription=Cloud & Smart Industries Group
&PersonExDescriptionInfos.1.PersonExDescriptionIndex=1
&PersonExDescriptionInfos.1.PersonExDescription=AI Product Center
&PersonExDescriptionInfos.2.PersonExDescriptionIndex=2
&PersonExDescriptionInfos.2.PersonExDescription=Face Recognition Products Group
&<Common request parameters>

Output Example

{
    "Response": {
        "FaceId": "3454816969590585881",
        "SimilarPersonId": "",
        "FaceRect": {
            "X": 172,
            "Y": 122,
            "Width": 178,
            "Height": 228
        },
        "FaceModelVersion": "3.0",
        "RequestId": "269a6bc0-0016-47e8-a63d-517ce4052b0e"
    }
}

Example3 Sample error

This example shows the error that will occur if a person ID already exists.

Input Example

https://iai.tencentcloudapi.com/?Action=CreatePerson
&GroupId=ZhuYuanDormitoryNo1
&PersonName=Cheng
&PersonId=1001
&Gender=2
&Url=http://test.image.myqcloud.com/testD.jpg
&<Common request parameters>

Output Example

{
    "Response": {
        "RequestId": "76dedef7-af27-4a20-9064-c5ef3133926d"
    }
}

Example4 Sample error - 2

This example shows the error that will occur if a group ID does not exist.

Input Example

https://iai.tencentcloudapi.com/?Action=CreatePerson
&GroupId=ShenZhenCitizen
&PersonName=Siccy
&PersonId=3001
&Gender=2
&Url=http://test.image.myqcloud.com/testC.jpg
&<Common request parameters>

Output Example

{
    "Response": {
        "RequestId": "dfa512fc-fd07-4bf1-a292-cb497b620857"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
AuthFailure.InvalidAuthorization Authentication failed.
FailedOperation.ConflictOperation The operations conflict. Do not operate on the same person simultaneously.
FailedOperation.CreateFaceConcurrent Faces cannot be added concurrently.
FailedOperation.DuplicatedGroupDescription The custom description field must be unique in the group.
FailedOperation.FaceQualityNotQualified The face image quality does not meet the requirement.
FailedOperation.FaceSizeTooSmall The face frame size is smaller than the MinFaceSize value, and the face is filtered out.
FailedOperation.GroupInDeletedState The current group is being deleted. Please wait.
FailedOperation.GroupPersonMapExist The ID of the corresponding person is already in the group.
FailedOperation.GroupPersonMapNotExist The ID of the corresponding person is not in the group.
FailedOperation.ImageDecodeFailed Image decoding failed.
FailedOperation.ImageDownloadError An error occurred while downloading the image.
FailedOperation.ImageFacedetectFailed Face detection failed.
FailedOperation.ImageResolutionExceed The image resolution is too high.
FailedOperation.ImageResolutionTooSmall The image short edge resolution is smaller than 64.
FailedOperation.ImageSizeExceed The size of the Base64-encoded image cannot exceed 5 MB.
FailedOperation.RequestLimitExceeded The request frequency exceeds the limit.
FailedOperation.RequestTimeout The backend service timed out.
FailedOperation.SearchFacesExceed The number of faces searched for exceeds the limit.
FailedOperation.ServerError The algorithm service is exceptional. Please retry.
InternalError Internal error.
InvalidParameter.InvalidParameter Invalid parameter.
InvalidParameterValue.AccountFaceNumExceed The number of faces in the account exceeds the limit.
InvalidParameterValue.DeleteFaceNumExceed The number of faces to be deleted exceeds the limit. Every person must have at least one face image.
InvalidParameterValue.GroupExDescriptionsExceed The array length of the group's custom description fields exceeds the limit. Up to 5 fields can be created.
InvalidParameterValue.GroupExDescriptionsNameIdentical The name of the group's custom description field must be unique.
InvalidParameterValue.GroupExDescriptionsNameIllegal The name of the group's custom description field contains invalid characters. It can contain only letters, -, _, and digits.
InvalidParameterValue.GroupExDescriptionsNameTooLong The name of the group's custom description field exceeds the length limit.
InvalidParameterValue.GroupFaceNumExceed The number of faces in the group exceeds the limit.
InvalidParameterValue.GroupIdAlreadyExist The group ID already exists. It must be unique.
InvalidParameterValue.GroupIdIllegal The group ID contains invalid characters. It can contain only letters, digits, and special symbols (-%@#&_).
InvalidParameterValue.GroupIdNotExist The group ID does not exist.
InvalidParameterValue.GroupIdTooLong The group ID exceeds the length limit.
InvalidParameterValue.GroupIdsExceed The list of groups passed in exceeds the limit.
InvalidParameterValue.GroupNameAlreadyExist The group name already exists. It must be unique.
InvalidParameterValue.GroupNameIllegal The group name contains invalid characters. It can contain only letters, -, _, and digits.
InvalidParameterValue.GroupNameTooLong The group name exceeds the length limit.
InvalidParameterValue.GroupNumExceed The number of groups exceeds the limit. If you need more, please contact us.
InvalidParameterValue.GroupNumPerPersonExceed The number of groups exceeds the limit. One person can be added to up to 100 groups.
InvalidParameterValue.GroupTagIllegal The group remarks field contains invalid characters. It can contain only letters, -, _, and digits.
InvalidParameterValue.GroupTagTooLong The group remarks field exceeds the length limit.
InvalidParameterValue.ImageEmpty Empty image.
InvalidParameterValue.LimitExceed The number of returned results exceeds the limit.
InvalidParameterValue.NoFaceInGroups There are no faces in the specified group.
InvalidParameterValue.NoFaceInPhoto There are no faces in the image.
InvalidParameterValue.OffsetExceed The starting number is too large. Please check the length of the array to be requested.
InvalidParameterValue.PersonExDescriptionInfosExceed The array length of the person's custom description fields exceeds the limit. Up to 5 fields are allowed.
InvalidParameterValue.PersonExDescriptionsNameIdentical The name of the person's custom description field must be unique.
InvalidParameterValue.PersonExDescriptionsNameIllegal The name of the person's custom description field contains invalid characters. It can contain only letters, -, _, and digits.
InvalidParameterValue.PersonExDescriptionsNameTooLong The name of the person's custom description field exceeds the length limit.
InvalidParameterValue.PersonFaceNumExceed The number of face images for the person exceeds the limit. One person can have up to 5 face images.
InvalidParameterValue.PersonGenderIllegal An error occurred while setting person gender. 0: empty; 1: male; 2: female.
InvalidParameterValue.PersonIdAlreadyExist The person ID already exists. It must be unique.
InvalidParameterValue.PersonIdIllegal The person ID contains invalid characters. It can contain only letters, digits, and -%@#&_.
InvalidParameterValue.PersonIdNotExist The person ID does not exist.
InvalidParameterValue.PersonIdTooLong The person ID field exceeds the length limit.
InvalidParameterValue.PersonNameIllegal The person name contains invalid characters. It can contain only letters, -, _, and digits.
InvalidParameterValue.PersonNameTooLong The person name exceeds the length limit.
InvalidParameterValue.QualityControlIllegal Invalid QualityControl parameter.
InvalidParameterValue.SearchPersonsExceed The number of persons searched for exceeds the limit.
InvalidParameterValue.UniquePersonControlIllegal Invalid UniquePersonControl parameter.
InvalidParameterValue.UploadFaceNumExceed Up to four faces can be uploaded at a time.
InvalidParameterValue.UrlIllegal Invalid URL format.
LimitExceeded.ErrorFaceNumExceed The number of faces exceeds the limit.
MissingParameter.ErrorParameterEmpty A required parameter is empty.
ResourceUnavailable.Delivering The resource is being shipped.
ResourceUnavailable.Freeze The account is frozen.
ResourceUnavailable.InArrears The account is in arrears.
ResourceUnavailable.LowBalance Insufficient balance.
ResourceUnavailable.NotExist The billing status is unknown. Please check whether the service has been activated in the console.
ResourceUnavailable.Recover The resource has been repossessed.
ResourceUnavailable.StopUsing The service has been suspended for the account.
ResourceUnavailable.UnknownStatus The billing status is unknown.
ResourcesSoldOut.ChargeStatusException The billing status is exceptional.
UnsupportedOperation.UnknowMethod Unknown method name.