API overview
Authentication, scopes, endpoint groups, and conventions of the InsightFlare HTTP API.
The full API reference is generated from the OpenAPI document served at /.well-known/openapi.json (also published as docs/openapi.json and docs/openapi.yaml in the repository). This page covers the concepts you need before calling the API.
Base URL and authentication
All API endpoints live under /api/v1 on your instance. Authenticate every request with an API key as a Bearer token:
curl https://your-instance.example.com/api/v1/token \
-H "Authorization: Bearer YOUR_API_KEY"GET /api/v1/token shows what the key can do, and POST /api/v1/token/check checks it against required scopes. Create keys as described in API keys.
Scopes
| Scope | Allows |
|---|---|
analytics:read | Read analytics data. |
analysis:read | Read shared saved filters, goals, and funnels. |
analysis:write | Create, update, and delete goals and funnels. |
site:read | List and read sites. |
site:write | Create, update, and delete sites. |
site_config:read | Read tracking, privacy, and sharing settings and the tracking script. |
site_config:write | Update those settings. |
A key can also be limited to specific sites.
Endpoint groups
| Group | Examples |
|---|---|
| Discovery | GET /api/v1 (root), GET /api/v1/capabilities |
| Token | GET /api/v1/token, POST /api/v1/token/check |
| Team | GET /api/v1/team, GET /api/v1/team/usage, and team-wide analytics under /api/v1/team/analytics/... |
| Sites | GET/POST /api/v1/sites, GET/PATCH/DELETE /api/v1/sites/{siteId} |
| Settings | /api/v1/sites/{siteId}/settings/tracking, /privacy, /sharing, /tracking-script |
| Analytics | POST /api/v1/sites/{siteId}/analytics/...: overview, comparison, timeseries, breakdowns, pages, referrers, channels, retention, funnels, goals, performance, events, event types, visitors, sessions, and realtime |
| Funnels and goals | /api/v1/sites/{siteId}/funnels and /goals (create, read, update, delete) |
| Saved filters | GET /api/v1/sites/{siteId}/saved-filters |
| Batch | POST /api/v1/batch |
The collector endpoint POST /collect and the script GET /script.js are public, and are used by the tracking script, not by API clients.
Conventions
- Analytics queries are
POSTrequests with a JSON body that carries the time range, filters, and options. Filters use the same field names and operators as the filter language. - Discover fields first.
GET /api/v1/sites/{siteId}/analytics/schema(or the team equivalent) lists the fields and operators you can filter by.POST .../analytics/filter-valuesreturns candidate values for a field. - Time range. For analytics operations with a
timeRangeinput, send an absolute range or a supported preset and specifytimeZonewhen local calendar boundaries matter. - Scope. Use the site endpoints for one site and the
/team/analytics/...endpoints for a cross-site result. - Batch.
POST /api/v1/batchruns several read operations in one request. Only operations that the OpenAPI document marks as batch-eligible can be batched. - Pagination. Read the pagination inputs of the operation you call in the OpenAPI document.
Where to go next
- See the API reference for the exact request and response shapes of every endpoint. The same OpenAPI document is served at
/.well-known/openapi.json. - Connect an AI agent if you want an agent to call the API for you.
Run a filtered query
Discover fields with GET /api/v1/sites/{siteId}/analytics/schema. Read filterProtocol.fields for types, units, and operators, and filterProtocol.dsl for syntax and examples. To check which values occur in your data, send the following body to POST /api/v1/sites/{siteId}/analytics/filter-values. Candidate results depend on the selected range and data.
{
"timeRange": {
"kind": "preset",
"preset": "last_7_days",
"timeZone": "UTC"
},
"field": "page.path",
"search": "/docs",
"page": {
"limit": 10
}
}Send this body to POST /api/v1/sites/{siteId}/analytics/overview with a key that has analytics:read.
{
"timeRange": {
"kind": "preset",
"preset": "last_7_days",
"timeZone": "UTC"
},
"scope": "session",
"filter": {
"type": "dsl",
"expression": "PAGE { $.path startsWith \"/docs\" } exists"
},
"metrics": [
"sessions",
"views"
]
}For operations that accept filter, type: "dsl" takes the dashboard expression text and type: "inline" takes a structured expression object. Site operations whose schema also allows type: "saved" take a shared filter ID and require analysis:read as well. Team queries accept DSL and inline filters. Check the specific operation before reusing the request body.
Read meta.filterScope.requested and meta.filterScope.resolved when the response includes them. If a saved filter and the request specify conflicting concrete scopes, use auto for the request or choose the saved filter’s scope.