Overview
The System & Testing endpoints provide tools for monitoring API health, testing authentication, and ensuring proper system functionality. These endpoints are essential for monitoring and debugging integrations.Health Check
GET /health
Comprehensive system health check that verifies API server status, database connectivity, and authentication services. This endpoint does not require authentication.Example Request
Response Statuses
- 200 OK: All systems operational
 - 207 Multi-Status: Some systems degraded but API functional
 - 503 Service Unavailable: Critical systems down
 
Healthy Response (200)
Degraded Response (207)
Error Response (503)
Authentication Testing
GET /test-auth
Test endpoint to verify that your authentication is working correctly. Supports both API key and JWT token authentication methods.Authentication Methods
The endpoint will detect and test whichever authentication method you provide:- API Key: Use 
X-API-Keyheader - JWT Token: Use 
Authorization: Bearerheader - Legacy API Key: Use 
Authorization: Bearerwith legacy key 
Example: Test API Key
Example: Test JWT Token
Success Response (200)
API Key Authentication:Error Response (401)
CORS Testing
GET /cors-test
Test Cross-Origin Resource Sharing (CORS) configuration. This endpoint helps verify that your web application can properly communicate with the API from browser environments.Example Request
Response
CORS Headers
The API supports requests from these origins:https://intentgpt.aihttps://www.intentgpt.aihttp://localhost:8080http://localhost:3000- Development workstation URLs
 
System Monitoring
Health Check Integration
The health check endpoint is designed for integration with monitoring systems:Kubernetes Liveness Probe
Docker Health Check
Monitoring Script
Error Diagnosis
Common Issues
Authentication Failures
Symptom: 401 errors on/test-auth
Solutions:
- Verify API key format and validity
 - Check header format (
X-API-KeyvsAuthorization: Bearer) - Ensure key is active using 
/toggle_keyendpoint 
Health Check Degraded
Symptom: 207 status on/health
Solutions:
- Check database connectivity
 - Verify required tables exist
 - Review system logs for errors
 
CORS Issues
Symptom: Browser requests blocked Solutions:- Verify origin is in allowed list
 - Test with 
/cors-testendpoint - Check preflight OPTIONS requests
 
Testing Checklist
Before going to production, test these scenarios:- Health check returns 200 OK
 -  API key authentication works via 
X-API-Keyheader -  JWT token authentication works via 
Authorization: Bearer - CORS requests succeed from your domain
 - Error responses are properly formatted
 - Rate limiting is functioning (if applicable)
 
Integration Examples
Frontend Health Check
Backend Monitoring
Best Practices
Monitoring
- Regular Health Checks: Monitor 
/healthevery 1-5 minutes - Alert Thresholds: Alert on 207 (degraded) and 503 (down) responses
 - Response Time Monitoring: Track 
response_time_msfor performance trends 
Testing
- Pre-deployment Testing: Always test auth before deploying
 - CORS Validation: Test from actual client domains
 - Error Handling: Verify your app handles API errors gracefully
 
Debugging
- Use Test Endpoints: Leverage 
/test-authfor debugging auth issues - Check Health Details: Review specific component failures in health checks
 - Monitor Logs: Enable logging for all API interactions during debugging