bossplatform.site

Analytics API Documentation

The bossplatform.site analytics API lets you query raw visit data for the main site and any tenant subdomain. Each request is logged with rich Cloudflare metadata — geography, network, device, and protocol details — all queryable and groupable. All query parameters are validated with Zod — invalid inputs return structured error messages.

Endpoints

MethodPathDescription
GET/api/analyticsQuery visit data with filters, grouping & pagination
GET/api/schemaOpenAPI 3.1 spec (JSON) — use to generate client types

Tracked Fields

Every visit records the following fields from Cloudflare's edge network:

FieldTypeExampleCategory
tenantstringbrand-a / _mainmeta
pathstring/about.htmlmeta
countrystringUSgeo
citystringAustingeo
continentstringNAgeo
regionstringTexasgeo
region_codestringTXgeo
timezonestringAmerica/Chicagogeo
colostringDFWtech
asninteger395747net
as_organizationstringGoogle Cloudnet
device_typestringmobiletech
refererstringhttps://google.commeta
http_protocolstringHTTP/2tech
tls_versionstringTLSv1.3tech
is_euinteger1 / 0geo
created_atdatetime2026-02-11 14:30:00meta

Query Parameters

All parameters are optional and can be combined freely.

Filters

Any tracked field (except created_at) can be used as a filter. Pass a single value or comma-separated values for IN matching.

ParameterDescriptionExample
tenantFilter by tenant. _main = main site.?tenant=brand-a
countrySingle or multi country code?country=US,GB,DE
cityFilter by city name?city=Austin
continentContinent code?continent=NA,EU
regionRegion name?region=Texas
region_codeRegion code?region_code=TX,CA
timezoneIANA timezone?timezone=America/Chicago
coloCloudflare data center?colo=DFW,LAX
asnASN number?asn=395747
as_organizationNetwork org name?as_organization=Google Cloud
device_typeDevice category?device_type=mobile,desktop
http_protocolHTTP version?http_protocol=HTTP/2
tls_versionTLS version?tls_version=TLSv1.3
is_euEU country flag?is_eu=1

Date Range

ParameterDescriptionExample
startStart date (inclusive), YYYY-MM-DD?start=2026-02-01
endEnd date (inclusive), YYYY-MM-DD?end=2026-02-11

Aggregation

ParameterDescriptionExample
group_byComma-separated list of fields to GROUP BY. Returns visits count per group.?group_by=country,device_type

Pagination

ParameterDefaultDescription
limit200Max rows to return (1–10,000).
offset0Number of rows to skip.

Examples

Raw visits for a tenant

GET /api/analytics?tenant=brand-a

Visits by country (aggregated)

GET /api/analytics?group_by=country

Visits by country & device type

GET /api/analytics?group_by=country,device_type

Daily visits for a tenant

GET /api/analytics?tenant=brand-a&group_by=tenant&start=2026-02-01&end=2026-02-11

Mobile traffic from EU countries

GET /api/analytics?device_type=mobile&is_eu=1&group_by=country

Top Cloudflare data centers

GET /api/analytics?group_by=colo

UK cities breakdown

GET /api/analytics?country=GB&group_by=city

Traffic by network provider

GET /api/analytics?group_by=as_organization&limit=20

Protocol & TLS breakdown

GET /api/analytics?group_by=http_protocol,tls_version

Response

Raw visits (no group_by)

{
  "success": true,
  "count": 2,
  "data": [
    {
      "tenant": "brand-a",
      "path": "/index.html",
      "country": "US",
      "city": "Austin",
      "continent": "NA",
      "region": "Texas",
      "region_code": "TX",
      "timezone": "America/Chicago",
      "colo": "DFW",
      "asn": 395747,
      "as_organization": "Google Cloud",
      "device_type": "desktop",
      "referer": null,
      "http_protocol": "HTTP/2",
      "tls_version": "TLSv1.3",
      "is_eu": 0,
      "created_at": "2026-02-11 14:30:00"
    }
  ]
}

Aggregated (with group_by)

{
  "success": true,
  "count": 3,
  "data": [
    { "country": "US", "device_type": "desktop", "visits": 142 },
    { "country": "US", "device_type": "mobile", "visits": 87 },
    { "country": "GB", "device_type": "desktop", "visits": 34 }
  ]
}

Error

{
  "success": false,
  "error": "error message"
}

Notes

OpenAPI Schema & Type Generation

The full API schema is available as an OpenAPI 3.1 spec at /api/schema. Use it to auto-generate typed clients in any language:

TypeScript

npx openapi-typescript https://bossplatform.site/api/schema -o api.d.ts

Python (datamodel-code-generator)

pip install datamodel-code-generator
datamodel-codegen --url https://bossplatform.site/api/schema --output models.py

Any language

curl https://bossplatform.site/api/schema | jq .

Feed the JSON into any OpenAPI generator for Go, Rust, Java, C#, Swift, etc.

Validation Errors

If a query parameter is invalid, the API returns 400 with details:

{
  "success": false,
  "error": "Invalid query parameters",
  "issues": [
    { "field": "start", "message": "Invalid" },
    { "field": "limit", "message": "Number must be less than or equal to 10000" }
  ]
}
← Back to bossplatform.site