v1

latestOpenAPI 3.0.0Creative Commons Attribution 3.02026-07-13112665.9 KB
subscriptions

Creates a Google Workspace subscription. To learn how to use this method, see Create a Google Workspace subscription. For a subscription on a Chat target resource, you can create a subscription as: - A Chat app by specifying an authorization scope that begins with chat.app and getting one-time administrator approval. To learn more, see Authorize as a Chat app with administrator approval. - A user by specifying an authorization scope that doesn't include app in its name. To learn more, see Authorize as a Chat user.

post/v1/subscriptions

Query parameters

validateOnlyboolean

Optional. If set to true, validates and previews the request, but doesn't create the subscription.

Request body

uidstring

Output only. System-assigned unique identifier for the subscription.

updateTimestring google-datetime

Output only. The last time that the subscription is updated.

state'STATE_UNSPECIFIED' | 'ACTIVE' | 'SUSPENDED' | 'DELETED'

Output only. The state of the subscription. Determines whether the subscription can receive events and deliver them to the notification endpoint.

ttlstring google-duration

Input only. The time-to-live (TTL) or duration for the subscription. If unspecified or set to 0, uses the maximum possible duration.

targetResourcestring

Required. Immutable. The Google Workspace resource that's monitored for events, formatted as the full resource name. To learn about target resources and the events that they support, see Supported 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 ALREADY_EXISTS error.

namestring

Identifier. Resource name of the subscription. Format: subscriptions/{subscription}

eventTypesstring[]

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, see Supported Google Workspace events. By default, you also receive events about the lifecycle 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 400 Bad Request status code.

etagstring

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.

userAuthoritystring

Output only. The user who authorized the creation of the subscription. The user must be able to view the target_resource. For Google Workspace users, the {user} value is the user.id field from the Directory API. Format: users/{user}

createTimestring google-datetime

Output only. The time when the subscription is created.

expireTimestring google-datetime

Non-empty default. The timestamp in UTC when the subscription expires. Always displayed on output, regardless of what was used on input.

authoritystring

Output only. The user who authorized the creation of the subscription. When a user authorizes the subscription, this field and the user_authority field have the same value and the format is: Format: users/{user} For Google Workspace users, the {user} value is the user.id field from the Directory API. When a Chat app authorizes the subscription, only service_account_authority field populates and this field is empty.

serviceAccountAuthoritystring

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 created this subscription. Format: projects/{project_id}/serviceAccounts/{service_account_id}

reconcilingboolean

Output only. If true, the subscription is in the process of being updated.

suspensionReason'ERROR_TYPE_UNSPECIFIED' | 'USER_SCOPE_REVOKED' | 'APP_SCOPE_REVOKED' | 'RESOURCE_DELETED' | 'USER_AUTHORIZATION_FAILURE' | 'APP_AUTHORIZATION_FAILURE' | 'ENDPOINT_PERMISSION_DENIED' | 'ENDPOINT_NOT_FOUND' | 'ENDPOINT_RESOURCE_EXHAUSTED' | 'OTHER'

Output only. The error that suspended the subscription. To reactivate the subscription, resolve the error and call the ReactivateSubscription method.

Response

Successful response