← Back to APIAPI Reference
All endpoints are REST, return JSON, and require an API key. Base URL: https://pegcheck.uk
Authentication
Pass your API key as a Bearer token in the Authorization header on every request.
// Every request needs this header
Authorization: Bearer YOUR_API_KEY
Missing or invalid keys return 401 Unauthorized.
Supported stablecoins
Use these slugs in any endpoint that accepts a [slug] parameter.
usdt
usdc
usds
ethena
pyusd
fdusd
rlusd
tusd
GET/api/v1/coins
List all coins
Returns the latest price, deviation, and depeg status for all 8 stablecoins.
Request
fetch
("https://pegcheck.uk/api/v1/coins", {
headers: {
Authorization: "Bearer YOUR_API_KEY"
}
})
Response
{
"coins": [
{
"slug": "usdt",
"price": 0.9998,
"deviation": -0.02,
"status": "stable",
"updated_at": "2024-01-15T10:30:00Z"
},
{
"slug": "usdc",
"price": 1.0001,
"deviation": 0.01,
"status": "stable",
"updated_at": "2024-01-15T10:30:00Z"
}
],
"total": 8
}
GET/api/v1/coins/[slug]
Get single coin
Returns the latest price and status for one stablecoin.
Request
fetch
("https://pegcheck.uk/api/v1/coins/usdc", {
headers: {
Authorization: "Bearer YOUR_API_KEY"
}
})
Response
{
"slug": "usdc",
"price": 1.0001,
"deviation": 0.01,
"status": "stable",
"updated_at": "2024-01-15T10:30:00Z"
}
Response fields
pricenumberCurrent USD price
deviationnumberPercentage deviation from $1.00 (negative = below peg)
statusstring"stable" | "warning" (≥1%) | "depegged" (≥3%)
GET/api/v1/coins/[slug]/history
Price history
Returns up to 100 price snapshots for a coin. Filter by date range with optional query parameters.
Query parameters
fromoptionalISO 8601 start date — e.g. 2024-01-01T00:00:00Z
tooptionalISO 8601 end date
intervaloptionalLabel for the range (default: "24h") — informational only, does not affect filtering
Request
fetch
("https://pegcheck.uk/api/v1/coins/usdt/history
?from=2024-01-01T00:00:00Z&to=2024-01-02T00:00:00Z
", {
headers: {
Authorization: "Bearer YOUR_API_KEY"
}
})
Response
{
"slug": "usdt",
"interval": "24h",
"history": [
{
"timestamp": "2024-01-15T10:30:00Z",
"price": 0.9998,
"deviation": -0.02,
"status": "stable"
},
{
"timestamp": "2024-01-15T09:30:00Z",
"price": 0.9701,
"deviation": -2.99,
"status": "warning"
}
],
"depeg_events": [],
"total": 2
}
GET/api/v1/alerts/status
Active alerts
Returns all coins currently off-peg by 1% or more. Empty array means everything is stable.
Request
fetch
("https://pegcheck.uk/api/v1/alerts/status", {
headers: {
Authorization: "Bearer YOUR_API_KEY"
}
})
Response
{
"alerts": [
{
"coin": "USDT",
"price": 0.9650,
"deviation": -3.5,
"severity": "depegged",
"triggered_at": "2024-01-15T10:30:00Z"
}
],
"all_stable": false
}
Response fields
severitystring"warning" (≥1%) | "depegged" (≥3%)
all_stablebooleanTrue when alerts array is empty — safe to use as a health check
POST/api/v1/webhooks/register
Register a webhook
PegCheck will POST to your URL whenever a coin crosses the threshold you specify.
Request body
urlstringrequiredHTTPS URL to receive POST notifications
thresholdnumberoptionalDeviation % that triggers a call (default: 1.0)
coinsstring[]optionalArray of slugs to watch (omit for "all")
api_keystringrequiredYour API key — used to identify the webhook owner
Request
fetch
("https://pegcheck.uk/api/v1/webhooks/register", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
url: "https://your-app.com/webhook",
threshold: 1.5,
coins: ["usdt", "usdc"],
api_key: "YOUR_API_KEY"
})
})
Response
{
"message": "Webhook registered successfully",
"webhook": {
"id": 42,
"url": "https://your-app.com/webhook",
"threshold": 1.5,
"coins": "usdt,usdc",
"api_key": "YOUR_API_KEY"
}
}
Error codes
401UnauthorizedMissing or invalid API key
400Bad RequestMissing required field or invalid parameter
404Not FoundSlug not recognised or no data available
500Server ErrorSomething went wrong on our end — try again