Skip to content

Get decision and verdict stats

GET
/v1/insights/stats
curl --request GET \
--url 'http://127.0.0.1:8080/v1/insights/stats?window=7d&from=2026-10-01T00%3A00%3A00Z&to=2026-10-04T00%3A00%3A00Z&by=rule&compare=previous' \
--header 'Authorization: Bearer <token>' \
--header 'Deedglass-Version: 2026-10-01'

Counts and percentiles over this org’s actions by decision time (S27), the same numbers deedglass insights stats prints: decisions, approvals (requested, outcomes, the approval rate approved / (approved + denied) and the wait), the deny rate (Stop decisions left out), verdicts and witnessed levels, latency, cost per currency, each budget’s daily use, and one row per org-local day. Rates are rounded to 4 decimals and always come with their counts. The window is window=7d (the default) or 30d ending now, or from and to in RFC 3339 (both; not with window; from before to, at most 90 days, else 400 replay_window_invalid). by groups by rule (the deciding rule, with the policy versions that used it), tool or agent (default none: only totals). agent (an agt_ id) and tool (a name or a glob like stripe.*) filter. compare=previous adds trend against the window of the same length just before: delta_pct for counts and delta_pp (percentage points) for rates, and only previous: null when that window has fewer than 20 actions. Days follow the org’s time zone. empty is a sentence when the window has no actions. Answers are cached for 60 s per org and query (Cache-Control: private, no-store). Any other parameter, or one sent twice, is 400 validation_failed. A Console session (viewer and up) or an org admin key (admin scope); agent keys get 403 insufficient_scope.

Deedglass-Version
string
/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/

The API version (YYYY-MM-DD). Leave it out to use your org’s pinned version (public routes use the latest). An unknown version is 400 api_version_invalid.

window
string
default: 7d
Allowed values: 7d 30d

7d (default) or 30d, ending now. Not with from and to.

from
string format: date-time

The window’s start (RFC 3339). Send to with it.

Example
2026-10-01T00:00:00Z
to
string format: date-time

The window’s end (RFC 3339). Send from with it.

Example
2026-10-04T00:00:00Z
by
string
default: none
Allowed values: rule tool agent none
agent
string
<= 64 characters

Only this agent’s actions (agt_…).

tool
string
<= 200 characters

A tool name, or a glob with * like stripe.*.

compare
string
Allowed values: previous

previous adds trend against the window just before.

The stats.

Media typeapplication/json
object
object
required
string
Allowed value: insights_stats
window
required
object
from
required
string format: date-time
to
required
string format: date-time
days
required
number
timezone
required

The org’s time zone; days and hours follow it.

string
by
required
string
Allowed values: rule tool agent none
filters
required
object
agent
required
string | null
tool
required
string | null
totals
required

One group’s numbers (or the totals, which have no key). Rates are rounded to 4 decimals: deny_rate = deny / actions with Stop decisions left out of both, mismatch_rate and unverifiable_rate over executed.

object
key

rule_id, tool, or agent with its name, by by.

object
rule_id
string
tool
string
agent
string
name
string
versions

by=rule: the policy versions whose rule decided.

Array<integer>
actions
required
integer
decisions
required
object
allow
required
integer
deny
required
integer
require_approval
required
integer
approval
required
object
requested
required
integer
approved
required
integer
denied
required
integer
expired
required
integer
cancelled
required
integer
pending
required
integer
rate
required

Approved / (approved + denied); null when none was decided.

number | null
median_seconds
required

From the request to the decision.

integer | null
p95_seconds
required
integer | null
deny_rate
required
number
verdicts
required
object
VERIFIED
required
integer
MISMATCH
required
integer
UNVERIFIABLE
required
integer
none
required

Actions with no verdict (not executed).

integer
levels
required
object
L0
required
integer
L1
required
integer
L2
required
integer
executed
required
integer
mismatch_rate
required
number
unverifiable_rate
required
number
latency_ms
required
object
p50
required
integer | null
p95
required
integer | null
cost
required
Array<object>

One currency’s cost, in integer minor units (cents for usd). The full CostRow schema is in openapi.yaml.

object
trend

compare=previous only. Keys: actions, deny_rate, mismatch_rate, unverifiable_rate, and approval_rate when both windows have one.

