Skip to main content

Admin Dashboard — API Contracts

Status: populated Owner: Platform Engineering (Frontend) Last updated: 2026-04-18

1. Overview

The admin-dashboard has no external API. This document covers:

  1. Next.js Route Handlers (BFF endpoints) called by client components.
  2. Backend API endpoints consumed by server components and route handlers.

All backend calls use Authorization: Bearer <admin-platform-jwt> through Kong admin routes.

2. Next.js Route Handlers (BFF Layer)

POST /api/auth/logout

Clears __admin_session and __admin_refresh cookies; redirects to /login.

POST /api/auth/refresh

Proxies POST /v1/auth/refresh. Rotates session cookie.

GET /api/metrics

Aggregates data from analytics-service. Called by client-side polling every 30 seconds. Returns combined MetricsSummary + ThroughputPoint[] + DeliveryBreakdown + OperatorSummaryRow[].

POST /api/operators

Proxies POST /v1/internal/operators to operator-management-service.

PUT /api/operators/[operatorId]

Proxies PUT /v1/internal/operators/{operatorId}.

DELETE /api/operators/[operatorId]

Proxies DELETE /v1/internal/operators/{operatorId}.

POST /api/routing-rules

Proxies POST /v1/internal/routing/rules.

PUT /api/routing-rules/[ruleId]

Proxies PUT /v1/internal/routing/rules/{ruleId}.

DELETE /api/routing-rules/[ruleId]

Proxies DELETE /v1/internal/routing/rules/{ruleId}.

PUT /api/users/[userId]/status

Proxies PUT /v1/internal/users/{userId}/status — suspend / reactivate user.

DELETE /api/users/[userId]

Proxies DELETE /v1/internal/users/{userId}.

3. Backend Endpoints Consumed

Auth Service (Internal Routes)

MethodPathUsed on pagePurpose
GET/v1/internal/auth/meAll pages (server)Verify admin claim
POST/v1/auth/refreshMiddlewareRotate JWT
GET/v1/internal/users/usersList platform users
POST/v1/internal/users/usersCreate user
PUT/v1/internal/users/{userId}/status/usersSuspend / reactivate
DELETE/v1/internal/users/{userId}/usersDelete user

Analytics Service

MethodPathUsed on pagePurpose
GET/v1/internal/analytics/summary/dashboard24h KPI metrics
GET/v1/internal/analytics/throughput?range=24h&interval=1h/dashboardHourly throughput chart data
GET/v1/internal/analytics/delivery-breakdown/dashboardDelivery status pie chart data
GET/v1/internal/analytics/top-operators?limit=5/dashboardTop-5 operators table

Operator Management Service

MethodPathUsed on pagePurpose
GET/v1/internal/operators/operatorsList all SMPP operators
GET/v1/internal/operators/{operatorId}/operators detailOperator detail
POST/v1/internal/operators/operatorsCreate operator
PUT/v1/internal/operators/{operatorId}/operatorsUpdate operator config
DELETE/v1/internal/operators/{operatorId}/operatorsDelete operator
GET/v1/internal/operators/{operatorId}/health/operatorsLive connection state

Routing Engine

MethodPathUsed on pagePurpose
GET/v1/internal/routing/rules/routingList routing rules
POST/v1/internal/routing/rules/routingCreate routing rule
PUT/v1/internal/routing/rules/{ruleId}/routingUpdate rule
DELETE/v1/internal/routing/rules/{ruleId}/routingDelete rule
POST/v1/internal/routing/rules/reorder/routingReorder priority

Message Store / SMS Orchestrator

MethodPathUsed on pagePurpose
GET/v1/internal/messages/messagesCross-tenant message log
GET/v1/internal/messages/{messageId}/messages detailFull message detail

Query params for GET /v1/internal/messages:

ParamTypeDescription
tenantIdstringFilter by tenant
accountIdstringFilter by account
fromstringFilter by sender
tostringFilter by recipient
statusstringDelivery status
operatorIdstringFilter by operator
startDateISO8601
endDateISO8601
pageinteger
limitintegerMax 100

Billing Service

MethodPathUsed on pagePurpose
GET/v1/internal/billing/invoices/billingAll tenant invoices
GET/v1/internal/billing/invoices/{invoiceId}/billingInvoice detail
GET/v1/internal/billing/pricing/billingCurrent pricing config
PUT/v1/internal/billing/pricing/billingUpdate pricing

System Health

MethodPathUsed on pagePurpose
GET/v1/internal/health/services/healthAggregated service health
GET/v1/internal/health/services/{serviceName}/healthSingle service health

4. Error Handling

HTTP StatusDashboard behaviour
401Attempt refresh; if fails, redirect to /login?reason=session_expired
403Show "Insufficient permissions" toast; log to Sentry
429Toast: "Rate limit exceeded"
5xxToast: "Backend error"; alert details logged to Sentry