# Health Check

Lightweight liveness probe for the Aurea API — use to verify the service is reachable before starting a flow.

## Overview

This endpoint is public, unauthenticated, and intentionally cheap. It returns a small JSON payload with the status, the server's time and the process uptime in seconds. Use it from client apps on startup, from load balancers, and from uptime-monitoring systems. Do not treat this as a deep health check — a `200 OK` here means the API process is up and the router is serving, not that its database or the services it calls (the ramps, the RPC nodes) are reachable. For the database, use `GET /health/ready` below.

### `GET /health`

Authentication: none (public endpoint).

Returns a 200 OK if the API process is running.

**Responses**

`200` OK

```json
{
  "status": "ok",
  "timestamp": "2026-10-05T21:41:25.492Z",
  "uptime": 12831.572459447
}
```

## Readiness

Whether the API reaches its database: `200` when a trivial query answers within 2 seconds, `503` otherwise. The outcome is kept for 5 seconds, so a burst of probes costs one query, and the answer is never cached (`Cache-Control: no-store`). No authentication. It names no error.

### `GET /health/ready`

Authentication: none (public endpoint).

Readiness: 200 when the API reaches its database, 503 otherwise.

**Responses**

`200` Ready

```json
{
  "status": "ok",
  "checks": { "database": "ok" }
}
```

`503` Unavailable

```json
{
  "status": "unavailable",
  "checks": { "database": "unreachable" }
}
```

## Implementation

```typescript
export async function isApiReachable(): Promise<boolean> {
  try {
    const res = await fetch('https://api.aureahub.com/health', { method: 'GET' });
    if (!res.ok) return false;
    const body = await res.json();
    return body.status === 'ok';
  } catch {
    return false;
  }
}
```

---

Web version: https://docs.aureahub.com/#health-check