object
key
additional properties

Against the previous window of the same length: delta_pct for counts, delta_pp (percentage points) for rates. Only previous: null when that window has fewer than 20 actions. The full StatsTrend schema is in openapi.yaml.

object
groups
required

Empty for by=none.

Array<object>

One group’s numbers (or the totals, which have no key). Rates are rounded to 4 decimals: deny_rate = deny / actions with Stop decisions left out of both, mismatch_rate and unverifiable_rate over executed. The full StatsGroup schema is in openapi.yaml.

object
budgets
required
Array<object>

One budget’s daily use over the window, by the org’s days. The full BudgetUse schema is in openapi.yaml.

object
series
required
Array<object>

One org-local day. The full SeriesRow schema is in openapi.yaml.

object
generated_at
required
string format: date-time
empty
required

The sentence when the window has no actions.

string | null
Examples

Three days by agent, compared with the three days before (two groups and two days shown)

{
"object": "insights_stats",
"window": {
"from": "2026-10-01T00:00:00Z",
"to": "2026-10-04T00:00:00Z",
"days": 3
},
"timezone": "Asia/Kolkata",
"by": "agent",
"filters": {
"agent": null,
"tool": null
},
"totals": {
"actions": 2554,
"decisions": {
"allow": 2373,
"deny": 9,
"require_approval": 172
},
"approval": {
"requested": 172,
"approved": 170,
"denied": 1,
"expired": 1,
"cancelled": 0,
"pending": 0,
"rate": 0.9942,
"median_seconds": 1129,
"p95_seconds": 6510
},
"deny_rate": 0.0035,
"verdicts": {
"VERIFIED": 2508,
"MISMATCH": 3,
"UNVERIFIABLE": 13,
"none": 30
},
"levels": {
"L0": 2037,
"L1": 330,
"L2": 157
},
"executed": 2543,
"mismatch_rate": 0.0012,
"unverifiable_rate": 0.0051,
"latency_ms": {
"p50": 58,
"p95": 448
},
"cost": [
{
"currency": "usd",
"total": 718956,
"p50": 2175,
"p95": 7657.85
}
],
"trend": {
"actions": {
"delta_pct": 1.753,
"previous": 2510
},
"approval_rate": {
"delta_pp": -0.58,
"previous": 1
},
"deny_rate": {
"delta_pp": 0.07,
"previous": 0.0028
},
"mismatch_rate": {
"delta_pp": 0.12,
"previous": 0
},
"unverifiable_rate": {
"delta_pp": -0.29,
"previous": 0.008
}
}
},
"groups": [
{
"key": {
"agent": "agt_01m42v9q47mmvp6gwzj71ba643",
"name": "nightly-etl"
},
"actions": 1194,
"decisions": {
"allow": 1194,
"deny": 0,
"require_approval": 0
},
"approval": {
"requested": 0,
"approved": 0,
"denied": 0,
"expired": 0,
"cancelled": 0,
"pending": 0,
"rate": null,
"median_seconds": null,
"p95_seconds": null
},
"deny_rate": 0,
"verdicts": {
"VERIFIED": 1194,
"MISMATCH": 0,
"UNVERIFIABLE": 0,
"none": 0
},
"levels": {
"L0": 1194,
"L1": 0,
"L2": 0
},
"executed": 1194,
"mismatch_rate": 0,
"unverifiable_rate": 0,
"latency_ms": {
"p50": 41,
"p95": 92
},
"cost": [],
"trend": {
"actions": {
"delta_pct": 1.8771,
"previous": 1172
},
"deny_rate": {
"delta_pp": 0,
"previous": 0
},
"mismatch_rate": {
"delta_pp": 0,
"previous": 0
},
"unverifiable_rate": {
"delta_pp": 0,
"previous": 0
}
}
},
{
"key": {
"agent": "agt_01m42v9q3v1av7wvzjr1kq3mx1",
"name": "support-bot"
},
"actions": 737,
"decisions": {
"allow": 730,
"deny": 7,
"require_approval": 0
},
"approval": {
"requested": 0,
"approved": 0,
"denied": 0,
"expired": 0,
"cancelled": 0,
"pending": 0,
"rate": null,
"median_seconds": null,
"p95_seconds": null
},
"deny_rate": 0.0095,
"verdicts": {
"VERIFIED": 698,
"MISMATCH": 0,
"UNVERIFIABLE": 13,
"none": 26
},
"levels": {
"L0": 227,
"L1": 330,
"L2": 154
},
"executed": 730,
"mismatch_rate": 0,
"unverifiable_rate": 0.0178,
"latency_ms": {
"p50": 232,
"p95": 622
},
"cost": [
{
"currency": "usd",
"total": 718956,
"p50": 2175,
"p95": 7657.85
}
],
"trend": {
"actions": {
"delta_pct": -7.99,
"previous": 801
},
"deny_rate": {
"delta_pp": 0.08,
"previous": 0.0087
},
"mismatch_rate": {
"delta_pp": 0,
"previous": 0
},
"unverifiable_rate": {
"delta_pp": -0.74,
"previous": 0.0252
}
}
}
],
"budgets": [
{
"agent": null,
"budget": "refunds-per-day",
"kind": "policy",
"limit": {
"amount": 400000,
"currency": "usd"
},
"max_utilisation": 0.95,
"days_over_80": 1,
"days": [
{
"date": "2026-10-01",
"used": 219559,
"utilisation": 0.5489
},
{
"date": "2026-10-02",
"used": 380000,
"utilisation": 0.95
}
]
}
],
"series": [
{
"date": "2026-10-01",
"actions": 526,
"denied": 5,
"verified": 510,
"mismatch": 0,
"unverifiable": 4
},
{
"date": "2026-10-02",
"actions": 933,
"denied": 2,
"verified": 912,
"mismatch": 3,
"unverifiable": 9
}
],
"generated_at": "2026-10-04T07:05:11.547012Z",
"empty": null
}
Deedglass-Request-Id
string
/^req_[0-7][0-9a-hjkmnp-tv-z]{25}$/

