# Get monthly usage Retrieve month-by-month usage breakdown for trend analysis. #### Path Parameters **`org_id`** string required The organization ID. #### Query Parameters **`month`** integer Specific month to retrieve (1-12). **`months`** integer Number of months to retrieve. Default: `12`. #### Returns Returns monthly usage analytics with trends and comparisons. ```bash curl "https://api.aitronos.com/v1/analytics/usage/monthly/org_abc123?year=2025&months=6" \ -H "X-API-Key: $FREDDY_API_KEY" ``` ```python import os import requests api_key = os.environ["FREDDY_API_KEY"] org_id = "org_abc123" response = requests.get( f"https://api.aitronos.com/v1/analytics/usage/monthly/{org_id}", params={"year": 2025, "months": 6}, headers={"X-API-Key": api_key} ) data = response.json() print(f"Total requests: {data['totalRequests']}") ``` ```javascript const response = await fetch( "https://api.aitronos.com/v1/analytics/usage/monthly/org_abc123?year=2025&months=6", { headers: { "X-API-Key": process.env.FREDDY_API_KEY } } ); const data = await response.json(); console.log(`Total requests: ${data.totalRequests}`); ``` **Response:** 200 OK ```json { "organization_id": "org_abc123", "period": "monthly", "data": [ { "month": 11, "year": 2025, "month_name": "November", "total_cost_chf": 1250.75, "total_requests": 5000, "total_synapses": 2500000.0, "total_tokens": 500000, "growth_rate_percent": -5.2 }, { "month": 10, "year": 2025, "month_name": "October", "total_cost_chf": 1320.50, "total_requests": 5280, "total_synapses": 2640000.0, "total_tokens": 528000, "growth_rate_percent": 8.5 } ], "totalRequests": 10280, "totalCost": 2571.25, "summary": { "year": 2025, "start_month": 6, "end_month": 11, "months_included": 6, "currency": "CHF" } } ``` 401 Unauthorized ```json { "success": false, "error": { "code": "AUTHENTICATION_REQUIRED", "message": "Authentication required", "system_message": "No API key provided", "type": "client_error", "status": 401, "trace_id": "abc-123-def", "timestamp": "2025-11-15T10:30:00Z" } } ``` 400 Bad Request ```json { "success": false, "error": { "code": "INVALID_REQUEST", "message": "Invalid query parameters", "system_message": "year is required and must be between 2020 and 2030", "type": "validation_error", "status": 400, "trace_id": "ghi-789-jkl", "timestamp": "2025-11-15T10:30:00Z" } } ``` 500 Server Error ```json { "success": false, "error": { "code": "INTERNAL_ERROR", "message": "An unexpected error occurred", "system_message": "Database query failed", "type": "server_error", "status": 500, "trace_id": "jkl-012-mno", "timestamp": "2025-11-15T10:30:00Z" } } ```