Agent Analytics API API

Web analytics platform with an HTTP API that AI agents can query.

Operations 67

POST /agent-sessions/start Start an agent-session signup/login flow #
GET /agent-sessions/authorize/{id} Browser approval page for an auth request #
POST /agent-sessions/poll Poll detached auth status #
POST /agent-sessions/exchange Exchange an approved auth request for an agent session #
POST /agent-sessions/refresh Refresh an agent session access token #
POST /agent-sessions/revoke Revoke an agent session #
POST /track Track a single event #
POST /track/batch Track multiple events #
POST /identify Link anonymous user to authenticated identity #
GET /stats Aggregated stats overview #
GET /events Raw event log #
POST /events Raw event log by user ID or email lookup #
POST /journey Customer journey by user ID or email lookup #
POST /query Flexible analytics query #
GET /properties Discover event names and property keys #
GET /properties/received Property keys by event name #
GET /replays/settings Get project replay settings #
PUT /replays/settings Enable, disable, or update project replay settings #
GET /replays List replay metadata #
DELETE /replays Disable and delete replay data #
GET /replays/usage Get replay storage and ingestion usage #
GET /replays/{replayId} Get replay metadata and committed chunks #
DELETE /replays/{replayId} Delete one replay #
POST /replays/{replayId}/open Create a short-lived sandboxed viewer link #
GET /sessions List sessions #
GET /breakdown Top property values #
GET /insights Period-over-period comparison #
GET /pages Entry/exit page stats #
GET /sessions/distribution Session duration histogram #
POST /paths Bounded session path analysis #
GET /heatmap Day-of-week x hour traffic grid #
POST /funnel Funnel analysis #
GET /retention Cohort retention analysis #
GET /stream Live event stream (SSE) #
GET /live Live snapshot (real-time) #
POST /website-scans Create public landing-page website analysis preview #
POST /cli/website-scans Create authenticated npx website analysis #
GET /website-scans/{id} Resume a website analysis #
GET /project-context Get project analytics context #
PUT /project-context Set project analytics context #
GET /portfolio-context Get account portfolio context #
PUT /portfolio-context Set account portfolio context #
GET /portfolios List identity lookup portfolios #
POST /portfolios Create an identity lookup portfolio #
GET /portfolios/{idOrSlug} Get an identity lookup portfolio #
PATCH /portfolios/{idOrSlug} Update an identity lookup portfolio #
DELETE /portfolios/{idOrSlug} Delete an empty identity lookup portfolio #
GET /projects List all projects #
POST /projects Create a new project #
GET /projects/{id} Get project details #
PATCH /projects/{id} Update a project #
DELETE /projects/{id} Delete a project #
GET /account Get account info #
GET /bot-traffic Filtered automated traffic for one project #
GET /account/usage Read account usage, pricing, and human payment handoff #
GET /account/all-sites Historical all-sites overview #
GET /account/bot-traffic Filtered automated traffic across all active projects #
GET /account/agent-sessions List active and historical agent sessions for the account #
POST /account/revoke-key Revoke and regenerate API key #
POST /account/feedback Submit product or workflow feedback #
GET /experiments/config Get experiment config for tracker.js #
POST /experiments Create an A/B experiment #
GET /experiments List experiments #
GET /experiments/{id} Get experiment with live results #
PATCH /experiments/{id} Update experiment status #
DELETE /experiments/{id} Delete an experiment #
GET /tracker.js JavaScript tracker script #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/agentanalytics-sh:agent-analytics-api-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

