Health Check
GET
No auth
Health check endpoint to verify service availability
Endpoint
GET
/v1/healthBase URL: https://api.derivws.com
Response Schema
No Authentication Required
This endpoint is publicly accessible and does not require any authentication headers. It can be called freely for monitoring purposes.
Status Codes
200
OK - Service is healthy and operational
OK
503
Service Unavailable - Service is down or experiencing issues
Error Responses
When the service is unavailable or experiencing issues, the endpoint may return error responses.
503
Service UnavailableService temporarily unavailable
About Health Checks
The health check endpoint provides a simple way to verify that the Deriv API service is operational and responding to requests.
Response Format
Returns plain text OK when the service is healthy. A non-200 status code indicates the service is experiencing issues.
Best Practices
- Poll this endpoint at regular intervals (e.g., every 30-60 seconds) for continuous monitoring
- Set appropriate timeouts (e.g., 5 seconds) to detect slow responses
- Monitor both response status and response time
- Log health check failures with timestamps for troubleshooting
- Implement exponential backoff if health checks fail repeatedly
Example Usage
cURL
curl https://api.derivws.com/v1/health
JavaScript / Node.js
const checkHealth = async () => {
try {
const response = await fetch('https://api.derivws.com/v1/health');
const text = await response.text();
if (response.ok && text === 'OK') {
console.log('API is healthy');
} else {
console.error('API health check failed:', response.status, text);
}
} catch (error) {
console.error('Failed to check API health:', error);
}
};
// Check health every 60 seconds
setInterval(checkHealth, 60000);Python
import requests
import time
def check_health():
try:
response = requests.get('https://api.derivws.com/v1/health', timeout=5)
if response.ok and response.text == 'OK':
print('API is healthy')
return True
else:
print(f'API health check failed: {response.status_code} {response.text}')
return False
except Exception as e:
print(f'Failed to check API health: {e}')
return False
# Check health every 60 seconds
while True:
check_health()
time.sleep(60)Monitoring Integration
Uptime Monitors
Use services like UptimeRobot, Pingdom, or StatusCake to monitor this endpoint:
- Set check interval to 1-5 minutes
- Alert on HTTP status code != 200
- Alert on response time > 2 seconds
Application Monitoring
Integrate with APM tools like DataDog, New Relic, or Prometheus:
- Track response times as metrics
- Set up alerts for failures
- Create dashboards for uptime visualization