Data APIs are open to all verified Official Accounts. With data APIs, developers can get data that is similar to but more flexible than that of the statistics module in the Official Accounts Platform and can also perform advanced processing operations as needed.

In the Official Account login authorization mechanism, "Interface Summary" APIs belong to the account service authorizations set.


1. The API's Official Account database only stores data after December 1, 2014. Data before this time may not be found or is untrusted dirty data.
2. Developers should save the data obtained by calling the API in their own databases. This will speed up the subsequent visit speed while reducing unnecessary loss in Weixin API call.
3. To ensure that the Official Account data is calculated and processed, query the previous-day data each day before 08:00.

"Interface Summary" APIs refer to the APIs that get the interface summary data in the data statistics module of the Official Accounts Platform. For specific APIs, see the following list (excluding APIs related to user property data):

API Name Maximum Time Span API Calling Address (starting with https)
Get Interface Summary Data (getinterfacesummary) 30
Get Interface Summary Hour Data (getinterfacesummaryhour) 1

The maximum time span is the maximum time range in which data can be acquired when an API is called. For example, a maximum time span of 7 means that data of the past 7 days can be acquired at a time. The actual value of access_token is obtained via the "Get access_token" API.

API Request Format

"Interface Summary" APIs (including the above APIs) post the following sample packet to API calling address:

    "begin_date": "2014-12-07", 
    "end_date": "2014-12-07"

Call Parameters

Parameter Required Description
access_token Yes The credential for API call
begin_date Yes Gets the start date of the data. The difference between begin_date and end_date must be less than the "maximum time span" (for example, when the maximum time span is 1, the difference between begin_date and end_date can only be 0). Otherwise, an error will occur.
end_date Yes Gets the end date of the data. The maximum value of end_date is yesterday.

Response Description

For a successful request, the response JSON packet of the API getinterfacesummary is as follows:

   "list": [ 
           "ref_date": "2014-12-07", 
           "callback_count": 36974, 
           "fail_count": 67, 
           "total_time_cost": 14994291, 
           "max_time_cost": 5044
       }//Followed by data of different ref_date (between begin_date and end_date)

For a successful request, the response JSON packet of the API getinterfacesummaryhour is as follows:

   "list": [ 
           "ref_date": "2014-12-01", 
           "ref_hour": 0, 
           "callback_count": 331, 
           "fail_count": 18, 
           "total_time_cost": 167870, 
           "max_time_cost": 5042
       }//Followed by data of different ref_hour

Response Parameters

Parameter Description
ref_date The date of the data
ref_hour The hour of data
callback_count The number of times the API replies to a user message after receiving it via the configured server URL
fail_count The number of times the above action fails
total_time_cost Total time spent. To get the average time spent, divide total_time_cost by callback_count.
max_time_cost Maximum time spent

When an error occurs, Weixin will return the error code and other information. For the specific error code, see:

Common Error Codes