Verify Encrypted Information

Last edited on 2025-12-22

This API should be called on the server side and cannot be called directly on the client side (Mini Program, web page, APP, etc.). For details, please refer to API Call Guide.

API English Name: checkEncryptedData

Verify whether the encrypted information was generated by WeChat (currently supports only encrypted phone number data). Only encrypted data generated within the last 3 days can be verified.

1. Call Method

HTTPS Call

POST https://api.weixin.qq.com/wxa/business/checkencryptedmsg?access_token=ACCESS_TOKEN

Encryption Support: This API supports secondary encryption and signature for service communication, which can effectively prevent data tampering and leakage. View Details

Cloud Call

  • This API does not support cloud call.

Third-party Call

  • This API supports third-party platforms on behalf of Merchant call.

  • The permission set ID of this API is: 18

  • After the service provider obtains one of the permission set authorizations, it can use authorizer_access_token to call on behalf of Merchant, for details please refer to Third-party Call documentation.

2. Request Parameters

Query Parameters Query String Parameters

ParameterTypeRequiredDescription
access_tokenstringYesAPI call credential, you can use access_token, authorizer_access_token

Request Body Request Payload

ParameterTypeRequiredDescription
encrypted_msg_hashstringYesThe SHA-256 hash of the encrypted data, encoded as a Hex (Base16) string.

3. Response Parameters

Response Body Response Payload

ParameterTypeDescription
errcodenumberError code
errmsgstringError message
vaildbooleanIndicates whether the data is valid.
create_timenumberTimestamp of when the encrypted data was generated.

4. Notes

No special notes for this API

5. Code Example

Request Example

{
  "encrypted_msg_hash": "657edd868c9715a9bebe42b833269a557a48498785397a796f1568c29a200b2c"
}

Response Example

{
  "errcode": 0,
  "errmsg": "ok",
  "vaild": true,
  "create_time": 1629121902
}

6. Error Codes

The following is the error code list of this API, other error codes can refer to Common Error Codes; When encountering errors in calling the API, you can use the official API Diagnostic Tool to assist in locating and analyzing problems.

Error CodeError DescriptionSolution
-1system errorSystem is busy. Developers, please try again later.
1data not exitThe encrypted data does not exist. This may be because the data generation time exceeds the retention limit (3 days), the key does not exist, or the data does not match the AppID.
40097invalid argsParameter error.
44002empty post dataThe POST data packet is empty. The body parameter for POST requests cannot be empty.
47001data format errorFailed to parse JSON/XML content; parameters are missing in the POST data. Check and correct the data, then retry.

7. Applicable Scope

API callable status for different account types:
Mini ProgramMini Game
✔ ✔
  • ✔:This account type can call this API。
  • Other account types not explicitly declared cannot call this API unless otherwise specified.