数据分析
获取 AI 助手会话记录
返回分页后的 AI 助手会话历史
GET
/
v1
/
analytics
/
{projectId}
/
assistant
获取 AI 助手会话记录
curl --request GET \
--url https://api.mintlify.com/v1/analytics/{projectId}/assistant \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.mintlify.com/v1/analytics/{projectId}/assistant"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.mintlify.com/v1/analytics/{projectId}/assistant', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mintlify.com/v1/analytics/{projectId}/assistant",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.mintlify.com/v1/analytics/{projectId}/assistant"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.mintlify.com/v1/analytics/{projectId}/assistant")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v1/analytics/{projectId}/assistant")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"conversations": [
{
"id": "<string>",
"timestamp": "<string>",
"query": "<string>",
"response": "<string>",
"sources": [
{
"title": "<string>",
"url": "<string>"
}
],
"queryCategory": "<string>",
"pageUrl": "<string>"
}
],
"nextCursor": "<string>",
"hasMore": true
}{
"error": "<string>",
"details": [
{
"message": "<string>"
}
]
}{
"error": "<string>",
"details": [
{
"message": "<string>"
}
]
}使用方法
cursor 参数对结果进行分页。当 hasMore 为 true 时继续获取。
筛选
dateFrom 和 dateTo 参数按日期范围过滤会话。
会话数据
- query: 用户的问题
- response: AI 助手的回答
- sources: 回答中引用的页面,包括标题和 URL
- resolutionStatus: AI 助手是否成功回答了问题。值为
answered或unanswered。使用此字段可跟踪并分析 AI 助手无法解答的用户问题所暴露出的文档缺口。 - queryCategory: query 的类型分类(如果可用)
- pageUrl: 会话开始时所在文档页面的完整 URL;如果没有可用的页面路径,则为
null。使用此字段可将会话归因到具体页面。
授权
Authorization 请求头需要使用 Bearer Token。请使用管理员 API key(以 mint_ 开头)。这是仅供服务端使用的密钥。你可以在控制台的 API keys 页面 中生成。
查询参数
ISO 8601 或 YYYY-MM-DD 格式的日期
示例:
"2024-01-01"
ISO 8601 或 YYYY-MM-DD 格式的日期。dateTo 为不包含在内的上限。结果将包含早于该日期的记录,但不包含该日期当天的记录。
示例:
"2024-01-01"
每页返回的最大结果数
必填范围:
1 <= x <= 1000分页游标(ULID 格式)
此页面对您有帮助吗?
⌘I
获取 AI 助手会话记录
curl --request GET \
--url https://api.mintlify.com/v1/analytics/{projectId}/assistant \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.mintlify.com/v1/analytics/{projectId}/assistant"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.mintlify.com/v1/analytics/{projectId}/assistant', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mintlify.com/v1/analytics/{projectId}/assistant",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.mintlify.com/v1/analytics/{projectId}/assistant"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.mintlify.com/v1/analytics/{projectId}/assistant")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v1/analytics/{projectId}/assistant")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"conversations": [
{
"id": "<string>",
"timestamp": "<string>",
"query": "<string>",
"response": "<string>",
"sources": [
{
"title": "<string>",
"url": "<string>"
}
],
"queryCategory": "<string>",
"pageUrl": "<string>"
}
],
"nextCursor": "<string>",
"hasMore": true
}{
"error": "<string>",
"details": [
{
"message": "<string>"
}
]
}{
"error": "<string>",
"details": [
{
"message": "<string>"
}
]
}