{ "openapi": "3.1.0", "info": { "title": "Mintlify Analytics Export API", "version": "1.0.0", "description": "用于导出文档 Analytics 数据的 API" }, "servers": [ { "url": "https://api.mintlify.com", "description": "生产环境" } ], "components": { "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer", "description": "Authorization 请求头需要使用 Bearer 令牌。请使用管理员 API 密钥。这是仅供服务端使用的机密密钥。你可以在控制台的 [API 密钥页面](https://dashboard.mintlify.com/settings/organization/api-keys) 中生成一个。" } }, "schemas": { "projectId": { "type": "string", "description": "你的项目 ID,可在控制台的 [API keys](https://dashboard.mintlify.com/settings/organization/api-keys) 页面中复制。" }, "FeedbackResponse": { "type": "object", "properties": { "feedback": { "type": "array", "description": "反馈条目的列表。", "items": { "anyOf": [ { "description": "当来源为 `contextual` 时返回。包含用户是否认为页面有帮助以及可选的联系邮箱。", "type": "object", "properties": { "id": { "type": "string", "description": "反馈的唯一标识符。" }, "path": { "type": "string", "description": "源文档的路径或 URL。" }, "comment": { "type": [ "string", "null" ], "description": "用户提交的反馈内容。" }, "createdAt": { "type": [ "string", "null" ], "description": "提交该反馈时的时间戳。" }, "source": { "type": "string", "enum": [ "code_snippet", "contextual", "agent", "thumbs_only" ], "description": "反馈的来源类型。`code_snippet` 表示针对代码块的反馈,`contextual` 表示页面级别的反馈,`agent` 表示由第三方 AI Agent 提交的反馈,`thumbs_only` 表示点赞/点踩投票。" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "resolved", "dismissed" ], "description": "该反馈当前的审核状态。" }, "helpful": { "type": "boolean", "description": "用户是否认为该内容有帮助。" }, "contact": { "type": [ "string", "null" ], "description": "用户提供的用于后续联系的电子邮件地址。" } }, "required": [ "id", "path", "comment", "createdAt", "source", "status", "helpful", "contact" ] }, { "description": "当来源为 `code_snippet` 时返回。包含反馈所涉及代码片段的代码、文件名和编程语言。", "type": "object", "properties": { "id": { "type": "string", "description": "该反馈的唯一标识符。" }, "path": { "type": "string", "description": "源文档的路径或 URL。" }, "comment": { "type": [ "string", "null" ], "description": "用户提交的反馈内容。" }, "createdAt": { "type": [ "string", "null" ], "description": "提交该反馈时的时间戳。" }, "source": { "type": "string", "enum": [ "code_snippet", "contextual", "agent", "thumbs_only" ], "description": "反馈的来源类型。`code_snippet` 表示针对代码块的反馈,`contextual` 表示页面级别的反馈,`agent` 表示由第三方 AI Agent 提交的反馈,`thumbs_only` 表示点赞/点踩投票。" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "resolved", "dismissed" ], "description": "反馈当前的审核状态。" }, "code": { "type": "string", "description": "与该反馈相关的代码片段。" }, "filename": { "type": [ "string", "null" ], "description": "与代码片段关联的文件名。" }, "lang": { "type": [ "string", "null" ], "description": "代码片段所使用的编程语言。" } }, "required": [ "id", "path", "comment", "createdAt", "source", "status", "code", "filename", "lang" ] }, { "description": "当来源为 `thumbs_only` 时返回。表示对页面的点赞或点踩投票,不含书面评论。包含用户是否认为页面有帮助。", "type": "object", "properties": { "id": { "type": "string", "description": "反馈的唯一标识符。" }, "path": { "type": "string", "description": "源文档的路径或 URL。" }, "comment": { "type": [ "string", "null" ], "description": "用户反馈评论的正文内容。" }, "createdAt": { "type": [ "string", "null" ], "description": "提交该反馈时的时间戳。" }, "source": { "type": "string", "enum": [ "code_snippet", "contextual", "agent", "thumbs_only" ], "description": "反馈的来源类型。`code_snippet` 表示针对代码块的反馈,`contextual` 表示页面级别的反馈,`agent` 表示由第三方 AI Agent 提交的反馈,`thumbs_only` 表示点赞/点踩投票。" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "resolved", "dismissed" ], "description": "反馈当前的审核状态。" }, "helpful": { "type": "boolean", "description": "用户是否认为该内容有帮助。" } }, "required": [ "id", "path", "comment", "createdAt", "source", "status", "helpful" ] }, { "description": "当来源为 `agent` 时返回。仅包含基本反馈字段。", "type": "object", "properties": { "id": { "type": "string", "description": "反馈的唯一标识符。" }, "path": { "type": "string", "description": "源文档的路径或 URL。" }, "comment": { "type": [ "string", "null" ], "description": "用户反馈评论的正文内容。" }, "createdAt": { "type": [ "string", "null" ], "description": "提交该反馈时的时间戳。" }, "source": { "type": "string", "enum": [ "code_snippet", "contextual", "agent", "thumbs_only" ], "description": "反馈的来源类型。`code_snippet` 表示针对代码块的反馈,`contextual` 表示页面级别的反馈,`agent` 表示由第三方 AI Agent 提交的反馈,`thumbs_only` 表示点赞/点踩投票。" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "resolved", "dismissed" ], "description": "反馈当前的审核状态。" } }, "required": [ "id", "path", "comment", "createdAt", "source", "status" ] } ] } }, "nextCursor": { "type": [ "string", "null" ], "description": "用于获取下一页结果的游标。如果没有更多结果,则为 null。" }, "hasMore": { "type": "boolean", "description": "当前页之后是否还有更多结果。" } }, "required": [ "feedback", "nextCursor", "hasMore" ] }, "AnalyticsErrorResponse": { "type": "object", "properties": { "error": { "type": "string", "description": "描述错误原因的错误信息。" }, "details": { "type": "array", "description": "关于该错误的其他详细信息。", "items": { "type": "object", "properties": { "message": { "type": "string", "description": "对某个特定校验或处理错误的说明。" } }, "required": [ "message" ] } } }, "required": [ "error" ] }, "AssistantConversationsResponse": { "type": "object", "properties": { "conversations": { "type": "array", "description": "AI 助手会话列表。", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "此轮次的唯一标识符。多轮会话中的每一行都有不同的 `id`。" }, "conversationId": { "type": "string", "description": "该轮次所属会话的标识符。同一会话中的各行共享相同的 `conversationId`。可将其作为获取 AI 助手会话线程端点的 `threadId` 使用。" }, "timestamp": { "type": "string", "description": "开启该轮次的用户消息的时间戳。" }, "query": { "type": "string", "description": "用户向 AI 助手提出的问题。" }, "response": { "type": "string", "description": "AI 助手的回答。对于澄清问题轮次,这是 AI 助手向用户提出的追问。" }, "responseType": { "type": "string", "enum": [ "answer", "clarifying_question" ], "description": "返回给用户的响应类型。`answer` 表示最终回答。`clarifying_question` 表示 AI 助手向用户提出了追问,而没有直接作答。当该字段不存在时,默认值为 `answer`。" }, "sources": { "type": "array", "description": "在回答中被引用的文档页面。", "items": { "type": "object", "properties": { "title": { "type": "string", "description": "被引用文档页面的标题。" }, "url": { "type": "string", "description": "被引用文档页面的 URL。" } }, "required": [ "title", "url" ] } }, "resolutionStatus": { "type": "string", "enum": [ "answered", "unanswered" ], "description": "助手是否成功回答了此轮次。按行计算:当助手将问题标记为现有文档未涵盖时,值为 `unanswered`。如果会话被记录为未回答(例如因为某个响应失败),且没有任何轮次被标记为未涵盖,则该会话中的每个轮次都为 `unanswered`。否则为 `answered`。" }, "queryCategory": { "type": [ "string", "null" ], "description": "会话自动分配的分类分组(如适用)。" }, "feedback": { "type": [ "string", "null" ], "enum": [ "positive", "negative", null ], "description": "用户对 AI 助手响应的点赞或点踩评价。`positive` 表示点赞,`negative` 表示点踩,`null` 表示用户未评价该响应。" }, "pageUrl": { "type": [ "string", "null" ], "description": "会话开始时所在文档页面的完整 URL。如果没有捕获页面路径,则为 null。" } }, "required": [ "id", "conversationId", "timestamp", "query", "response", "sources", "resolutionStatus", "queryCategory", "feedback", "pageUrl" ] } }, "nextCursor": { "type": [ "string", "null" ], "description": "用于获取下一页结果的游标;如果没有更多结果则为 null。" }, "hasMore": { "type": "boolean", "description": "指示在当前页之外是否还有更多可用结果。" } }, "required": [ "conversations", "nextCursor", "hasMore" ] }, "FeedbackGroupedByPageResponse": { "type": "object", "properties": { "feedback": { "type": "array", "description": "按文档页面路径汇总的反馈数量。", "items": { "type": "object", "properties": { "path": { "type": "string", "description": "文档页面路径。" }, "thumbsUp": { "type": "number", "description": "正面(点赞)上下文反馈的数量。" }, "thumbsDown": { "type": "number", "description": "负面(点踩)上下文反馈的数量。" }, "code": { "type": "number", "description": "代码片段反馈的数量。" }, "total": { "type": "number", "description": "该页面的反馈总数。" } }, "required": [ "path", "thumbsUp", "thumbsDown", "code", "total" ] } }, "hasMore": { "type": "boolean", "description": "当前页之后是否还有更多结果。" } }, "required": [ "feedback", "hasMore" ] }, "SearchesResponse": { "type": "object", "properties": { "searches": { "type": "array", "description": "按搜索次数降序排列的搜索词。", "items": { "type": "object", "properties": { "searchQuery": { "type": "string", "description": "用户输入的搜索词。" }, "hits": { "type": "number", "description": "该搜索词被搜索的次数。" }, "ctr": { "type": "number", "description": "该搜索词的搜索中点击了某个具体搜索结果的百分比(点击次数 ÷ 搜索次数 × 100)。点击包括用指针选择结果,或在结果高亮时按 Enter。仅提交查询不算点击。在搜索栏中点击 AI 助手或按 Enter 使用它,算作一次没有点击的搜索,此字段不会单独记录。" }, "topClickedPage": { "type": [ "string", "null" ], "description": "该查询点击次数最多的结果路径(如有)。" }, "lastSearchedAt": { "type": "string", "description": "该搜索词最近一次被搜索的时间戳。" } }, "required": [ "searchQuery", "hits", "ctr", "topClickedPage", "lastSearchedAt" ] } }, "totalSearches": { "type": "integer", "minimum": 0, "description": "所请求日期范围内的搜索事件总数(所有搜索次数之和,而非不同查询的数量)。" }, "nextCursor": { "type": [ "string", "null" ], "description": "用于获取下一页的不透明分页游标。没有更多结果时为 null。" } }, "required": [ "searches", "totalSearches", "nextCursor" ] }, "ViewsTrafficTotals": { "type": "object", "properties": { "human": { "type": "number", "description": "全站来自人类读者的内容浏览事件数。" }, "ai": { "type": "number", "description": "全站来自 AI 机器人的内容浏览事件数。" }, "total": { "type": "number", "description": "全站内容浏览事件数。" } }, "required": [ "human", "ai", "total" ] }, "ViewsByPageResponse": { "type": "object", "properties": { "totals": { "$ref": "#/components/schemas/ViewsTrafficTotals", "description": "该日期范围内的全站浏览总数。" }, "views": { "type": "array", "description": "各页面的浏览数。", "items": { "type": "object", "properties": { "path": { "type": "string", "description": "文档页面路径。" }, "human": { "type": "number", "description": "该路径上来自人类的内容浏览事件数。" }, "ai": { "type": "number", "description": "该路径上来自 AI 机器人的内容浏览事件数。" }, "total": { "type": "number", "description": "该路径上的内容浏览事件总数。" } }, "required": [ "path", "human", "ai", "total" ] } }, "hasMore": { "type": "boolean", "description": "当前页之后是否还有更多结果。" } }, "required": [ "totals", "views", "hasMore" ] }, "AssistantThreadResponse": { "type": "object", "properties": { "threadId": { "type": "string", "description": "AI 助手会话线程标识符(ULID)。" }, "createdAt": { "type": "string", "description": "线程创建时间戳。" }, "messages": { "type": "array", "description": "该线程中按顺序排列的消息列表。", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "消息的唯一标识符。" }, "role": { "type": "string", "enum": [ "user", "assistant" ], "description": "该消息由用户还是 AI 助手发送。" }, "content": { "type": "string", "description": "消息的文本内容。" }, "createdAt": { "type": "string", "description": "消息发送时间戳。" } }, "required": [ "id", "role", "content", "createdAt" ] } } }, "required": [ "threadId", "createdAt", "messages" ] }, "AssistantCallerStatsResponse": { "type": "object", "properties": { "web": { "type": "number", "description": "从网页端(文档站点)发起的助手会话数。" }, "api": { "type": "number", "description": "从 API 调用发起的助手会话数。" }, "other": { "type": "number", "description": "从其他来源(例如集成、SDK)发起的助手会话数。" }, "total": { "type": "number", "description": "所有调用方类型的助手会话总数。" } }, "required": [ "web", "api", "other", "total" ] }, "VisitorsTrafficTotals": { "type": "object", "properties": { "human": { "type": "number", "description": "全站人类唯一访客数。" }, "ai": { "type": "number", "description": "全站 AI 机器人唯一访客数。" }, "total": { "type": "number", "description": "全站有任意有效浏览的近似去重访客数(在人类和 AI 之间去重)。" } }, "required": [ "human", "ai", "total" ] }, "VisitorsByPageResponse": { "type": "object", "properties": { "totals": { "$ref": "#/components/schemas/VisitorsTrafficTotals", "description": "该日期范围内的全站唯一访客总数。" }, "visitors": { "type": "array", "description": "各页面的访客数。", "items": { "type": "object", "properties": { "path": { "type": "string", "description": "文档页面路径。" }, "human": { "type": "number", "description": "人类唯一访客数。" }, "ai": { "type": "number", "description": "AI 机器人唯一访客数。" }, "total": { "type": "number", "description": "在该路径上有任意有效浏览的近似去重访客数(在人类和 AI 之间去重)。" } }, "required": [ "path", "human", "ai", "total" ] } }, "hasMore": { "type": "boolean", "description": "当前页之后是否还有更多结果。" } }, "required": [ "totals", "visitors", "hasMore" ] } }, "parameters": { "projectId": { "schema": { "$ref": "#/components/schemas/projectId" }, "required": true, "name": "projectId", "in": "path" } } }, "paths": { "/v1/analytics/{projectId}/feedback": { "get": { "summary": "列出反馈", "description": "列出用户反馈,支持可选筛选和分页。\n\n使用管理员 API 密钥进行身份验证。", "tags": [ "Analytics" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/projectId" }, { "schema": { "type": "string", "description": "ISO 8601 或 YYYY-MM-DD 格式的日期", "example": "2024-01-01" }, "required": false, "name": "dateFrom", "in": "query" }, { "schema": { "type": "string", "description": "ISO 8601 或 YYYY-MM-DD 格式的日期。`dateTo` 为不包含在内的上界。结果包括指定日期之前的所有日期,但不包括指定日期当天。", "example": "2024-01-01" }, "required": false, "name": "dateTo", "in": "query" }, { "schema": { "type": "string", "enum": [ "code_snippet", "contextual", "agent", "thumbs_only" ], "description": "按反馈来源进行筛选" }, "required": false, "name": "source", "in": "query" }, { "schema": { "type": "string", "description": "用于筛选的以逗号分隔的状态列表" }, "required": false, "name": "status", "in": "query" }, { "schema": { "type": "number", "minimum": 1, "maximum": 100, "default": 50, "description": "每页返回的最大结果数" }, "required": false, "name": "limit", "in": "query" }, { "schema": { "type": "string", "description": "分页游标" }, "required": false, "name": "cursor", "in": "query" } ], "responses": { "200": { "description": "包含分页信息的反馈数据", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FeedbackResponse" } } } }, "400": { "description": "某个查询参数无效,例如日期格式错误或 `limit` 超出允许范围,或者项目 ID 格式错误。响应正文会说明具体错误。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyticsErrorResponse" } } } }, "401": { "description": "API 密钥缺失或无效,或者你的方案不包含 API 访问权限。" }, "403": { "description": "你的请求来自不在该 API 密钥允许列表中的 IP 地址。" }, "404": { "description": "该项目不存在或不属于你的组织。" }, "429": { "description": "你已超出分析端点的速率限制。" }, "500": { "description": "发生意外的服务器错误。请重试该请求。如果错误仍然存在,请联系支持团队。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyticsErrorResponse" } } } } } } }, "/v1/analytics/{projectId}/feedback/by-page": { "get": { "summary": "按页面获取反馈", "description": "获取按文档页面路径汇总的反馈数量,包括上下文反馈的点赞和点踩数、代码片段反馈数以及每个页面的总数。\n\n使用管理员 API 密钥进行身份验证。", "tags": [ "Analytics" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/projectId" }, { "schema": { "type": "string", "description": "ISO 8601 或 YYYY-MM-DD 格式的日期", "example": "2024-01-01" }, "required": false, "name": "dateFrom", "in": "query" }, { "schema": { "type": "string", "description": "ISO 8601 或 YYYY-MM-DD 格式的日期。`dateTo` 为不包含在内的上界。结果包括指定日期之前的所有日期,但不包括指定日期当天。", "example": "2024-01-01" }, "required": false, "name": "dateTo", "in": "query" }, { "schema": { "type": "number", "minimum": 1, "maximum": 100, "default": 10, "description": "每页返回的最大结果数" }, "required": false, "name": "limit", "in": "query" }, { "schema": { "type": "string", "enum": [ "code_snippet", "contextual", "agent", "thumbs_only" ], "description": "按反馈来源进行筛选" }, "required": false, "name": "source", "in": "query" }, { "schema": { "type": "string", "description": "用于筛选的以逗号分隔的状态列表" }, "required": false, "name": "status", "in": "query" } ], "responses": { "200": { "description": "带分页标志的按页面反馈汇总", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FeedbackGroupedByPageResponse" } } } }, "400": { "description": "某个查询参数无效,例如日期格式错误或 `limit` 超出允许范围,或者项目 ID 格式错误。响应正文会说明具体错误。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyticsErrorResponse" } } } }, "401": { "description": "API 密钥缺失或无效,或者你的方案不包含 API 访问权限。" }, "403": { "description": "你的请求来自不在该 API 密钥允许列表中的 IP 地址。" }, "404": { "description": "该项目不存在或不属于你的组织。" }, "429": { "description": "你已超出分析端点的速率限制。" }, "500": { "description": "发生意外的服务器错误。请重试该请求。如果错误仍然存在,请联系支持团队。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyticsErrorResponse" } } } } } } }, "/v1/analytics/{projectId}/assistant": { "get": { "summary": "列出 AI 助手会话", "description": "列出 AI 助手会话历史,支持分页。\n\n使用管理员 API 密钥进行身份验证。", "tags": [ "Analytics" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/projectId" }, { "schema": { "type": "string", "description": "ISO 8601 或 YYYY-MM-DD 格式的日期", "example": "2024-01-01" }, "required": false, "name": "dateFrom", "in": "query" }, { "schema": { "type": "string", "description": "ISO 8601 或 YYYY-MM-DD 格式的日期。`dateTo` 为不包含在内的上限。结果将包含早于该日期的记录,但不包含该日期当天的记录。", "example": "2024-01-01" }, "required": false, "name": "dateTo", "in": "query" }, { "schema": { "type": "number", "minimum": 1, "maximum": 1000, "default": 100, "description": "每页返回的最大结果数" }, "required": false, "name": "limit", "in": "query" }, { "schema": { "type": "string", "format": "ulid", "description": "分页游标(ULID 格式)" }, "required": false, "name": "cursor", "in": "query" } ], "responses": { "200": { "description": "包含分页信息的会话数据", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AssistantConversationsResponse" } } } }, "400": { "description": "某个查询参数无效,例如日期格式错误或 `limit` 超出允许范围,或者项目 ID 格式错误。响应正文会说明具体错误。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyticsErrorResponse" } } } }, "401": { "description": "API 密钥缺失或无效,或者你的方案不包含 API 访问权限。" }, "403": { "description": "你的请求来自不在该 API 密钥允许列表中的 IP 地址。" }, "404": { "description": "该项目不存在或不属于你的组织。" }, "429": { "description": "你已超出分析端点的速率限制。" }, "500": { "description": "发生意外的服务器错误。请重试该请求。如果错误仍然存在,请联系支持团队。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyticsErrorResponse" } } } } } } }, "/v1/analytics/{projectId}/assistant/threads/{threadId}": { "get": { "summary": "获取 AI 助手会话线程", "description": "获取单个 AI 助手会话线程的完整消息转录。线程 ID 可从 AI 助手会话端点获取,或在支持路由使用 **Link** 模式时,作为 AI 助手支持 URL 上追加的 `threadId` 查询参数获取。\n\n使用管理员 API 密钥进行身份验证。", "tags": [ "Analytics" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/projectId" }, { "schema": { "type": "string", "format": "ulid", "description": "AI 助手会话线程 ID(ULID)。" }, "required": true, "name": "threadId", "in": "path" } ], "responses": { "200": { "description": "会话转录", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AssistantThreadResponse" } } } }, "400": { "description": "线程 ID 无效,或项目 ID 格式错误。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyticsErrorResponse" } } } }, "401": { "description": "API 密钥缺失或无效,或者你的方案不包含 API 访问权限。" }, "403": { "description": "你的请求来自不在该 API 密钥允许列表中的 IP 地址。" }, "404": { "description": "该线程不存在,或该项目不存在或不属于你的组织。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyticsErrorResponse" } } } }, "429": { "description": "你已超出分析端点的速率限制。" }, "500": { "description": "发生意外的服务器错误。请重试该请求。如果错误仍然存在,请联系支持团队。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyticsErrorResponse" } } } } } } }, "/v1/analytics/{projectId}/assistant/caller-stats": { "get": { "summary": "获取 AI 助手调用方统计", "description": "获取在指定日期范围内发起的助手会话按调用方类型(网页端、API 和其他)划分的数量明细。\n\n使用管理员 API 密钥进行身份验证。", "tags": [ "Analytics" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/projectId" }, { "schema": { "type": "string", "description": "ISO 8601 或 YYYY-MM-DD 格式的日期", "example": "2024-01-01" }, "required": false, "name": "dateFrom", "in": "query" }, { "schema": { "type": "string", "description": "ISO 8601 或 YYYY-MM-DD 格式的日期。`dateTo` 为不包含在内的上限。结果将包含早于该日期的记录,但不包含该日期当天的记录。", "example": "2024-01-01" }, "required": false, "name": "dateTo", "in": "query" } ], "responses": { "200": { "description": "按调用方类型划分的助手会话数", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AssistantCallerStatsResponse" } } } }, "400": { "description": "某个查询参数无效,例如日期格式错误或 `limit` 超出允许范围,或者项目 ID 格式错误。响应正文会说明具体错误。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyticsErrorResponse" } } } }, "401": { "description": "API 密钥缺失或无效,或者你的方案不包含 API 访问权限。" }, "403": { "description": "你的请求来自不在该 API 密钥允许列表中的 IP 地址。" }, "404": { "description": "该项目不存在或不属于你的组织。" }, "429": { "description": "你已超出分析端点的速率限制。" }, "500": { "description": "发生意外的服务器错误。请重试该请求。如果错误仍然存在,请联系支持团队。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyticsErrorResponse" } } } } } } }, "/v1/analytics/{projectId}/searches": { "get": { "summary": "列出搜索查询", "description": "列出该日期范围内的文档搜索词,按搜索次数降序排列并支持分页。每一行包括点击率、该查询点击次数最多的结果路径(如有)以及该搜索词最近一次被搜索的时间。`totalSearches` 是同一日期范围内搜索查询事件的总数(所有搜索次数之和,而非不同查询的数量)。\n\n使用管理员 API 密钥进行身份验证。", "tags": [ "Analytics" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/projectId" }, { "schema": { "type": "string", "description": "ISO 8601 或 YYYY-MM-DD 格式的日期", "example": "2024-01-01" }, "required": false, "name": "dateFrom", "in": "query" }, { "schema": { "type": "string", "description": "ISO 8601 或 YYYY-MM-DD 格式的日期。`dateTo` 为不包含在内的上界。结果包括指定日期之前的所有日期,但不包括指定日期当天。", "example": "2024-01-01" }, "required": false, "name": "dateTo", "in": "query" }, { "schema": { "type": "number", "minimum": 1, "maximum": 100, "default": 50, "description": "每页返回的最大搜索词数量(按搜索次数降序排列)" }, "required": false, "name": "limit", "in": "query" }, { "schema": { "type": "string", "description": "来自上一次响应的不透明分页游标" }, "required": false, "name": "cursor", "in": "query" } ], "responses": { "200": { "description": "带分页的搜索词汇总", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SearchesResponse" } } } }, "400": { "description": "某个查询参数或 `cursor` 无效,例如日期格式错误或 `limit` 超出允许范围,或者项目 ID 格式错误。响应正文会说明具体错误。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyticsErrorResponse" } } } }, "401": { "description": "API 密钥缺失或无效,或者你的方案不包含 API 访问权限。" }, "403": { "description": "你的请求来自不在该 API 密钥允许列表中的 IP 地址。" }, "404": { "description": "该项目不存在或不属于你的组织。" }, "429": { "description": "你已超出分析端点的速率限制。" }, "500": { "description": "发生意外的服务器错误。请重试该请求。如果错误仍然存在,请联系支持团队。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyticsErrorResponse" } } } } } } }, "/v1/analytics/{projectId}/views": { "get": { "summary": "获取页面浏览量", "description": "获取按路径和全站统计的内容浏览事件数,并区分人类和 AI 流量。\n\n使用管理员 API 密钥进行身份验证。", "tags": [ "Analytics" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/projectId" }, { "schema": { "type": "string", "description": "ISO 8601 或 YYYY-MM-DD 格式的日期", "example": "2024-01-01" }, "required": false, "name": "dateFrom", "in": "query" }, { "schema": { "type": "string", "description": "ISO 8601 或 YYYY-MM-DD 格式的日期。`dateTo` 为不包含在内的上界。结果包括指定日期之前的所有日期,但不包括指定日期当天。", "example": "2024-01-01" }, "required": false, "name": "dateTo", "in": "query" }, { "schema": { "type": "integer", "minimum": 1, "maximum": 250, "default": 50, "description": "每页返回的最大结果数(1-250,默认 50)。分页时,在 hasMore 为 true 期间将 offset 按 limit 递增。" }, "required": false, "name": "limit", "in": "query" }, { "schema": { "type": "integer", "minimum": 0, "default": 0, "description": "要跳过的行数。按页访问时使用 offset = (page - 1) * limit。" }, "required": false, "name": "offset", "in": "query" } ], "responses": { "200": { "description": "全站和按路径统计的内容浏览事件数", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ViewsByPageResponse" } } } }, "400": { "description": "某个查询参数无效,例如日期格式错误或 `limit` 超出允许范围,或者项目 ID 格式错误。响应正文会说明具体错误。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyticsErrorResponse" } } } }, "401": { "description": "API 密钥缺失或无效,或者你的方案不包含 API 访问权限。" }, "403": { "description": "你的请求来自不在该 API 密钥允许列表中的 IP 地址。" }, "404": { "description": "该项目不存在或不属于你的组织。" }, "429": { "description": "你已超出分析端点的速率限制。" }, "500": { "description": "发生意外的服务器错误。请重试该请求。如果错误仍然存在,请联系支持团队。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyticsErrorResponse" } } } } } } }, "/v1/analytics/{projectId}/visitors": { "get": { "summary": "获取唯一访客", "description": "按流量类型获取按路径和全站统计的近似去重访客数。`total` 字段在人类和 AI 之间去重(即有任意有效内容浏览的不同访客 ID 的并集)。\n\n使用管理员 API 密钥进行身份验证。", "tags": [ "Analytics" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/projectId" }, { "schema": { "type": "string", "description": "ISO 8601 或 YYYY-MM-DD 格式的日期", "example": "2024-01-01" }, "required": false, "name": "dateFrom", "in": "query" }, { "schema": { "type": "string", "description": "ISO 8601 或 YYYY-MM-DD 格式的日期。`dateTo` 为不包含在内的上界。结果包括指定日期之前的所有日期,但不包括指定日期当天。", "example": "2024-01-01" }, "required": false, "name": "dateTo", "in": "query" }, { "schema": { "type": "integer", "minimum": 1, "maximum": 250, "default": 50, "description": "每页返回的最大结果数(1-250,默认 50)。分页时,在 hasMore 为 true 期间将 offset 按 limit 递增。" }, "required": false, "name": "limit", "in": "query" }, { "schema": { "type": "integer", "minimum": 0, "default": 0, "description": "要跳过的行数。按页访问时使用 offset = (page - 1) * limit。" }, "required": false, "name": "offset", "in": "query" } ], "responses": { "200": { "description": "全站总数和按路径统计的访客数", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VisitorsByPageResponse" } } } }, "400": { "description": "某个查询参数无效,例如日期格式错误或 `limit` 超出允许范围,或者项目 ID 格式错误。响应正文会说明具体错误。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyticsErrorResponse" } } } }, "401": { "description": "API 密钥缺失或无效,或者你的方案不包含 API 访问权限。" }, "403": { "description": "你的请求来自不在该 API 密钥允许列表中的 IP 地址。" }, "404": { "description": "该项目不存在或不属于你的组织。" }, "429": { "description": "你已超出分析端点的速率限制。" }, "500": { "description": "发生意外的服务器错误。请重试该请求。如果错误仍然存在,请联系支持团队。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnalyticsErrorResponse" } } } } } } } }, "webhooks": {} }