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

# 报告

> 为项目生成独立的 HTML 可见度报告。

## 生成报告

```http theme={null}
GET /projects/{project_id}/report
```

返回渲染后的 HTML 报告，而不是标准 JSON 响应封装。

### 查询参数

| 参数              | 类型      | 默认值      | 说明                    |
| --------------- | ------- | -------- | --------------------- |
| `duration_days` | integer | `30`     | 1-365 天的回溯窗口          |
| `date_from`     | string  | --       | 明确的开始日期（`YYYY-MM-DD`） |
| `date_to`       | string  | --       | 明确的结束日期（`YYYY-MM-DD`） |
| `format`        | string  | `inline` | `inline` 或 `download` |

同时提供 `date_from` 和 `date_to` 时，它们优先于 `duration_days`。

```bash theme={null}
curl "https://topify-customer-api-production.up.railway.app/api/public/v1/projects/{project_id}/report?duration_days=30&format=download" \
  -H "X-API-Key: tk_live_..." \
  -o topify-report.html
```

使用 `format=download` 时，如果报告服务提供文件名，响应会包含 `Content-Disposition` 请求头。

### 错误响应

| 状态码   | 原因               |
| ----- | ---------------- |
| `403` | API 密钥所属团队无法访问项目 |
| `422` | 日期、天数或格式参数无效     |
| `502` | 报告后端不可用          |
| `504` | 报告生成超过 120 秒超时限制 |
