NewConnect Claude, Gemini, ChatGPT, and other AI agents to API Ninjas via our MCP server

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
(4.7)

From 10,194 users

500+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
220ms230ms292ms460ms1086ms

Didn't find what you were looking for? Suggest an improvement


/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_key  required

    Your API Key. This is passed as a query parameter instead of in the header for this endpoint.

Response

A JSON object with the following fields or an error if the request is unsuccessful.

  • api_key

    Your API key.

  • account_creation_date

    The date your account was created (YYYY-MM-DD format).

  • subscription_tier

    Your current subscription tier (e.g., Business, Professional, Enterprise).

  • subscription_period

    Your subscription billing period: month or year.

  • api_reset_date

    The date when your API quota will reset (YYYY-MM-DD format).

  • current_month_usage

    Total number of API calls made in the current billing period.

  • api_call_history

    Object 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!

Try this API endpoint with all available parameters in our API playground

https://api.api-ninjas.com/v1/analytics?api_key=YOUR_API_KEY

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON
{
    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 the X-Api-Key header.
  • Only the API call counts in api_call_history are 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.

Frequently Asked Questions

  • Yes, but you must have a premium subscription. Commercial use of the Analytics API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.
  • Sign up for a free account to instantly get your API key, then pass it in the X-Api-Key header on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.
  • Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.
  • The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.
  • The Analytics API returns a JSON object with your subscription_tier, subscription_period, account_creation_date, api_reset_date, current_month_usage (total calls in the current billing period), and api_call_history, an object keyed by date (YYYY-MM-DD) mapping each API name to its call count for that day.
  • Unlike other API Ninjas endpoints, the Analytics endpoint requires your API key to be passed as the api_key query parameter (for example ?api_key=YOUR_API_KEY) rather than in the X-Api-Key header; you can get a key by signing up at registration.
  • No, calling the Analytics API does not consume any of your API quota, but the endpoint is only available on the Professional and Enterprise tiers shown on the pricing page.
  • You can use the current_month_usage and api_call_history fields to monitor consumption and optimize costs, identify which of your API Ninjas APIs are called most frequently, analyze usage patterns over time, and build custom dashboards or quota-limit alerts.