Skip to main content
The Public Metrics API is a read-only, versioned REST surface under /api/v1/* on the web app host. It exposes the same aggregates the dashboard renders — visibility KPIs, trends, share of voice, citations, AI traffic, prompt performance and shopping cards — so you can blend Ansvisor data with GA4 / Search Console in an external reporting tool.
These endpoints live on the web app (Next.js), not the Express API server. If you self-host, the base URL is your web app’s domain.

Authentication

Every request needs an Ansvisor API key in the Authorization header. Create one under Settings → API Keys in the dashboard — the plaintext key (prefix ans_) is shown exactly once at creation time.
Keys are scoped to the user who created them and resolve to that user’s organization: every endpoint only returns data for brands the organization owns. Revoking a key (Settings → API Keys) takes effect immediately. GET /api/v1/whoami echoes the resolved identity — useful as a connection test:

Conventions

  • All endpoints are GET and return JSON.
  • brand_id is required on every metrics endpoint; list your brands via GET /api/v1/brands first.
  • date_from / date_to accept YYYY-MM-DD (the date_to day is included through 23:59:59 UTC).
  • Optional filters shared by most endpoints: model (comma-separated model slugs), region, topic_id.
  • Errors return { "error": "…" } with 400 (bad params), 401 (missing/invalid key), 404 (brand not in your organization) or 500.

Endpoints

List brands

Returns { "brands": [{ "id", "name", "slug", "industry", "region", "created_at" }] } for the caller’s organization.

Visibility summary

Overall KPIs for the window: result count, average visibility score, total mentions, total citations, plus the top 5 competitors by mentions. Supports model, region.

Visibility trend

Time-bucketed visibility for charting — the endpoint to join against GA4 date series. granularity is day (default) or week (ISO Monday buckets). Supports date_from, date_to, model, region, topic_id. Returns:
ai_visibility_score is the dashboard’s headline Visibility number (0-100): 0.6 × mention rate + 0.25 × citation rate + 0.15 × position factor over the day’s answers. It is only populated for day granularity. avg_visibility_score and avg_competitor_score are legacy intensity averages kept for compatibility — prefer ai_visibility_score. The same field also appears on /api/v1/visibility-summary (totals.aiVisibilityScore, with mentionAnswers / citationAnswers / positionFactor components) and /api/v1/competitor-comparison (ai_visibility_score on the brand row and every competitor row).

Competitor comparison & share of voice

The brand’s benchmark row, one row per competitor (visibility, mentions, citations, appearances) and a share_of_voice block with the overall SoV percentage and a per-platform split. Supports model, region, topic_id.

Citations

The domains and URLs AI engines cite around the brand: totals, a source-type breakdown (owned / competitor / editorial / forum / social / review / institutional), top_domains and top_urls. source_filter is one of all (default), owned, competitor, external; limit caps the top lists (default 50, max 200). Supports date_from, date_to, model, region, topic_id.

AI traffic

Visits referred by AI platforms, collected by the tracking pixel: total_visits, platform_breakdown, top_pages (top 10 paths) and country_breakdown.

Prompt performance

Per-prompt aggregates for the window: average visibility, mentions, citations, appearance count and the average competitor score per prompt. sort_by is visibility (default), mentions, citations or appearances; order is desc (default) or asc; limit 1–100 (default 10). Supports date_from, date_to, model, region, topic_id.

Shopping cards

Normalized shopping-card rows (product title, brand, price, merchant, rating, position) captured from AI shopping surfaces. role filters to own, competitor or other matches; cursor-paginated via limit (default 50, max 200) and the returned next_cursor.

Using it from Looker Studio

Until a native Community Connector ships, any generic JSON/API connector (or a small Apps Script that calls these endpoints with UrlFetchApp) works: point it at /api/v1/visibility-trend with your key in the Authorization header and join on the date column. The endpoints are also what a future official connector will consume.

MCP server

The same API keys power the Ansvisor MCP server — query these metrics from Claude or any MCP client.