- HTTP request
- Request body
- Response body
- Authorization scopes
- QueryDomainStatsRequest
- BatchQueryDomainStatsResult
- Status
- Try it!
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.
HTTP request
POST https://gmailpostmastertools.googleapis.com/v2/domainStats:batchQuery
The URL uses gRPC Transcoding syntax.
Request body
The request body contains data with the following structure:
| JSON representation |
|---|
{
"requests"
:
[
{
object (
|
| Fields | |
|---|---|
requests[]
|
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. |
Response body
Response message for domainStats.batchQuery.
If successful, the response body contains data with the following structure:
| JSON representation |
|---|
{
"results"
:
[
{
object (
|
| Fields | |
|---|---|
results[]
|
A list of responses, one for each query in the BatchQueryDomainStatsRequest. The order of responses will correspond to the order of requests. |
Authorization scopes
Requires one of the following OAuth scopes:
-
https://www.googleapis.com/auth/postmaster -
https://www.googleapis.com/auth/postmaster.traffic.readonly
For more information, see the Authorization guide .
QueryDomainStatsRequest
Request message for QueryDomainStats.
| JSON representation |
|---|
{ "parent" : string , "metricDefinitions" : [ { object ( |
| Fields | |
|---|---|
parent
|
Required. The parent resource name where the stats are queried. Format: domains/{domain} |
metricDefinitions[]
|
Required. The specific metrics to query. You can define a custom name for each metric, which will be used in the response. |
timeQuery
|
Required. The time range or specific dates for which to retrieve the metrics. |
pageSize
|
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. |
pageToken
|
Optional. The nextPageToken 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. |
aggregationGranularity
|
Optional. The granularity at which to aggregate the statistics. If unspecified, defaults to DAILY. |
BatchQueryDomainStatsResult
Represents the result of a single QueryDomainStatsRequest within a batch.
| JSON representation |
|---|
{ "response" : { object ( |
result
. The result of the individual query. result
can be only one of the following:response
object (
QueryDomainStatsResponse
)
The successful response for the individual query.
error
object (
Status
)
The error status if the individual query failed.
Status
The Status
type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC
. Each Status
message contains three pieces of data: error code, error message, and error details.
You can find out more about this error model and how to work with it in the API Design Guide .
| JSON representation |
|---|
{ "code" : integer , "message" : string , "details" : [ { "@type" : string , field1 : ... , ... } ] } |
| Fields | |
|---|---|
code
|
The status code, which should be an enum value of |
details[]
|
A list of messages that carry the error details. There is a common set of message types for APIs to use. |

