---
title: "POST /v2/domainStats:batchQuery"
method: POST
path: "/v2/domainStats:batchQuery"
tags: ["domainStats"]
---

# POST /v2/domainStats:batchQuery

`POST /v2/domainStats:batchQuery`

Executes a batch of QueryDomainStats requests for multiple domains. Returns PERMISSION_DENIED if you don't have permission to access DomainStats for any of the requested domains.

## Request body

- BatchQueryDomainStatsRequest — Request message for BatchQueryDomainStats.
  - `requests` QueryDomainStatsRequest[] — Required. A list of individual query requests. Each request can be for a different domain. A maximum of 100 requests can be included in a single batch.
    - `pageSize` integer — Optional. The maximum number of DomainStats resources to return in the response. The server may return fewer than this value. If unspecified, a default value of 10 will be used. The maximum value is 200.
    - `timeQuery` TimeQuery — The date ranges or specific dates for which you want to retrieve data.
      - `dateRanges` DateRanges — A set of date ranges.
        - `dateRanges` DateRange[] — Required. The list of date ranges for which to retrieve data.
          - `start` Date — Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
            - `day` integer — Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
            - `year` integer — Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
            - `month` integer — Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
          - `end` Date — Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
            - `day` integer — Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
            - `year` integer — Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
            - `month` integer — Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
      - `dateList` DateList — A set of specific dates.
        - `dates` Date[] — Required. The list of specific dates for which to retrieve data.
          - `day` integer — Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
          - `year` integer — Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
          - `month` integer — Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
    - `aggregationGranularity` 'AGGREGATION_GRANULARITY_UNSPECIFIED' | 'DAILY' | 'OVERALL' — Optional. The granularity at which to aggregate the statistics. If unspecified, defaults to DAILY.
    - `parent` string — Required. The parent resource name where the stats are queried. Format: domains/{domain}
    - `pageToken` string — Optional. The next_page_token value returned from a previous List request, if any. If the aggregation granularity is DAILY, the page token will be the encoded date + "/" + metric name. If the aggregation granularity is OVERALL, the page token will be the encoded metric name.
    - `metricDefinitions` MetricDefinition[] — Required. The specific metrics to query. You can define a custom name for each metric, which will be used in the response.
      - `baseMetric` BaseMetric — Specifies the base metric to query, which can be a predefined standard metric or a user-defined custom metric (if supported in the future).
        - `standardMetric` 'STANDARD_METRIC_UNSPECIFIED' | 'FEEDBACK_LOOP_ID' | 'FEEDBACK_LOOP_SPAM_RATE' | 'SPAM_RATE' | 'AUTH_SUCCESS_RATE' | 'TLS_ENCRYPTION_MESSAGE_COUNT' | 'TLS_ENCRYPTION_RATE' | 'DELIVERY_ERROR_COUNT' | 'DELIVERY_ERROR_RATE' — A predefined standard metric.
      - `name` string — Required. The user-defined name for this metric. This name will be used as the key for this metric's value in the response.
      - `filter` string — Optional. Optional filters to apply to the metric.

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/gmailpostmastertools.md) · [All operations](https://skmtc.net/google/apis/gmailpostmastertools/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/gmailpostmastertools/versions/ee090f4a0797/schema)
