Skip to main content
Mintlify
current

Search documentation

Type to search this documentation.

On this pageOverview

Get page views

Returns per-path and site-wide content view event counts, split by human and AI traffic.

Authenticate with an admin API key.

Use this endpoint to export page view analytics. Results include both site-wide totals and per-page breakdowns, split by human and AI traffic.

Paginate through results using offset-based pagination. Increment offset by limit while hasMore is true.

Filter view data by date range using dateFrom and dateTo parameters.

This endpoint allows 100 requests per organization per hour. All analytics endpoints share this limit.

Related topics

GET/v1/analytics/{projectId}/views

Get page views

5 parameters
  • projectIdstringpathrequired
  • dateFromstringquery
  • dateTostringquery
  • limitintegerquery
  • offsetintegerquery
cURL
curl --request GET \
  --url https://api.mintlify.com/v1/analytics/{projectId}/views \
  --header 'Authorization: Bearer <token>'
Python
import requests

url = "https://api.mintlify.com/v1/analytics/{projectId}/views"

headers = {
    "Authorization": "Bearer <token>"
}

response = requests.get(url, headers=headers)

print(response.text)
JavaScript
const options = {method: "GET", headers: {"Authorization": "Bearer <token>"}};

fetch("https://api.mintlify.com/v1/analytics/{projectId}/views", options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
PHP
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.mintlify.com/v1/analytics/{projectId}/views",
  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;
}
Go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.mintlify.com/v1/analytics/{projectId}/views"

	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))

}
Java
HttpResponse<String> response = Unirest.get("https://api.mintlify.com/v1/analytics/{projectId}/views")
  .header("Authorization", "Bearer <token>")
  .asString();
Ruby
require 'uri'
require 'net/http'

url = URI("https://api.mintlify.com/v1/analytics/{projectId}/views")

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
200
{
  "totals": {
    "human": 123,
    "ai": 123,
    "total": 123
  },
  "views": [
    {
      "path": "<string>",
      "human": 123,
      "ai": 123,
      "total": 123
    }
  ],
  "hasMore": true
}
400
{
  "error": "<string>",
  "details": [
    {
      "message": "<string>"
    }
  ]
}
500
{
  "error": "<string>",
  "details": [
    {
      "message": "<string>"
    }
  ]
}
Authorizationstringrequired

The 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.

projectIdstringrequired
dateFrom?string

Example: 2024-01-01

Typestring
dateTo?string

Example: 2024-01-01

Typestring
limit?integer

Required range: 1 <= x <= 250

Typeinteger
Default50
offset?integer

Required range: 0 <= x

Typeinteger
Default0

200 — Site-wide and per-path content view event counts

totalsobjectrequired
Show child attributes
humannumberrequired

Site-wide content view events from human traffic.

Typenumber
ainumberrequired

Site-wide content view events from AI bot traffic.

Typenumber
totalnumberrequired

Site-wide content view events.

Typenumber
viewsobject[]required

Per-page view counts.

Typeobject[]
Show child attributes
pathstringrequired

The documentation page path.

Typestring
humannumberrequired

Content view events on this path from human traffic.

Typenumber
ainumberrequired

Content view events on this path from AI bot traffic.

Typenumber
totalnumberrequired

Total content view events on this path.

Typenumber
hasMorebooleanrequired

Whether additional results are available beyond this page.

Typeboolean
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu