Skip to main content

Health & Utilities

Monitor API health, check usage, and access utility endpoints.

Try it Live

Open in Swagger UI โ†’ to test these endpoints interactively.

Endpointsโ€‹

EndpointDescriptionPrice
GET /api/healthAPI healthFREE
GET /api/usageYour usageFREE
GET /api/sources/healthData source healthFREE
GET /api/convert/{amount}/{from}/{to}Convert$0.001

GET /api/healthโ€‹

Check API status.

Requestโ€‹

curl https://api.web3identity.com/api/health

Responseโ€‹

{
"status": "healthy",
"version": "2.8.0",
"endpoints": 975,
"uptime": "99.95%",
"timestamp": "2026-02-08T04:30:00Z"
}

GET /api/usageโ€‹

Check your current usage and remaining free tier.

Requestโ€‹

curl https://api.web3identity.com/api/usage

Responseโ€‹

{
"used": 27,
"limit": 100,
"remaining": 73,
"tier": "anonymous",
"resetsAt": "2026-02-09T00:00:00Z",
"resetIn": "19 hours"
}

SDKโ€‹

const usage = await client.getUsage();
if (usage.remaining < 10) {
console.log('Running low on free tier!');
}

GET /api/sources/healthโ€‹

Check health of upstream data sources.

Responseโ€‹

{
"sources": {
"coingecko": { "status": "healthy", "latency": 145 },
"defillama": { "status": "healthy", "latency": 89 },
"alchemy": { "status": "healthy", "latency": 52 },
"neynar": { "status": "healthy", "latency": 123 }
},
"healthy": 4,
"unhealthy": 0,
"percentage": 100
}

GET /api/convert/{amount}/{from}/{to}โ€‹

Convert between tokens/currencies.

Requestโ€‹

curl https://api.web3identity.com/api/convert/100/ETH/USD

Responseโ€‹

{
"amount": 100,
"from": "ETH",
"to": "USD",
"result": 324567.00,
"rate": 3245.67,
"timestamp": "2026-02-08T04:30:00Z"
}

SDKโ€‹

const result = await client.convert(100, 'ETH', 'USD');
console.log(result.result); // 324567.00

SDK Examplesโ€‹

import { Web3IdentityClient } from '@web3identity/sdk';

const client = new Web3IdentityClient();

// Check conversion
const usdValue = await client.convert(1.5, 'ETH', 'USD');
console.log(`1.5 ETH = $${usdValue.result.toLocaleString()}`);

// Convert between tokens
const btcInEth = await client.convert(1, 'BTC', 'ETH');

// Batch conversions
const amounts = [1, 10, 100];
const conversions = await Promise.all(
amounts.map(amt => client.convert(amt, 'ETH', 'USD'))
);

Pythonโ€‹

import requests

BASE_URL = "https://api.web3identity.com"

def convert(amount: float, from_token: str, to_token: str) -> dict:
url = f"{BASE_URL}/api/convert/{amount}/{from_token}/{to_token}"
response = requests.get(url)
return response.json()

# Convert 100 ETH to USD
result = convert(100, 'ETH', 'USD')
print(f"100 ETH = ${result['result']:,.2f}")

# Convert USDC to ETH
usdc_to_eth = convert(10000, 'USDC', 'ETH')
print(f"10,000 USDC = {usdc_to_eth['result']:.4f} ETH")

JavaScriptโ€‹

const BASE_URL = 'https://api.web3identity.com';

async function convert(amount, from, to) {
const response = await fetch(
`${BASE_URL}/api/convert/${amount}/${from}/${to}`
);
return response.json();
}

// Portfolio value calculator
async function calculatePortfolioValue(holdings) {
const conversions = await Promise.all(
holdings.map(({ amount, token }) =>
convert(amount, token, 'USD')
)
);

return conversions.reduce((sum, conv) => sum + conv.result, 0);
}

// Usage
const portfolio = [
{ amount: 10, token: 'ETH' },
{ amount: 0.5, token: 'BTC' },
{ amount: 5000, token: 'USDC' }
];

const totalValue = await calculatePortfolioValue(portfolio);
console.log(`Total: $${totalValue.toLocaleString()}`);

GET /api/openapiโ€‹

