Query your analytics from the tools you already use.
Your InsightFlare instance publishes a machine-readable API description and agent guide. An external agent or program uses a dedicated Bearer key and can only do what you allow, on the sites you allow.
curl -X POST \
https://stats.edgekit.dev/api/v1/sites/edgekit/analytics/funnel-analysis \
-H "Authorization: Bearer $INSIGHTFLARE_KEY" \
-H "Content-Type: application/json" \
-d '{
"funnelId": "pricing-to-deploy",
"timeRange": { "kind": "preset", "preset": "last_30_days" },
"filter": {
"type": "dsl",
"expression": "client.deviceType eq \"mobile\""
}
}'InsightFlare does not include an AI chat or a built-in MCP server. Agents run outside InsightFlare and call its HTTP API using the skills manifest and OpenAPI document.
How it works in InsightFlare
Everything the dashboard reads is available over a versioned HTTP API. Scripts, BI tools and AI agents use the same endpoints and the same filter syntax.
An API described by its own routes
A hand-written spec drifts from the code. In InsightFlare the OpenAPI document is generated from the routes and their Zod schemas, so it lists what the server accepts.
- The spec is served at /.well-known/openapi.json and covers more than 60 paths under /api/v1.
- Every operation declares its required scope, its request schema and an example body.
- Operations that are safe to combine are marked x-api-v1-batch-eligible.
- Health is available at /.well-known/health, and GET /api/v1/token/check reports whether a key is valid.
A skills manifest for agents
An agent that only has a URL needs to know how to get a key, which calls to make first and what to do on errors. /.well-known/skills.json answers those questions in a structured file.
- Credential guidance: where to create a key in the app, which permissions to pick for a task, and how to choose the site range and expiry.
- Execution policy: use site scope unless the user asks for team scope, state the time range used, and fetch the analytics schema before building filters.
- Error policy: what to do for authentication, authorization, validation, rate limit and service errors, and to say so when something is unsupported instead of guessing.
- 24 task recipes, such as funnel analysis, retention, realtime monitoring, visitor investigation, site settings and batch reporting. Each lists the operations to call and how to report the result.
curl https://stats.edgekit.dev/.well-known/skills.json curl https://stats.edgekit.dev/.well-known/openapi.json
API keys with scopes and site limits
A key for a report should not be able to edit a site. Keys are created per team in the API Keys page, with only the permissions the task needs.
- Keys start with ifk_live_. Only an HMAC hash is stored, so the full key is shown once at creation.
- Seven permissions: analytics:read, analysis:read, analysis:write, site:read, site:write, site_config:read and site_config:write.
- A key can cover all sites, including future ones, or only the sites you pick.
- Expiry is 30, 90, 180 or 365 days, or never. The default is 180 days.
- Keys can be revoked, and the list shows when each was last used.
The same analysis as the dashboard
The API is not a reduced export. The analysis views you use in the dashboard have endpoints, and they take the same time ranges and the same filters.
- Overview, timeseries, breakdowns, cross-breakdowns, pages, referrers and channels, plus comparison with breakdowns by dimension.
- Funnel analysis, retention cohorts, goal summaries and timeseries, performance, events, visitor, session and journey detail, and realtime snapshots.
- Filters can be an inline structure, a DSL string or a saved filter ID. GET the schema endpoint first to see the fields and operators a site supports.
- Funnels, goals, saved filters and site settings can also be read and, with write permissions, changed.
curl -X POST \
https://stats.edgekit.dev/api/v1/sites/edgekit/analytics/funnel-analysis \
-H "Authorization: Bearer $INSIGHTFLARE_KEY" \
-H "Content-Type: application/json" \
-d '{
"funnelId": "pricing-to-deploy",
"timeRange": { "kind": "preset", "preset": "last_30_days" },
"filter": {
"type": "dsl",
"expression": "client.deviceType eq \"mobile\""
}
}'Team-level analysis across sites
Comparing sites by hand means one export per site. Team endpoints answer a team-wide question in one call.
- Under /api/v1/team/analytics: overview, timeseries, breakdowns, comparison, comparison breakdowns, a site list and a schema.
- Results are limited to the sites the key can access.
- Agents should use team scope only when the question is about the whole team. Site questions use the site endpoints.
Batch several reads into one request
A weekly report needs a dozen queries, and a dozen round trips are slow. The batch endpoint sends them together and returns each result with its own status.
- POST /api/v1/batch takes up to 50 requests, each with an id, a method (GET or POST), a path and an optional body.
- deadlineMs sets a time limit, up to 30000.
- Only operations marked batch-eligible can be included, which are read operations. Mutations are not batched.
- One failed item does not fail the rest. Check each item's status.
{
"requests": [
{
"id": "site",
"method": "POST",
"path": "/api/v1/sites/edgekit/analytics/overview",
"body": { "timeRange": { "kind": "preset", "preset": "last_7_days" } }
},
{
"id": "team",
"method": "POST",
"path": "/api/v1/team/analytics/overview",
"body": { "timeRange": { "kind": "preset", "preset": "last_7_days" } }
}
],
"deadlineMs": 10000
}Hand it to an external coding agent
Point the agent at your instance's skills manifest, and give it a dedicated read-only key when it asks for authorization.
Run a scheduled report
A scheduled program calls the analytics endpoints and stores or publishes the result in your own workflow.
Manage saved analyses
Only grant analysis permissions if an integration needs to read or change saved filters, funnels, or goals.
Grant only the access the task needs
Create one key per integration. Limit its sites, scopes, and expiry. You can rotate or revoke it without affecting other integrations.
- 1Open the skills manifest or OpenAPI document served by your instance.
- 2Create a dedicated API key with the read or write scopes you need.
- 3Limit the key to the sites the task needs, and set an expiry if that fits.
- 4Send it as a Bearer token, and use the token endpoints to check what the key can actually access.
What a key can access
No. The agent is an external tool such as Codex or Claude Code. InsightFlare provides the skills manifest, the HTTP API, and keys with limited scope.
Only if you explicitly allow all sites. A key can be limited to chosen sites and to specific read and write scopes.
No. The OpenAPI document your instance publishes lists the resources and operations that are available.