curl --request GET \
--url https://context7.com/api/v2/libs/metrics \
--header 'Authorization: Bearer <token>'import requests
url = "https://context7.com/api/v2/libs/metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://context7.com/api/v2/libs/metrics', 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://context7.com/api/v2/libs/metrics",
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://context7.com/api/v2/libs/metrics"
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://context7.com/api/v2/libs/metrics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://context7.com/api/v2/libs/metrics")
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{
"total": {
"page": 12450,
"txt": 3820,
"mcp": 95210,
"cli": 1240
},
"daily": [
{
"date": "2025-01-14",
"page": 8,
"txt": 3,
"mcp": 42,
"cli": 1,
"total": 54
},
{
"date": "2025-01-15",
"page": 11,
"txt": 5,
"mcp": 67,
"cli": 0,
"total": 83
}
],
"mcpClients": {
"dailyData": [
{
"date": "2025-01-14",
"uniqueUsersByClient": {
"cursor": 12,
"claude-code": 7
},
"totalUniqueUsers": 18
},
{
"date": "2025-01-15",
"uniqueUsersByClient": {
"cursor": 15,
"claude-code": 9,
"codex": 2
},
"totalUniqueUsers": 25
}
]
},
"topics": [
{
"topic": "routing",
"count": 420
},
{
"topic": "middleware",
"count": 312
},
{
"topic": "app-router",
"count": 187
}
],
"countries": [
{
"country": "US",
"count": 3120
},
{
"country": "DE",
"count": 842
},
{
"country": "IN",
"count": 610
}
]
}Get library usage metrics
Retrieve full usage metrics for a library: cumulative and daily request counters broken down by surface (web page, text docs, MCP, CLI), MCP client daily unique-user breakdown, and lifetime topic and country distributions. The API key must belong to a member of the teamspace that owns the library — claim ownership from the library’s admin page on context7.com.
curl --request GET \
--url https://context7.com/api/v2/libs/metrics \
--header 'Authorization: Bearer <token>'import requests
url = "https://context7.com/api/v2/libs/metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://context7.com/api/v2/libs/metrics', 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://context7.com/api/v2/libs/metrics",
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://context7.com/api/v2/libs/metrics"
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://context7.com/api/v2/libs/metrics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://context7.com/api/v2/libs/metrics")
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{
"total": {
"page": 12450,
"txt": 3820,
"mcp": 95210,
"cli": 1240
},
"daily": [
{
"date": "2025-01-14",
"page": 8,
"txt": 3,
"mcp": 42,
"cli": 1,
"total": 54
},
{
"date": "2025-01-15",
"page": 11,
"txt": 5,
"mcp": 67,
"cli": 0,
"total": 83
}
],
"mcpClients": {
"dailyData": [
{
"date": "2025-01-14",
"uniqueUsersByClient": {
"cursor": 12,
"claude-code": 7
},
"totalUniqueUsers": 18
},
{
"date": "2025-01-15",
"uniqueUsersByClient": {
"cursor": 15,
"claude-code": 9,
"codex": 2
},
"totalUniqueUsers": 25
}
]
},
"topics": [
{
"topic": "routing",
"count": 420
},
{
"topic": "middleware",
"count": 312
},
{
"topic": "app-router",
"count": 187
}
],
"countries": [
{
"country": "US",
"count": 3120
},
{
"country": "DE",
"count": 842
},
{
"country": "IN",
"count": 610
}
]
}Authorizations
Get your API key at context7.com/dashboard. Treat your API key like a password and store it securely. Every key can read the management API (/v2/teamspaces/*), except personal data: member and invitation emails, library requesters, visitor questions, Docs7 reader searches, conversations, feedback and feature requests, and the GitHub account behind a build. To read those or make changes there, the key must be created with Write access ticked; other keys get 403 write_access_required. A teamspace can limit API keys to owners and admins, or turn them off for OAuth only; a key that its teamspace's policy refuses gets 403 api_key_admins_only or api_keys_disabled.
Query Parameters
Context7-compatible library ID — the URL path of the library on context7.com. Use /owner/repo for GitHub repositories, or /<source>/<id> for other sources (websites, llms.txt, GitLab/Bitbucket, etc.). Optionally suffix with /<version> or @<version> to pin a specific version. See Library ID format.
1 - 500^/[^/]+/[^/]+([/@][^/]+)?$Response
Library usage metrics
Library usage metrics response
Was this page helpful?