Get decision and verdict stats
const 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';const options = { method: 'GET', headers: {'Deedglass-Version': '2026-10-01', Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”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.
Query Parameters
Section titled “Query Parameters”7d (default) or 30d, ending now. Not with from and to.
The window’s start (RFC 3339). Send to with it.
Example
2026-10-01T00:00:00ZThe window’s end (RFC 3339). Send from with it.
Example
2026-10-04T00:00:00ZOnly this agent’s actions (agt_…).
A tool name, or a glob with * like stripe.*.
previous adds trend against the window just before.
Responses
Section titled “Responses”The stats.
object
object
The org’s time zone; days and hours follow it.
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.
object
rule_id, tool, or agent with its name, by by.
object
by=rule: the policy versions whose rule decided.
object
object
Approved / (approved + denied); null when none was decided.
From the request to the decision.
object
Actions with no verdict (not executed).
object
object
One currency’s cost, in integer minor units (cents for usd). The full CostRow schema is in openapi.yaml.
object
compare=previous only. Keys: actions, deny_rate, mismatch_rate, unverifiable_rate, and approval_rate when both windows have one.
object
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
Empty for by=none.
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
One budget’s daily use over the window, by the org’s days. The full BudgetUse schema is in openapi.yaml.
object
The sentence when the window has no actions.
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}The last 7 days by rule (one group shown, no compare)
{ "object": "insights_stats", "window": { "from": "2026-09-27T07:03:20.897006Z", "to": "2026-10-04T07:03:20.897006Z", "days": 7 }, "timezone": "Asia/Kolkata", "by": "rule", "filters": { "agent": null, "tool": null }, "totals": { "actions": 5868, "decisions": { "allow": 5448, "deny": 17, "require_approval": 403 }, "approval": { "requested": 403, "approved": 389, "denied": 1, "expired": 5, "cancelled": 0, "pending": 8, "rate": 0.9974, "median_seconds": 1118, "p95_seconds": 6508 }, "deny_rate": 0.0029, "verdicts": { "VERIFIED": 5741, "MISMATCH": 3, "UNVERIFIABLE": 41, "none": 83 }, "levels": { "L0": 4633, "L1": 800, "L2": 352 }, "executed": 5837, "mismatch_rate": 0.0005, "unverifiable_rate": 0.007, "latency_ms": { "p50": 55, "p95": 465 }, "cost": [ { "currency": "usd", "total": 1774668, "p50": 2206, "p95": 7839 } ] }, "groups": [ { "key": { "rule_id": "approve-order-updates" }, "versions": [ 1 ], "actions": 403, "decisions": { "allow": 0, "deny": 0, "require_approval": 403 }, "approval": { "requested": 403, "approved": 389, "denied": 1, "expired": 5, "cancelled": 0, "pending": 8, "rate": 0.9974, "median_seconds": 1118, "p95_seconds": 6508 }, "deny_rate": 0, "verdicts": { "VERIFIED": 389, "MISMATCH": 0, "UNVERIFIABLE": 0, "none": 14 }, "levels": { "L0": 389, "L1": 0, "L2": 0 }, "executed": 389, "mismatch_rate": 0, "unverifiable_rate": 0, "latency_ms": { "p50": 39, "p95": 88 }, "cost": [] } ], "budgets": [], "series": [], "generated_at": "2026-10-04T07:03:20.897011Z", "empty": null}Headers
Section titled “Headers”This request’s id. Quote it to support; it matches error.request_id.
The API version this response follows.
A bad parameter (validation_failed), or a window that is backwards or longer than 90 days (replay_window_invalid).
object
object
One or more calm sentences with the next step.
The request field, query parameter or header the error is about.
On policy_invalid only. Each problem with its line, code and hint.
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
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
On undo_unavailable only. Every check of the undo, each with its fix. Additive (S23).
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" }}from after to
{ "error": { "type": "invalid_request_error", "code": "replay_window_invalid", "message": "The window must start before it ends, and it can be at most 90 days long. Send from before to.", "param": "from", "request_id": "req_01m42vk215p3bfyp3xasewttq4", "doc_url": "https://docs.deedglass.com/errors/replay_window_invalid" }}Headers
Section titled “Headers”This request’s id. Quote it to support; it matches error.request_id.
default
Section titled “default”An error. Every error has this envelope; doc_url explains the code.
object
object
One or more calm sentences with the next step.
The request field, query parameter or header the error is about.
On policy_invalid only. Each problem with its line, code and hint.
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
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
On undo_unavailable only. Every check of the undo, each with its fix. Additive (S23).
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" }}Headers
Section titled “Headers”This request’s id. Quote it to support; it matches error.request_id.
The API version this response follows.