# /api/health/detailed (auxiliary)

Source-derived auxiliary endpoint contract, authentication, request validation, responses, and errors.

Source: https://docs.minds.sh/docs/api/platform/reference/auxiliary--api-health-detailed



This is the **auxiliary** service route. Its origin and authentication are described in [Platform API overview](/docs/api/platform) and [Authentication](/docs/api/platform/authentication). A path shared by another service is a different endpoint.

| Property                       | Contract                                                                       |
| ------------------------------ | ------------------------------------------------------------------------------ |
| Methods                        | GET                                                                            |
| Path                           | `/api/health/detailed`                                                         |
| Path parameters                | None                                                                           |
| Query parameters read in route | None read directly; schema validation below may define additional fields       |
| Headers read in route          | No additional direct header reads; authentication helpers may read credentials |

## Authentication and access [#authentication-and-access]

Webhook-specific signature or verification handler; not a customer bearer-token endpoint. See the handler and signing setup.

## Request and response definitions [#request-and-response-definitions]

The following named definitions are imported or declared by this route. Optional markers, defaults, bounds, and enum values are shown exactly as implemented. A response type is a source contract, not an example populated with real account data.

### HealthCheck [#healthcheck]

```typescript
interface HealthCheck {
  status: 'healthy' | 'degraded' | 'unhealthy';
  message?: string;
  latency?: number;
  timestamp: string;
}
```

Source: `minds-ui/apps/api/app/api/health/detailed/route.ts:15`.

### DetailedHealthResponse [#detailedhealthresponse]

```typescript
interface DetailedHealthResponse {
  status: 'healthy' | 'degraded' | 'unhealthy';
  timestamp: string;
  uptime: number;
  version: string;
  checks: {
    api: HealthCheck;
    database: HealthCheck;
    auth: HealthCheck;
    webhooks: HealthCheck;
  };
}
```

Source: `minds-ui/apps/api/app/api/health/detailed/route.ts:22`.

## Method behavior [#method-behavior]

The handler excerpt preserves field validation, response envelopes, cookie changes, and exception branches. Values returned by service helpers retain their named response type above; for passthrough routes, the upstream response is authoritative.

### GET [#get]

```typescript
GET = async (): Promise<Response> => {
  const timestamp = new Date().toISOString();

  // Run all health checks in parallel
  const [databaseCheck, authCheck, webhooksCheck] = await Promise.all([
    checkDatabase(),
    checkAuth(),
    checkWebhooks(),
  ]);

  const checks = {
    api: {
      status: 'healthy' as const,
      message: 'API service operational',
      timestamp,
    },
    database: databaseCheck,
    auth: authCheck,
    webhooks: webhooksCheck,
  };

  // Determine overall health status
  let overallStatus: 'healthy' | 'degraded' | 'unhealthy' = 'healthy';

  // Critical services: API, Database, Auth
  const criticalServices = [checks.database, checks.auth];
  if (criticalServices.some((check) => check.status === 'unhealthy')) {
    overallStatus = 'unhealthy';
  } else if (
    criticalServices.some((check) => check.status === 'degraded') ||
    checks.webhooks.status === 'degraded'
  ) {
    overallStatus = 'degraded';
  }

  const response: DetailedHealthResponse = {
    status: overallStatus,
    timestamp,
    uptime: getUptime(),
    version: '1.0.0',
    checks,
  };

  // Return 503 for unhealthy, 200 for healthy or degraded
  const statusCode = overallStatus === 'unhealthy' ? 503 : 200;

  return new Response(JSON.stringify(response, null, 2), {
    status: statusCode,
    headers: {
      'Content-Type': 'application/json',
      'Cache-Control': 'no-cache, no-store, must-revalidate',
    },
  });
}
```

Source: `minds-ui/apps/api/app/api/health/detailed/route.ts:145`.

## Evidence [#evidence]

Generated from the local source snapshot on 2026-09-12. This page documents implemented code and does not certify a deployed service, permissions configuration, or successful provider operation.

Source file: `minds-ui/apps/api/app/api/health/detailed/route.ts`. SHA-256: `1cf816f48e0f79e019fcd6a4e896c9255c6381c899e8cd315c80d4d52d05e1e1`.
