openapi: 3.1.0
info:
title: Google Analytics Data API
description: 'Accesses report data in Google Analytics. Warning: Creating multiple Customer Applications,
Accounts, or Projects to simulate or act as a single Customer Application, Account, or Project (respectively)
or to circumvent Service-specific usage limits or quotas is a direct violation of Google Cloud Platform
Terms of Service as well as Google APIs Terms of Service. These actions can result in immediate termination
of your GCP project(s) without any warning. '
version: v1beta
contact:
name: Google
url: https://developers.google.com/analytics/devguides/reporting/data/v1/
x-discovery-revision: '20260812'
servers:
- url: https://analyticsdata.googleapis.com
description: Google Analytics Data API
tags:
- name: properties
security:
- BearerAuth: []
paths:
/v1beta/properties/{propertiesId}:batchRunPivotReports:
post:
operationId: properties_batchRunPivotReports
summary: Returns multiple pivot reports in a batch
tags:
- properties
description: Returns multiple pivot reports in a batch. All reports must be for the same Google
Analytics property.
parameters:
- name: property
in: query
required: true
schema:
type: string
pattern: ^properties/[^/]+$
description: 'A Google Analytics property identifier whose events are tracked. Specified in the
URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
This property must be specified for the batch. The property within RunPivotReportRequest may
either be unspecified or consistent with this property. Example: properties/1234'
- name: propertiesId
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BatchRunPivotReportsRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/BatchRunPivotReportsResponse'
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/GoogleRpcStatus'
security:
- OAuth2:
- analytics
- analytics.readonly
- BearerAuth: []
/v1beta/properties/{propertiesId}:batchRunReports:
post:
operationId: properties_batchRunReports
summary: Returns multiple reports in a batch
tags:
- properties
description: Returns multiple reports in a batch. All reports must be for the same Google Analytics
property.
parameters:
- name: property
in: query
required: true
schema:
type: string
pattern: ^properties/[^/]+$
description: 'A Google Analytics property identifier whose events are tracked. Specified in the
URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
This property must be specified for the batch. The property within RunReportRequest may either
be unspecified or consistent with this property. Example: properties/1234'
- name: propertiesId
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BatchRunReportsRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/BatchRunReportsResponse'
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/GoogleRpcStatus'
security:
- OAuth2:
- analytics
- analytics.readonly
- BearerAuth: []
/v1beta/properties/{propertiesId}:checkCompatibility:
post:
operationId: properties_checkCompatibility
summary: This compatibility method lists dimensions and metrics that can be added to a report request
and maintain compatibility
tags:
- properties
description: This compatibility method lists dimensions and metrics that can be added to a report
request and maintain compatibility. This method fails if the request's dimensions and metrics
are incompatible. In Google Analytics, reports fail if they request incompatible dimensions and/or
metrics; in that case, you will need to remove dimensions and/or metrics from the incompatible
report until the report is compatible. The Realtime and Core reports have different compatibility
rules. This method checks compatibility for Core reports.
parameters:
- name: property
in: query
required: true
schema:
type: string
pattern: ^properties/[^/]+$
description: 'A Google Analytics property identifier whose events are tracked. To learn more,
see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
`property` should be the same value as in your `runReport` request. Example: properties/1234'
- name: propertiesId
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CheckCompatibilityRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/CheckCompatibilityResponse'
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/GoogleRpcStatus'
security:
- OAuth2:
- analytics
- analytics.readonly
- BearerAuth: []
/v1beta/properties/{propertiesId}/metadata:
get:
operationId: properties_getMetadata
summary: Returns metadata for dimensions and metrics available in reporting methods
tags:
- properties
description: Returns metadata for dimensions and metrics available in reporting methods. Used to
explore the dimensions and metrics. In this method, a Google Analytics property identifier is
specified in the request, and the metadata response includes Custom dimensions and metrics as
well as Universal metadata. For example if a custom metric with parameter name `levels_unlocked`
is registered to a property, the Metadata response will contain `customEvent:levels_unlocked`.
Universal metadata are dimensions and metrics applicable to any property such as `country` and
`totalUsers`.
parameters:
- name: name
in: query
required: true
schema:
type: string
pattern: ^properties/[^/]+/metadata$
description: 'Required. The resource name of the metadata to retrieve. This name field is specified
in the URL path and not URL parameters. Property is a numeric Google Analytics property identifier.
To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
Example: properties/1234/metadata Set the Property ID to 0 for dimensions and metrics common
to all properties. In this special mode, this method will not return custom dimensions and metrics.'
- name: propertiesId
in: path
required: true
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Metadata'
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/GoogleRpcStatus'
security:
- OAuth2:
- analytics
- analytics.readonly
- BearerAuth: []
/v1beta/properties/{propertiesId}:runPivotReport:
post:
operationId: properties_runPivotReport
summary: Returns a customized pivot report of your Google Analytics event data
tags:
- properties
description: Returns a customized pivot report of your Google Analytics event data. Pivot reports
are more advanced and expressive formats than regular reports. In a pivot report, dimensions are
only visible if they are included in a pivot. Multiple pivots can be specified to further dissect
your data.
parameters:
- name: property
in: query
required: true
schema:
type: string
pattern: ^properties/[^/]+$
description: 'A Google Analytics property identifier whose events are tracked. Specified in the
URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
Within a batch request, this property should either be unspecified or consistent with the batch-level
property. Example: properties/1234'
- name: propertiesId
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RunPivotReportRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/RunPivotReportResponse'
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/GoogleRpcStatus'
security:
- OAuth2:
- analytics
- analytics.readonly
- BearerAuth: []
/v1beta/properties/{propertiesId}:runRealtimeReport:
post:
operationId: properties_runRealtimeReport
summary: Returns a customized report of realtime event data for your property
tags:
- properties
description: Returns a customized report of realtime event data for your property. Events appear
in realtime reports seconds after they have been sent to the Google Analytics. Realtime reports
show events and usage data for the periods of time ranging from the present moment to 30 minutes
ago (up to 60 minutes for Google Analytics 360 properties). For a guide to constructing realtime
requests & understanding responses, see [Creating a Realtime Report](https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-basics).
parameters:
- name: property
in: query
required: true
schema:
type: string
pattern: ^properties/[^/]+$
description: 'A Google Analytics property identifier whose events are tracked. Specified in the
URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
Example: properties/1234'
- name: propertiesId
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RunRealtimeReportRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/RunRealtimeReportResponse'
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/GoogleRpcStatus'
security:
- OAuth2:
- analytics
- analytics.readonly
- BearerAuth: []
/v1beta/properties/{propertiesId}:runReport:
post:
operationId: properties_runReport
summary: Returns a customized report of your Google Analytics event data
tags:
- properties
description: Returns a customized report of your Google Analytics event data. Reports contain statistics
derived from data collected by the Google Analytics tracking code. The data returned from the
API is as a table with columns for the requested dimensions and metrics. Metrics are individual
measurements of user activity on your property, such as active users or event count. Dimensions
break down metrics across some common criteria, such as country or event name. For a guide to
constructing requests & understanding responses, see [Creating a Report](https://developers.google.com/analytics/devguides/reporting/data/v1/basics).
parameters:
- name: property
in: query
required: true
schema:
type: string
pattern: ^properties/[^/]+$
description: 'A Google Analytics property identifier whose events are tracked. Specified in the
URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
Within a batch request, this property should either be unspecified or consistent with the batch-level
property. Example: properties/1234'
- name: propertiesId
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RunReportRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/RunReportResponse'
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/GoogleRpcStatus'
security:
- OAuth2:
- analytics
- analytics.readonly
- BearerAuth: []
/v1beta/properties/{propertiesId}/audienceExports:
post:
operationId: properties_audienceExports_create
summary: Creates an audience export for later retrieval
tags:
- properties
description: Creates an audience export for later retrieval. This method quickly returns the audience
export's resource name and initiates a long running asynchronous request to form an audience export.
To export the users in an audience export, first create the audience export through this method
and then send the audience resource name to the `QueryAudienceExport` method. See [Creating an
Audience Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics)
for an introduction to Audience Exports with examples. An audience export is a snapshot of the
users currently in the audience at the time of audience export creation. Creating audience exports
for one audience on different days will return different results as users enter and exit the audience.
Audiences in Google Analytics 4 allow you to segment your users in the ways that are important
to your business. To learn more, see https://support.google.com/analytics/answer/9267572. Audience
exports contain the users in each audience. Audience Export APIs have some methods at alpha and
other methods at beta stability. The intention is to advance methods to beta stability after some
feedback and adoption. To give your feedback on this API, complete the [Google Analytics Audience
Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
parameters:
- name: parent
in: query
required: true
schema:
type: string
pattern: ^properties/[^/]+$
description: 'Required. The parent resource where this audience export will be created. Format:
`properties/{property}`'
- name: propertiesId
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AudienceExport'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Operation'
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/GoogleRpcStatus'
security:
- OAuth2:
- analytics
- analytics.readonly
- BearerAuth: []
get:
operationId: properties_audienceExports_list
summary: Lists all audience exports for a property
tags:
- properties
description: Lists all audience exports for a property. This method can be used for you to find
and reuse existing audience exports rather than creating unnecessary new audience exports. The
same audience can have multiple audience exports that represent the export of users that were
in an audience on different days. See [Creating an Audience Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics)
for an introduction to Audience Exports with examples. Audience Export APIs have some methods
at alpha and other methods at beta stability. The intention is to advance methods to beta stability
after some feedback and adoption. To give your feedback on this API, complete the [Google Analytics
Audience Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
parameters:
- name: pageSize
in: query
required: false
schema:
type: integer
format: int32
description: Optional. The maximum number of audience exports to return. The service may return
fewer than this value. If unspecified, at most 200 audience exports will be returned. The maximum
value is 1000 (higher values will be coerced to the maximum).
- name: parent
in: query
required: true
schema:
type: string
pattern: ^properties/[^/]+$
description: 'Required. All audience exports for this property will be listed in the response.
Format: `properties/{property}`'
- name: pageToken
in: query
required: false
schema:
type: string
description: Optional. A page token, received from a previous `ListAudienceExports` call. Provide
this to retrieve the subsequent page. When paginating, all other parameters provided to `ListAudienceExports`
must match the call that provided the page token.
- name: propertiesId
in: path
required: true
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/ListAudienceExportsResponse'
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/GoogleRpcStatus'
security:
- OAuth2:
- analytics
- analytics.readonly
- BearerAuth: []
/v1beta/properties/{propertiesId}/audienceExports/{audienceExportsId}:
get:
operationId: properties_audienceExports_get
summary: Gets configuration metadata about a specific audience export
tags:
- properties
description: Gets configuration metadata about a specific audience export. This method can be used
to understand an audience export after it has been created. See [Creating an Audience Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics)
for an introduction to Audience Exports with examples. Audience Export APIs have some methods
at alpha and other methods at beta stability. The intention is to advance methods to beta stability
after some feedback and adoption. To give your feedback on this API, complete the [Google Analytics
Audience Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
parameters:
- name: name
in: query
required: true
schema:
type: string
pattern: ^properties/[^/]+/audienceExports/[^/]+$
description: 'Required. The audience export resource name. Format: `properties/{property}/audienceExports/{audience_export}`'
- name: audienceExportsId
in: path
required: true
schema:
type: string
- name: propertiesId
in: path
required: true
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/AudienceExport'
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/GoogleRpcStatus'
security:
- OAuth2:
- analytics
- analytics.readonly
- BearerAuth: []
/v1beta/properties/{propertiesId}/audienceExports/{audienceExportsId}:query:
post:
operationId: properties_audienceExports_query
summary: Retrieves an audience export of users
tags:
- properties
description: Retrieves an audience export of users. After creating an audience, the users are not
immediately available for exporting. First, a request to `CreateAudienceExport` is necessary to
create an audience export of users, and then second, this method is used to retrieve the users
in the audience export. See [Creating an Audience Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics)
for an introduction to Audience Exports with examples. Audiences in Google Analytics 4 allow you
to segment your users in the ways that are important to your business. To learn more, see https://support.google.com/analytics/answer/9267572.
Audience Export APIs have some methods at alpha and other methods at beta stability. The intention
is to advance methods to beta stability after some feedback and adoption. To give your feedback
on this API, complete the [Google Analytics Audience Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA)
form.
parameters:
- name: name
in: query
required: true
schema:
type: string
pattern: ^properties/[^/]+/audienceExports/[^/]+$
description: 'Required. The name of the audience export to retrieve users from. Format: `properties/{property}/audienceExports/{audience_export}`'
- name: audienceExportsId
in: path
required: true
schema:
type: string
- name: propertiesId
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/QueryAudienceExportRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/QueryAudienceExportResponse'
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/GoogleRpcStatus'
security:
- OAuth2:
- analytics
- analytics.readonly
- BearerAuth: []
components:
schemas:
RunRealtimeReportRequest:
description: The request to generate a realtime report.
type: object
properties:
returnPropertyQuota:
description: Toggles whether to return the current state of this Google Analytics property's
Realtime quota. Quota is returned in [PropertyQuota](#PropertyQuota).
type: boolean
limit:
description: The number of rows to return. If unspecified, 10,000 rows are returned. The API
returns a maximum of 250,000 rows per request, no matter how many you ask for. `limit` must
be positive. The API can also return fewer rows than the requested `limit`, if there aren't
as many dimension values as the `limit`. For instance, there are fewer than 300 possible values
for the dimension `country`, so when reporting on only `country`, you can't get more than
300 rows, even if you set `limit` to a higher value.
type: string
format: int64
dimensionFilter:
description: The filter clause of dimensions. Metrics cannot be used in this filter.
$ref: '#/components/schemas/FilterExpression'
metrics:
items:
$ref: '#/components/schemas/Metric'
description: The metrics requested and displayed.
type: array
minuteRanges:
description: The minute ranges of event data to read. If unspecified, one minute range for the
last 30 minutes will be used. If multiple minute ranges are requested, each response row will
contain a zero based minute range index. If two minute ranges overlap, the event data for
the overlapping minutes is included in the response rows for both minute ranges.
type: array
items:
$ref: '#/components/schemas/MinuteRange'
metricAggregations:
description: Aggregation of metrics. Aggregated metric values will be shown in rows where the
dimension_values are set to "RESERVED_(MetricAggregation)".
type: array
items:
x-enumDescriptions:
- Unspecified operator.
- SUM operator.
- Minimum operator.
- Maximum operator.
- Count operator.
enum:
- METRIC_AGGREGATION_UNSPECIFIED
- TOTAL
- MINIMUM
- MAXIMUM
- COUNT
type: string
metricFilter:
description: The filter clause of metrics. Applied at post aggregation phase, similar to SQL
having-clause. Dimensions cannot be used in this filter.
$ref: '#/components/schemas/FilterExpression'
orderBys:
description: Specifies how rows are ordered in the response.
type: array
items:
$ref: '#/components/schemas/OrderBy'
dimensions:
description: The dimensions requested and displayed.
type: array
items:
$ref: '#/components/schemas/Dimension'
RunRealtimeReportResponse:
properties:
metricHeaders:
description: Describes metric columns. The number of MetricHeaders and ordering of MetricHeaders
matches the metrics present in rows.
type: array
items:
$ref: '#/components/schemas/MetricHeader'
rows:
description: Rows of dimension value combinations and metric values in the report.
type: array
items:
$ref: '#/components/schemas/Row'
totals:
items:
$ref: '#/components/schemas/Row'
description: If requested, the totaled values of metrics.
type: array
minimums:
description: If requested, the minimum values of metrics.
type: array
items:
$ref: '#/components/schemas/Row'
rowCount:
description: The total number of rows in the query result. `rowCount` is independent of the
number of rows returned in the response and the `limit` request parameter. For example if
a query returns 175 rows and includes `limit` of 50 in the API request, the response will
contain `rowCount` of 175 but only 50 rows.
type: integer
format: int32
propertyQuota:
description: This Google Analytics property's Realtime quota state including this request.
$ref: '#/components/schemas/PropertyQuota'
maximums:
description: If requested, the maximum values of metrics.
type: array
items:
$ref: '#/components/schemas/Row'
dimensionHeaders:
description: Describes dimension columns. The number of DimensionHeaders and ordering of DimensionHeaders
matches the dimensions present in rows.
type: array
items:
$ref: '#/components/schemas/DimensionHeader'
kind:
description: Identifies what kind of resource this message is. This `kind` is always the fixed
string "analyticsData#runRealtimeReport". Useful to distinguish between response types in
JSON.
type: string
description: The response realtime report table corresponding to a request.
type: object
EmptyFilter:
description: Filter for empty values.
type: object
properties: {}
DimensionValue:
description: The value of a dimension.
type: object
properties:
value:
description: Value as a string if the dimension type is a string.
type: string
AudienceExport:
properties:
dimensions:
description: Required. The dimensions requested and displayed in the query response.
type: array
items:
$ref: '#/components/schemas/V1betaAudienceDimension'
percentageCompleted:
description: Output only. The percentage completed for this audience export ranging between
0 to 100.
type: number
format: double
name:
description: 'Output only. Identifier. The audience export resource name assigned during creation.
This resource name identifies this `AudienceExport`. Format: `properties/{property}/audienceExports/{audience_export}`'
type: string
creationQuotaTokensCharged:
description: Output only. The total quota tokens charged during creation of the AudienceExport.
Because this token count is based on activity from the `CREATING` state, this tokens charged
will be fixed once an AudienceExport enters the `ACTIVE` or `FAILED` states.
type: integer
format: int32
rowCount:
description: Output only. The total number of rows in the AudienceExport result.
type: integer
format: int32
beginCreatingTime:
description: Output only. The time when CreateAudienceExport was called and the AudienceExport
began the `CREATING` state.
type: string
format: google-datetime
audienceDisplayName:
description: Output only. The descriptive display name for this audience. For example, "Purchasers".
type: string
audience:
description: 'Required. The audience resource name. This resource name identifies the audience
being listed and is shared between the Analytics Data & Admin APIs. Format: `properties/{property}/audiences/{audience}`'
type: string
state:
description: Output only. The current state for this AudienceExport.
type: string
enum:
- STATE_UNSPECIFIED
- CREATING
- ACTIVE
# --- truncated at 32 KB (109 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/google-analytics-4/refs/heads/main/openapi/google-analytics-4-data-v1beta-openapi.yml