> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trae.cn/llms.txt?lang=zh
> Use this file to discover all available pages before exploring further.

查询指定成员当前的用量限额，包括 TRAE 内置模型和企业内置模型的成员个人限额配置。

## 所需权限 {#hc0zThr48}

`quota:read`

## 请求说明 {#hAhXNYHkE}

* 请求方式：`POST`
* 请求地址：`{域名}/openapi/v1/quota/query_user_usage_quota`

## 请求参数 {#请求参数}

### 请求头参数 {#请求头参数}

<!-- @cols-width: 172,122,608 -->
| **Header 参数**  | **是否必填**  | **描述**  |
| --- | --- | --- |
| `Authorization`  | 是  | 固定取值为 `Bearer {access_token}`。关于如何获取访问令牌，参考[鉴权](enterprise_authentication)。  |
| `Content-Type`  | 是  | 固定取值为 `application/json`。  |

### 请求体参数 {#hNlTmDAlk}

<!-- @cols-width: 116,112,121,100,463 -->
| **参数**  | **类型**  | **是否必填**  | **默认值**  | **描述**  |
| --- | --- | --- | --- | --- |
| `emails`  | string[]  | 条件必填  | \-  | 目标成员的邮箱列表。与 `user_ids` 至少传入一个。 | \
| | | | | | \
| | | | | 成员的邮箱可以通过 “[获取成员列表](/enterprise_get-user-list)” 接口获取。  |
| `user_ids`  | string[]  | 条件必填  | \-  | 目标成员的 ID 列表。与 `emails` 至少传入一个。 | \
| | | | | | \
| | | | | 成员的 ID 可以通过 “[获取成员列表](/enterprise_get-user-list)” 接口获取。  |

:::tip 提示
单次请求支持同时传入 `emails` 和 `user_ids`。系统会根据邮箱或用户 ID 解析成员，并对重复成员自动去重。去重后，单次请求最多支持传入 50 个成员。
:::

## 响应参数 {#hyEJsNtkL}

该接口独有的响应参数如下。通用响应参数参考[此文档](/enterprise_general-response-schema)。

<!-- @cols-width: 225,110,580 -->
| **参数**  | **类型**  | **描述**  |
| --- | --- | --- |
| `trae_model_quota_type`  | string  | 企业当前对 TRAE 内置模型采用的用量计算模式。取值： | \
| | | | \
| | | * `token`：按 Token 计，仅旧企业版套餐使用。 | \
| | | * `price`：按金额计（单位：元），仅新企业版套餐使用。  |
| `pooling_enabled`  | bool  | 企业当前是否已启用 “共享额度池（池化）” 功能。该功能仅对新旗舰版套餐和 TRAE 内置模型生效。详情参考[共享额度池](/enterprise_pooled-usage)。  |
| `quota_granularity`  | string  | 企业当前的额度配置粒度。取值： | \
| | | | \
| | | * `all`：为全部模型设置一个总额度。 | \
| | | * `per_model`：为每个模型单独设置额度。  |
| `users`  | array  | 已查询到的成员用量限额信息。具体字段说明参考[设置成员的用量限额](/enterprise_set-usage-limits-for-members)。  |
| `not_found_users`  | string[]  | 未查询到或不属于当前企业的成员标识。  |

## 示例 {#示例}

### 请求示例 {#ho0MLpU8l}

```Bash
curl -X POST "${HOST}/openapi/v1/quota/query_user_usage_quota" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "emails": ["john@example.com", "alice@example.com"],
    "user_ids": ["123456"]
  }'
```

### 响应示例 {#hYeIfhQwC}

```JSON
{
  "code": 0,
  "message": "success",
  "request_id": "req_xxx",
  "data": {
    "trae_model_quota_type": "price",
    "pooling_enabled": true,
    "quota_granularity": "all",
    "users": [
      {
        "email": "john@example.com",
        "user_id": "123456",
        "basic_quota": 20,
        "total_excess_quota": 5000,
        "trae_model_excess_quota": [],
        "custom_model_excess_quota": [
          {
            "name": "Enterprise-GPT",
            "token_quota": 10000000
          }
        ]
      }
    ],
    "not_found_users": ["alice@example.com"]
  }
}
```

## 错误码 {#hp2HG0jSo}

若该接口的请求返回错误码，参考[错误码](/enterprise_error-codes)文档进行排查。