This request’s id. Quote it to support; it matches error.request_id.

Deedglass-Version
string

The API version this response follows.

Cache-Control
string
Allowed value: private, no-store

A bad parameter (validation_failed), or a window that is backwards or longer than 90 days (replay_window_invalid).

Media typeapplication/json
object
error
required
object
type
required
string
Allowed values: invalid_request_error authentication_error permission_error policy_error rate_limit_error api_error
code
required
string
Allowed values: invalid_api_key api_key_revoked api_key_expired agent_suspended agent_stopped org_stopped insufficient_scope policy_denied approval_required approval_expired budget_exceeded intent_required intent_invalid intent_replay tool_unknown connector_unavailable upstream_error timeout rate_limited idempotency_conflict validation_failed not_found conflict internal_error authentication_required method_not_allowed request_too_large unsupported_media_type invalid_json api_version_invalid idempotency_key_invalid idempotency_key_in_use service_unavailable session_expired csrf_failed insufficient_role login_link_invalid login_code_invalid last_owner policy_unavailable policy_invalid credentials_missing destination_blocked vault_unavailable upstream_auth_failed upstream_not_found upstream_rate_limited response_too_large statement_refused row_limit_exceeded database_role_unsafe database_not_ready witness_not_configured approval_decided already_countersigned approver_not_eligible self_approval approval_needs_person context_changed approval_unsatisfiable approval_link_invalid approval_link_review_only approver_unmapped stripe_live_key_refused stripe_livemode_detected upstream_approval_pending schedule_needs_approval action_executing from_denied undo_unavailable undo_plan_stale already_undone undo_conflict replay_too_large replay_window_invalid suggestion_stale shadow_slot_taken suggestion_decided observe_not_enabled pro_required
message
required

One or more calm sentences with the next step.

string
param
required

The request field, query parameter or header the error is about.

string | null
request_id
required
string
/^req_[0-7][0-9a-hjkmnp-tv-z]{25}$/
doc_url
required
string format: uri
diagnostics

On policy_invalid only. Each problem with its line, code and hint.

Array<object>

One finding about a policy file, with its position and the next step. Codes are stable and listed in docs/POLICY_ERRORS.md. In the policy_invalid error envelope each diagnostic also carries object: policy_diagnostic. The full PolicyDiagnostic schema is in openapi.yaml.

object
action

