# Health (Coinbax API)

> Source: https://developers.coinbax.com/reference/coinbax-api/health/
> Staging base URL: https://api-staging.coinbax.com

Health check and monitoring endpoints

## Complete health check

`GET /api/v1/health`

- Auth: Public (no authentication)
- Operation ID: `HealthController_check`

Returns detailed health status of all system components including database, cache, blockchain, and external services

### Example request

```bash
curl https://api-staging.coinbax.com/api/v1/health
```

### Responses

**200** System is healthy

```json
{
  "status": "healthy",
  "timestamp": "2024-10-14T20:30:00.000Z",
  "version": "0.1.0",
  "uptime": 3600,
  "database": {
    "status": "up",
    "responseTime": 12,
    "details": {
      "version": "14.2",
      "connections": 10
    },
    "error": "Connection timeout"
  },
  "cache": {
    "status": "up",
    "responseTime": 12,
    "details": {
      "version": "14.2",
      "connections": 10
    },
    "error": "Connection timeout"
  },
  "blockchain": {
    "status": "up",
    "responseTime": 12,
    "details": {
      "version": "14.2",
      "connections": 10
    },
    "error": "Connection timeout"
  },
  "riskService": {
    "status": "up",
    "responseTime": 12,
    "details": {
      "version": "14.2",
      "connections": 10
    },
    "error": "Connection timeout"
  },
  "memory": {
    "total": 16777216000,
    "free": 8388608000,
    "used": 8388608000,
    "usedPercent": 50
  },
  "process": {
    "pid": 12345,
    "memoryUsage": 150000000,
    "cpuUsage": 5.5
  }
}
```

**503** System is unhealthy

---

## Liveness probe

`GET /api/v1/health/live`

- Auth: Public (no authentication)
- Operation ID: `HealthController_liveness`

Kubernetes liveness probe - checks if the application is running. Returns 200 if alive, 503 if dead.

### Example request

```bash
curl https://api-staging.coinbax.com/api/v1/health/live
```

### Responses

**200** Application is alive

```json
{
  "status": "alive",
  "timestamp": "2024-10-14T20:30:00.000Z",
  "uptime": 3600
}
```

**503** Application is not responding

---

## Readiness probe

`GET /api/v1/health/ready`

- Auth: Public (no authentication)
- Operation ID: `HealthController_readiness`

Kubernetes readiness probe - checks if application can accept traffic. Validates critical dependencies.

### Example request

```bash
curl https://api-staging.coinbax.com/api/v1/health/ready
```

### Responses

**200** Application is ready to accept traffic

```json
{
  "status": "ready",
  "timestamp": "2024-10-14T20:30:00.000Z",
  "dependencies": {
    "database": "up",
    "cache": "up"
  }
}
```

**503** Application is not ready

---

## Test Sentry integration

`GET /api/v1/sentry-test`

- Auth: Public (no authentication)
- Operation ID: `SentryTestController_testSentry`

Triggers various types of Sentry events for testing. Use query parameter "type" to select test type: error, log, or span.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `type` | query | enum ("error", "log", "span") | no | Type of Sentry test to run |

### Example request

```bash
curl https://api-staging.coinbax.com/api/v1/sentry-test
```

### Responses

**200** Test completed successfully (log or span)

**500** Test error thrown (error type)
