Pull any analytics metric as JSON. Single endpoint, API-key auth, curl-friendly. Try it below without leaving the page.
Generate a key at Settings → API keys. Keys only live in your browser — we never see what you paste here.
Pick a metric and hit Run. We'll execute the curl for you.
Visitors, sessions, pageviews — last 30 days.
curl -H "Authorization: Bearer cvk_YOUR_API_KEY" \
"https://perchlens.com/api/v1/stats?site_id=cv_YOUR_SITE_ID&metric=overview&days=30"{
"stats": {
"visitors": 12847,
"sessions": 18392,
"pageviews": 42651
},
"metric": "overview"
}Pass your API key in an Authorization: Bearer cvk_… header. Keys are scoped to a user — any site you own works. Rotate or revoke at Settings → API keys.
The metric parameter accepts friendly names. Power users can pass the raw pipe name instead.
| Metric | Description | Common params |
|---|---|---|
| overview | visitors/sessions/pageviews | days |
| realtime | live count last 5min | — |
| ai | AI engine breakdown | days |
| top_pages | most-viewed pages | days, limit |
| top_sources | traffic sources | days, limit |
| countries | top countries | days, limit |
| channels | AI/search/social/direct split | days |
| conversions | conversion rate + count | days |