> ## 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/export/

将潜在客户分析（全部三种细分：条目计数、转化和来源）下载为文件。

<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>
  与[获取潜在客户分析](/zh/api-reference/management-api/leads/analytics)相同 —— 根据 `filter_by`，为 `lead_id` 或 QR 的 `url_hash`。
</ParamField>

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

<ParamField query="file_format" type="string" default="csv">
  `csv`（每种细分一个 CSV 的 ZIP 压缩包），或 `xls`/`xlsx`（包含三张工作表的工作簿）。
</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/export/?file_format=xlsx&from=2026-08-01&to=2026-08-31' \
    --header 'Authorization: YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{ "q": ["L9c2f4a1e"] }' \
    --output lead_analytics.xlsx
  ```
</RequestExample>

响应是文件下载 —— `csv` 对应 `application/zip`，带有 `Content-Disposition: attachment; filename=lead_analytics.zip`；`xls`/`xlsx` 对应 XLSX MIME 类型，带有 `filename=lead_analytics.xlsx`。与[获取潜在客户分析](/zh/api-reference/management-api/leads/analytics)不同，没有 `type` 筛选 —— 导出始终包含全部三种细分。

如果 `file_format` 无法识别，则返回带纯文本正文的 `400`：

```json 400 theme={null}
{ "detail": "Invalid file format" }
```

## 相关内容

* [获取潜在客户分析](/zh/api-reference/management-api/leads/analytics) —— 带有 `type` 筛选的 JSON 等效端点。
* [管理 API 概述](/zh/api-reference/management-api/overview) —— 此端点所属的身份验证方案和配额体系。


## OpenAPI

````yaml api-reference/openapi/management-api.json POST /lead/analytics/export/
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/export/:
    post:
      summary: Export lead analytics
      operationId: exportManagedLeadAnalytics
      responses:
        '200':
          description: ZIP of CSVs or a multi-sheet XLSX file download.
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.

````