Skip to main content

Platform Admin Service — API Contracts

Status: populated Owner: TBD Last updated: 2026-04-18 Companion: Service Template · 05 API Design

Base URL: https://api.ghasi-ehealth.{tld} Auth: Bearer JWT (RS256) except internal routes.

1. Platform configuration (Super Admin)

MethodPathScopeSummary
GET/api/v1/admin/platform-configSUPER_ADMINList all config entries
POST/api/v1/admin/platform-configSUPER_ADMINUpsert config entry
GET/api/v1/admin/platform-config/:key/historySUPER_ADMINChange history (cursor-paginated)
DELETE/api/v1/admin/platform-config/:idSUPER_ADMINArchive config entry

POST /api/v1/admin/platform-config — request:

{
"key": "global.session_idle_minutes",
"value": "30",
"scope": "PLATFORM",
"tenantId": null,
"description": "Global session idle timeout"
}

200 response:

{
"key": "global.session_idle_minutes",
"value": "30",
"scope": "PLATFORM",
"tenantId": null,
"isArchived": false,
"updatedAt": "2026-04-18T10:00:00Z"
}

Errors: 400 ADM_CONFIG_KEY_UNKNOWN, 400 ADM_CONFIG_VALUE_INVALID.

GET /api/v1/admin/platform-config/:key/history — response:

{
"data": [
{
"changedAt": "2026-04-18T09:00:00Z",
"changedBy": "usr_01H...",
"oldValue": "20",
"newValue": "30",
"scope": "PLATFORM"
}
],
"nextCursor": "cur_01H..."
}

2. Feature flags (Super Admin)

MethodPathScopeSummary
GET/api/v1/admin/flagsSUPER_ADMINList all flags
GET/api/v1/admin/flags/:keySUPER_ADMINGet flag details
POST/api/v1/admin/flagsSUPER_ADMINCreate flag
PATCH/api/v1/admin/flags/:keySUPER_ADMINUpdate description / defaultEnabled
DELETE/api/v1/admin/flags/:keySUPER_ADMINArchive flag
POST/api/v1/admin/flags/:key/tenant-overridesSUPER_ADMINSet tenant override
DELETE/api/v1/admin/flags/:key/tenant-overrides/:tenantIdSUPER_ADMINRemove tenant override

POST /api/v1/admin/flags — request:

{
"key": "feature.telehealth_beta",
"description": "Enables telehealth video call feature for early adopters",
"defaultEnabled": false
}

POST /admin/flags/:key/tenant-overrides — request:

{ "tenantId": "ten_01H...", "enabled": true }

Errors: 404 ADM_FLAG_NOT_FOUND, 409 ADM_FLAG_KEY_DUPLICATE, 422 ADM_FLAG_ARCHIVED.

3. Feature flags (Tenant Admin)

MethodPathScopeSummary
GET/api/v1/platform/flagsTENANT_ADMINList flags with tenant-resolved state
GET/api/v1/platform/flags/:key/evaluateJWTEvaluate flag for caller's tenant context

GET /platform/flags/:key/evaluate — response:

{ "key": "feature.telehealth_beta", "enabled": true, "reason": "tenant_override_enabled" }

4. Platform health

MethodPathScopeSummary
GET/api/v1/admin/health/aggregateSUPER_ADMIN or serviceAggregate health summary

GET /admin/health/aggregate — response:

{
"overall": "degraded",
"services": [
{ "serviceId": "identity-service", "status": "healthy", "lastChecked": "2026-04-18T10:00:00Z" },
{ "serviceId": "laboratory-service", "status": "unhealthy", "lastChecked": "2026-04-18T09:55:00Z" }
],
"cachedAt": "2026-04-18T10:00:05Z"
}

Cache TTL: 10 s.

5. Internal routes (cluster-only, IP-restricted)

MethodPathSummary
GET/internal/admin/flags/:key/evaluateFlag evaluation for services (p95 ≤ 120 ms)
GET/internal/admin/flags/bootstrapAll flag decisions for tenant (used at service startup)
GET/internal/admin/config/:keySingle config value lookup
POST/internal/admin/health/sourcesRegister health source

GET /internal/admin/flags/:key/evaluate?tenantId=ten_01H...

{ "key": "feature.telehealth_beta", "enabled": true, "reason": "tenant_override_enabled" }

6. Pagination and rate limits

  • History endpoint: cursor-based pagination (cursor, limit max 100).
  • Flags and config list: offset pagination (page, pageSize max 100).
  • Rate limits (Kong): Super Admin write endpoints 60/min; internal evaluate 1000/min/service.

7. Compatibility routes (M1 — legacy transition)

During the M0→M1 transition window, legacy /api/platform/* paths are proxied to /api/v1/admin/* routes via Kong route compatibility policy. Deprecated at M2; removed at M3.