API Documentation

Complete reference for all Zyrachain API services. All requests go through https://Zyrachain-server.onrender.com/api.

API Key

100 Pi one-time, no recurring fees

Rate Limit

60 req/min, 10,000 req/day per key

Cache

10-second TTL on price endpoint

Format

All responses in JSON

Price Oracle

Aggregated Pi price, blockchain data, and Horizon proxy. Requires API key (100 Pi one-time purchase).

MethodEndpointCopy
GET/api/oracle/v1/price
GET/api/oracle/v1/sources
GET/api/oracle/v1/health
GET/api/oracle/data/pi-price
GET/api/oracle/data/mainnet-supply
ALL/api/oracle/horizon/*

Response Schemas

GET/api/oracle/v1/price
{ "symbol": "PI", "price_usd": 1.23, "sources_used": 3, "total_sources": 3, "aggregation_method": "weighted_average", "confidence_score": 0.95, "cache_hit": false, "source_prices": { "coingecko": {"price": 1.22, "weight": 1.5}, "okx": {"price": 1.23, "weight": 2.0}, "bitget": {"price": 1.24, "weight": 2.0} } }
GET/api/oracle/v1/health
{ "status": "healthy", "uptime": 3600, "timestamp": "2025-05-18T12:00:00.000Z" }
GET/api/oracle/data/pi-price
{ "data": [{ "idxPx": "1.2300", "high24h": "1.2300", "open24h": "1.2300", "low24h": "1.2300" }] }
GET/api/oracle/data/mainnet-supply
{ "total_circulating_supply": 6600980756.31, "total_locked": 4968482226.45, "total_supply": 10155355009.71 }

Code Examples

JavaScript (fetch)

javascript
const BASE = "https://Zyrachain-server.onrender.com/api/oracle";
const KEY = "zyra_your_api_key";

const headers = { "X-API-Key": KEY };

// Get Pi price
const price = await fetch(BASE + "/v1/price", { headers }).then(r => r.json());
console.log("Pi: $" + price.price_usd);

// Get supply
const supply = await fetch(BASE + "/data/mainnet-supply", { headers }).then(r => r.json());
console.log("Circulating: " + supply.total_circulating_supply.toLocaleString());

// Horizon proxy: account details
const acct = await fetch(BASE + "/horizon/accounts/GABC...", { headers }).then(r => r.json());
console.log("Balances:", acct.balances);

Python (requests)

python
import requests

BASE = "https://Zyrachain-server.onrender.com/api/oracle"
HEADERS = {"X-API-Key": "zyra_your_api_key"}

# Current price & confidence
r = requests.get(f"{BASE}/v1/price", headers=HEADERS)
data = r.json()
print(f"Pi: ${data['price_usd']} (confidence: {data['confidence_score']})")

# Supply stats
r = requests.get(f"{BASE}/data/mainnet-supply", headers=HEADERS)
supply = r.json()
print(f"Circulating: {supply['total_circulating_supply']:,}")

# Horizon proxy
r = requests.get(f"{BASE}/horizon/accounts/GABC...", headers=HEADERS)
print(r.json())

cURL

bash
# Price (API key required)
curl -H "X-API-Key: zyra_..." "https://Zyrachain-server.onrender.com/api/oracle/v1/price"

# Sources status
curl -H "X-API-Key: zyra_..." "https://Zyrachain-server.onrender.com/api/oracle/v1/sources"

# Supply
curl -H "X-API-Key: zyra_..." "https://Zyrachain-server.onrender.com/api/oracle/data/mainnet-supply"

# Horizon proxy
curl -H "X-API-Key: zyra_..." "https://Zyrachain-server.onrender.com/api/oracle/horizon/accounts/GABC..."

# Public endpoints (no key needed)
curl "https://Zyrachain-server.onrender.com/api/listings/business?page=1&limit=10"
curl "https://Zyrachain-server.onrender.com/api/ecosystem?type=communities"
curl "https://Zyrachain-server.onrender.com/api/pct-monitor/summary"

Authentication

Oracle API Key

Purchase for 100 Pi. Send in X-API-Key header or ?apiKey= query parameter. Keys are SHA-256 hashed with a pepper — server never stores plaintext.

Purchase a key | Manage your keys

User Auth (Pi Network)

Users authenticate via Pi Browser SDK. Server verifies the Pi access token against the Pi Platform API. Send in Authorization: Bearer <pi_access_token>.

Admin Auth (OTP + JWT)

Admins receive a 6-digit OTP via email (SMTP). After verification, receive a JWT (24h expiry) used as Authorization: Bearer <jwt>. Email must be whitelisted in server config.

Rate Limiting

ScopeLimitHeader / Info
Oracle API Key (per minute)60 requests429 if exceeded
Oracle API Key (per day)10,000 requestsRolling 24h window
Global (all routes)800 req/15 min (production) | 20,000 req/15 min (dev)Via express-rate-limit
Horizon Proxy10-second timeoutForwarded to Pi Mainnet Horizon

Pricing

Access LevelCostEndpoints
Oracle API Key100 Pi (one-time)/api/oracle/* — price, sources, health, pi-data, horizon proxy
Business Listing20 PiSubmit a business listing
Startup / Community / Influencer Listing50 Pi eachSubmit respective listing type
Company Listing100 PiSubmit a company listing
Listing Update80 PiUpdate an existing listing
All Public EndpointsFreeListings read, ecosystem, PCT/CEX monitors, v2 home, charts, social stats