Deriv API
K

Health Check

GET
No auth

Health check endpoint to verify service availability

Endpoint

GET
/v1/health

Base URL: https://api.derivws.com

Response Schema
View Raw

Status Codes

200

OK - Service is healthy and operational

{
  "status": "ok",
  "timestamp": "2025-12-16T10:30:00Z"
}
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 Unavailable
{
  "status": "error",
  "message": "Service temporarily unavailable",
  "timestamp": "2025-12-16T10:30:00Z"
}

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 Fields

  • status: Indicates the service health status. Returns "ok" when the service is healthy.
  • timestamp: Current server time in ISO 8601 format. Useful for verifying server time and detecting clock drift.

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 data = await response.json();
    
    if (data.status === 'ok') {
      console.log('API is healthy');
      console.log('Server time:', data.timestamp);
    } else {
      console.error('API health check failed');
    }
  } 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)
        data = response.json()
        
        if data['status'] == 'ok':
            print('API is healthy')
            print(f"Server time: {data['timestamp']}")
            return True
        else:
            print('API health check failed')
            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
Click to open live chat support. Get instant help from our support team.