Hello Ashish Gupta,
No, Azure API Management does not persist historical quota counters. The quota-by-counter-keys API only returns the current active quota period (with periodStartTime, periodEndTime, and callsCount). There is no built-in API to retrieve previous cycles or historic quota counters this is basically because quota counters are designed for real-time enforcement, not historical reporting. APIM analytics and reports are the only source for historical data.
No direct API exists for historical quota boundaries. The first-period-start attribute in your policy defines the initial cycle start, and subsequent cycles are calculated based on renewal-period. However, APIM does not expose past cycle metadata.
Recommended approach to reconstruct per-month quota usage
Since APIM only stores the current cycle, you need to reconstruct historical usage from logs:
Use the Reports API:
Endpoints like /reports/bySubscription or /reports/byRequest allow filtering by timestamp to get API call counts for any date range.
GET https://management.azure.com/subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/bySubscription?$filter=timestamp ge datetime'2025-09-01T00:00:00' and timestamp le datetime'2025-09-30T23:59:59'&api-version=2024-05-01
This returns aggregated metrics like callCountTotal, bandwidth, etc.
Reference Document:
Reports - List By Subscription - REST API (Azure API Management) | Microsoft Learn
Define monthly windows manually:
- Use your policy’s first-period-start and renewal-period (e.g., 2,592,000 seconds ≈ 30 days) to compute cycle boundaries.
- Query /reports/bySubscription for each cycle range.
Alternative:
- Export APIM logs to Azure Monitor / Log Analytics and run KQL queries for monthly aggregation.
Reference Document:
Monitor Azure API Management | Microsoft Learn
Let us know if you have any questions?