REST Resource: subscriptions Stay organized with collections Save and categorize content based on your preferences.
Page Summary
A Subscription enables receiving events about Google Workspace resources, such as Google Chat messages or Drive files, delivered to a notification endpoint like a Pub/Sub topic.
You can configure payload options to control the data included in the event notifications, such as resource details or specific fields.
Subscriptions can be managed through various methods including creation, deletion, retrieval, listing, updating, and reactivation, providing flexibility in handling event streams.
Subscriptions have a defined state (active, suspended, deleted) and potential error types that can help in monitoring and troubleshooting event delivery.
The API offers developer preview access to manage and interact with Google Workspace subscriptions for receiving real-time event notifications.
Resource: Subscription
A subscription to receive events about a Google Workspace resource. To learn more about subscriptions, see theGoogle Workspace Events API overview.
| JSON representation |
|---|
{"name":string,"uid":string,"targetResource":string,"eventTypes":[string],"payloadOptions":{object ( |
| Fields | |
|---|---|
name |
Identifier. Resource name of the subscription. Format: |
uid |
Output only. System-assigned unique identifier for the subscription. |
targetResource |
Required. Immutable. The Google Workspace resource that's monitored for events, formatted as thefull resource name. To learn about target resources and the events that they support, seeSupported Google Workspace events. A user can only authorize your app to create one subscription for a given target resource. If your app tries to create another subscription with the same user credentials, the request returns an |
eventTypes[] |
Required. Unordered list. Input for creating a subscription. Otherwise, output only. One or more types of events to receive about the target resource. Formatted according to the CloudEvents specification. The supported event types depend on the target resource of your subscription. For details, seeSupported Google Workspace events. By default, you also receive events about thelifecycle of your subscription. You don't need to specify lifecycle events for this field. If you specify an event type that doesn't exist for the target resource, the request returns an HTTP |
payloadOptions |
Optional. Options about what data to include in the event payload. Only supported for Google Chat and Google Drive events. |
notificationEndpoint |
Required. Immutable. The endpoint where the subscription delivers events, such as a Pub/Sub topic. |
state |
Output only. The state of the subscription. Determines whether the subscription can receive events and deliver them to the notification endpoint. |
suspensionReason |
Output only. The error that suspended the subscription. To reactivate the subscription, resolve the error and call the |
authority |
Output only. The user who authorized the creation of the subscription. When a user authorizes the subscription, this field and the Format: For Google Workspace users, the When a Chat app authorizes the subscription, only |
createTime |
Output only. The time when the subscription is created. |
updateTime |
Output only. The last time that the subscription is updated. |
reconciling |
Output only. If |
etag |
Optional. This checksum is computed by the server based on the value of other fields, and might be sent on update requests to ensure the client has an up-to-date value before proceeding. |
Union fieldsubscription_options. Additional subscription options available to specific target resources for Google Workspace subscriptions.subscription_options can be only one of the following: | |
driveOptions |
Optional. Features that are supported only for subscriptions on Drive resources. |
Union fieldauthority_info. The identity that authorized the creation of the subscription.authority_info can be only one of the following: | |
userAuthority |
Output only. The user who authorized the creation of the subscription. The user must be able to view the For Google Workspace users, the Format: |
serviceAccountAuthority |
Output only. The service account that was used to authorize the creation of the subscription. This service account must be owned by the same Google Cloud project where you create this subscription. Format: |
Union field The maximum expiration time depends on whether your subscription includes resource data in event payloads (specified in the
After a subscription expires, it's deleted automatically. You receive lifecycle events to the To prevent a subscription from expiring, you can use the | |
expireTime |
Non-empty default. The timestamp in UTC when the subscription expires. Always displayed on output, regardless of what was used on input. |
ttl |
Input only. The time-to-live (TTL) or duration for the subscription. If unspecified or set to |
DriveOptions
Additional supported options for serving Drive events.
| JSON representation |
|---|
{"includeDescendants":boolean} |
| Fields | |
|---|---|
includeDescendants |
Optional. Immutable. For subscriptions to Google Drive events, whether to receive events about Drive files that are children of the target folder or shared drive.
For details, seeGoogle Drive event types. |
PayloadOptions
Options about what data to include in the event payload. Only supported for Google Chat and Google Drive events.
| JSON representation |
|---|
{"includeResource":boolean,"fieldMask":string} |
| Fields | |
|---|---|
includeResource |
Optional. Whether the event payload includes data about the resource that changed. For example, for an event where a Google Chat message was created, whether the payload contains data about the |
fieldMask |
Optional. If If you specify a field that doesn't exist for the resource, the system ignores the field. |
NotificationEndpoint
The endpoint where the subscription delivers events.
| JSON representation |
|---|
{// Union field |
| Fields | |
|---|---|
Union field
| |
pubsubTopic |
Immutable. The Pub/Sub topic that receives events for the subscription. Format: You must create the topic in the same Google Cloud project where you create this subscription. Note: The Google Workspace Events API usesordering keys for the benefit of sequential events. If the Cloud Pub/Sub topic has amessage storage policy configured to exclude the nearest Google Cloud region, publishing events with ordering keys will fail. When the topic receives events, the events are encoded as Pub/Sub messages. For details, see theGoogle Cloud Pub/Sub Protocol Binding for CloudEvents. |
State
Possible states for the subscription.
| Enums | |
|---|---|
STATE_UNSPECIFIED | Default value. This value is unused. |
ACTIVE | The subscription is active and can receive and deliver events to its notification endpoint. |
SUSPENDED | The subscription is unable to receive events due to an error. To identify the error, see the field. |
DELETED | The subscription is deleted. |
ErrorType
Possible errors for a subscription.
| Enums | |
|---|---|
ERROR_TYPE_UNSPECIFIED | Default value. This value is unused. |
USER_SCOPE_REVOKED | The authorizing user has revoked the grant of one or more OAuth scopes. To learn more about authorization for Google Workspace, seeConfigure the OAuth consent screen. |
APP_SCOPE_REVOKED | The domain administrator has revoked the grant of one or more OAuth scopes for the app.Developer Preview: Available as part of theGoogle Workspace Developer Preview Program, which grants early access to certain features. |
RESOURCE_DELETED | The target resource for the subscription no longer exists. |
USER_AUTHORIZATION_FAILURE | The user that authorized the creation of the subscription no longer has access to the subscription's target resource. |
APP_AUTHORIZATION_FAILURE | The app that authorized the creation of the subscription no longer has access to the subscription's target resource.Developer Preview: Available as part of theGoogle Workspace Developer Preview Program, which grants early access to certain features. |
ENDPOINT_PERMISSION_DENIED | The Google Workspace application doesn't have access to deliver events to your subscription's notification endpoint. |
ENDPOINT_NOT_FOUND | The subscription's notification endpoint doesn't exist, or the endpoint can't be found in the Google Cloud project where you created the subscription. |
ENDPOINT_RESOURCE_EXHAUSTED | The subscription's notification endpoint failed to receive events due to insufficient quota or reaching rate limiting. |
OTHER | An unidentified error has occurred. |
Methods | |
|---|---|
| Creates a Google Workspace subscription. |
| Deletes a Google Workspace subscription. |
| Gets details about a Google Workspace subscription. |
| Lists Google Workspace subscriptions. |
| Updates or renews a Google Workspace subscription. |
| Reactivates a suspended Google Workspace subscription. |
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-19 UTC.