Skip to main content
GET
/
v2
/
libs
/
metrics
Get library usage metrics
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

Authorization
string
header
required

Get your API key at context7.com/dashboard. Treat your API key like a password and store it securely.

Query Parameters

libraryId
string
required

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.

Required string length: 1 - 500
Pattern: ^/[^/]+/[^/]+([/@][^/]+)?$
days
integer
default:30

Number of days of daily history to return (1-365). Defaults to 30.

Required range: 1 <= x <= 365

Response

Library usage metrics

Library usage metrics response

total
object
required

Cumulative request counts for a library, broken down by request surface

daily
object[]
required

Per-day request counts (deltas, not cumulative), ordered from oldest to newest. Days with zero activity are omitted. Up to days points — fewer if the library has less history or had idle days in the window.

mcpClients
object
required

MCP client usage breakdown by day

topics
object[]
required

Lifetime topic distribution, ordered by count descending

countries
object[]
required

Lifetime country distribution (ISO-2 codes), ordered by count descending