Skip to content

Governance dashboard API

The governance dashboard API returns a single, tenant-scoped inventory of a tenant's AI-governance posture, aggregating surfaces that already exist as separate mechanisms into one payload:

  • Guardrail activity and data residency — the same mechanical counts the compliance report exports, over a time window.
  • EU-AI-Act template state — how many governance templates are configured and how many are DPO-authoritative.
  • Compliance-report history — the tenant's stored monthly compliance-report snapshots, downloadable as CSV or PDF.
  • Agent-approval workflow status — the count of pending agent-egress approvals awaiting a decision.

It reads only; it stores, caches, and computes nothing of its own. The metric definitions are not restated here — they are owned by the compliance report API.

Base URL: https://<your-gateway-host>/admin/v1


GET /governance/dashboard

Returns the aggregated dashboard for one tenant as JSON.

Required role: admin, tenant_admin, or ki_manager.

curl 'https://<your-gateway-host>/admin/v1/governance/dashboard?tenant_id=<id>'

Tenant scope

Tenant scope is decided server-side; the client value never widens it. The dashboard is inherently per-tenant — there is no global/all-tenant variant.

Caller Scope
admin Must target one tenant with ?tenant_id=<id>.
tenant_admin / ki_manager Always their own tenant. A ?tenant_id naming another tenant is ignored (pinned to the caller's own).

An admin who omits ?tenant_id is rejected 400 { "error": "tenant_id required", "code": "tenant_id_required" } (no query runs). A non-admin whose account carries no tenant is refused 403 { "error": "forbidden" }.

Approval-count visibility. The pending-approval count is surfaced to any of the three roles above. Actioning an approval — and the approval inbox itself, which reveals the held egress — remains restricted to a tenant admin (the admin or tenant_admin role) and is scoped to the caller's own tenant (see scheduled tasks / approvals). The count is a tenant aggregate carrying no recipient or content, so a ki_manager sees the number without gaining access to the inbox.

Query parameters

A query string carrying more than 100 parameters is refused 400 { "error": "too many query parameters", "code": "too_many_params" }.

Parameter Accepted Rejected
tenant_id A single tenant id string (admin only; ignored for other roles). A repeated (?tenant_id=a&tenant_id=b) or valueless (?tenant_id) parameter → 400 { "error": "tenant_id must be a single value", "code": "bad_param" }; for an admin, a value that is not one canonical tenant UUID → 400 { "error": "tenant_id must be a tenant id", "code": "bad_param" }.
from, to Both absent (the default window applies), or a pair of unix-second integers written in plain digits (at most 15) with from < to. A window that ends in the future is a valid query. Every rejection is 400 with "code": "bad_param": an empty (from=), repeated, valueless, negative, fractional or exponent-form bound; a lone from or to → "from and to must be given together" (it used to be ignored); from >= to → "from must be < to".

The window applies to metrics only. templates, compliance_reports, and approvals are point-in-time current state, unaffected by from/to. Default window: the last 30 days; maximum: clamped to 366 days, identical to the compliance report.

Bad input is rejected at the boundary before any database work. A storage failure on any of the four aggregated reads returns 503 { "error": "temporarily unavailable; retry later" } (retry) — never a partial or misleading inventory (fail-closed).

Response

200 OK, Content-Type: application/json.

The body carries read_source: "mysql", "clickhouse" or "mysql_fallback", naming the store that answered the compliance rollup (see the setting request_log_read_source_compliance). It is always present; "mysql" while the switch is off.

{
  "window": { "from_ms": 1767225600000, "to_ms": 1769904000000 },
  "metrics": {
    "requests_total": 48213,
    "requests_redacted": 192,
    "requests_detector_hit": 204,
    "requests_blocked": 57,
    "blocked_rate_limit": 4,
    "blocked_budget_quota": 2,
    "blocked_pii_gate": 9,
    "blocked_ip_allowlist": 1,
    "blocked_plan_model": 3,
    "blocked_guardrail": 38,
    "auth_failures": 11,
    "residency_eu": 47010,
    "residency_non_eu": 20,
    "residency_unknown": 6,
    "residency_no_dispatch": 120
  },
  "residency_authoritative": false,
  "templates": { "total": 5, "authoritative": 0, "myra": 2 },
  "compliance_reports": {
    "total": 2,
    "reports": [
      { "id": "…", "period_from_ms": 1767225600000, "period_to_ms": 1769904000000, "generated_at_ms": 1770000000000 }
    ]
  },
  "approvals": { "pending": 4 }
}
Field Meaning
window The [from_ms, to_ms) window (unix ms) the metrics cover.
metrics The complete compliance metric map for the window — see the metric definitions. Always fully populated (zero-defaulted).
residency_authoritative true only when the residency breakdown is authoritative evidence (no unresolved zones and the whole period post-dates residency-recording go-live); otherwise the four residency_* counts are an approximation. Same verdict as the compliance report's residency_basis.
templates.total Governance templates available to the tenant: its own live templates plus the Myra templates (templates.myra), which every organisation has.
templates.myra How many Myra templates are available (the current version of each). They are never authoritative.
templates.authoritative How many are DPO-signed authoritative mappings. 0 until a DPO signs (the data model carries the flag; UI-created templates are always non-authoritative).
compliance_reports.total Number of stored monthly snapshots.
compliance_reports.reports Metadata for each stored snapshot, newest period first (a JSON array — [] when none). Download a snapshot via GET /compliance/reports/{id}.
approvals.pending Exact count of pending agent-egress approvals awaiting a decision.

GET /governance/agents/purpose-unconfirmed

Lists the agents whose purpose is still a model suggestion awaiting a human (purpose_status: unconfirmed), ordered by agent name (then id), so a reviewer can confirm them in one click each with PATCH /gateways/{gw}/agents/{id} {"purpose": "...", "expected_version": N}.

Required permissions: AGENTS_REVIEW and AGENTS_AUTHOR (confirming is an agent PATCH, which needs both; held by admin, tenant_admin, ki_manager by default). Missing either is 403, an unauthenticated call is 401. Tenant scope is decided server-side exactly as for the dashboard above: admin must pass ?tenant_id=<uuid> (missing or malformed is 400), everyone else is pinned to their own tenant. admin and tenant_admin see every unconfirmed agent of the tenant; any other caller sees only agents they can see (own, shared with them or their group, or approved in the org catalog; MAP-3530).

curl 'https://<your-gateway-host>/admin/v1/governance/agents/purpose-unconfirmed?tenant_id=<id>'
{
  "agents": [
    {
      "id": "…", "gateway_id": "…", "name": "HR helper",
      "purpose": "Answers employee questions about leave and payroll.",
      "version": 3, "owner_name": "Dana Example", "can_edit": true
    }
  ],
  "total": 1
}
Field Meaning
agents At most 200 rows (a JSON array, [] when none). Send version back as expected_version when confirming.
total All unconfirmed agents of the tenant, which can exceed agents.
purpose The suggested text; "" when no suggestion exists yet (there is nothing to confirm - edit the agent).
owner_name Display name of the owner: the user's name, or their email address when the name is empty. null only when the owner no longer exists or has been deleted.
can_edit Whether the caller may open and edit the agent (owner or admin / tenant_admin). Decided by the server.

The creator's id is never returned. A database fault is 503 (never a partial list).

GET /governance/least-privilege

A tenant-wide, read-only list of least-privilege proposals: one item per granted connector right that an agent of the tenant has not used within the window (reason: unused), or whose connector no longer exists (reason: connector_deleted). It is the same computation as the per-agent access recommendations, evaluated for every agent of the tenant that sits on one of the tenant's gateways, and sorted by risk class. Nothing is revoked or changed by this endpoint: a proposal is advice, applying it is the agent owner's consent edit.

Required permission: GOVERNANCE_MANAGE (held by admin, tenant_admin, ki_manager by default). Any other caller is 403, an unauthenticated call is 401. Tenant scope is decided server-side as for the dashboard above: admin must pass ?tenant_id=<uuid> (missing or malformed is 400); for everyone else a single-valued tenant_id is ignored (pinned to their own tenant). A repeated or bare tenant_id is rejected for every role, and an admin who omits it is rejected 400 { "error": "tenant_id required", "code": "tenant_id_required" }; see the Tenant-scope rules above.

curl 'https://<your-gateway-host>/admin/v1/governance/least-privilege?window_days=30&sort=risk_class&limit=50&offset=0'
Parameter Default Meaning
tenant_id none admin: required, one tenant UUID. Others: a single value is ignored (pinned to own tenant). Repeated or bare is 400; see the Tenant-scope rules above.
window_days 30 Plain decimal integer 7 to 90.
sort risk_class risk_class or agent (see below).
limit 50 Plain decimal integer 1 to 200.
offset 0 Plain decimal integer 0 to 100000.

Values must be plain decimal digits (no sign, decimal point, space or leading zero). An unknown query parameter, any other empty, bare or repeated key (other than tenant_id, below), a malformed value, or a query with more than 100 parameters (too many query parameters) is rejected with 400 bad_param; it is never silently defaulted. A repeated or bare tenant_id is rejected for every role with 400 { "error": "tenant_id must be a single value", "code": "bad_param" }.

{
  "items": [
    {
      "agent_id": "…", "gateway_id": "…", "agent_name": "HR helper", "owner_name": "Dana Example",
      "connector_id": "…", "connector_name": "Mail", "tool": null,
      "reason": "unused", "granted_since_s": 1785000000,
      "risk_class": "destructive", "agent_status": "ok"
    }
  ],
  "total": 1, "limit": 50, "offset": 0, "sort": "risk_class", "window_days": 30,
  "agents_evaluated": 12, "agents_truncated": false,
  "agent_status_counts": { "ok": 10, "consent_unreadable": 0, "agent_too_new": 2, "coverage_insufficient": 0 },
  "consent_unreadable_agents": [],
  "coverage_since_ms": 1780000000000, "generated_at_ms": 1792389000000
}
Field Meaning
items The requested page (a JSON array, [] when none). tool is null for a whole-connector right. owner_name is the creator's name (email when the name is empty), null when the creator no longer exists.
total All items of the tenant for the window, which can exceed items.
risk_class destructive, write or read: the class of the tool (admin entry, then catalog, then destructive). A tool nobody classified, a whole-connector right (tool: null) and a connector that no longer exists are all destructive; an unclassified right is never treated as read.
agent_status_counts How many agents are in each state. An agent_too_new or coverage_insufficient agent cannot be proven unused, so it contributes no unused items (an empty list is not proof of least privilege).
consent_unreadable_agents Agents whose consent could not be read, so they are excluded from the proposals.
agents_evaluated, agents_truncated At most 500 agents are evaluated per request, ordered by name then id. agents_truncated: true means the tenant has more agents than that and the list is incomplete.
coverage_since_ms The oldest access decision record of the tenant, null when there is none.

Sort order: risk_class orders by class (destructive, write, read) and then by agent name, connector and tool; agent orders by agent name first (an item without an agent name sorts first). Names sort in byte order (case-sensitive: Zeta before alpha). Ties are broken by ids, so pages are stable. The list is computed on every request and is not cached. A database fault is 503 (never a partial list).

Scope

This endpoint ships the tenant-aggregate inventory. A future per-entity inventory (models, agents, connectors, workflows with their individual approval state and guardrail-hit counts) converges onto this same surface; it is intentionally not a second, competing view.