# Get API key usage div strong 🔨 In Development — This section is still being developed and may change. Retrieve detailed spend and request metrics for a specific API key within an organization. #### Path Parameters **`orgId`** string required Unique organization identifier (format: `ORG_` + 16 chars). **`apiKeyId`** string required API key identifier (`ak_...`). **`month`** integer required Target billing month (1-12). **`year`** integer required Target billing year (e.g., `2025`). #### Query Parameters **`period`** string optional · Defaults to `daily` Aggregation granularity. One of: `daily`, `weekly`, `monthly`. #### Authentication - `Authorization: Bearer $FREDDY_API_KEY` ## Returns Spend summary plus per-period breakdown for the requested API key. Request ```bash curl "https://api.freddy.aitronos.com/v1/analytics/ORG_B66136CBB1304C98/api-keys/ak_5daf103fe74c8603/10/2025?period=daily" \ -H "Authorization: Bearer $FREDDY_API_KEY" ``` ```python import requests response = requests.get( "https://api.freddy.aitronos.com/v1/analytics/ORG_B66136CBB1304C98/api-keys/ak_5daf103fe74c8603/10/2025", headers={"Authorization": f"Bearer {api_key}"}, params={"period": "daily"} ) api_key_usage = response.json() print(api_key_usage["summary"]["totalUsage"]) ``` ## Response 200 OK ```json { "organizationId": "ORG_B66136CBB1304C98", "apiKeyId": "ak_5daf103fe74c8603", "period": { "month": 10, "year": 2025, "periodDisplay": "October 2025" }, "usageData": { "apiKeyName": "Production API Key", "totalCost": 1250.45, "totalRequests": 8923, "currency": "CHF" }, "breakdown": [ { "date": "2025-10-01", "cost": 34.56, "requests": 156 }, { "date": "2025-10-02", "cost": 41.23, "requests": 189 } ], "summary": { "totalUsage": 1250.45, "totalRequests": 8923, "averageDailyCost": 41.67, "averageDailyRequests": 297.43 } } ``` Errors **404 Not Found** ```json { "error": { "message": "API key not found for organization", "type": "not_found_error", "code": "api_key_missing" } } ``` **401 Unauthorized** ```json { "error": { "message": "Authentication required", "type": "authentication_error", "code": "missing_authentication" } } ``` ## Related Resources - [Get top API usage](/docs/api-reference/organizations/analytics/get-top-api-usage) - [Get daily usage breakdown](/docs/api-reference/organizations/analytics/get-daily-usage-breakdown)