Was this helpful?


Base Path: https://api.enterprise.apigee.com/v1/o/{org_name}

API Resource Path:


Description: Use the GET method to retrieve metrics for a dimension

Verb: GET
Auth: Basic Auth
Media types:


The /stats resource provides access to metrics collected by Apigee Edge.

Apigee Edge records and aggregates metrics for dimensions.

Apigee Edge defines 3 classes of dimensions:

  • Pre-computed, static dimensions used for operational dashboards
  • Dynamic dimensions, whose metrics are computed 'on-demand' when a report is built
  • Custom dimensions, which enable you to build reports based on message content

For each type of dimension, you construct a request by adding the desired dimension by name as a URI parameter following /stats.

For example:


You can define queries against the collected metrics by specifying metrics, type of calculation to run, time range, and, optionally, any filters to use for drill-down into the data set that is returned by the query.

For pre-computed metrics, only simple calculations are needed, since the specific function used to perform the calculation is embedded in the metric.

To generate custom reports, you select a metric + function calculation to run over the specified dimensions.

The base request to create a custom report that calculates average response time for all APIs in an environment is:


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


Filters can be applied to custom resources. Custom resources are:

Symbol Operation
in for list inclusion
notin for list exclusion
eq =
ne != or
gt >
lt <
ge >=
le <=

Sample filters
Description Filter query structure
Stats for API proxies named either api1 or api2 filter=(apiproxy in 'api1','api2')
Stats for all API proxies except api1 and api2 filter=(apiproxy notin 'ap1','api2')
Stats where there are no errors filter=(iserror eq 0)
Stats where there is no error messages or the API proxy name is api1 or api2 filter=(iserror eq 1) or (apiproxy in 'api1','api2')
Stats where (response code is either 201 or 301) and (there are errors) or (API proxy name is either api1 or api2) filter=(responsecode le 201 or responsecode eq 301) and (iserror eq 1) or (apiproxy in 'api1','api2')

Sample Request:
$ curl -X GET -H "Accept:application/json" \
https://api.enterprise.apigee.com/v1/o/{org_name}/environments/{env_name}/stats/{dimension_name}?"select={metric_name}&timeRange=1/1/2013%2000:00~1/2/2013%2000:00&timeUnit=hour&sortby={metric_name}&sort=DESC&filter=(apiproxy%20in%20'weather','news')" \
-u myname:mypass

Query Parameters:
Name Description Default Required?
select Designates the metric to be aggregated for the report. Supported metrics are message_count, error_count, total_response_time, max_response_time, min_response_time, data_exchange_size, end_point_response_time N/A Yes
timeRange The start and end time for the desired interval. The date format is MM/DD/YYYY HH:MM. For example, 1/1/2013%2000:00~1/2/2013%2000:00 N/A Yes
timeUnit second, minute, hour, day, week, month, quarter, year, decade, century, millennium N/A Yes
sortby When two or more select values are specified, 'sortby' can be used to specify the select used for sorting results: message_count, error_count, total_response_time, max_response_time, min_response_time, data_exchange_size, end_point_response_time N/A No
sort Supported sort scopes are DESC or ASC N/A No
topk Take "top k" results from results, for example, to return the top 5 results "topk=5". N/A No
filter Enables drill-down on specific dimension values N/A No
limit Set the limit for the number of entries returned by the API N/A No
offset Use offset with limit to enable pagination of results. For example, to display results 11-20, set limit to '10' and offset to '10'. N/A No


Lets you obtain real-time query data. When set to true, queries return recently arrived API traffic data when the user-submitted time range for the query is less than one hour. If set to false, then queries are taken from the default cloud data store, which results a delay in the availability of query data of up to three hours. This parameter overrides the accuracy query parameter setting. 


accuracy Lets you specify that queries return data either from the raw (non-sampled) API traffic data store or from a sample of the raw API data. Queries against sampled data sets are smaller than the raw data set, and therefore run faster. You can specify the following values for the accuracy query parameter. 


  • accuracy=0: Retrieve query data from the raw API traffic.
  • accuracy=1 : Retrieve query data from the 1% sampled traffic table; that is, the table that is 1% in size of the raw traffic table.
  • accuracy=10: Retrieve query data from the 10% sampled traffic table; that is, the table that is 1% in size of the raw traffic table. 
Note that the realtime query parameter overrides this parameter. 
N/A No

Sample Response:
  "environments" : [ {
	"dimensions" : [ {
  	  "metrics" : [ 
    	        "name" : "message_count",
    	        "values" : [ {
      	           "timestamp" : 1335241800000,
      	           "value" : "1.0"
    	         } ]
  	      } ,
    	         "name" : "error_count",
    	         "values" : [ {
      	            "timestamp" : 1335241800000,
      	            "value" : "0.0"
    	           } ]
               "name" : "api1"
  	  "metrics" : [ 
    	      "name" : "message_count",
    	      "values" : [ {
      	             "timestamp" : 1335241800000,
      	             "value" : "1.0"
    	          } ]
    	        "name" : "error_count",
    	        "values" : [ {
      	              "timestamp" : 1335241800000,
      	              "value" : "0.0"
    	        } ]
             "name" : "api2"
         "name" : "test"
   "metaData" : {

Response Payload Elements:
Name Description
metadata Metadata associated with the report
environments Environments in the organization where the statistics are collected (supports wildcard * for cross environment statistics collection)
metrics The values returned for the specified dimension
dimensions The dimension defined for measurement: in this example api_name.
metrics Metrics for the report



In the curl command, only the query string seems to have been wrapped in double-quotes. Shouldn't the entire resource be?

(also, every time I submit a comment, it pops me back to the top of the page and shows an error message that is easy to miss instructing me to complete the captcha. Why not show the captcha up front? And even better, once I pass as a human, cookie me so that I'm no longer forced to prove it.)

What about case sensitivity? If I want to filter on the request verb, does it matter if I specify 'POST' or 'post' as the value of the Request Path filter?

Why is "timeUnit" and "timeRange" medial-camelCase but "sortby" and "realtime" are not? This wouldn't matter as much if it weren't case sensitive in how query parameters are handled…

Add new comment

Provide your email address if you wish to be contacted offline about your comment.
We will not display your email address as part of your comment.

We'd love your feedback and perspective! Please be as specific as possible.
Type the characters you see in this picture. (verify using audio)

Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.