> ## 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.

# 获取潜在客户分析

> POST /lead/analytics/

返回一个或多个潜在客户列表的聚合分析（条目计数、转化细分和流量来源）。

<Note>
  需要具有 `MANAGEMENT_API`（或 `MANAGEMENT_API_SANDBOX`）配额和 `LEAD_GENERATION_ANALYTICS_CAN_VIEW` 权限的管理 API 密钥，作为原始 `Authorization` 标头值发送 —— 参见[管理 API 概述](/zh/api-reference/management-api/overview)。
</Note>

<ParamField body="q" type="array" required>
  标识要分析的潜在客户列表的字符串数组 —— 根据 `filter_by` 的值，为 `lead_id` 或 QR 的 `url_hash`。
</ParamField>

<ParamField body="filter_by" type="string" default="lead_id">
  `lead_id`（默认）或 `qr_hash`。
</ParamField>

<ParamField query="type" type="string" default="entries_count">
  要计算的以逗号分隔的子集，取自 `entries_count`、`leads_conversion`、`source`。
</ParamField>

<ParamField query="from" type="string">
  起始日期（`YYYY-MM-DD`）。默认为 `to` 之前 7 天。
</ParamField>

<ParamField query="to" type="string">
  结束日期（`YYYY-MM-DD`）。默认为今天。
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.scanova.io/lead/analytics/?type=entries_count,leads_conversion,source&from=2026-08-01&to=2026-08-31' \
    --header 'Authorization: YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{ "q": ["L9c2f4a1e"], "filter_by": "lead_id" }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "entries_count": {
      "total": 14,
      "elevation": { "percent": 12, "previous": 12, "type": "+", "period": { "start": "2026-07-01", "end": "2026-08-01" } }
    },
    "leads_conversion": {
      "all": [["2026-08-01", 3], ["2026-08-02", 1]],
      "leads": [["2026-08-01", 2], ["2026-08-02", 1]],
      "skip": [["2026-08-01", 1], ["2026-08-02", 0]]
    },
    "source": [["Booth QR", 9.0], ["Flyer QR", 5.0]]
  }
  ```
</ResponseExample>

当所请求周期及其之前的对比周期均为零条目时，`elevation` 为 `null`，以避免出现误导性的百分比。如果 `q` 缺失或为空，则在 `q` 下返回 `400` —— 此端点的契约是 `{"q": [...], "filter_by": "..."}`，而不是较旧的、不兼容的 `{"lead_list": [...], "date_from": "...", "date_to": "..."}` 形式。

## 相关内容

* [导出潜在客户分析](/zh/api-reference/management-api/leads/analytics-export) —— 将这些细分数据作为文件下载。
* [列出潜在客户列表](/zh/api-reference/management-api/leads/list) —— 查找要分析的 `lead_id` 值。
* [管理 API 概述](/zh/api-reference/management-api/overview) —— 此端点所属的身份验证方案和配额体系。


## OpenAPI

````yaml api-reference/openapi/management-api.json POST /lead/analytics/
openapi: 3.1.0
info:
  title: Scanova Management API (v2)
  description: >-
    The complete Scanova Management API — every endpoint available at
    api.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://api.scanova.io
    description: Management API — QR/folder/tag/lead/form/analytics/plans endpoints
security:
  - apiKeyAuth: []
paths:
  /lead/analytics/:
    post:
      summary: Get lead analytics
      operationId: getManagedLeadAnalytics
      responses:
        '200':
          description: Aggregated analytics for the requested lead lists.
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. api.scanova.io) — the same key sent to the
        regular API host will not authenticate.

````