Skip to content

Analytics API

The Analytics API provides aggregated metrics and insights about your MeshGuard deployment. Use these endpoints to build dashboards, generate reports, or integrate with external monitoring tools.

All analytics endpoints:

  • Require the X-Admin-Token header (same token used for other Admin Endpoints)
  • Support a period query parameter: 24h (default), 7d, or 30d
  • Are multi-tenant — results are automatically scoped to the authenticated organization
  • Return application/json responses

Overview

Returns high-level summary statistics for the selected period, including comparison trends against the prior equivalent period.

GET /admin/analytics/overview

Query Parameters

ParameterTypeDefaultDescription
periodstring24hTime window: 24h, 7d, or 30d

Example Request

bash
curl https://dashboard.meshguard.app/admin/analytics/overview?period=7d \
  -H "X-Admin-Token: $ADMIN_TOKEN"

Example Response

json
{
  "period": "7d",
  "totalRequests": 48210,
  "enforcementRate": 94.3,
  "activeAgents": 17,
  "avgLatencyMs": 12.4,
  "trends": {
    "totalRequests": 8.2,
    "enforcementRate": -0.5,
    "activeAgents": 2,
    "avgLatencyMs": -1.1
  }
}

Response Fields

FieldTypeDescription
periodstringThe requested time window
totalRequestsnumberTotal governance requests in the period
enforcementRatenumberPercentage of requests that matched a policy rule (0–100)
activeAgentsnumberCount of agents that made at least one request
avgLatencyMsnumberAverage gateway evaluation latency in milliseconds
trends.totalRequestsnumberPercent change vs. prior period (positive = increase)
trends.enforcementRatenumberAbsolute change in enforcement rate vs. prior period
trends.activeAgentsnumberChange in active agent count vs. prior period
trends.avgLatencyMsnumberChange in average latency vs. prior period (negative = faster)

Timeseries

Returns allow/deny counts bucketed over time for charting request volume and enforcement trends.

GET /admin/analytics/timeseries

Query Parameters

ParameterTypeDefaultDescription
periodstring24hTime window: 24h, 7d, or 30d
bucketstringhourBucket granularity: hour or day

Example Request

bash
curl "https://dashboard.meshguard.app/admin/analytics/timeseries?period=7d&bucket=day" \
  -H "X-Admin-Token: $ADMIN_TOKEN"

Example Response

json
{
  "period": "7d",
  "bucket": "day",
  "data": [
    { "time": "2026-01-20T00:00:00Z", "allowed": 5820, "denied": 390 },
    { "time": "2026-01-21T00:00:00Z", "allowed": 6100, "denied": 415 },
    { "time": "2026-01-22T00:00:00Z", "allowed": 5950, "denied": 370 },
    { "time": "2026-01-23T00:00:00Z", "allowed": 6200, "denied": 402 },
    { "time": "2026-01-24T00:00:00Z", "allowed": 6340, "denied": 450 },
    { "time": "2026-01-25T00:00:00Z", "allowed": 6050, "denied": 388 },
    { "time": "2026-01-26T00:00:00Z", "allowed": 5900, "denied": 410 }
  ]
}

Response Fields

FieldTypeDescription
periodstringThe requested time window
bucketstringBucket granularity used
dataarrayArray of time-bucketed counts
data[].timestringISO 8601 timestamp for the start of the bucket
data[].allowednumberNumber of allowed requests in the bucket
data[].deniednumberNumber of denied requests in the bucket

Agents

Returns per-agent analytics ranked by the selected sort criteria. Use this to identify your most active agents, highest denial rates, or latency outliers.

GET /admin/analytics/agents

Query Parameters

ParameterTypeDefaultDescription
periodstring24hTime window: 24h, 7d, or 30d
sortstringrequestsSort field: requests, denied, or latency
limitnumber20Maximum number of agents to return (1–100)

Example Request