agentanalytics-sh-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Agent Analytics API
  version: 1.0.0
  description: |
    Web analytics platform with an HTTP API that AI agents can query.

    **Docs:** [Home](https://docs.agentanalytics.sh) · [Getting Started](https://docs.agentanalytics.sh/getting-started/) · [Installation](https://docs.agentanalytics.sh/installation/) · [API Reference](https://docs.agentanalytics.sh/api/) · [OpenAPI Spec](https://docs.agentanalytics.sh/openapi.yaml)

    **Quick start:**

    1. Start an agent session with `POST /agent-sessions/start` or sign in on the dashboard.
    2. Create a project with `POST /projects`.
    3. Add the returned tracker snippet to your site.
    4. Query analytics with `GET /stats`.

    **Authentication:**

    - `aas_*` agent sessions are the primary machine-auth mechanism for CLI, MCP, and managed runtimes.
    - `aak_*` API keys are an advanced/manual fallback for direct HTTP users.
    - `aat_*` project tokens are public and used for ingestion only.

    Installation guides for Claude Code, Claude Desktop / Cowork, Cursor, and OpenAI Codex now live in the docs site instead of this OpenAPI intro block.

  contact:
    email: support@agentanalytics.sh
    url: https://agentanalytics.sh
  license:
    name: MIT
    url: https://github.com/Agent-Analytics/agent-analytics/blob/main/LICENSE

servers:
  - url: https://api.agentanalytics.sh
    description: Production (hosted)

tags:
  - name: Ingestion
    description: Event tracking endpoints called by the browser `tracker.js` script. These use a public project token (`aat_*`) — not your API key. You don't call these directly; the tracker handles it.
  - name: Analytics
    description: Query analytics data. Requires account auth. Agent-session bearer auth is preferred; API keys remain a supported fallback.
  - name: Session Replay
    description: Explicitly opt in projects, list linked replay metadata, create short-lived viewer links, inspect usage, and delete retained recordings. Pro or complimentary access only.
  - name: Projects
    description: Manage projects programmatically. Requires account auth. Agent-session bearer auth is preferred; API keys remain a supported fallback.
  - name: Project Context
    description: Store compact goals, activation events, event-name glossary entries, and date annotations so agents can interpret analytics results with project-specific meaning.
  - name: Website Analysis
    description: Product Growth Scanner. Anonymous previews return growth questions, measurement blind spots, and first instrumentation decisions; full analysis and project linking require account auth.
  - name: Account
    description: Account information and feedback. Agent-session bearer auth is preferred for scoped account reads and feedback; raw API-key management is dashboard-only or API-key fallback only.
  - name: Agent Sessions
    description: Agent-session signup/login, detached approval, refresh, revocation, and account-side session management.
  - name: Experiments
    description: |
      A/B testing experiments. Create experiments, assign variants client-side via tracker.js, and query results with Bayesian significance. Pro tier only.

      ## Declarative Experiments (recommended)

      The simplest way to run experiments — no custom JavaScript needed. Mark elements with HTML attributes and tracker.js handles variant assignment automatically.

      ### Anti-Flicker Snippet

      Add this in `<head>` **before** the tracker.js script tag to prevent flash of control content:

      ```html
      <style>.aa-loading [data-aa-experiment]{visibility:hidden!important}</style>
      <script>document.documentElement.classList.add('aa-loading');
      setTimeout(function(){document.documentElement.classList.remove('aa-loading')},3000)</script>
      ```

      - Uses `visibility: hidden` to preserve layout (not `display: none`)
      - Only hides `[data-aa-experiment]` elements, not the entire page
      - 3-second timeout fallback shows control content if config fetch fails
      - tracker.js removes the `aa-loading` class after applying variants

      ### Declarative Attributes

      ```html
      <h1 data-aa-experiment="hero_text"
          data-aa-variant-b="Try it free today!">
        Start your free trial
      </h1>
      ```

      - Original element content = control variant
      - `data-aa-variant-{key}` attributes provide replacement text for non-control variants
      - Multiple elements can share the same experiment name (same variant assigned to all)
      - Variant keys are lowercased for attribute lookup
      - Requires a server-side experiment config (created via `POST /experiments`)

      ### Programmatic API

      For complex cases that can't be expressed as text swaps:

      ```js
      var variant = window.aa?.experiment('signup_cta', ['control', 'new_cta']);
      if (variant === 'new_cta') {
        document.querySelector('.cta').style.backgroundColor = 'green';
      }
      ```

      ### URL Param Variant Forcing

      Force a specific variant via URL parameter — useful for ad landing pages, QA testing, or sharing a specific variant with teammates.

      ```
      https://yoursite.com/pricing/?aa_variant_signup_cta=new_cta
      ```

      Format: `?aa_variant_<experiment_name>=<variant_key>`

      - The forced variant must exist in the experiment config — invalid values fall through to normal hash assignment
      - Works with both declarative and programmatic experiments
      - Exposure events include `forced: true` so you can filter them in analytics
      - No URL param = existing hash-based assignment (backward compatible)
  - name: Funnels
    description: |
      Ad-hoc funnel analysis — track where users drop off across a sequence of events.
      No saved funnels — agents query in one shot via `POST /funnel`.
  - name: Paths
    description: |
      Bounded session path analysis from entry pages to goal, drop-off, or truncation.
      Built for agent workflows: pages → funnels → retention → experiments.
  - name: Streaming
    description: |
      Real-time event streaming.

      `/stream` and `/live` are Pro-only on hosted cloud. Both read from an in-memory ring buffer — no D1 query.


# --- truncated at 32 KB (192 KB total) ---
# Full source: https://artifacts.apis.io/agentanalytics-sh/openapi/_original/agentanalytics-sh-api-openapi.yml