You are viewing the Apigee Management API reference documentation. For the main product docs, and to search all docs, go to For cross-site search, click Search all in the search results.

Get metrics organized by dimensions

Resource Summary


Content Type






Get metrics organized by dimensions

Retrieve metrics, group them by dimensions, and filter the results. If you are using Edge Microgateway with the analytics plugin enabled (default), API calls to Edge Microgateway are included in results.


Data delay interval
After API calls are made to proxies, it may take up to 10 minutes for the data to appear in dashboards, custom reports, and management API calls.

The types of metrics you can retrieve (shown in the select query parameter description) include traffic, message counts, API call latency, response size, and cache hits and counts.


Dimensions let you view metrics in meaningful groups. For example, instead of looking at total API traffic in your organization, you can see API traffic for each API proxy.


For each type of dimension (or more than one dimension), you construct a request by adding the desired dimension(s) by name in the URI after /stats. This groups the data by that dimension or combination of dimensions. For example, to group metrics by API proxies, you'd use /stats/apiproxy. To group metrics by API proxy and target response code combinations, you'd comma-separate dimensions in the URI like this: /stats/apiproxy,target_response_code.


Following are the supported dimensions. For descriptions, see the Analytics metrics, dimensions, and filters reference.

access_token, api_product, apiproxy, apiproxy_revision, ax_cache_key, ax_cache_name, ax_cache_source, ax_day_of_week, ax_dn_region, ax_execution_fault_flow_name, ax_execution_fault_flow_state, ax_execution_fault_policy_name, ax_geo_city, ax_geo_continent, ax_geo_country, ax_geo_region, ax_geo_timezone, ax_hour_of_day, ax_month_of_year, ax_true_client_ip, ax_ua_agent_family, ax_ua_agent_type, ax_ua_agent_version, ax_ua_device_category, ax_ua_os_family, ax_ua_os_version, ax_week_of_month, client_id, client_ip, developer, developer_app, developer_email, environment, flow_resource, gateway_flow_id, organization, proxy_basepath, proxy_client_ip, proxy_pathsuffix, request_path, request_uri, request_verb, response_status_code, target, target_basepath, target_host, target_ip, target_response_code, target_url, useragent, virtual_host, x_forwarded_for_ip

You can also include your own custom dimensions, as described in Analyze API message content using custom analytics.


Here's an example that shows how to get the average response time (metric) for all API proxies (dimension) in an environment:


You can also apply filters to limit the data that's returned. For example, if you're getting message counts grouped by API proxies, you can add a filter that returns only metrics for API proxies that return 4xx or 5xx status codes. Use any available dimensions or metrics to build your filters.


For information on filters and the operators you can use, see the Analytics metrics, dimensions, and filters reference.

Sample filters
Description Filter query structure
Metrics API proxies named either api1 or api2 filter=(apiproxy in 'api1','api2')
Metrics for all API proxies except api1 and api2 filter=(apiproxy notin 'ap1','api2')
Metrics where there are no errors filter=(is_error eq 0)
Metrics where there is an error or the API proxy name is api1 or api2 filter=(is_error eq 1) or (apiproxy in 'api1','api2')
Metrics where the response status code is 4xx or 5xx filter=(response_status_code ge 400 and response_status_code le 599)

Use the additional query parameters defined in the API method to construct the complete request.


For a list of examples using this API, see Analytics command reference.


You can use the _optimized=js query parameter to optimize the JSON in the response so that it is less verbose, as described in this community article. However, the _optimized query parameter has not been fully tested and its performance cannot be guaranteed.


Resource URL /organizations/{org_name}/environments/{env_name}/stats/{dimension_name}

Query Parameters

Name Values Description

Designates one or more metrics to be aggregated for the report. Following are supported metrics and aggregate functions. For descriptions, see the Analytics reference.
tps (Currently must use with another metric)

Separate more than one metric with a comma. For example:



The start and end time for the desired interval. The date format is MM/DD/YYYY HH:MM. For example, 04/15/2017 00:00~05/15/2017 23:59

If you have high API traffic, report generation will be faster if you use smaller time ranges, such as 2 or 3 hours.

It takes at least 10 minutes after an API call for Edge analytics to register it.

Do not use 24:00 as the time because it wraps around to 00:00. Use 23:59 instead.

If you make a request through the API reference on this page, it automatically URL encodes the space character before HH:MM. However, if you are entering the time range in a cURL command from the command line, manually insert "%20" for the space character, in the form: MM/DD/YYYY%20HH:MM~MM/DD/YYYY%20HH:MM.

In a curl command, you can URL encode special characters in the date format, including: "%2F" for a forward slash ("/"), "%20" for a space, and "%3A" for a colon (":").

Note: Data older than six months from the current date is not accessible by default. If you want to access data older than six months, contact Apigee Support.

Note:If you set timeUnit to second, the timeRange cannot be longer than one hour.


A value of second, minute, hour, day, week, month, quarter, year, decade, century, millennium.

Note: second is not supported for Edge for the Private Cloud.


When two or more metrics are specified, use sortby to sort results by a specific metric. For example: when you include the metricssum(message_count),sum(is_error), use a sortby of sum(message_count) to sort the results by message count.


Supported sort scopes are DESC or ASC.


Take 'top k' results from results, for example, to return the top 5 results 'topk=5'.


Enables drill-down on specific dimension values. Don't add the word "filter", and close value in parenthesis "()". For example: (response_status_code gt 500 and response_status_code lt 599)

SmartDocs automatically URL encodes the spaces.


Set the limit for the number of entries returned by the API. The default limit is 1000 entries. If you expect your query to return more than 1000 entries, then set the limit appropriately. Otherwise, your query returns a maximum of 1000 entries.


Use offset with limit to enable pagination of results. For example, to display results 11-20, set limit to '10' and offset to '10'.

Note: Edge ignores the offset parameter on queries that process raw fact data. For these "fact" queries, Edge uses Big Data (Apache Spark), which processes data using a parallel map-reduce technique. You can tell if the Spark query engine was used to process a query when you see something like the following in the response:

"notices" : [ "query served by:d62441a4-0951-4b90-abd3-318e86c23cf6", "Spark engine used" ]


Lists timestamps in ascending order if set to true. Recommend setting this value to true if you are using sortby with sort=DESC.

Request Body

org_name Mention the organization name true

env_name Mention the environment name, such as test or prod true

dimension_name Mention the dimension name true

org_name Mention the organization name true

env_name Mention the environment name, such as test or prod true

dimension_name Mention the dimension name true

org_name Mention the organization name true

env_name Mention the environment name, such as test or prod true

dimension_name Mention the dimension name true

org_name Mention the organization name true

dimension_name Mention the dimension name true

org_name Mention the organization name true

dimension_name Mention the dimension name true

HTTP Basic

OAuth 2.0



Make a request and see the response.

Make a request and see the response.

Make a request and see the response.


Help or comments?

  • If something's not working: Ask the Apigee Community or see Apigee Support.
  • If something's wrong with the docs: Click the "Send Feedback" button.
    (Incorrect? Unclear? Broken link? Typo?)