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 Summary Metrics

Retrieve summary metrics for an account, with optional filtering capabilities.

Path Parameters

accountSid
string
required
Account identifier (format: acc_ followed by 27 alphanumeric characters)

Query Parameters

bucketSid
string
Filter metrics by specific bucket
startDate
string
Start date for metrics (ISO 8601 format)
endDate
string
End date for metrics (ISO 8601 format)
environmentSid
string
Filter by environment identifier

Headers

Authorization
string
required
Bearer token for authentication

Response

totalRequests
number
Total number of requests in the time period
totalErrors
number
Total number of error responses (4xx/5xx status codes)
averageResponseTime
number
Average response time in milliseconds
totalDataTransferred
number
Total bytes transferred (request + response)
requestsByMethod
object
Breakdown of requests by HTTP method
requestsByStatus
object
Breakdown of requests by HTTP status code ranges
topEndpoints
array
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

accountSid
string
required
Account identifier

Query Parameters

bucketSid
string
Filter metrics by specific bucket
startDate
string
Start date for metrics (ISO 8601 format)
endDate
string
End date for metrics (ISO 8601 format)
interval
string
Time interval for grouping: hour, day, week, month

Headers

Authorization
string
required
Bearer token for authentication

Response

interval
string
Time interval used for grouping
data
array
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
    }
  ]
}

Get Performance Metrics

Retrieve detailed performance metrics including response times, error rates, and endpoint analytics.

Path Parameters

accountSid
string
required
Account identifier

Query Parameters

bucketSid
string
Filter metrics by specific bucket
startDate
string
Start date for metrics (ISO 8601 format)
endDate
string
End date for metrics (ISO 8601 format)
groupBy
string
Group metrics by: endpoint, method, status, environment

Headers

Authorization
string
required
Bearer token for authentication

Response

groupBy
string
The grouping method used
metrics
array
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

accountSid
string
required
Account identifier

Query Parameters

bucketSid
string
Filter metrics by specific bucket
startDate
string
Start date for metrics (ISO 8601 format)
endDate
string
End date for metrics (ISO 8601 format)
statusCode
number
Filter by specific HTTP status code

Headers

Authorization
string
required
Bearer token for authentication

Response

totalErrors
number
Total number of errors in the time period
errorRate
number
Overall error rate as a percentage
errorsByStatus
object
Breakdown of errors by HTTP status code
errorsByEndpoint
array
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]
    }
  ]
}