openApi管理 /重置API调用次数

# 重置 API 调用次数

> 接口应在服务器端调用,详细说明参见[服务端API](https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/backend-api.html)。

## 接口说明

### 接口英文名

clearQuota

### 功能描述

本接口用于清空公众号/小程序/第三方平台等接口的每日调用接口次数。

### 注意事项

1、如果要清空公众号的接口的quota,则需要用公众号的access_token;如果要清空小程序的接口的quota,则需要用[小程序的access_token](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html);如果要清空第三方平台的接口的quota,则需要用[第三方平台的component_access_token](https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/token/component_access_token.html)

2、如果是第三方服务商代公众号或者小程序清除quota,则需要用[authorizer_access_token](https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/token/api_authorizer_token.html)

3、每个帐号每月共10次清零操作机会,清零生效一次即用掉一次机会;第三方帮助公众号/小程序调用时,实际上是在消耗公众号/小程序自身的quota

4、由于指标计算方法或统计时间差异,实时调用量数据可能会出现误差,一般在1%以内

## 调用方式

### HTTPS 调用

```text
POST https://api.weixin.qq.com/cgi-bin/clear_quota?access_token=ACCESS_TOKEN 
```

### 第三方调用

- 调用方式以及出入参和 HTTPS 相同,仅是调用的 token 不同

### 请求参数

| 属性         | 类型   | 必填 | 说明                                                         |
| :----------- | :----- | :--- | :----------------------------------------------------------- |
| access_token | string | 是   | 第三方平台接口调用凭证[authorizer_access_token](https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/token/api_authorizer_token.html),该参数为 URL 参数,非 Body 参数。 |
| appid        | string | 是   | 要被清空的账号的appid                                        |

### 返回参数

| 属性    | 类型   | 说明     |
| :------ | :----- | :------- |
| errcode | number | 错误码   |
| errmsg  | string | 错误信息 |

## 调用示例

> 示例说明: 请求示例:

### 请求数据示例

```json
{
"appid":"wx448f04719cd48f69"
} 
```

### 返回数据示例

```json
{
  "errcode": 0,
  "errmsg": "ok"
} 
```

### 错误码

| 错误码 | 错误码取值                                          | 解决方案                                                     |
| :----- | :-------------------------------------------------- | :----------------------------------------------------------- |
| 48006  | forbid to clear quota because of reaching the limit | api 禁止清零调用次数,因为清零次数达到上限                   |
| 0      | ok                                                  | ok                                                           |
| 40013  | invalid appid                                       | 不合法的 AppID ,请开发者检查 AppID 的正确性,避免异常字符,注意大小写 |

|      |      |      |
| :--- | :--- | :--- |
|      |      |      |
|      |      |      |
|      |      |      |