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.

Create an asynchronous analytics query (Beta)

Resource Summary


Content Type

application/json, text.xml





Create an asynchronous analytics query (Beta)

Create an asynchronous analytics query. You must be in the role of organization administrator to call this API.


See Use the asynchronous custom reports API for more information and examples.

Resource URL /organizations/{org_name}/environments/{env_name}/queries

Request Body

Property Description Required?

Array of metrics. You can specify one or more metrics for a query where each metric includes. Only the metric name is required:

  • name: (Required) The name of the metric as defined by the table at metrics.
  • function: (Optional) The aggregation function as avg, min, max, or sum.

    Not all metrics support all aggregation functions. The documentation on metrics contains a table that specifies the metric name and the function (avg, min, max,sum) supported by the metric.

  • alias: (Optional) The name of the proroperty containing the metric data in the output. If omitted, it defaults to the metric name combined with the name of the aggregation function.
  • operator: (Optional) An operation to perform on the metric after its value has been calculated. Works with the value property. Supported operations include: + - / % *.
  • value: (Optional) The value applied to the calculated metric by the specified operator.

The operator and value properties define a post-processing operation performed on the metric. For example, if you specify the metric response_processing_latency, the metric returns the average response processing latency with a unit of milliseconds. To convert the units to seconds, set the operator to "/" and the value to ”1000.0“:


For more information, see Analytics metrics, dimensions, and filters reference.

dimensions Array of dimensions to group the metrics. For more information, see the list of supported dimension. You can specify multiple dimensions. No
timeRange Time range for the query.

You can use the following predefined strings to specify the time range:

  • last60minutes
  • last24hours
  • last7days

Or, you can specify the timeRange as a structure describing start and end timestamps in the ISO format: yyyy-mm-ddThh:mm:ssZ. For example:

"timeRange": {
    "start": "2018-07-29T00:13:00Z",
    "end": "2018-08-01T00:18:00Z"
limit Maximum number of rows that can be returned in the result. No
filter Boolean expression that can be used to filter data. Filter expressions can be combined using AND/OR terms and should be fully parenthesized to avoid ambiguity. See Analytics metrics, dimensions, and filters reference for more information on the fields available to filter on. For more information on the tokens that you use to build filter expressions, see Filter expression syntax. No
groupByTimeUnit Time unit used to group the result set. Valid values include: second, minute, hour, day, week, or month.

If a query includes groupByTimeUnit, then the result is an aggregation based on the specified time unit and the resultant timestamp does not include milliseconds precision. If a query omits groupByTimeUnit, then the resultant timestamp includes milliseconds precision.

outputFormat Output format. Valid values include: csv or json. Defaults to json.

Note: Configure the delimiter for CSV output using the csvDelimiter property.

csvDelimiter Delimiter used in the CSV file, if outputFormat is set to csv. Defaults to the , (comma) character. Supported delimiter characters include comma (,), pipe (|), and tab (\t). No

org_name Mention the organization name true

env_name Mention the environment 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?)