> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scanova.io/llms.txt
> Use this file to discover all available pages before exploring further.

# 按端点统计用量

> GET /console/usage/by-endpoint/

返回按端点和 HTTP 方法分组的请求次数——便于查看某个集成实际使用了 Management API 的哪些部分。位于**常规**的 Scanova API 主机（`qcg-api.scanova.io`）上，使用您的仪表盘 OAuth 访问令牌进行身份验证。

## 请求

```
GET https://qcg-api.scanova.io/console/usage/by-endpoint/
Authorization: Bearer <your_oauth_access_token>
```

<ParamField query="environment" type="string" required>
  `sandbox`、`live`、`zapier`、`mcp` 之一。选择要聚合哪些密钥的日志。
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -G "https://qcg-api.scanova.io/console/usage/by-endpoint/" \
    -H "Authorization: Bearer <your_oauth_access_token>" \
    -d environment=live
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  [
    { "endpoint": "https://management.scanova.io/qr/", "method": "GET", "count": 2140, "error_rate": 0.004 },
    { "endpoint": "https://management.scanova.io/qr/", "method": "POST", "count": 318, "error_rate": 0.03 },
    { "endpoint": "https://management.scanova.io/qrcode/QR7K9M2XN/", "method": "PUT", "count": 96, "error_rate": 0.0 }
  ]
  ```
</ResponseExample>

### 响应字段

响应是一个数组，日志中出现的每一个不同的 `(endpoint, method)` 组合对应一个条目，按 `count` 降序排列。

<ResponseField name="endpoint" type="string">
  被记录的完整请求 URL，包含路径参数的实际值（例如某个具体的 `qrid`）——而不是规范化的路由模板。如果您用不同的 ID 调用过路径参数化的路由，预期会看到许多不同的条目。
</ResponseField>

<ResponseField name="method" type="string">
  请求的 HTTP 方法，例如 `GET`、`POST`、`PUT`、`DELETE`。
</ResponseField>

<ResponseField name="count" type="integer">
  针对此端点/方法组合记录的请求总数。
</ResponseField>

<ResponseField name="error_rate" type="number">
  针对此端点/方法组合的请求中，返回状态码为 `400` 或以上的比例（`0`–`1`）。
</ResponseField>

<Note>
  与[用量统计](/zh/api-reference/management-api/tokens/usage-stats)和[每日用量](/zh/api-reference/management-api/tokens/usage-daily)不同，此端点没有 `period`/`days` 时间窗口——它会在完整的日志保留期内进行聚合（请求日志会在 6 个月后被清除）。
</Note>

## 错误

`environment` 为必填项，校验规则与[用量统计](/zh/api-reference/management-api/tokens/usage-stats#errors)相同。

## 相关内容

* [用量统计](/zh/api-reference/management-api/tokens/usage-stats) —— 同样的流量数据，以单一的滚动时间窗口总计呈现，而不是按端点细分。
* [每日用量](/zh/api-reference/management-api/tokens/usage-daily) —— 同样的流量数据，按日历日而不是按路由拆分。
* [Management API 概览](/zh/api-reference/management-api/overview) —— 本端点据以聚合的 `environment` 取值（`sandbox`、`live`、`zapier`、`mcp`）。


## OpenAPI

````yaml api-reference/openapi/management-api.json GET /console/usage/by-endpoint/
openapi: 3.1.0
info:
  title: Scanova Management API (v2)
  description: >-
    The complete Scanova Management API — every endpoint available at
    management.scanova.io (QR codes, folders, tags, leads, forms, analytics,
    plans, shared users & roles), plus the token-creation and usage-stats
    endpoints used to authenticate against it. Every path and request/response
    shape below was verified live against a real API key and the actual running
    backend (Phase 7, 2026-08-16) — not guessed from reading urls.py alone.
  version: 2.0.0
servers:
  - url: https://management.scanova.io
    description: Management API — QR/folder/tag/lead/form/analytics/plans endpoints
security:
  - apiKeyAuth: []
paths:
  /console/usage/by-endpoint/:
    get:
      summary: Usage by endpoint
      operationId: getUsageByEndpoint
      parameters:
        - name: environment
          in: query
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Usage grouped by endpoint
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Send your Management API key as the raw value of the Authorization
        header — no "Bearer " or "Token " prefix, and no other characters.
        Example: `Authorization: 401f7ac837da42b97f613d789819ff93537bee6a`. A
        header containing more than one space-separated part is rejected
        outright. Requests also require the request's Host header to be the
        management API host (e.g. management.scanova.io) — the same key sent to
        the regular API host will not authenticate.

````