Developer

REST API

Pull any analytics metric as JSON. Single endpoint, API-key auth, curl-friendly. Try it below without leaving the page.

Your credentials

Generate a key at Settings → API keys. Keys only live in your browser — we never see what you paste here.

Try an endpoint

Pick a metric and hit Run. We'll execute the curl for you.

Visitors, sessions, pageviews — last 30 days.

curl
curl -H "Authorization: Bearer cvk_YOUR_API_KEY" \
  "https://perchlens.com/api/v1/stats?site_id=cv_YOUR_SITE_ID&metric=overview&days=30"
sample response
{
  "stats": {
    "visitors": 12847,
    "sessions": 18392,
    "pageviews": 42651
  },
  "metric": "overview"
}

Auth

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.

Available metrics

The metric parameter accepts friendly names. Power users can pass the raw pipe name instead.

MetricDescriptionCommon params
overviewvisitors/sessions/pageviewsdays
realtimelive count last 5min
aiAI engine breakdowndays
top_pagesmost-viewed pagesdays, limit
top_sourcestraffic sourcesdays, limit
countriestop countriesdays, limit
channelsAI/search/social/direct splitdays
conversionsconversion rate + countdays