GET
/
api
/
v2
/
keys
/
{key_id}
/
stats
curl -X GET \
  "https://api.buena.ai/api/v2/keys/key_123/stats?period=7d&granularity=day" \
  -H "x-api-key: YOUR_API_KEY"
{
  "key_id": "key_123",
  "period": "7d",
  "total_requests": 1250,
  "successful_requests": 1180,
  "failed_requests": 70,
  "usage_by_endpoint": {
    "/api/v2/leads": 450,
    "/api/v2/enrich": 380,
    "/api/v2/linkedin": 420
  },
  "daily_usage": [
    {
      "date": "2024-01-01",
      "requests": 180,
      "successful": 175,
      "failed": 5
    }
  ]
}
Retrieves usage statistics and analytics for a specific API key.

Path Parameters

key_id
string
required
The unique identifier of the API key

Query Parameters

period
string
default:"30d"
The time period for statistics. Options: 24h, 7d, 30d, 90d
granularity
string
default:"day"
The granularity of the data. Options: hour, day, week

Response

key_id
string
The unique identifier of the API key
period
string
The time period of the statistics
total_requests
number
Total number of requests made with this key
successful_requests
number
Number of successful requests (2xx status codes)
failed_requests
number
Number of failed requests (4xx and 5xx status codes)
usage_by_endpoint
object
Breakdown of usage by API endpoint
daily_usage
array
Array of daily usage statistics
curl -X GET \
  "https://api.buena.ai/api/v2/keys/key_123/stats?period=7d&granularity=day" \
  -H "x-api-key: YOUR_API_KEY"
{
  "key_id": "key_123",
  "period": "7d",
  "total_requests": 1250,
  "successful_requests": 1180,
  "failed_requests": 70,
  "usage_by_endpoint": {
    "/api/v2/leads": 450,
    "/api/v2/enrich": 380,
    "/api/v2/linkedin": 420
  },
  "daily_usage": [
    {
      "date": "2024-01-01",
      "requests": 180,
      "successful": 175,
      "failed": 5
    }
  ]
}