Skip to main content

History Statistics

developer
GET/v1/history/stats

Returns 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

Engineering Manager

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.

SRE / Platform Engineer

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.

Finance / DevOps

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

NameTypeRequiredDescription
domainstringOptionalISO 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

FieldTypeDescription
period.fromstringStart of the analysis period (null if unfiltered)
period.tostringEnd of the analysis period (null if unfiltered)
overview.total_queriesnumberTotal API queries in the period
overview.total_errorsnumberTotal queries with status >= 400
overview.error_rate_percentnumberError rate as a percentage (0-100)
overview.cache_hit_rate_percentnumberPercentage of requests served from cache
overview.avg_response_time_msnumberAverage response time in milliseconds
overview.total_cost_centsnumberTotal API cost in cents for the period
by_endpointarrayTop 20 endpoints by usage with endpoint path, request count, and average latency (ms)
by_statusobjectRequest count grouped by HTTP status class: 2xx, 3xx, 4xx, 5xx

Code Examples

cURL
curl "https://api.edgedns.dev/v1/history/stats" \
  -H "Authorization: Bearer YOUR_API_KEY"
JavaScript
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);
Python
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.