⚠️ Porta is in beta — APIs and features may change before v1.0
Skip to content

Dashboard Statistics API

The statistics API provides aggregated metrics for the admin dashboard, giving administrators a real-time overview of the Porta instance.

Endpoints

MethodPathPermissionDescription
GET/api/admin/statsstats:readGet dashboard statistics

Get Dashboard Statistics

http
GET /api/admin/stats
Authorization: Bearer <token>

Response

json
{
  "organizations": {
    "total": 15,
    "active": 12,
    "suspended": 2,
    "archived": 1
  },
  "users": {
    "total": 342,
    "active": 298,
    "inactive": 20,
    "suspended": 15,
    "locked": 9
  },
  "applications": {
    "total": 8,
    "active": 7,
    "archived": 1
  },
  "clients": {
    "total": 23,
    "active": 20,
    "revoked": 3
  },
  "sessions": {
    "activeSessions": 47,
    "uniqueUsers": 31
  },
  "recentActivity": {
    "loginsLast24h": 156,
    "failedLoginsLast24h": 12,
    "newUsersLast7d": 8,
    "newOrgsLast7d": 1
  }
}

Field Descriptions

SectionFieldDescription
organizationstotalTotal number of organizations
organizationsactive/suspended/archivedCount by status
userstotalTotal users across all organizations
usersactive/inactive/suspended/lockedCount by status
sessionsactiveSessionsCurrently active (non-revoked, non-expired) OIDC sessions
sessionsuniqueUsersDistinct users with active sessions
recentActivityloginsLast24hSuccessful login events in the last 24 hours
recentActivityfailedLoginsLast24hFailed login events in the last 24 hours
recentActivitynewUsersLast7dUsers created in the last 7 days
recentActivitynewOrgsLast7dOrganizations created in the last 7 days

Entity Change History

Each entity (organization, application, client, user) exposes a history endpoint that returns audit log entries specific to that entity.

MethodPathPermissionDescription
GET/api/admin/organizations/:id/historyorg:readOrganization change history
GET/api/admin/applications/:id/historyapp:readApplication change history
GET/api/admin/clients/:id/historyclient:readClient change history
GET/api/admin/organizations/:orgId/users/:userId/historyuser:readUser change history

Query Parameters

ParameterTypeDefaultDescription
limitnumber20Number of history entries (max 100)
afterstringOpaque cursor for pagination (pass nextCursor from previous response)
event_typestringFilter by event type prefix (e.g., org.status)

Response

json
{
  "data": [
    {
      "id": "uuid",
      "eventType": "user.status.suspended",
      "actorId": "uuid",
      "metadata": { "reason": "Policy violation" },
      "ipAddress": "192.168.1.1",
      "createdAt": "2026-01-15T10:30:00Z"
    }
  ],
  "hasMore": true,
  "nextCursor": "eyJjIjoiMjAyNi0wMS0xNVQxMDozMDowMFoiLCJpIjoiOThmZTQ2M2EtLi4uIn0"
}

Released under the MIT License.