> ## Documentation Index
> Fetch the complete documentation index at: https://docs.manthan.systems/llms.txt
> Use this file to discover all available pages before exploring further.

# Statistics

> Aggregate audit statistics via GET /audit/stats

## Endpoint

```bash theme={null}
curl http://localhost:3000/audit/stats \
  -H "Authorization: Bearer $PARMANA_API_KEY" | jq .
```

***

## Response

```json theme={null}
{
  "total_decisions": "12847",
  "decisions_today": "342",
  "total_verifications": "12831",
  "valid_verifications": "12831",
  "invalid_verifications": "0",
  "total_security_events": "3",
  "total_api_calls": "38291"
}
```

All values are strings — PostgreSQL returns `bigint` counts as strings over JSON.

| Field                   | Description                                                                      |
| ----------------------- | -------------------------------------------------------------------------------- |
| `total_decisions`       | Total decisions ever recorded                                                    |
| `decisions_today`       | Decisions recorded today (UTC)                                                   |
| `total_verifications`   | Total verification calls recorded                                                |
| `valid_verifications`   | Verifications that returned `valid: true`                                        |
| `invalid_verifications` | Verifications that returned `valid: false` — investigate immediately if non-zero |
| `total_security_events` | Total security events recorded                                                   |
| `total_api_calls`       | Total API calls recorded across all endpoints                                    |

***

## SDK

```typescript theme={null}
const stats = await client.audit.stats();

const invalidVerifications = parseInt(stats.invalid_verifications, 10);
if (invalidVerifications > 0) {
  // Alert immediately — invalid verifications require investigation
  console.error(`WARNING: ${invalidVerifications} invalid verification(s) detected`);
}
```

***

## Dashboard

The Statistics view in the audit dashboard ([http://localhost:8081](http://localhost:8081)) displays these counts alongside a decision timeline chart.

***

## Troubleshooting

**All counts show "0"** — Postgres is connected but no decisions have been recorded. Verify that executions are actually being made and that `audit_db: true` in `/health`.

**`total_decisions` matches but `total_verifications` is much lower** — Verification is not being called after each execution. Call `client.verify()` immediately after every `POST /execute` in your application.

**`invalid_verifications > 0`** — This is a critical signal. Pull the security events to identify which executions are failing verification, retrieve the full attestations, and investigate immediately.
