Skip to main content

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#

HeaderValueRequired
Content-Typeapplication/jsonYes
X-Api-KeyYour API keyYes

Parameters#

ParameterTypeRequiredDescription
typestringYesMust be "exchangeStatus"

Example Request#

{
"type": "exchangeStatus"
}

Response#

Success Response#

{
"time": 1704067200000,
"specialStatuses": []
}

Response Fields#

FieldTypeDescription
timeintegerUnix timestamp in milliseconds
specialStatusesarrayArray of special status strings (empty during normal operation)

Code Examples#

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"}'

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#

  1. Poll regularly (every 30-60 seconds) for monitoring dashboards
  2. Check freshness before processing critical data
  3. Alert on special statuses to catch maintenance periods
  4. Monitor latency between your server time and exchange time
  5. 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));
}
}
}
  • meta — Get trading pair metadata
  • spotMeta — Get spot trading metadata

Monitor Hyperliquid exchange health with Dwellir's HyperCore Info Endpoint. Get your API key →