Google Gmail Domain Stats API

The DomainStats API from Google Gmail — 1 operation(s) for domainstats.

GitHub OpenAPI

Operations 1

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

POST /v2/domainStats:batchQuery Query domain stats for several domains · Batch query domainStats #
Ask an LLM
“Can I pull domain reputation stats for many domains in one request?”
“What is the maximum number of domains I can query at once?”
Tell an agent
Run a batch query for domain stats on {requests}.
Pull reputation stats for these domains: {requests}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/google-gmail:google-gmail-domainstats-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

google-gmail-domainstats-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Gmail Postmaster Tools Domain Stats API
  version: v2
  description: Generated from Google's published Discovery document for Gmail Postmaster Tools API (gmailpostmastertools v2, revision 20261111). 1 operation(s).
  contact:
    name: Google
    url: https://developers.google.com/
  termsOfService: https://developers.google.com/terms
servers:
- url: https://gmailpostmastertools.googleapis.com
tags:
- name: DomainStats
paths:
  /v2/domainStats:batchQuery:
    post:
      operationId: gmailpostmastertools.domainStats.batchQuery
      summary: Batch query domainStats
      description: 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.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchQueryDomainStatsRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchQueryDomainStatsResponse'
        4XX:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GoogleRpcError'
          description: 'Client error (google.rpc.Status: INVALID_ARGUMENT, PERMISSION_DENIED, NOT_FOUND ...)'
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GoogleRpcError'
          description: Error response (google.rpc.Status)
      security:
      - oauth2:
        - https://www.googleapis.com/auth/postmaster
        - https://www.googleapis.com/auth/postmaster.traffic.readonly
      - apiKey: []
      tags:
      - DomainStats
