Get Summary Metrics
Retrieve summary metrics for an account, with optional filtering capabilities.
Path Parameters
Account identifier (format: acc_
followed by 27 alphanumeric characters)
Query Parameters
Filter metrics by specific bucket
Start date for metrics (ISO 8601 format)
End date for metrics (ISO 8601 format)
Filter by environment identifier
Bearer token for authentication
Response
Total number of requests in the time period
Total number of error responses (4xx/5xx status codes)
Average response time in milliseconds
Total bytes transferred (request + response)
Breakdown of requests by HTTP method
Breakdown of requests by HTTP status code ranges
Most frequently accessed endpoints
curl -X GET "https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/metrics/summary?startDate=2023-12-01T00:00:00Z&endDate=2023-12-02T00:00:00Z" \
-H "Authorization: Bearer your-jwt-token"
{
"totalRequests": 15420,
"totalErrors": 234,
"averageResponseTime": 145.6,
"totalDataTransferred": 2048576,
"requestsByMethod": {
"GET": 12340,
"POST": 2100,
"PUT": 680,
"DELETE": 300
},
"requestsByStatus": {
"2xx": 14186,
"3xx": 1000,
"4xx": 200,
"5xx": 34
},
"topEndpoints": [
{
"path": "/api/users",
"count": 3420,
"averageResponseTime": 120.5
},
{
"path": "/api/orders",
"count": 2100,
"averageResponseTime": 180.2
}
]
}
Get Throughput Metrics
Retrieve request throughput metrics over time.
Path Parameters
Query Parameters
Filter metrics by specific bucket
Start date for metrics (ISO 8601 format)
End date for metrics (ISO 8601 format)
Time interval for grouping: hour
, day
, week
, month
Bearer token for authentication
Response
Time interval used for grouping
Show Throughput Data Points
ISO 8601 timestamp for the data point
Number of requests in this time interval
Number of errors in this time interval
Average response time for this interval
curl -X GET "https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/metrics/throughput?interval=hour&startDate=2023-12-01T00:00:00Z&endDate=2023-12-02T00:00:00Z" \
-H "Authorization: Bearer your-jwt-token"
{
"interval": "hour",
"data": [
{
"timestamp": "2023-12-01T00:00:00Z",
"requestCount": 450,
"errorCount": 12,
"averageResponseTime": 142.3
},
{
"timestamp": "2023-12-01T01:00:00Z",
"requestCount": 523,
"errorCount": 8,
"averageResponseTime": 138.7
}
]
}
Retrieve detailed performance metrics including response times, error rates, and endpoint analytics.
Path Parameters
Query Parameters
Filter metrics by specific bucket
Start date for metrics (ISO 8601 format)
End date for metrics (ISO 8601 format)
Group metrics by: endpoint
, method
, status
, environment
Bearer token for authentication
Response
The group identifier (endpoint, method, etc.)
Total requests for this group
Error rate as a percentage (0-100)
Average response time in milliseconds
50th percentile response time
95th percentile response time
99th percentile response time
curl -X GET "https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/metrics/performance?groupBy=endpoint&startDate=2023-12-01T00:00:00Z&endDate=2023-12-02T00:00:00Z" \
-H "Authorization: Bearer your-jwt-token"
{
"groupBy": "endpoint",
"metrics": [
{
"group": "/api/users",
"requestCount": 3420,
"errorRate": 1.2,
"averageResponseTime": 120.5,
"p50ResponseTime": 95.0,
"p95ResponseTime": 280.0,
"p99ResponseTime": 450.0
},
{
"group": "/api/orders",
"requestCount": 2100,
"errorRate": 2.8,
"averageResponseTime": 180.2,
"p50ResponseTime": 145.0,
"p95ResponseTime": 420.0,
"p99ResponseTime": 650.0
}
]
}
Get Error Metrics
Retrieve detailed error analysis and patterns.
Path Parameters
Query Parameters
Filter metrics by specific bucket
Start date for metrics (ISO 8601 format)
End date for metrics (ISO 8601 format)
Filter by specific HTTP status code
Bearer token for authentication
Response
Total number of errors in the time period
Overall error rate as a percentage
Breakdown of errors by HTTP status code
Show Endpoint Error Analysis
Number of errors for this endpoint
Error rate percentage for this endpoint
Most frequent error status codes
curl -X GET "https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/metrics/errors?startDate=2023-12-01T00:00:00Z&endDate=2023-12-02T00:00:00Z" \
-H "Authorization: Bearer your-jwt-token"
{
"totalErrors": 234,
"errorRate": 1.52,
"errorsByStatus": {
"400": 120,
"401": 45,
"404": 35,
"500": 25,
"503": 9
},
"errorsByEndpoint": [
{
"endpoint": "/api/auth/login",
"errorCount": 45,
"errorRate": 3.2,
"mostCommonErrors": [401, 400]
},
{
"endpoint": "/api/users/profile",
"errorCount": 35,
"errorRate": 2.1,
"mostCommonErrors": [404, 403]
}
]
}