bash
curl "https://dashboard.meshguard.app/admin/analytics/agents?period=30d&sort=denied&limit=10" \
  -H "X-Admin-Token: $ADMIN_TOKEN"

Example Response

json
{
  "period": "30d",
  "sort": "denied",
  "agents": [
    {
      "id": "agent_abc123",
      "name": "data-pipeline",
      "trustTier": "verified",
      "requests": 12400,
      "allowed": 11200,
      "denied": 1200,
      "avgLatencyMs": 14.2,
      "lastActive": "2026-01-26T15:32:00Z"
    },
    {
      "id": "agent_def456",
      "name": "email-assistant",
      "trustTier": "sandboxed",
      "requests": 3800,
      "allowed": 3200,
      "denied": 600,
      "avgLatencyMs": 9.8,
      "lastActive": "2026-01-26T14:10:00Z"
    }
  ]
}

Response Fields

FieldTypeDescription
periodstringThe requested time window
sortstringThe sort field used
agentsarrayArray of agent analytics objects
agents[].idstringUnique agent identifier
agents[].namestringAgent display name
agents[].trustTierstringAgent trust tier (sandboxed, verified, trusted, privileged)
agents[].requestsnumberTotal requests in the period
agents[].allowednumberNumber of allowed requests
agents[].deniednumberNumber of denied requests
agents[].avgLatencyMsnumberAverage gateway evaluation latency (ms)
agents[].lastActivestringISO 8601 timestamp of the agent's last request

Policies

Returns per-policy enforcement analytics showing how often each policy was triggered and the resulting action breakdown.

GET /admin/analytics/policies

Query Parameters

ParameterTypeDefaultDescription
periodstring24hTime window: 24h, 7d, or 30d

Example Request

bash
curl https://dashboard.meshguard.app/admin/analytics/policies?period=7d \
  -H "X-Admin-Token: $ADMIN_TOKEN"

Example Response

json
{
  "period": "7d",
  "policies": [
    {
      "name": "default-deny",
      "triggered": 2840,
      "allowRate": 0.0,
      "denyRate": 100.0,
      "topAction": "write:filesystem"
    },
    {
      "name": "verified-agent-access",
      "triggered": 18500,
      "allowRate": 95.2,
      "denyRate": 4.8,
      "topAction": "read:database"
    },
    {
      "name": "rate-limit-external",
      "triggered": 620,
      "allowRate": 88.5,
      "denyRate": 11.5,
      "topAction": "call:external-api"
    }
  ]
}

Response Fields

FieldTypeDescription
periodstringThe requested time window
policiesarrayArray of policy analytics objects
policies[].namestringPolicy name
policies[].triggerednumberNumber of times the policy was evaluated
policies[].allowRatenumberPercentage of evaluations that resulted in allow (0–100)
policies[].denyRatenumberPercentage of evaluations that resulted in deny (0–100)
policies[].topActionstringMost frequently evaluated action for this policy

Delegations

Returns analytics on delegation chains — when agents delegate authority to other agents. Useful for understanding how trust propagates through your system.

GET /admin/analytics/delegations

Query Parameters

ParameterTypeDefaultDescription
periodstring24hTime window: 24h, 7d, or 30d

Example Request

bash
curl https://dashboard.meshguard.app/admin/analytics/delegations?period=30d \
  -H "X-Admin-Token: $ADMIN_TOKEN"

Example Response

json
{
  "period": "30d",
  "totalChains": 342,
  "avgDepth": 2.1,
  "blockedChains": 18,
  "topPairs": [
    { "fromAgent": "orchestrator", "toAgent": "data-pipeline", "count": 120 },
    { "fromAgent": "orchestrator", "toAgent": "email-assistant", "count": 95 },
    { "fromAgent": "data-pipeline", "toAgent": "db-reader", "count": 64 },
    { "fromAgent": "email-assistant", "toAgent": "calendar-bot", "count": 38 }
  ]
}

Response Fields

