REST APIv1

API Reference

Programmatic access to your analytics data. Build custom dashboards, embed stats in your app, or automate reporting.

Base URL

https://www.glancelytics.com/api/v1

Authentication

All requests require an API key passed in the Authorization header.

Authorization: Bearer gl_live_xxxxxxxxxxxxxxxx

Note: API access requires a Business plan.Create your API key

Rate Limits

5,000 requests per hour. Rate limit info is included in response headers:

X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
X-RateLimit-Reset: 1700829600

Endpoints

GET/stats/{websiteId}

Retrieve analytics data for a specific website.

Parameters

websiteIdstring, required
timeRange"7d" | "30d" | "90d" (default: "7d")

Request

curl "https://www.glancelytics.com/api/v1/stats/clx123?timeRange=7d" \
  -H "Authorization: Bearer gl_live_xxx"

Response

{
  "success": true,
  "data": {
    "domain": "example.com",
    "totalViews": 15420,
    "uniqueToday": 142,
    "currentlyOnline": 8,
    "totalViewsChange": 12.5,
    "uniqueVisitorsChange": 8.3,
    "chartData": [
      { "date": "2024-11-17", "totalViews": 320, "uniqueVisitors": 180 }
    ],
    "topPages": [
      { "path": "/", "views": 1240 }
    ],
    "topReferrers": [
      { "referrer": "google.com", "views": 450 }
    ]
  }
}

Coming soon:

POST/websites
GET/websites
DELETE/websites/{id}

Errors

All errors return a consistent JSON structure:

{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or expired API key"
  }
}
401Invalid or missing API key
403Not on Business plan
404Website not found
429Rate limit exceeded

Examples

JavaScript

const response = await fetch(
  'https://www.glancelytics.com/api/v1/stats/clx123?timeRange=7d',
  {
    headers: {
      'Authorization': `Bearer ${process.env.GLANCELYTICS_API_KEY}`
    }
  }
);

const { data } = await response.json();
console.log(data.totalViews);

Python

import requests

response = requests.get(
    'https://www.glancelytics.com/api/v1/stats/clx123',
    params={'timeRange': '7d'},
    headers={'Authorization': f'Bearer {api_key}'}
)

data = response.json()['data']
print(data['totalViews'])

Quick Start

1

Get an API key

Go to Dashboard → API Keys

2

Find your website ID

It's in your dashboard URL (e.g., /dashboard/clx123...)

3

Make a request

curl "https://www.glancelytics.com/api/v1/stats/YOUR_WEBSITE_ID" \
  -H "Authorization: Bearer YOUR_API_KEY"

Need help? Contact support