List Google Workspace subscriptions

This page explains how to list Google Workspace subscriptions using the subscriptions.list() method.

When you call this method with user authentication, the method returns a list of subscriptions authorized by the user. When you use app authentication, the method can return a list that contains any subscription for the app.



  • Python 3.6 or greater
  • The pip package management tool
  • The latest Google client libraries for Python. To install or update them, run the following command in your command-line interface:
      pip3 install --upgrade google-api-python-client google-auth-oauthlib
  • A Google Workspace subscription. To create one, see Create a subscription.

  • Requires authentication. For user authentication, requires a scope that supports at least one of the event types for the subscription. To identify a scope, see Scopes by event type.

    Requires authentication:

    • For user authentication, requires a scope that supports at least one of the event types for the subscription. To identify a scope, see Scopes by event type.
    • For app authentication, requires the scope (Google Chat apps only).

List subscriptions authorized by a user

To list subscriptions, you must filter by at least one event type. You can also filter your query by one or more target resources. To learn about supported query filters, see the list() method documentation.

The following code sample returns an array of Subscription objects filtered by event type and target resource. When authenticated as a user, the method only returns a list of subscriptions that the user authorized the app to create.

To list subscriptions for a specified event type and target resource:


  1. In your working directory, create a file named and add the following code:

    """List subscriptions."""
    from google_auth_oauthlib.flow import InstalledAppFlow
    from googleapiclient.discovery import build
    # Specify required scopes.
    SCOPES = ['SCOPE']
    # Authenticate with Google Workspace and get user authentication.
    flow = InstalledAppFlow.from_client_secrets_file('client_secrets.json', SCOPES)
    CREDENTIALS = flow.run_local_server()
    # Call the Workspace Events API using the service endpoint.
    service = build(
    # Filter for event type (required).
    # Filter for target resource (optional).
    FILTER = f'event_types:"{EVENT_TYPE}" AND target_resource="{TARGET_RESOURCE}"'
    response = service.subscriptions().list(filter=FILTER).execute()

    Replace the following:

    • SCOPE: An OAuth scope that supports at least one event type from the subscription. For example, if your subscription receives events an updated Chat space,
    • EVENT_TYPE: An event type formatted according to the CloudEvents specification. For example, to filter for subscriptions that receive events about new memberships to a Google Chat space,
    • TARGET_RESOURCE: A target resource, formatted as its full resource name. For example, to filter by subscriptions for a Google Chat space, use // where spaces/SPACE_ID represents the name field for the Space resource.
  2. In your working directory, make sure you've stored your OAuth client ID credentials and named the file client_secrets.json. The code sample uses this JSON file to authenticate with Google Workspace and get user credentials. For instructions, see Create OAuth client ID credentials.

  3. To list subscriptions, run the following in your terminal:


The Google Workspace Events API returns a paginated array of Subscription objects that match the filter for your query.