Health
Health Endpoint
Section titled “Health Endpoint”The health endpoint provides API status information and is useful for monitoring and debugging.
Get Health Status
Section titled “Get Health Status”GET /api/v1/health
Returns the current health status of the API.
Authentication
Section titled “Authentication”None required.
Request
Section titled “Request”curl https://app.bitmarks.sh/api/v1/healthconst response = await fetch('https://app.bitmarks.sh/api/v1/health');const health = await response.json();Response
Section titled “Response”Status: 200 OK
{ "name": "@bitmarks.sh/api", "version": "2.0.0-alpha", "environment": "production", "status": "healthy", "timestamp": "2025-01-15T12:00:00.000Z"}Response Fields
Section titled “Response Fields”| Field | Type | Description |
|---|---|---|
name | string | API package name |
version | string | API version |
environment | string | Current environment (development, staging, production) |
status | string | Health status (healthy, degraded, unhealthy) |
timestamp | string | ISO 8601 timestamp of the response |
Status Values
Section titled “Status Values”| Status | Description |
|---|---|
healthy | All systems operational |
degraded | Some features may be unavailable |
unhealthy | Major issues, limited functionality |
Use Cases
Section titled “Use Cases”- Monitoring: Set up health checks in your monitoring system
- Load Balancers: Use as health check endpoint for load balancers
- Debugging: Verify API connectivity and version
Example Integration
Section titled “Example Integration”async function checkAPIHealth() { try { const response = await fetch('https://app.bitmarks.sh/api/v1/health'); const health = await response.json();
if (health.status !== 'healthy') { console.warn('API is not healthy:', health.status); }
return health; } catch (error) { console.error('Failed to reach API:', error); return { status: 'unreachable' }; }}