Price Oracle API

Access aggregated Pi Network price data via https://api.zyrachain.org/api/oracle. Pay as you go — purchase an API key with Pi to get started.

API Key

Pay as you go with Pi

Rate Limit

60 req/min, 10,000 req/day

Cache

10-second TTL on price

Format

All responses in JSON

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://api.zyrachain.org/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://api.zyrachain.org/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
curl -H "X-API-Key: zyra_..." "https://api.zyrachain.org/api/oracle/v1/price"

# Sources status
curl -H "X-API-Key: zyra_..." "https://api.zyrachain.org/api/oracle/v1/sources"

# Health check
curl -H "X-API-Key: zyra_..." "https://api.zyrachain.org/api/oracle/v1/health"

# Supply
curl -H "X-API-Key: zyra_..." "https://api.zyrachain.org/api/oracle/data/mainnet-supply"

# Horizon proxy
curl -H "X-API-Key: zyra_..." "https://api.zyrachain.org/api/oracle/horizon/accounts/GABC..."

Authentication

Oracle API Key

Pay as you go — purchase an API key with Pi. Send it in the 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

Rate Limiting

ScopeLimitDetail
Per API key (minute)60 requests429 status if exceeded
Per API key (day)10,000 requestsRolling 24h window
Horizon Proxy10-second timeoutForwarded to Pi Mainnet Horizon
Cache10-second TTLPrice endpoint only