One agent action. Its sections mirror the deed’s. status is the one field an agent needs; state is the exact lifecycle state (docs/GATE.md). The Gate’s own responses (POST /v1/actions and its result report) add execution.result and witness.reasons; lists leave both out. The full Action schema is in openapi.yaml.

object
checks

On undo_unavailable only. Every check of the undo, each with its fix. Additive (S23).

Array<object>

One of the twelve safety checks (S23 §3.3). Available means no check failed. The full UndoCheck schema is in openapi.yaml.

object
Examples

An unknown window

{
"error": {
"type": "invalid_request_error",
"code": "validation_failed",
"message": "window must be 7d or 30d, or send from and to (RFC 3339).",
"param": "window",
"request_id": "req_01m42vk20pnfaem7cw2nt7amza",
"doc_url": "https://docs.deedglass.com/errors/validation_failed"
}
}
Deedglass-Request-Id
string
/^req_[0-7][0-9a-hjkmnp-tv-z]{25}$/

This request’s id. Quote it to support; it matches error.request_id.

An error. Every error has this envelope; doc_url explains the code.

Media typeapplication/json
object
error
required
object
type
required
string
Allowed values: invalid_request_error authentication_error permission_error policy_error rate_limit_error api_error
code
required
string
Allowed values: invalid_api_key api_key_revoked api_key_expired agent_suspended agent_stopped org_stopped insufficient_scope policy_denied approval_required approval_expired budget_exceeded intent_required intent_invalid intent_replay tool_unknown connector_unavailable upstream_error timeout rate_limited idempotency_conflict validation_failed not_found conflict internal_error authentication_required method_not_allowed request_too_large unsupported_media_type invalid_json api_version_invalid idempotency_key_invalid idempotency_key_in_use service_unavailable session_expired csrf_failed insufficient_role login_link_invalid login_code_invalid last_owner policy_unavailable policy_invalid credentials_missing destination_blocked vault_unavailable upstream_auth_failed upstream_not_found upstream_rate_limited response_too_large statement_refused row_limit_exceeded database_role_unsafe database_not_ready witness_not_configured approval_decided already_countersigned approver_not_eligible self_approval approval_needs_person context_changed approval_unsatisfiable approval_link_invalid approval_link_review_only approver_unmapped stripe_live_key_refused stripe_livemode_detected upstream_approval_pending schedule_needs_approval action_executing from_denied undo_unavailable undo_plan_stale already_undone undo_conflict replay_too_large replay_window_invalid suggestion_stale shadow_slot_taken suggestion_decided observe_not_enabled pro_required
message
required

One or more calm sentences with the next step.

string
param
required

The request field, query parameter or header the error is about.

string | null
request_id
required
string
/^req_[0-7][0-9a-hjkmnp-tv-z]{25}$/
doc_url
required
string format: uri
diagnostics

On policy_invalid only. Each problem with its line, code and hint.

Array<object>

One finding about a policy file, with its position and the next step. Codes are stable and listed in docs/POLICY_ERRORS.md. In the policy_invalid error envelope each diagnostic also carries object: policy_diagnostic. The full PolicyDiagnostic schema is in openapi.yaml.

object
action

One agent action. Its sections mirror the deed’s. status is the one field an agent needs; state is the exact lifecycle state (docs/GATE.md). The Gate’s own responses (POST /v1/actions and its result report) add execution.result and witness.reasons; lists leave both out. The full Action schema is in openapi.yaml.

object
checks

On undo_unavailable only. Every check of the undo, each with its fix. Additive (S23).

Array<object>

One of the twelve safety checks (S23 §3.3). Available means no check failed. The full UndoCheck schema is in openapi.yaml.

object
Example
{
"error": {
"type": "invalid_request_error",
"code": "not_found",
"message": "There's no endpoint at GET /v1/helth. Did you mean /v1/health?",
"param": null,
"request_id": "req_01j9zr3m5k8q2w7x4t6v0b1c9d",
"doc_url": "https://docs.deedglass.com/errors/not_found"
}
}
Deedglass-Request-Id
string
/^req_[0-7][0-9a-hjkmnp-tv-z]{25}$/

This request’s id. Quote it to support; it matches error.request_id.

Deedglass-Version
string

The API version this response follows.