
# Site metrics

Read the site's traffic metrics: daily hits and visits, top pages, referrers, devices, countries, and bandwidth, with people, AI agents, and crawlers counted apart.

```sh
GET https://sitepaste.com/api/v1/public/sites/{siteId}/metrics
```

Requires the `data` scope.

## Usage

```bash
curl "https://sitepaste.com/api/v1/public/sites/default/metrics?range=week" \
  -H "Authorization: Bearer $TOKEN"
```

## Authorizations

| Header | Type | Required | Description |
|--------|------|----------|-------------|
| Authorization | string | Yes | Bearer token (`Authorization: Bearer sp_...`). Created in the dashboard under Account > Tokens. See [authentication](/api/authentication). |


## Query parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| range | string | No | `today`, `week`, `month` (default), `6mo`, `1y`, or `all`. Any other value answers 422, naming the field. |

## Response

```json
{
  "totalVisits": 613,
  "totalBandwidthBytes": 48210944,
  "passwordSuccesses": 4,
  "passwordFailures": 1,
  "daily": [ { "date": "2026-02-08", "hits": 120, "agentHits": 31, "crawlerHits": 210 } ],
  "pages": [ { "path": "/blog/hello", "hits": 310 } ],
  "topReferrers": [ { "domain": "news.ycombinator.com", "hits": 88 } ],
  "devices": { "desktop": 402, "mobile": 211 },
  "countries": { "US": 380, "GB": 121 },
  "agentPages": [ { "path": "/docs/install", "hits": 96 } ],
  "bots": [
    { "name": "Claude-User", "operator": "Anthropic", "kind": "agent", "hits": 140, "markdownHits": 120 },
    { "name": "GPTBot", "operator": "OpenAI", "kind": "ai_training", "hits": 610, "markdownHits": 0 },
    { "name": "http-client", "operator": null, "kind": "other", "hits": 75, "markdownHits": 40 }
  ]
}
```

Each request is counted for one audience:

- People: a person loading a page in a web browser. `daily[].hits`, `pages`, `totalVisits`, `devices`, `topReferrers`, and `countries` count people only.
- Agents: an AI product fetching a page because a person asked it to right now, such as ChatGPT or Claude answering a question, or a browser an agent drives. They are counted in `daily[].agentHits` and `agentPages`.
- Crawlers: automatic crawling for AI training, for AI search answers, for search engines, and every other bot, including headless browsers and command-line tools such as curl. They are counted in `daily[].crawlerHits`.

An audience's total for the window is the sum of its daily counts: `daily[].hits` for people, `daily[].agentHits` for agents, and `daily[].crawlerHits` for crawlers.

`totalBandwidthBytes` is every byte your site sent, to people and bots, for pages and for the theme's files alike. Images and other files from your media library are not included. A request a page's own script makes, such as the Copy Markdown button reading the page's source, adds to bandwidth but is not counted as a hit. Neither is a visit that only reached a protected page's password or sign-in form.

`bots` lists every agent and crawler, most requests first. `name` is the bot's name, such as `GPTBot`, with its company in `operator`. A bot Sitepaste does not name is grouped under a generic name, with `operator` set to `null`:

| Name | Meaning |
|------|---------|
| `markdown-agent` | An agent that asks for pages as Markdown. |
| `signed-agent` | A browser an AI agent drives, from a company Sitepaste does not name. |
| `http-client` | A command-line tool or programming library, such as curl. |
| `headless-browser` | A browser running without a window, such as headless Chrome. |
| `impersonator` | A request that names a bot, such as `GPTBot`, but does not come from the bot's company. |
| `other` | Any other bot. |

`kind` is one of:

| Kind | Meaning |
|------|---------|
| `agent` | Fetches a page when a person asks for it. |
| `ai_training` | Collects pages to train AI models. |
| `ai_search` | Indexes pages for an AI's answers, such as ChatGPT search, or for a knowledge base an AI product builds from pages its user chooses. |
| `search` | Indexes pages for a search engine. |
| `other` | Link previews, advertising checks, datasets, command-line tools, programming libraries, headless browsers, and unnamed bots. |

`markdownHits` counts the bot's requests for a page's Markdown, at the page's address followed by `index.md`, or for `/llms.txt`. See [Agents](/concepts/agents).

`pages` and `agentPages` hold the 50 pages with the most hits, and `topReferrers` the 10 referring domains with the most. A day records at most 100 referring domains. Once it has 100, no new domain is added that day and the recorded ones keep counting. `daily`, `pages`, `agentPages`, `topReferrers`, and `bots` are arrays; `devices` and `countries` are objects keyed by device class and ISO country code. All are empty on a site with no traffic yet.