Get API key analytics
Changed onGet analytics data for API key usage
Request
- Base URLhttps://gateway.prem.io
- AuthHTTP bearer and API key in header Authorization
Query parameters
Scope every metric to one or more API keys. Repeat the parameter for several. Omitted = the whole organization.
IANA zone name used to group day-grain buckets into calendar days, e.g. Europe/Rome. Shorter buckets are absolute time and are unaffected. Defaults to UTC, and falls back to UTC for an unknown zone.
Predefined analytics window. Defaults to last_30_days.
Response
Successful API key analytics response
Example response
{
"data": {
"period": "last_30_days",
"bucket_seconds": 86400,
"timezone": "UTC",
"core_metrics": {
"total_requests": 4,
"requests_per_second": 0,
"total_success": 3,
"total_errors": 1,
"success_rate_pct": 75,
"avg_latency_ms": 67.5,
"under_10ms": 0,
"from_10_to_50ms": 1,
"from_50_to_200ms": 3,
"over_200ms": 0,
"pct_under_10ms": 0,
"pct_under_50ms": 25,
"pct_under_200ms": 100,
"unique_endpoints": 1,
"distinct_api_keys": 2
},
"prev_core_metrics": {
"total_requests": 10,
"requests_per_second": 0,
"total_success": 8,
"total_errors": 2,
"success_rate_pct": 80,
"avg_latency_ms": 120,
"under_10ms": 0,
"from_10_to_50ms": 2,
"from_50_to_200ms": 7,
"over_200ms": 1,
"pct_under_10ms": 0,
"pct_under_50ms": 20,
"pct_under_200ms": 90,
"unique_endpoints": 3,
"distinct_api_keys": 4
},
"most_used_api_keys": [
{
"api_key_id": "key_01HZX9",
"api_key_label": "production",
"usage_count": 3,
"total_success": 3,
"success_rate": 100
}
],
"ip_metrics": [
{
"ip": "203.0.113.7",
"total_requests": 3,
"total_success": 2,
"success_rate": 66.67,
"total_errors": 1,
"error_rate": 33.33,
"country_code": "IT",
"city": "Rome",
"isp": "Example ISP"
},
{
"ip": "2001:db8::1",
"total_requests": 1,
"total_success": 1,
"success_rate": 100,
"total_errors": 0,
"error_rate": 0,
"country_code": null,
"city": null,
"isp": null
}
],
"hourly_metrics": [
{
"hour": "2025-07-30 00:00:00",
"total_requests": 3,
"success_count": 2,
"error_count": 1,
"error_rate_pct": 33.33,
"success_rate_pct": 66.67,
"avg_latency_ms": 71.33,
"unique_endpoints": 1,
"distinct_api_keys": 2
},
{
"hour": "2025-07-31 00:00:00",
"total_requests": 1,
"success_count": 1,
"error_count": 0,
"error_rate_pct": 0,
"success_rate_pct": 100,
"avg_latency_ms": 56,
"unique_endpoints": 1,
"distinct_api_keys": 1
}
],
"latency_breakdown": {
"total_requests": 4,
"under_10ms": 0,
"from_10_to_50ms": 1,
"from_50_to_200ms": 3,
"over_200ms": 0
},
"latency": {
"min": 42,
"max": 110,
"avg": 67.5,
"p50": 59,
"p90": 110,
"p95": 110,
"p99": 110
}
},
"message": null
}Changes
- breaking
the
/////response's property type changed fromarrayobjecttoarrayfor status - breaking
the
/////response's property type changed fromarrayobjecttoarrayfor status - breaking
removed the required property
/////from the response with the status - warning
removed the optional property
//////from the response with the status - warning
removed the optional property
//////from the response with the status - warning
removed the optional property
//////from the response with the status - warning
removed the optional property
//////from the response with the status - warning
removed the optional property
//////from the response with the status - warning
removed the optional property
//////from the response with the status - warning
removed the optional property
//////from the response with the status - warning
removed the optional property
///////from the response with the status - warning
removed the optional property
//////from the response with the status - warning
removed the optional property
//////from the response with the status - warning
removed the optional property
//////from the response with the status - warning
added the new
405.00enum value to the/response property for the response status - warning
added the new
405.00enum value to the/response property for the response status - warning
added the new
409.00enum value to the/response property for the response status - warning
added the new
409.00enum value to the/response property for the response status - warning
added the new
500.00enum value to the/response property for the response status - warning
added the new
500.00enum value to the/response property for the response status - info
added the new optional
queryrequest parameterapi_key_id - info
added the new optional
queryrequest parameterperiod - info
added the new optional
queryrequest parametertimezone - info
added the non-success response with the status
- info
added the non-success response with the status
- info
added the optional property
//////to the response with the status - info
added the optional property
//////to the response with the status - info
added the optional property
//////to the response with the status - info
added the optional property
//////to the response with the status - info
added the optional property
//////to the response with the status - info
added the optional property
//////to the response with the status - info
added the optional property
//////to the response with the status - info
added the optional property
///////to the response with the status - info
added the optional property
///////to the response with the status - info
added the optional property
///////to the response with the status - info
added the optional property
///////to the response with the status - info
added the optional property
///////to the response with the status - info
added the optional property
///////to the response with the status - info
added the optional property
///////to the response with the status - info
added the optional property
///////to the response with the status - info
added the optional property
///////to the response with the status - info
added the optional property
//////to the response with the status - info
added the optional property
//////to the response with the status - info
added the optional property
//////to the response with the status - info
added the optional property
//////to the response with the status - info
added the optional property
//////to the response with the status - info
added the optional property
//////to the response with the status - info
added the optional property
//////to the response with the status - info
added the optional property
//////to the response with the status - info
added the optional property
//////to the response with the status - info
added the optional property
//////to the response with the status - info
added the optional property
//////to the response with the status - info
the response property
///////became required for the status - info
added the required property
/////to the response with the status - info
added the required property
///////to the response with the status - info
added the required property
///////to the response with the status - info
added the required property
///////to the response with the status - info
added the required property
///////to the response with the status - info
added the required property
/////to the response with the status - info
added the required property
/////to the response with the status
- breaking
- info
endpoint added
- info