> ## 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 /analytics/report/

将一个异步任务加入队列，为一组 QR 码、一个标签或一个文件夹生成扫描数据和/或分析报告。

<Note>
  需要具有 `MANAGEMENT_API`（或 `MANAGEMENT_API_SANDBOX`）配额的管理 API 密钥 —— 参见[管理 API 概述](/zh/api-reference/management-api/overview) —— 以及账户自身的 `EXPORT_ANALYTICS_REPORT` 配额和 `ANALYTICS_CAN_EXPORT_REPORT` 权限。
</Note>

<ParamField body="filter_type" type="string" required>
  `filter_data` 所标识的内容：`qrcode`、`tag` 或 `folder`。
</ParamField>

<ParamField body="filter_data" type="string" required>
  标识目标的 JSON 编码字符串 —— 例如当 `filter_type` 为 `qrcode` 时，一个 `qrid` 的 JSON 数组。
</ParamField>

<ParamField body="start_date" type="string" required>
  起始日期（`YYYY-MM-DD`）。
</ParamField>

<ParamField body="end_date" type="string" required>
  结束日期（`YYYY-MM-DD`）。
</ParamField>

<ParamField body="report_type" type="string" default="both">
  `scan_data`、`analytics` 或 `both`。
</ParamField>

<ParamField body="analytics_format" type="string" default="csv">
  分析部分的文件格式：`csv`、`xls`、`xlsx`、`png`、`jpeg` 或 `pdf`。
</ParamField>

<ParamField body="scan_format" type="string" default="csv">
  扫描数据部分的文件格式：与 `analytics_format` 相同的选项。
</ParamField>

<ParamField body="advance_filter" type="object">
  叠加在 `filter_type`/`filter_data` 之上的可选附加 JSON 筛选负载。
</ParamField>

<ParamField body="exclude_bot_scan" type="boolean" default="false">
  从报告中排除被识别为机器人流量的扫描。
</ParamField>

<ParamField body="is_saved" type="boolean" default="false">
  是否将此报告保留为可重复使用的已保存预设 —— 参见[更新已保存的分析报告](/zh/api-reference/management-api/analytics/report-update)。
</ParamField>

<ParamField body="saved_name" type="string">
  已保存预设的名称，当 `is_saved` 为 `true` 时必填。每个账户内必须唯一 —— 重复会返回 `400`。
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.scanova.io/analytics/report/' \
    --header 'Authorization: YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
      "filter_type": "qrcode",
      "filter_data": "[\"Q07afe81aa0034c01\"]",
      "start_date": "2026-08-01",
      "end_date": "2026-08-31",
      "report_type": "both",
      "analytics_format": "xlsx",
      "scan_format": "csv"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "id": 59,
    "filter_type": "qrcode",
    "filter_data": "[\"Q07afe81aa0034c01\"]",
    "start_date": "2026-08-01",
    "end_date": "2026-08-31",
    "report_type": "both",
    "analytics_format": "xlsx",
    "scan_format": "csv",
    "status": "new",
    "report_file": null,
    "completed_on": null,
    "is_saved": false,
    "saved_name": null,
    "created": "2026-09-08T10:20:00Z",
    "requested_by_name": "Docs"
  }
  ```
</ResponseExample>

任务入队后调用会立即返回 `201`，`status` 为 `"new"` —— 报告本身在后台生成，完成后账户会收到电子邮件通知。请查询[列出分析报告](/zh/api-reference/management-api/analytics/report-list)以获取 `status` 和 `report_file`。

## 相关内容

* [列出分析报告](/zh/api-reference/management-api/analytics/report-list) —— 查询任务状态。
* [更新已保存的分析报告](/zh/api-reference/management-api/analytics/report-update) —— 重命名或管理已保存的预设。
* [管理 API 概述](/zh/api-reference/management-api/overview) —— 此端点所属的身份验证方案和配额体系。


## OpenAPI

````yaml api-reference/openapi/management-api.json POST /analytics/report/
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:
  /analytics/report/:
    post:
      summary: Generate an analytics report
      description: >-
        Queues an async job that generates a scan-data and/or analytics report
        for the given QR codes, tags, or folders. Returns immediately — poll
        [List analytics
        reports](/api-reference/management-api/analytics/report-list) for
        `status`.
      operationId: createAnalyticsReport
      requestBody:
        content:
          application/json:
            example:
              filter_type: qrcode
              filter_data: '["Q07afe81aa0034c01"]'
              start_date: '2026-08-01'
              end_date: '2026-08-31'
              report_type: both
              analytics_format: xlsx
              scan_format: csv
      responses:
        '201':
          description: Report job queued.
          content:
            application/json:
              example:
                id: 59
                filter_type: qrcode
                filter_data: '["Q07afe81aa0034c01"]'
                start_date: '2026-08-01'
                end_date: '2026-08-31'
                report_type: both
                analytics_format: xlsx
                scan_format: csv
                status: new
                report_file: null
                completed_on: null
                is_saved: false
                saved_name: null
                created: '2026-09-08T10:20:00Z'
                requested_by_name: Docs
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: YOUR_API_KEY`. 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.

````