# Get API key usage Retrieve detailed usage information for a specific API key in a given month. #### Path Parameters **`org_id`** string required The organization ID (format: `org_`). **`api_key_id`** string required The API key ID (format: `apikey_`). #### Query Parameters **`month`** integer optional Month to query (1-12). Defaults to current month. **`year`** integer optional Year to query. Defaults to current year. ## Returns Returns detailed usage information for the specified API key, including total requests, costs, synapses, neurons, and limit information. ```bash curl "https://api.aitronos.com/v1/analytics/api-keys/usage/org_abc123/apikey_def456?month=11&year=2025" \ -H "X-API-Key: $FREDDY_API_KEY" ``` ```python import os import requests api_key = os.environ["FREDDY_API_KEY"] org_id = "org_abc123" api_key_id = "apikey_def456" response = requests.get( f"https://api.aitronos.com/v1/analytics/api-keys/usage/{org_id}/{api_key_id}", params={"month": 11, "year": 2025}, headers={"X-API-Key": api_key} ) data = response.json() print(f"Total requests: {data['usage']['totalRequests']}") print(f"Total cost: CHF {data['usage']['totalCost']}") ``` ```javascript const response = await fetch( "https://api.aitronos.com/v1/analytics/api-keys/usage/org_abc123/apikey_def456?month=11&year=2025", { headers: { "X-API-Key": process.env.FREDDY_API_KEY } } ); const data = await response.json(); console.log(`Total requests: ${data.usage.totalRequests}`); console.log(`Total cost: CHF ${data.usage.totalCost}`); ``` **Response:** 200 OK ```json { "apiKeyId": "apikey_abc123", "apiKeyName": "Production Key", "organizationId": "org_123", "month": 11, "year": 2025, "usage": { "totalRequests": 1250, "totalCost": 350.25, "totalSynapses": 125000, "totalNeurons": 2500000, "averageCostPerRequest": 0.28 }, "limit": { "monthlyLimit": 500.00, "utilizationPercentage": 70.05, "remainingBudget": 149.75, "status": "ok" } } ``` 404 Not Found ```json { "success": false, "error": { "code": "API_KEY_NOT_FOUND", "message": "API key not found", "system_message": "API key not found", "type": "client_error", "status": 404, "details": { "api_key_id": "apikey_123" }, "trace_id": "abc-123-def", "timestamp": "2025-11-19T10:30:00Z" } } ``` 403 Forbidden ```json { "success": false, "error": { "code": "ORGANIZATION_ACCESS_DENIED", "message": "You don't have permission to access this API key", "system_message": "Authorization error", "type": "client_error", "status": 403, "details": { "api_key_id": "apikey_123", "organization_id": "org_456" }, "trace_id": "def-456-ghi", "timestamp": "2025-11-19T10:30:00Z" } } ```