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: getApiQuota
This interface is used to query the daily call quota, number of calls, and frequency limits for server-side APIs. Applicable account types: Official Accounts/Service Accounts/ Mini Program /Mini Games/WeChat Stores/Shopping Assistant/Video Account Assistant/Affiliate Marketing Agencies/Mobile Apps/Web Apps/Multi-Platform Apps/Third-Party Platforms, etc.
1. Call Method
HTTPS Call
POST https://api.weixin.qq.com/cgi-bin/openapi/quota/get?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 to call using component_access_token, and also supports calling on behalf of Merchant call.
-
After the service provider obtains any permission set authorization, 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
| Parameter | Type | Required | Description |
|---|---|---|---|
| access_token | string | Yes | API call credential, you can use access_token, component_access_token, authorizer_access_token |
Request Body Request Payload
| Parameter | Type | Required | Description |
|---|---|---|---|
| cgi_path | string | Yes | The request URL for the API, such as "/cgi-bin/message/custom/send". Do not include the “https://api.weixin.qq.com” prefix, and ensure the “/” is present; otherwise, error code 76003 will occur. |
3. Response Parameters
Response Body Response Payload
| Parameter | Type | Description |
|---|---|---|
| errcode | number | Response code |
| errmsg | string | Error message |
| quota | object | Quota details |
| rate_limit | object | Regular call frequency limit |
| component_rate_limit | object | Authorized call frequency limit |
Res.quota Object Payload
Quota details
| Parameter | Type | Description |
|---|---|---|
| daily_limit | number | Number of times the account can call this API on the current day |
| used | number | Number of times already called on the current day |
| remain | number | Remaining number of calls available for the day |
Res.rate_limit Object Payload
Regular call frequency limit
| Parameter | Type | Description |
|---|---|---|
| call_count | number | Total number of calls allowed within a period, in units of times |
| refresh_second | number | Update interval, in seconds |
Res.component_rate_limit Object Payload
Authorized call frequency limit
| Parameter | Type | Description |
|---|---|---|
| call_count | number | Total number of calls allowed within a period, in units of times |
| refresh_second | number | Update interval, in seconds |
4. Notes
-
If the API being queried belongs to an Official Account, the Official Account’s access_token is required; if it belongs to Mini Program, the ** Mini Program ’s** access_token (api_token) is needed; if it belongs to a third-party platform, the third-party platform’s component_access_token is required, and so on.
-
If the API is from a third-party platform but is used for Official Accounts/ Mini Program, the third-party platform’s authorizer_access_token must be used.
-
Each API has a limit on the number of calls, so developers should use these APIs responsibly.
-
Interfaces of the type “/xxx/sns/xxx” do not support this query and will result in error code 76022.
-
If the API documentation specifies special quota amounts or logic, those details shall take precedence over general rules.
5. Code Example
Request Example
{
"cgi_path": "/wxa/gettemplatedraftlist"
}
Response Example
{
"errcode": 0,
"errmsg": "ok",
"quota": {
"daily_limit": 0,
"used": 0,
"remain": 0
}
}
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 Code | Error Description | Solution |
|---|---|---|
| 0 | ok | ok |
| 76021 | cgi_path not found, please check | The *cgi_path* value is incorrect. |
| 76022 | could not use this cgi_path,no permission | The token used in the current API call does not match the account associated with the API. For details, please refer to the notes section. |
7. Applicable Scope
| Mini Program | Official Account | Service Account | Mini Game | WeChat Shop | Alliance Agency | Influencer | Shop Supplier | Third-party Platform | Mobile App | Website App | Channels Window | Multi-platform App |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | 〇 | ✔ | ✔ | ✔ | ✔ |
- ✔:This account type can call this API。
- 〇:Third-party platforms can use component_access_token to call. For calling on behalf of Merchant, please refer to the Call Method section。