> ## Documentation Index
> Fetch the complete documentation index at: https://docs.strikebet.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Health Check

> Returns service health status and basic information

Returns the current health status of the Strike Auth Service. This endpoint is useful for monitoring, load balancers, and service discovery systems.

<Note>
  This endpoint does not require authentication and can be called by anyone.
</Note>

<RequestExample>
  ```bash cURL
  curl -X GET "http://localhost:8080/health" \
    -H "Content-Type: application/json"
  ```

  ```javascript JavaScript
  const response = await fetch('http://localhost:8080/health', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json',
    },
  });

  const healthData = await response.json();
  console.log(healthData);
  ```

  ```python Python
  import requests

  response = requests.get('http://localhost:8080/health')
  health_data = response.json()
  print(health_data)
  ```

  ```go Go
  package main

  import (
      "fmt"
      "io"
      "net/http"
  )

  func main() {
      resp, err := http.Get("http://localhost:8080/health")
      if err != nil {
          panic(err)
      }
      defer resp.Body.Close()
      
      body, err := io.ReadAll(resp.Body)
      if err != nil {
          panic(err)
      }
      
      fmt.Println(string(body))
  }
  ```
</RequestExample>

## Response

<ResponseField name="status" type="string">
  Service health status. Always "healthy" when the service is operational.
</ResponseField>

<ResponseField name="service" type="string">
  Service name identifier.
</ResponseField>

<ResponseField name="version" type="string">
  Current version of the service.
</ResponseField>

<ResponseField name="timestamp" type="string">
  Current server timestamp in ISO 8601 format.
</ResponseField>

<ResponseExample>
  ```json 200 - Service Healthy
  {
    "status": "healthy",
    "service": "supabase-auth-service",
    "version": "1.0.0",
    "timestamp": "2025-05-30T00:00:00Z"
  }
  ```
</ResponseExample>

## Use Cases

### Load Balancer Health Checks

Configure your load balancer to use this endpoint for health checks:

```yaml
# Example Kubernetes liveness probe
livenessProbe:
  httpGet:
    path: /health
    port: 8080
  initialDelaySeconds: 30
  periodSeconds: 10
```

### Service Discovery

Use this endpoint to verify service availability in service discovery systems:

```javascript
// Example service discovery check
async function checkServiceHealth(serviceUrl) {
  try {
    const response = await fetch(`${serviceUrl}/health`);
    const health = await response.json();
    return health.status === 'healthy';
  } catch (error) {
    return false;
  }
}
```

### Monitoring and Alerting

Monitor service health and set up alerts:

```bash
# Example monitoring script
#!/bin/bash
HEALTH_URL="http://localhost:8080/health"
RESPONSE=$(curl -s $HEALTH_URL)
STATUS=$(echo $RESPONSE | jq -r '.status')

if [ "$STATUS" != "healthy" ]; then
  echo "Service is unhealthy: $RESPONSE"
  # Send alert
  exit 1
fi

echo "Service is healthy"
```

### Docker Health Checks

Use in Docker containers for health checking:

```dockerfile
# Dockerfile example
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
  CMD curl -f http://localhost:8080/health || exit 1
```

## Response Time

This endpoint is designed to respond quickly (typically \< 10ms) as it performs minimal processing:

* No database queries
* No external API calls
* Simple status check only

## Security Considerations

* **No Authentication Required**: This endpoint is public by design
* **No Sensitive Information**: Only basic service information is exposed
* **Rate Limiting**: Standard rate limits apply to prevent abuse

## Troubleshooting

If the health check fails:

1. **Service Not Running**: Verify the service is started and listening on the correct port
2. **Network Issues**: Check network connectivity and firewall rules
3. **Resource Constraints**: Monitor CPU, memory, and disk usage
4. **Dependencies**: Verify database and external service connectivity

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Get Settings" icon="gear" href="/api-reference/public/get-settings">
    Get public service configuration
  </Card>

  <Card title="Token Inspection" icon="magnifying-glass" href="/api-reference/debug/token-inspection">
    Debug endpoint for development
  </Card>
</CardGroup>