Get the OpenAPI specification for all endpoints.

Requestโ€‹

curl https://api.web3identity.com/api/openapi

Responseโ€‹

Returns full OpenAPI 3.0 schema with 966 documented endpoints.

{
"openapi": "3.0.0",
"info": {
"title": "Web3 Identity API",
"version": "2.8.0"
},
"paths": {
"/api/health": {...},
"/api/ens/{name}": {...}
}
}

Monitoring & Alertsโ€‹

Webhook Notifications (Coming Soon)โ€‹

Set up alerts for:

  • API downtime
  • Rate limit warnings
  • Usage threshold alerts
  • Data source failures

Health Check Examplesโ€‹

Node.js Health Monitor:

const https = require('https');

function checkAPIHealth() {
return new Promise((resolve, reject) => {
https.get('https://api.web3identity.com/api/health', (res) => {
let data = '';
res.on('data', chunk => data += chunk);
res.on('end', () => {
const health = JSON.parse(data);
resolve(health.status === 'healthy');
});
}).on('error', reject);
});
}

// Use in production monitoring
setInterval(async () => {
const healthy = await checkAPIHealth();
if (!healthy) {
console.error('โŒ API is down!');
// Send alert
}
}, 60000); // Check every minute

Python Health Dashboard:

import requests
import time
from datetime import datetime

def monitor_api_health():
while True:
try:
health = requests.get("https://api.web3identity.com/api/health").json()
sources = requests.get("https://api.web3identity.com/api/sources/health").json()

print(f"[{datetime.now()}] API Status: {health['status']}")
print(f"Uptime: {health['uptime']}")
print(f"Healthy sources: {sources['healthy']}/{sources['healthy'] + sources['unhealthy']}")

if sources['percentage'] < 80:
print("โš ๏ธ Some data sources are degraded")

except Exception as e:
print(f"โŒ Health check failed: {e}")

time.sleep(300) # Check every 5 minutes

if __name__ == "__main__":
monitor_api_health()

Bash Monitoring Script:

#!/bin/bash
# monitor-api.sh

API_BASE="https://api.web3identity.com"
WEBHOOK_URL="YOUR_SLACK_WEBHOOK" # Optional

while true; do
# Check API health
STATUS=$(curl -s "${API_BASE}/api/health" | jq -r '.status')

if [ "$STATUS" != "healthy" ]; then
echo "[$(date)] โŒ API unhealthy!"
# Optional: Send Slack alert
curl -X POST "$WEBHOOK_URL" \
-H 'Content-Type: application/json' \
-d "{\"text\":\"โš ๏ธ API health check failed: $STATUS\"}"
else
echo "[$(date)] โœ… API healthy"
fi

# Check source health
SOURCE_PCT=$(curl -s "${API_BASE}/api/sources/health" | jq -r '.percentage')
echo "Source health: ${SOURCE_PCT}%"

sleep 300 # 5 minutes
done

Free Endpointsโ€‹

These endpoints never count against your quota:

EndpointDescription
/api/healthAPI health check
/api/usageYour usage stats
/api/sources/healthData source status
/api/gasEthereum gas prices
/api/openapiOpenAPI schema
/docsSwagger UI
/demoInteractive demo

Rate Limit Headersโ€‹

Every response includes:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 73
X-RateLimit-Reset: 2026-02-09T00:00:00Z
X-RateLimit-Policy: anonymous

JavaScript Rate Limit Handlerโ€‹

async function fetchWithRateLimitHandling(url) {
const response = await fetch(url);

const remaining = parseInt(response.headers.get('X-RateLimit-Remaining'));
const reset = response.headers.get('X-RateLimit-Reset');

if (remaining < 10) {
console.warn(`โš ๏ธ Only ${remaining} requests left until ${reset}`);
}

if (response.status === 429) {
const retryAfter = response.headers.get('Retry-After');
console.error(`Rate limited! Retry after ${retryAfter} seconds`);
throw new Error('RATE_LIMITED');
}

return response.json();
}

Status Pageโ€‹

For real-time API status and incident history:

status.web3identity.com

Subscribe to Alertsโ€‹

Get notified of:

  • Downtime incidents
  • Scheduled maintenance
  • Performance degradations
  • New feature announcements