数据分析
获取 AI 助手调用方统计
返回指定日期范围内按调用方类型(网页端、API 和其他)划分的助手查询次数明细。
GET
/
v1
/
analytics
/
{projectId}
/
assistant
/
caller-stats
获取 AI 助手调用方统计
curl --request GET \
--url https://api.mintlify.com/v1/analytics/{projectId}/assistant/caller-stats \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.mintlify.com/v1/analytics/{projectId}/assistant/caller-stats"
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/caller-stats', 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/caller-stats",
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/caller-stats"
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/caller-stats")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v1/analytics/{projectId}/assistant/caller-stats")
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{
"web": 123,
"api": 123,
"other": 123,
"total": 123
}{
"error": "<string>",
"details": [
{
"message": "<string>"
}
]
}{
"error": "<string>",
"details": [
{
"message": "<string>"
}
]
}使用方法
- web: 来自文档站点的查询
- api: 来自直接 API 调用的查询
- other: 来自其他来源的查询(例如集成、SDK)
- total: 所有查询类型的总和
筛选
dateFrom 和 dateTo 参数按日期范围筛选。授权
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"
⌘I
获取 AI 助手调用方统计
curl --request GET \
--url https://api.mintlify.com/v1/analytics/{projectId}/assistant/caller-stats \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.mintlify.com/v1/analytics/{projectId}/assistant/caller-stats"
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/caller-stats', 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/caller-stats",
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/caller-stats"
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/caller-stats")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v1/analytics/{projectId}/assistant/caller-stats")
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{
"web": 123,
"api": 123,
"other": 123,
"total": 123
}{
"error": "<string>",
"details": [
{
"message": "<string>"
}
]
}{
"error": "<string>",
"details": [
{
"message": "<string>"
}
]
}