Menu
PegWatch

Data sourced from CoinGecko & DefiLlama · Not financial advice

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:

bash
# 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.

bash
# With API key for higher rate limits
curl -H "X-API-Key: pw_your_api_key_here" \
     https://pegwatch.io/api/v1/tokens

3Endpoints

GET/api/v1/tokens

Returns a list of all active stablecoins with their current stability metrics, peg streak data, and days since last depeg event.

GET/api/v1/tokens/:symbol

Returns detailed information for a specific stablecoin, including its stability score, peg streak, and last depeg event.

Parameters

NameTypeRequiredDescription
:symbolstringRequiredToken symbol (e.g. USDT, USDC, DAI). Case-insensitive, alphanumeric only.

4Response Fields

FieldTypeDescription
symbolstringToken ticker symbol (e.g. USDT, USDC)
coingeckoIdstringCoinGecko identifier for the token
stabilityScorenumberPeg stability score (0–100). Higher is more stable.
pegStreaknumberConsecutive price snapshots within 0.1% of $1.00
daysSinceDepegnumber | nullDays since the last depeg event. null if no depeg recorded.
severitystring | nullSeverity 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-AfterSeconds to wait before retrying
X-RateLimit-LimitYour total request allowance
X-RateLimit-RemainingRemaining requests in current window

6Status Codes

Status Codes

CodeStatusDescription
200OKSuccessful request
400Bad RequestInvalid symbol or malformed request
401UnauthorizedInvalid or expired API key
404Not FoundToken symbol not found
405Method Not AllowedOnly GET and OPTIONS are supported
429Too Many RequestsRate limit exceeded — check Retry-After header
500Internal Server ErrorSomething went wrong on our end
503Service UnavailablePublic 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-MethodsGET, OPTIONS
  • X-Content-Type-Optionsnosniff
  • X-Frame-OptionsDENY
  • Cache-Controlpublic, s-maxage=60, stale-while-revalidate=120

Try It Live

Try It Live

Test the API directly from your browser

8Code Examples

javascript
// 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
# 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")
bash
# 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.