Get unique visitors
Returns per-path and site-wide approximate distinct visitors by traffic type. The total field is deduplicated across human and AI (union of distinct visitor IDs with any qualifying content view).
Authenticate with an admin API key.
Use this endpoint to export unique visitor analytics. Results include both site-wide totals and per-page breakdowns, split by human and AI traffic. The total field is deduplicated across human and AI traffic.
Paginate through results using offset-based pagination. Increment offset by limit while hasMore is true.
Filtering
Section titled “Filtering”Filter visitor data by date range using dateFrom and dateTo parameters.
Rate limits
Section titled “Rate limits”This endpoint allows 100 requests per organization per hour. All analytics endpoints share this limit.
Related topics
- Mintlify REST API introduction
- Mintlify CLI command reference
- Deploy at a subpath with Cloudflare Workers
/v1/analytics/{projectId}/visitorsGet unique visitors
5 parameters
- projectIdstringpathrequired
- dateFromstringquery
- dateTostringquery
- limitintegerquery
- offsetintegerquery
curl --request GET \
--url https://api.mintlify.com/v1/analytics/{projectId}/visitors \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.mintlify.com/v1/analytics/{projectId}/visitors"
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}/visitors", 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}/visitors",
CURLOPT_RETURNTRANSFER => true,
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}/visitors"
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}/visitors")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v1/analytics/{projectId}/visitors")
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{
"totals": {
"human": 123,
"ai": 123,
"total": 123
},
"visitors": [
{
"path": "<string>",
"human": 123,
"ai": 123,
"total": 123
}
],
"hasMore": true
}{
"error": "<string>",
"details": [
{
"message": "<string>"
}
]
}{
"error": "<string>",
"details": [
{
"message": "<string>"
}
]
}Authorizations
Section titled “Authorizations”AuthorizationstringrequiredThe Authorization header expects a Bearer token. Use an admin API key. This is a server-side secret key. Generate one on the API keys page in your dashboard.
Path Parameters
Section titled “Path Parameters”projectIdstringrequiredQuery Parameters
Section titled “Query Parameters”dateFrom?stringExample: 2024-01-01
dateTo?stringExample: 2024-01-01
limit?integerRequired range: 1 <= x <= 250
offset?integerRequired range: 0 <= x
Response
Section titled “Response”200 — Site-wide totals and per-path visitor counts
totalsobjectrequiredShow child attributes
humannumberrequiredSite-wide unique visitors from human traffic.
ainumberrequiredSite-wide unique visitors from AI bot traffic.
totalnumberrequiredSite-wide approximate distinct visitors with any qualifying view (deduplicated across human and AI).
visitorsobject[]requiredPer-page visitor counts.
Show child attributes
pathstringrequiredThe documentation page path.
humannumberrequiredUnique visitors from human traffic.
ainumberrequiredUnique visitors from AI bot traffic.
totalnumberrequiredApproximate distinct visitors with any qualifying view on this path (deduplicated across human and AI).
hasMorebooleanrequiredWhether additional results are available beyond this page.