Azure Monitor Metrics Batch API
A high-volume API designed for retrieving metric values across multiple Azure resources in a single request. All resources in a batch must be in the same subscription and region.
A high-volume API designed for retrieving metric values across multiple Azure resources in a single request. All resources in a batch must be in the same subscription and region.
openapi: 3.1.0
info:
title: Azure Monitor Metrics Batch API
description: >-
A high-volume API designed for retrieving metric values across multiple Azure
resources in a single request. All resources in a batch must be in the same
subscription and region.
version: '2024-02-01'
contact:
name: Microsoft Azure Support
url: https://azure.microsoft.com/en-us/support/options/
license:
name: Microsoft API License
url: https://azure.microsoft.com/en-us/support/legal/
servers:
- url: https://{region}.metrics.monitor.azure.com
description: Azure Monitor Metrics regional endpoint
variables:
region:
default: eastus
description: The Azure region for the metrics endpoint.
security:
- oauth2:
- https://management.azure.com/.default
tags:
- name: Metrics Batch
description: Operations for batch querying Azure Monitor metrics across multiple resources
paths:
/subscriptions/{subscriptionId}/metrics:batchGet:
post:
operationId: MetricsBatch_Batch
summary: Azure Monitor Batch query metrics for multiple resources
description: >-
Lists the metric values for multiple resources in a single batch request.
All resources must be in the same subscription, region, and resource type.
Allows for efficient retrieval of metric data at scale.
tags:
- Metrics Batch
parameters:
- $ref: '#/components/parameters/SubscriptionIdParameter'
- $ref: '#/components/parameters/ApiVersionParameter'
- $ref: '#/components/parameters/StartTimeParameter'
- $ref: '#/components/parameters/EndTimeParameter'
- $ref: '#/components/parameters/IntervalParameter'
- $ref: '#/components/parameters/MetricNamesParameter'
- $ref: '#/components/parameters/MetricNamespaceParameter'
- $ref: '#/components/parameters/AggregationParameter'
- $ref: '#/components/parameters/TopParameter'
- $ref: '#/components/parameters/OrderByParameter'
- $ref: '#/components/parameters/FilterParameter'
- $ref: '#/components/parameters/RollUpByParameter'
requestBody:
description: >-
The batch body that contains the list of resource IDs to query metrics for.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MetricsBatchRequest'
responses:
'200':
description: Successful batch request to get metrics for multiple resources.
content:
application/json:
schema:
$ref: '#/components/schemas/MetricsBatchResponse'
default:
description: Error response describing why the operation failed.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
securitySchemes:
oauth2:
type: oauth2
flows:
clientCredentials:
tokenUrl: https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token
scopes:
https://management.azure.com/.default: Access Azure Management API
parameters:
SubscriptionIdParameter:
name: subscriptionId
in: path
required: true
description: The ID of the target subscription.
schema:
type: string
ApiVersionParameter:
name: api-version
in: query
required: true
description: Client API version.
schema:
type: string
default: '2024-02-01'
StartTimeParameter:
name: starttime
in: query
required: true
description: The start time of the query in ISO 8601 format.
schema:
type: string
format: date-time
EndTimeParameter:
name: endtime
in: query
required: true
description: The end time of the query in ISO 8601 format.
schema:
type: string
format: date-time
IntervalParameter:
name: interval
in: query
required: false
description: The interval (window size) of the query in ISO 8601 duration format.
schema:
type: string
default: PT1M
MetricNamesParameter:
name: metricnames
in: query
required: true
description: The names of the metrics (comma-separated) to retrieve.
schema:
type: string
MetricNamespaceParameter:
name: metricNamespace
in: query
required: true
description: Metric namespace that contains the requested metric names.
schema:
type: string
AggregationParameter:
name: aggregation
in: query
required: false
description: The list of aggregation types (comma-separated) to retrieve.
schema:
type: string
TopParameter:
name: top
in: query
required: false
description: The maximum number of records to retrieve per resource.
schema:
type: integer
format: int32
OrderByParameter:
name: orderBy
in: query
required: false
description: The aggregation to use for sorting results and the direction of the sort.
schema:
type: string
FilterParameter:
name: $filter
in: query
required: false
description: The $filter used to reduce the set of metric data returned.
schema:
type: string
RollUpByParameter:
name: rollUpBy
in: query
required: false
description: Dimension name(s) to rollup results by.
schema:
type: string
schemas:
MetricsBatchRequest:
type: object
required:
- resourceids
properties:
resourceids:
type: array
items:
type: string
description: >-
The list of resource IDs to query metrics for. All resources must be
in the same subscription, region, and resource type.
MetricsBatchResponse:
type: object
properties:
values:
type: array
items:
$ref: '#/components/schemas/MetricResultsResponse'
description: The collection of metric results for each resource.
MetricResultsResponse:
type: object
properties:
starttime:
type: string
description: The start time, in datetime format, for which the data was retrieved.
endtime:
type: string
description: The end time, in datetime format, for which the data was retrieved.
interval:
type: string
description: The interval (window size) for which the metric data was returned.
namespace:
type: string
description: The namespace of the metrics being queried.
resourceregion:
type: string
description: The region of the resource being queried for metrics.
resourceid:
type: string
description: The resource ID for which metrics were retrieved.
value:
type: array
items:
$ref: '#/components/schemas/Metric'
description: The value of the collection.
Metric:
type: object
required:
- id
- type
- name
- unit
- timeseries
properties:
id:
type: string
description: The metric ID.
type:
type: string
description: The resource type of the metric resource.
name:
type: object
properties:
value:
type: string
description: The invariant value.
localizedValue:
type: string
description: The display name.
required:
- value
displayDescription:
type: string
description: Detailed description of this metric.
unit:
type: string
enum:
- Count
- Bytes
- Seconds
- CountPerSecond
- BytesPerSecond
- Percent
- MilliSeconds
- ByteSeconds
- Unspecified
- Cores
- MilliCores
- NanoCores
- BitsPerSecond
description: The unit of the metric.
timeseries:
type: array
items:
$ref: '#/components/schemas/TimeSeriesElement'
description: The time series returned when a data query is performed.
TimeSeriesElement:
type: object
properties:
metadatavalues:
type: array
items:
type: object
properties:
name:
type: object
properties:
value:
type: string
localizedValue:
type: string
value:
type: string
description: The metadata values returned.
data:
type: array
items:
$ref: '#/components/schemas/MetricValue'
description: An array of data points representing the metric values.
MetricValue:
type: object
required:
- timeStamp
properties:
timeStamp:
type: string
format: date-time
description: The timestamp for the metric value in ISO 8601 format.
average:
type: number
format: double
description: The average value in the time range.
minimum:
type: number
format: double
description: The least value in the time range.
maximum:
type: number
format: double
description: The greatest value in the time range.
total:
type: number
format: double
description: The sum of all of the values in the time range.
count:
type: number
format: double
description: The number of samples in the time range.
ErrorResponse:
type: object
properties:
code:
type: string
description: Error code.
message:
type: string
description: Error message indicating why the operation failed.