---
title: "Get Api Key Usage Stats"
method: GET
path: "/api/v1/usage-stats/api-key/{api_key_id}"
tags: ["usage-stats"]
---

# Get Api Key Usage Stats

`GET /api/v1/usage-stats/api-key/{api_key_id}`

Get usage statistics for a specific API key.

Args:
    api_key_id: The local API key ID
    
Returns:
    Usage statistics for the specified API key

## Path parameters

- `api_key_id` integer, required

## Response `200`

Successful Response

- DashboardUsageStats — Dashboard usage statistics summary.
  - `api_key_id` integer, required — Local API key ID
  - `api_key_name` string, required — API key name
  - `external_id` string, nullable, required — External API key ID
  - `is_active` boolean, required — Whether API key is active
  - `expires_at` string, nullable — Expiration timestamp from API
  - `expires_at_display` string — Formatted expiration time for display
  - `current_tokens` integer — Current window tokens used
  - `current_requests` integer — Current window requests made
  - `current_daily_cost` number — Current daily cost
  - `formatted_current_cost` string — Formatted current daily cost
  - `current_window_tokens` integer — Current rate limit window tokens
  - `current_window_requests` integer — Current rate limit window requests
  - `current_window_cost` number — Current rate limit window cost
  - `total_tokens` integer — Total tokens used
  - `total_requests` integer — Total requests made
  - `total_cost` number — Total cost
  - `formatted_cost` string — Formatted total cost
  - `daily_cost_limit` number — Daily cost limit
  - `token_limit` integer — Token limit
  - `has_daily_limit` boolean — Whether this key has daily limits
  - `rate_limit_window` integer — Rate limit window in minutes
  - `rate_limit_requests` integer — Rate limit requests per window
  - `rate_limit_cost` number — Rate limit cost per window
  - `opus_weekly_cost` number — Opus model cost this week
  - `opus_weekly_limit` number — Opus model weekly limit
  - `opus_weekly_percentage` number — Opus weekly usage percentage
  - `has_monthly_quota` boolean — Whether this key has a monthly/lifetime cost cap
  - `monthly_cost_limit` number — Monthly cost limit in USD (CRS totalCostLimit)
  - `monthly_cost_used` number — Amount of monthly cost used
  - `monthly_cost_percentage` number — Percentage of monthly cost limit used
  - `window_remaining_seconds` integer — Seconds until window reset
  - `window_remaining_text` string — Human readable time until reset
  - `daily_cost_percentage` number — Percentage of daily cost limit used
  - `token_percentage` number — Percentage of token limit used
  - `window_requests_percentage` number — Percentage of window requests used
  - `window_cost_percentage` number — Percentage of window cost used
  - `is_near_cost_limit` boolean — Whether near daily cost limit
  - `is_near_token_limit` boolean — Whether near token limit
  - `is_near_window_limit` boolean — Whether near window limit
  - `is_near_opus_limit` boolean — Whether near Opus weekly limit
  - `has_error` boolean — Whether there was an error fetching stats
  - `error_message` string, nullable — Error message if any
  - `error_type` string, nullable — Error type for better handling
  - `daily_model_stats` ModelDailyStats[] — Today's model usage breakdown
    - `model` string, required — Model name
    - `requests` integer, required — Number of requests today
    - `inputTokens` integer, required — Input tokens used
    - `outputTokens` integer, required — Output tokens used
    - `cacheCreateTokens` integer, required — Cache creation tokens
    - `cacheReadTokens` integer, required — Cache read tokens
    - `allTokens` integer, required — Total tokens
    - `total_cost` number — Total cost for this model today
    - `formatted_cost` string — Formatted cost string

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/qcode/apis/qcode-web.md) · [All operations](https://skmtc.dev/qcode/apis/qcode-web/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/qcode/qcode-web/revisions/2f2f5f49ffc7/schema)
