History Statistics
developer/v1/history/statsReturns aggregated statistics from your API query history including total queries, error rates, cache hit ratios, average latency, cost tracking, per-endpoint breakdowns, and status code distribution. Supports ISO 8601 date range filtering for period comparisons.
What It Does
Calculates real-time statistics from your query history across multiple dimensions: total queries and errors, error rate percentage, cache hit rate, average response time, total cost in cents, top 20 endpoints by usage with per-endpoint average latency, and HTTP status code distribution grouped by class (2xx/3xx/4xx/5xx). Date range filtering enables week-over-week or month-over-month comparisons.
Why It's Useful
Provides a single-request dashboard overview of your API consumption — the kind of data typically requiring a dedicated analytics platform. Use it to build internal dashboards, set up automated alerting on error rate spikes, track API spend, and identify which endpoints consume the most quota. Essential for capacity planning and budget forecasting.
Use Cases
API Usage Dashboard
Build an internal dashboard showing weekly API usage trends, error rates, and cost breakdowns per endpoint. Compare current week vs. previous week to track growth and identify anomalies.
Data-driven visibility into API consumption without building custom analytics infrastructure.
SLA & Reliability Monitoring
Monitor error rates and average latency to track Service Level Objectives (SLOs). Set up automated alerts when error_rate_percent exceeds thresholds or avg_response_time_ms degrades beyond acceptable limits.
Proactive SLO monitoring with actionable metrics for incident response and capacity planning.
Cost Optimization & Forecasting
Analyze per-endpoint usage and cache hit rates to identify optimization opportunities. Endpoints with low cache hit rates may benefit from longer TTLs, while high-volume endpoints may qualify for bulk pricing.
Reduce API costs by optimizing caching strategy and forecasting spend based on usage trends.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
domain | string | Optional | ISO 8601 date range: from (start date) and to (end date)Example: from=2024-01-01T00:00:00Z&to=2024-01-31T23:59:59Z |
Response Fields
| Field | Type | Description |
|---|---|---|
period.from | string | Start of the analysis period (null if unfiltered) |
period.to | string | End of the analysis period (null if unfiltered) |
overview.total_queries | number | Total API queries in the period |
overview.total_errors | number | Total queries with status >= 400 |
overview.error_rate_percent | number | Error rate as a percentage (0-100) |
overview.cache_hit_rate_percent | number | Percentage of requests served from cache |
overview.avg_response_time_ms | number | Average response time in milliseconds |
overview.total_cost_cents | number | Total API cost in cents for the period |
by_endpoint | array | Top 20 endpoints by usage with endpoint path, request count, and average latency (ms) |
by_status | object | Request count grouped by HTTP status class: 2xx, 3xx, 4xx, 5xx |
Code Examples
curl "https://api.edgedns.dev/v1/history/stats" \
-H "Authorization: Bearer YOUR_API_KEY"const response = await fetch(
'https://api.edgedns.dev/v1/history/stats',
{
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
}
);
const data = await response.json();
console.log(data);import requests
response = requests.get(
'https://api.edgedns.dev/v1/history/stats',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
params={
}
)
data = response.json()
print(data)Read the full History Statistics guide
Why it matters, real-world use cases, parameters, response fields, and how to call it from Claude, ChatGPT, or Gemini via MCP.
Read the guide →Related Endpoints
External References
Learn more about the standards and protocols behind this endpoint.
Try This Endpoint
Test the History Statistics endpoint live in the playground.