components:
  schemas:
    BatchQueryDomainStatsResult:
      type: object
      properties:
        response:
          $ref: '#/components/schemas/QueryDomainStatsResponse'
          description: The successful response for the individual query.
        error:
          $ref: '#/components/schemas/Status'
          description: The error status if the individual query failed.
      description: Represents the result of a single QueryDomainStatsRequest within a batch.
    BatchQueryDomainStatsRequest:
      properties:
        requests:
          description: 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.
          type: array
          items:
            $ref: '#/components/schemas/QueryDomainStatsRequest'
      type: object
      description: Request message for BatchQueryDomainStats.
    StringList:
      properties:
        values:
          description: The string values.
          items:
            type: string
          type: array
      description: Represents a list of strings.
      type: object
    Date:
      type: object
      properties:
        day:
          format: int32
          type: integer
          description: 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.
        month:
          format: int32
          type: integer
          description: Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
        year:
          type: integer
          description: Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
          format: int32
      description: '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'
    TimeQuery:
      description: The date ranges or specific dates for which you want to retrieve data.
      type: object
      properties:
        dateList:
          $ref: '#/components/schemas/DateList'
          description: A list of specific dates.
        dateRanges:
          $ref: '#/components/schemas/DateRanges'
          description: A list of date ranges.
    MetricDefinition:
      description: Defines a specific metric to query, including a user-defined name, the base metric type, and optional filters.
      type: object
      properties:
        name:
          description: Required. The user-defined name for this metric. This name will be used as the key for this metric's value in the response.
          type: string
        filter:
          type: string
          description: Optional. Optional filters to apply to the metric.
        baseMetric:
          $ref: '#/components/schemas/BaseMetric'
          description: Required. The underlying metric to query.
    QueryDomainStatsResponse:
      description: Response message for QueryDomainStats.
      type: object
      properties:
        domainStats:
          items:
            $ref: '#/components/schemas/DomainStat'
          type: array
          description: The list of domain statistics. Each DomainStat object contains the value for a metric requested in the QueryDomainStatsRequest.
        nextPageToken:
          type: string
          description: Token to retrieve the next page of results, or empty if there are no more results in the list.
    DateList:
      type: object
      description: A set of specific dates.
      properties:
        dates:
          type: array
          description: Required. The list of specific dates for which to retrieve data.
          items:
            $ref: '#/components/schemas/Date'
    DateRange:
      properties:
        end:
          $ref: '#/components/schemas/Date'
          description: Required. The inclusive end date of the date range.
        start:
          $ref: '#/components/schemas/Date'
          description: Required. The inclusive start date of the date range.
      description: A single date range defined by a start and end date.
      type: object
    StatisticValue:
      description: The actual value of a statistic.
      type: object
      properties:
        doubleValue:
          description: Double value.
          type: number
          format: double
        stringList:
          $ref: '#/components/schemas/StringList'
          description: List of string values.
        intValue:
          description: Integer value.
          type: string
          format: int64
        stringValue:
          description: String value.
          type: string
        floatValue:
          format: float
          type: number
          description: Float value.
    Status:
      type: object
      properties:
        message:
          description: A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
          type: string
        details:
          description: A list of messages that carry the error details. There is a common set of message types for APIs to use.
          type: array
          items:
            additionalProperties:
              description: Properties of the object. Contains field @type with type URL.
            type: object
        code:
          format: int32
          description: The status code, which should be an enum value of google.rpc.Code.
          type: integer
      description: '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](https://github.com/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](https://cloud.google.com/apis/design/errors).'
    BaseMetric:
      type: object
      properties:
        standardMetric:
          type: string
          enum:
          - 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
          description: A predefined standard metric.
      description: Specifies the base metric to query, which can be a predefined standard metric or a user-defined custom metric (if supported in the future).
    BatchQueryDomainStatsResponse:
      properties:
        results:
          type: array
          items:
            $ref: '#/components/schemas/BatchQueryDomainStatsResult'
          description: A list of responses, one for each query in the BatchQueryDomainStatsRequest. The order of responses will correspond to the order of requests.
      type: object
      description: Response message for BatchQueryDomainStats.
    DateRanges:
      type: object
      properties:
        dateRanges:
          items:
            $ref: '#/components/schemas/DateRange'
          description: Required. The list of date ranges for which to retrieve data.
          type: array
      description: A set of date ranges.
    QueryDomainStatsRequest:
      description: Request message for QueryDomainStats.
      properties:
        pageSize:
          format: int32
          description: 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.
          type: integer
        metricDefinitions:
          type: array
          description: Required. The specific metrics to query. You can define a custom name for each metric, which will be used in the response.
          items:
            $ref: '#/components/schemas/MetricDefinition'
        parent:
          type: string
          description: 'Required. The parent resource name where the stats are queried. Format: domains/{domain}'
        aggregationGranularity:
          type: string
          enum:
          - AGGREGATION_GRANULARITY_UNSPECIFIED
          - DAILY
          - OVERALL
          description: Optional. The granularity at which to aggregate the statistics. If unspecified, defaults to DAILY.
        timeQuery:
          $ref: '#/components/schemas/TimeQuery'
          description: Required. The time range or specific dates for which to retrieve the metrics.
        pageToken:
          description: 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.
          type: string
      type: object
    GoogleRpcError:
      type: object
      description: The error envelope every Google API returns.
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
            status:
              type: string
            details:
              type: array
              items:
                type: object
    DomainStat:
      properties:
        name:
          description: 'Output only. The resource name of the DomainStat resource. Format: domains/{domain}/domainStats/{domain_stat} The `{domain_stat}` segment is an opaque, server-generated ID. We recommend using the `metric` field to identify queried metrics instead of parsing the name.'
          readOnly: true
          type: string
        value:
          $ref: '#/components/schemas/StatisticValue'
          description: The value of the corresponding metric.
        metric:
          type: string
          description: The user-defined name from MetricDefinition.name in the request, used to correlate this result with the requested metric.
        date:
          $ref: '#/components/schemas/Date'
          description: Optional. The specific date for these stats, if granularity is DAILY. This field is populated if the QueryDomainStatsRequest specified a DAILY aggregation granularity.
      description: Email statistics for a domain for a specified time period or date.
      type: object
  securitySchemes:
    apiKey:
      type: apiKey
      in: query
      name: key
      description: API key; accepted by methods that do not need user data.
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://accounts.google.com/o/oauth2/auth
          tokenUrl: https://oauth2.googleapis.com/token
          scopes:
            https://www.googleapis.com/auth/postmaster.domain: View and manage the domains you have registered with Postmaster Tools
            https://www.googleapis.com/auth/postmaster.user: View and manage users for the domains you have registered with Postmaster Tools
            https://www.googleapis.com/auth/postmaster: Get email traffic metrics, manage domains, and manage domain users for the domains you have registered with Postmaster Tools
            https://www.googleapis.com/auth/postmaster.traffic.readonly: Get email traffic metrics for the domains you have registered with Postmaster Tools
externalDocs:
  url: https://developers.google.com/workspace/gmail/postmaster
x-provenance:
  method: harvested
  publisher: Google
  source: https://gmailpostmastertools.googleapis.com/$discovery/rest?version=v2
  note: converted by discovery-to-openapi.py from Google's Discovery document (revision 20261111)