Analytics API
The Analytics API provides detailed usage analytics and API call history for your account. Track your API consumption, monitor usage patterns, and analyze which APIs you're calling most frequently.
Calling this API does NOT consume any of your API quota.
Use Cases
- Monitor your API usage to optimize costs
- Track which APIs are most popular in your application
- Analyze usage patterns over time
- Build custom dashboards and reporting tools
- Set up alerts when approaching quota limits
/v1/analytics GET
Professional and Enterprise tiers only
https://api.api-ninjas.com/v1/analytics
Returns comprehensive analytics data for your API account, including subscription information, current usage, and detailed API call history.
Parameters
api_keyrequiredYour API Key. This is passed as a query parameter instead of in the header for this endpoint.
Response
api_keyYour API key.
account_creation_dateThe date your account was created (YYYY-MM-DD format).
subscription_tierYour current subscription tier (e.g., Business, Professional, Enterprise).
subscription_periodYour subscription billing period:
monthoryear.api_reset_dateThe date when your API quota will reset (YYYY-MM-DD format).
current_month_usageTotal number of API calls made in the current billing period.
api_call_historyObject containing daily API call history. Each key is a date (YYYY-MM-DD), and the value is an object mapping API names to call counts for that day.
Sample Request Live Demo!
https://api.api-ninjas.com/v1/analytics?api_key=YOUR_API_KEYHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
"api_key": "YOUR_API_KEY",
"account_creation_date": "2024-01-15",
"subscription_tier": "Business",
"subscription_period": "month",
"api_reset_date": "2024-12-01",
"current_month_usage": 45230,
"api_call_history": {
"2024-11-15": {
"Cars": 125,
"Quotes": 89,
"Weather": 234
},
"2024-11-14": {
"Celebrity": 45,
"Nutrition": 156,
"Quotes": 78
},
"2024-11-13": {
"Cars": 98,
"City": 67,
"Exchange Rate": 145
}
}
}Code Examples
1
curl -X GET "https://api.api-ninjas.com/v1/analytics?api_key=YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
Notes
- Unlike other API endpoints, the Analytics API requires your API key to be passed as a query parameter (
?api_key=YOUR_KEY) rather than in theX-Api-Keyheader. - Only the API call counts in
api_call_historyare stored. API inputs (including parameters, body, etc.) and API responses are not stored for privacy reasons. - This endpoint is rate-limited to prevent abuse. Please cache responses when building dashboards.