FieldTypeDescription
periodstringThe requested time window
totalChainsnumberTotal delegation chains observed
avgDepthnumberAverage depth of delegation chains (1 = direct, 2+ = nested)
blockedChainsnumberNumber of delegation chains that were denied by policy
topPairsarrayMost frequent delegation pairs
topPairs[].fromAgentstringName of the delegating agent
topPairs[].toAgentstringName of the agent receiving delegation
topPairs[].countnumberNumber of times this delegation occurred

Trust Distribution

Returns a breakdown of agents and request volume by trust tier. Helps you understand the trust profile of your deployment.

GET /admin/analytics/trust-distribution

Query Parameters

ParameterTypeDefaultDescription
periodstring24hTime window: 24h, 7d, or 30d

Example Request

bash
curl https://dashboard.meshguard.app/admin/analytics/trust-distribution?period=7d \
  -H "X-Admin-Token: $ADMIN_TOKEN"

Example Response

json
{
  "period": "7d",
  "tiers": [
    { "tier": "privileged", "agentCount": 2, "requestCount": 8400, "pct": 17.4 },
    { "tier": "trusted", "agentCount": 5, "requestCount": 18200, "pct": 37.8 },
    { "tier": "verified", "agentCount": 7, "requestCount": 16800, "pct": 34.9 },
    { "tier": "sandboxed", "agentCount": 3, "requestCount": 4810, "pct": 9.9 }
  ]
}

Response Fields

FieldTypeDescription
periodstringThe requested time window
tiersarrayArray of tier breakdown objects
tiers[].tierstringTrust tier name (sandboxed, verified, trusted, privileged)
tiers[].agentCountnumberNumber of agents in this tier
tiers[].requestCountnumberTotal requests from agents in this tier
tiers[].pctnumberPercentage of total requests from this tier (0–100)

Latency Heatmap

Returns a grid of average latency values bucketed by day-of-week and hour-of-day. Use this to identify performance patterns and plan maintenance windows.

GET /admin/analytics/latency-heatmap

Query Parameters

ParameterTypeDefaultDescription
periodstring30dTime window: 24h, 7d, or 30d

TIP

This endpoint works best with period=30d for statistically meaningful results. Shorter periods may produce sparse heatmaps.

Example Request

bash
curl https://dashboard.meshguard.app/admin/analytics/latency-heatmap?period=30d \
  -H "X-Admin-Token: $ADMIN_TOKEN"

Example Response

json
{
  "period": "30d",
  "cells": [
    { "dayOfWeek": 0, "hourOfDay": 0, "avgLatencyMs": 8.2, "count": 120 },
    { "dayOfWeek": 0, "hourOfDay": 1, "avgLatencyMs": 7.9, "count": 95 },
    { "dayOfWeek": 0, "hourOfDay": 9, "avgLatencyMs": 18.4, "count": 890 },
    { "dayOfWeek": 1, "hourOfDay": 10, "avgLatencyMs": 22.1, "count": 1240 },
    { "dayOfWeek": 4, "hourOfDay": 15, "avgLatencyMs": 19.7, "count": 1100 },
    { "dayOfWeek": 6, "hourOfDay": 3, "avgLatencyMs": 6.5, "count": 45 }
  ]
}

Response Fields

FieldTypeDescription
periodstringThe requested time window
cellsarrayArray of heatmap cell objects
cells[].dayOfWeeknumberDay of week (0 = Sunday, 6 = Saturday)
cells[].hourOfDaynumberHour of day in UTC (0–23)
cells[].avgLatencyMsnumberAverage gateway evaluation latency for this cell (ms)
cells[].countnumberNumber of requests in this cell

Error Responses

All analytics endpoints return standard error responses:

StatusDescription
401Missing or invalid X-Admin-Token
400Invalid query parameter (e.g., bad period)
500Internal server error
json
{
  "error": "invalid_period",
  "message": "Period must be one of: 24h, 7d, 30d"
}

Governance Control Plane for AI Agents