Retrieve the recent usage data for Mini Program of a specific paid feature.

View Markdown

Last edited on 2026-02-08

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: getRecentAverageUsage

Mini Program can use this API to query the average usage of a specific paid feature over the last three months.

1. Call Method

HTTPS Call

GET https://api.weixin.qq.com/wxa/charge/usage/get_recent_average?access_token=ACCESS_TOKEN

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

ParameterTypeRequiredExampleDescription
access_tokenstringYesACCESS_TOKENAPI call credential, you can use access_token, authorizer_access_token

Request Body Request Payload

ParameterTypeRequiredDescription
spuIdstringYesProduct SPU ID

3. Response Parameters

Response Body Response Payload

ParameterTypeDescription
errcodenumberError Code
errmsgstringError Message
averageDatanumberAverage monthly usage, which has been obfuscated and is not an exact value. Note: When the return value of `averageData` is 50, it means the recent average usage for Mini Program is less than or equal to 50 times/month, not specifically exactly 50 times per month.

4. Notes

No special notes for this API

5. Code Example

Request Example

GET https://api.weixin.qq.com/wxa/charge/usage/get_recent_average?access_token=ACCESS_TOKEN&spuId=10000077

Response Example

{
    "errcode": 0,
    "errmsg": "ok",
    "averageData": 260000
}

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 Description
10120002Invalid parameters
10120700Invalid `spuId`
10122000No recent usage data available for this product

7. Applicable Scope

This API supports 「Mini Program」 account type calls. Other account types cannot call unless otherwise specified.