API Documentation
PegWatch Public API v1
Access real-time stablecoin peg stability data programmatically. Our API provides stability scores, peg streak information, and depeg event history for all tracked stablecoins.
1Quick Start
No API key required for public access. Simply make a GET request:
# List all stablecoins with stability data
curl https://pegwatch.io/api/v1/tokens
# Get detailed info for a specific token
curl https://pegwatch.io/api/v1/tokens/USDT💡The public API is rate-limited to 30 requests per minute. For higher limits, use an API key.
2Authentication
The PegWatch API supports two access modes:
Public Access
No authentication needed. Rate-limited to 30 requests/min per IP.
API Key
Higher rate limits for partners. Pass via X-API-Key header.
# With API key for higher rate limits
curl -H "X-API-Key: pw_your_api_key_here" \
https://pegwatch.io/api/v1/tokens3Endpoints
/api/v1/tokensReturns a list of all active stablecoins with their current stability metrics, peg streak data, and days since last depeg event.
/api/v1/tokens/:symbolReturns detailed information for a specific stablecoin, including its stability score, peg streak, and last depeg event.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
:symbol | string | Required | Token symbol (e.g. USDT, USDC, DAI). Case-insensitive, alphanumeric only. |
4Response Fields
| Field | Type | Description |
|---|---|---|
symbol | string | Token ticker symbol (e.g. USDT, USDC) |
coingeckoId | string | CoinGecko identifier for the token |
stabilityScore | number | Peg stability score (0–100). Higher is more stable. |
pegStreak | number | Consecutive price snapshots within 0.1% of $1.00 |
daysSinceDepeg | number | null | Days since the last depeg event. null if no depeg recorded. |
severity | string | null | Severity of last depeg: "minor", "moderate", "severe", or "critical". null if none. |
5Rate Limiting
Public (No Key)
30 req/min
With API Key
1,000 req/hour
When rate-limited, you'll receive a 429 response with these headers:
Retry-After | Seconds to wait before retrying |
X-RateLimit-Limit | Your total request allowance |
X-RateLimit-Remaining | Remaining requests in current window |
6Status Codes
Status Codes
| Code | Status | Description |
|---|---|---|
| 200 | OK | Successful request |
| 400 | Bad Request | Invalid symbol or malformed request |
| 401 | Unauthorized | Invalid or expired API key |
| 404 | Not Found | Token symbol not found |
| 405 | Method Not Allowed | Only GET and OPTIONS are supported |
| 429 | Too Many Requests | Rate limit exceeded — check Retry-After header |
| 500 | Internal Server Error | Something went wrong on our end |
| 503 | Service Unavailable | Public API is temporarily disabled |
7CORS & Security
The API supports CORS and can be called from any origin. All responses include security headers:
Access-Control-Allow-Origin→ * (all origins allowed)Access-Control-Allow-Methods→ GET, OPTIONSX-Content-Type-Options→ nosniffX-Frame-Options→ DENYCache-Control→ public, s-maxage=60, stale-while-revalidate=120
⚡Try It Live
⚡Try It Live
Test the API directly from your browser
8Code Examples
// JavaScript / Node.js
const response = await fetch("https://pegwatch.io/api/v1/tokens");
const { data } = await response.json();
// Find stablecoins with stability score below 90
const risky = data.filter(token => token.stabilityScore < 90);
console.log("At-risk stablecoins:", risky);# Python
import requests
response = requests.get("https://pegwatch.io/api/v1/tokens/USDT")
data = response.json()
print(f"USDT Stability: {data['data']['stabilityScore']}/100")
print(f"Peg Streak: {data['data']['pegStreak']} snapshots")# cURL with API key
curl -s -H "X-API-Key: pw_your_key" \
https://pegwatch.io/api/v1/tokens | jq '.data[] | {symbol, stabilityScore}'Need an API key for higher rate limits? Contact us at support<@>pegwatch<.>io for partner access.