GET /v1/account/activity
Get comprehensive account activity and usage statistics.
- Method: GET
- Path: /v1/account/activity
- Auth: Bearer token (provisioning key) in Authorizationheader
Provisioning Key Required
This endpoint requires authentication with a provisioning key, not a regular API key.
Description
Returns detailed usage statistics for your account, including:
- Total aggregated stats for the specified period
- Daily breakdown of requests and costs
- Top models used
- Usage statistics per API key
Performance Optimization
Results are cached for 5 minutes to optimize performance. Repeated requests within this window will return cached data.
Query Parameters
- days(integer, optional): Number of days to look back for statistics- Minimum: 1
- Maximum: 30
- Default: 30
 
Example Request
- Python
- Node.js
- cURL
import requests
# Get activity for the last 7 days
response = requests.get(
    "https://api.naga.ac/v1/account/activity",
    headers={"Authorization": "Bearer YOUR_PROVISIONING_KEY"},
    params={"days": 7}
)
activity = response.json()
print(f"Total requests: {activity['total_stats']['total_requests']}")
print(f"Total cost: ${activity['total_stats']['total_cost']}")
// Get activity for the last 7 days
const response = await fetch(
  "https://api.naga.ac/v1/account/activity?days=7",
  {
    headers: {
      "Authorization": "Bearer YOUR_PROVISIONING_KEY"
    }
  }
);
const activity = await response.json();
console.log(`Total requests: ${activity.total_stats.total_requests}`);
console.log(`Total cost: $${activity.total_stats.total_cost}`);
# Get activity for the last 7 days
curl "https://api.naga.ac/v1/account/activity?days=7" \
  -H "Authorization: Bearer YOUR_PROVISIONING_KEY"
Response
{
  "period_days": 7,
  "total_stats": {
    "total_requests": 1523,
    "total_cost": "45.67",
    "total_input_tokens": 125430,
    "total_output_tokens": 89210
  },
  "daily_stats": [
    {
      "date": "2025-01-20",
      "total_requests": 245,
      "total_cost": "7.82",
      "total_input_tokens": 20150,
      "total_output_tokens": 15230
    },
    {
      "date": "2025-01-19",
      "total_requests": 198,
      "total_cost": "6.45",
      "total_input_tokens": 18920,
      "total_output_tokens": 12840
    }
  ],
  "top_models": [
    {
      "model_name": "gpt-4o-mini",
      "request_count": 892,
      "total_cost": "28.34",
      "total_input_tokens": 78450,
      "total_output_tokens": 52310
    },
    {
      "model_name": "claude-sonnet-4.5",
      "request_count": 431,
      "total_cost": "12.89",
      "total_input_tokens": 32180,
      "total_output_tokens": 24590
    }
  ],
  "api_key_usage": [
    {
      "api_key_id": 1,
      "api_key_name": "Production API Key",
      "request_count": 1204,
      "total_cost": "38.92",
      "total_input_tokens": 98230,
      "total_output_tokens": 71450
    },
    {
      "api_key_id": 2,
      "api_key_name": "Development API Key",
      "request_count": 319,
      "total_cost": "6.75",
      "total_input_tokens": 27200,
      "total_output_tokens": 17760
    }
  ]
}
Response Fields
Root Object
- period_days(integer): Number of days included in the statistics
- total_stats(object): Aggregated statistics for the entire period
- daily_stats(array): Day-by-day breakdown of usage
- top_models(array): Models sorted by usage
- api_key_usage(array): Usage statistics per API key
Total Stats Object
- total_requests(integer): Total number of API requests
- total_cost(string): Total cost in USD
- total_input_tokens(integer): Total input tokens processed
- total_output_tokens(integer): Total output tokens generated
Daily Stats Object
- date(string): Date in YYYY-MM-DD format
- total_requests(integer): Requests made on this day
- total_cost(string): Cost for this day in USD
- total_input_tokens(integer): Input tokens processed on this day
- total_output_tokens(integer): Output tokens generated on this day
Model Usage Object
- model_name(string): Model identifier
- request_count(integer): Number of requests to this model
- total_cost(string): Total cost for this model in USD
- total_input_tokens(integer): Input tokens for this model
- total_output_tokens(integer): Output tokens for this model
API Key Usage Object
- api_key_id(integer | null): API key identifier
- api_key_name(string | null): API key name
- request_count(integer): Number of requests using this key
- total_cost(string): Total cost for this key in USD
- total_input_tokens(integer): Input tokens processed by this key
- total_output_tokens(integer): Output tokens generated by this key
Authentication
Provide your provisioning key as a Bearer token:
Authorization: Bearer YOUR_PROVISIONING_KEY