Prompt
Need API analytics by endpoint and consumer
Latest observation
Oct 11, 2026
OpenAI APIWeb search: off
Yes — to get API analytics by endpoint and consumer, you generally want a report with these dimensions:
Dimensions
- Endpoint: path, method, version, or operation name
- Consumer: API key, client ID, app name, tenant, or user
- Optional: timestamp bucket, status code, region, environment
Metrics
Common ones:
- Request count
- Success/error rate
- Latency: average, p95, p99
- Payload size in/out
- Throttled/failed auth counts
- Unique consumers per endpoint
Example output
| Endpoint | Consumer | Requests | Errors | Avg Latency | p95 Latency |
|---|---|---|---|---|---|
GET /orders | app-a | 12,340 | 21 | 180 ms | 420 ms |
POST /orders | app-b | 4,120 | 87 | 260 ms | 610 ms |
Common implementation options
- API gateway analytics: Kong, Apigee, AWS API Gateway, Azure API Management
- Observability tools: Datadog, New Relic, Grafana/Prometheus, Elastic
- Custom logging + warehouse: emit structured logs with
endpoint,consumer_id,latency_ms,status_code, then aggregate in SQL
Example SQL
If your logs table has endpoint, consumer_id, status_code, latency_ms, created_at:
SELECT
endpoint,
consumer_id,
COUNT(*) AS requests,
SUM(CASE WHEN status_code >= 400 THEN 1 ELSE 0 END) AS errors,
AVG(latency_ms) AS avg_latency_ms,
PERCENTILE_CONT(0.95) WITHIN GROUP (ORDER BY latency_ms) AS p95_latency_ms
FROM api_requests
WHERE created_at >= NOW() - INTERVAL '24 hours'
GROUP BY endpoint, consumer_id
ORDER BY requests DESC;
If you want, I can help you with one of these next:
- a dashboard design
- a SQL query for your database
- a schema for logging API analytics
- a tool recommendation based on your stack