exchangeStatus
Get current Hyperliquid exchange status and timestamp for health monitoring and data freshness verification.
When to Use This Endpoint#
The exchangeStatus endpoint is essential for:
- Health Monitoring — Verify exchange is operational
- Data Freshness — Check timestamp for data staleness
- Maintenance Detection — Monitor for special statuses
- Uptime Tracking — Build status dashboards
Request#
Endpoint#
POST https://api-hyperliquid-mainnet-info.n.dwellir.com/info
Headers#
| Header | Value | Required |
|---|---|---|
Content-Type | application/json | Yes |
X-Api-Key | Your API key | Yes |
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Must be "exchangeStatus" |
Example Request#
{
"type": "exchangeStatus"
}
Response#
Success Response#
{
"time": 1704067200000,
"specialStatuses": []
}
Response Fields#
| Field | Type | Description |
|---|---|---|
time | integer | Unix timestamp in milliseconds |
specialStatuses | array | Array of special status strings (empty during normal operation) |
Code Examples#
- cURL
- JavaScript
- Python
curl -X POST 'https://api-hyperliquid-mainnet-info.n.dwellir.com/info' \
-H 'X-Api-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"type":"exchangeStatus"}'
const ENDPOINT = 'https://api-hyperliquid-mainnet-info.n.dwellir.com/info';
async function getExchangeStatus() {
const response = await fetch(ENDPOINT, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Key': 'YOUR_API_KEY'
},
body: JSON.stringify({ type: 'exchangeStatus' })
});
return await response.json();
}
// Usage
const status = await getExchangeStatus();
const date = new Date(status.time);
console.log(`Exchange time: ${date.toISOString()}`);
console.log(`Special statuses: ${status.specialStatuses.length === 0 ? 'None' : status.specialStatuses.join(', ')}`);
import requests
from datetime import datetime
ENDPOINT = 'https://api-hyperliquid-mainnet-info.n.dwellir.com/info'
def get_exchange_status():
response = requests.post(
ENDPOINT,
json={'type': 'exchangeStatus'},
headers={
'Content-Type': 'application/json',
'X-Api-Key': 'YOUR_API_KEY'
},
timeout=10
)
response.raise_for_status()
return response.json()
# Usage
status = get_exchange_status()
exchange_time = datetime.fromtimestamp(status['time'] / 1000)
print(f"Exchange time: {exchange_time.isoformat()}")
print(f"Special statuses: {status['specialStatuses'] or 'None'}")
Common Use Cases#
1. Check Data Freshness#
async function checkDataFreshness(maxAgeSeconds = 60) {
const status = await getExchangeStatus();
const now = Date.now();
const age = (now - status.time) / 1000; // Convert to seconds
if (age > maxAgeSeconds) {
console.warn(`Warning: Exchange data is ${age.toFixed(1)}s old`);
return false;
}
return true;
}
// Usage
const isFresh = await checkDataFreshness(30);
if (!isFresh) {
console.log('Consider retrying or alerting');
}
2. Build Health Check Monitor#
class ExchangeHealthMonitor {
constructor(checkIntervalMs = 30000) {
this.checkIntervalMs = checkIntervalMs;
this.isHealthy = true;
this.lastCheck = null;
}
async start() {
while (true) {
try {
const status = await getExchangeStatus();
this.lastCheck = Date.now();
const age = (Date.now() - status.time) / 1000;
this.isHealthy = age < 60 && status.specialStatuses.length === 0;
if (!this.isHealthy) {
console.error('Exchange unhealthy:', {
dataAge: age,
specialStatuses: status.specialStatuses
});
}
} catch (error) {
console.error('Health check failed:', error);
this.isHealthy = false;
}
await new Promise(r => setTimeout(r, this.checkIntervalMs));
}
}
getStatus() {
return {
isHealthy: this.isHealthy,
lastCheck: this.lastCheck
};
}
}
// Usage
const monitor = new ExchangeHealthMonitor();
monitor.start();
3. Status Dashboard Endpoint#
async function getDashboardStatus() {
const status = await getExchangeStatus();
const now = Date.now();
const latency = now - status.time;
return {
status: status.specialStatuses.length === 0 ? 'operational' : 'maintenance',
latency: `${latency}ms`,
specialStatuses: status.specialStatuses,
lastUpdate: new Date(status.time).toISOString()
};
}
4. Alert on Special Statuses#
async function checkForAlerts() {
const status = await getExchangeStatus();
if (status.specialStatuses.length > 0) {
// Send alert
console.error('ALERT: Special statuses detected:', status.specialStatuses);
await sendAlert({
title: 'Hyperliquid Special Status',
message: `Statuses: ${status.specialStatuses.join(', ')}`,
timestamp: status.time
});
}
}
Best Practices#
- Poll regularly (every 30-60 seconds) for monitoring dashboards
- Check freshness before processing critical data
- Alert on special statuses to catch maintenance periods
- Monitor latency between your server time and exchange time
- Implement circuit breakers when exchange is unhealthy
Performance Tips#
Lightweight Health Check#
// Minimal health check for high-frequency monitoring
async function quickHealthCheck() {
try {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 5000);
const status = await fetch(ENDPOINT, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Key': 'YOUR_API_KEY'
},
body: JSON.stringify({ type: 'exchangeStatus' }),
signal: controller.signal
});
clearTimeout(timeout);
return status.ok;
} catch {
return false;
}
}
Error Handling#
async function safeGetExchangeStatus(maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await getExchangeStatus();
} catch (error) {
if (i === maxRetries - 1) {
throw new Error('Exchange status unavailable after retries');
}
await new Promise(r => setTimeout(r, Math.pow(2, i) * 1000));
}
}
}
Related Endpoints#
Monitor Hyperliquid exchange health with Dwellir's HyperCore Info Endpoint. Get your API key →