spaces

PATCH /v1/spaces/{spacesId}

Changed on

Updates a space. For an example, see Update a space. If you're updating the displayName field and receive the error message ALREADY_EXISTS, try a different display name.. An existing space within the Google Workspace organization might already use this display name. Supports the following types of authentication: - App authentication with administrator approval and one of the following authorization scopes: - https://www.googleapis.com/auth/chat.app.spaces - User authentication with one of the following authorization scopes: - https://www.googleapis.com/auth/chat.spaces - https://www.googleapis.com/auth/chat.import (import mode spaces only) - User authentication grants administrator privileges when an administrator account authenticates, use_admin_access is true, and the following authorization scopes is used: - https://www.googleapis.com/auth/chat.admin.spaces App authentication has the following limitations: - To update either space.predefined_permission_settings or space.permission_settings, the app must be the space creator. - Updating the space.access_settings.audience is not supported for app authentication.

Request

  • Base URL
    https://chat.googleapis.com
  • URL
    https://chat.googleapis.com/v1/spaces/{spacesId}
  • Auth
    • OAuth 2 and OAuth 2
      Implicit: https://accounts.google.com/o/oauth2/auth
      Scopes: https://www.googleapis.com/auth/chat.admin.spaces
      Authorization code: https://accounts.google.com/o/oauth2/auth
      Token URL: https://accounts.google.com/o/oauth2/token scopes: https://www.googleapis.com/auth/chat.admin.spaces
    • or OAuth 2 and OAuth 2
      Implicit: https://accounts.google.com/o/oauth2/auth
      Scopes: https://www.googleapis.com/auth/chat.app.spaces
      Authorization code: https://accounts.google.com/o/oauth2/auth
      Token URL: https://accounts.google.com/o/oauth2/token scopes: https://www.googleapis.com/auth/chat.app.spaces
    • or OAuth 2 and OAuth 2
      Implicit: https://accounts.google.com/o/oauth2/auth
      Scopes: https://www.googleapis.com/auth/chat.import
      Authorization code: https://accounts.google.com/o/oauth2/auth
      Token URL: https://accounts.google.com/o/oauth2/token scopes: https://www.googleapis.com/auth/chat.import
    • or OAuth 2 and OAuth 2
      Implicit: https://accounts.google.com/o/oauth2/auth
      Scopes: https://www.googleapis.com/auth/chat.spaces
      Authorization code: https://accounts.google.com/o/oauth2/auth
      Token URL: https://accounts.google.com/o/oauth2/token scopes: https://www.googleapis.com/auth/chat.spaces

Path parameters

spacesIdstring required

Query parameters

updateMaskstring google-fieldmask

Required. The updated field paths, comma separated if there are multiple. You can update the following fields for a space: space_details: Updates the space's description and guidelines. You must pass both description and guidelines in the update request as SpaceDetails. If you only want to update one of the fields, pass the existing value for the other field. display_name: Only supports updating the display name for spaces where spaceType field is SPACE. If you receive the error message ALREADY_EXISTS, try a different value. An existing space within the Google Workspace organization might already use this display name. space_type: Only supports changing a GROUP_CHAT space type to SPACE. Include display_name together with space_type in the update mask and ensure that the specified space has a non-empty display name and the SPACE space type. Including the space_type mask and the SPACE type in the specified space when updating the display name is optional if the existing space already has the SPACE type. Trying to update the space type in other ways results in an invalid argument error. space_type is not supported with useAdminAccess. space_history_state: Updates space history settings by turning history on or off for the space. Only supported if history settings are enabled for the Google Workspace organization. To update the space history state, you must omit all other field masks in your request. space_history_state is not supported with useAdminAccess. access_settings.audience: Updates the access setting of who can discover the space, join the space, and preview the messages in named space where spaceType field is SPACE. If the existing space has a target audience, you can remove the audience and restrict space access by omitting a value for this field mask. To update access settings for a space, the authenticating user must be a space manager and omit all other field masks in your request. You can't update this field if the space is in import mode. To learn more, see Make a space discoverable to specific users. access_settings.audience is not supported with useAdminAccess. access_settings.access_permission_settings: Updates the access permission settings of who can discover and join the space where spaceType field is SPACE. Principals allowed to join the space must also be allowed to discover it. To update access permission settings for a space, the authenticating user must be a space manager or assistant manager and omit all other field masks in the request. You can't update this field if the space is in import mode. To learn more, see Make a space discoverable to specific users. access_settings.access_permission_settings is not supported with useAdminAccess. The supported field masks include: - access_settings.access_permission_settings.discoverSpaceSetting - access_settings.access_permission_settings.joinSpaceSetting - access_settings.access_permission_settings.viewSpaceMembershipSetting permission_settings: Supports changing the permission settings of a space. When updating permission settings, you can only specify permissionSettings field masks; you cannot update other field masks at the same time. The supported field masks include: - permission_settings.manageMembersAndGroups - permission_settings.modifySpaceDetails - permission_settings.toggleHistory - permission_settings.useAtMentionAll - permission_settings.manageApps - permission_settings.manageWebhooks - permission_settings.replyMessages - permission_settings.viewSpaceMembership

useAdminAccessboolean

Optional. When true, the method runs using the user's Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the manage chat and spaces conversations privilege. Requires the chat.admin.spaces OAuth 2.0 scope. Some FieldMask values are not supported using admin access. For details, see the description of update_mask.

Request body

adminInstalledboolean

Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.

createTimestring google-datetime

Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when spaceType is GROUP_CHAT or SPACE.

customerstring

Optional. Immutable. The customer id of the domain of the space. Required only when creating a space with app authentication and SpaceType is SPACE, otherwise should not be set. In the format customers/{customer}, where customer is the id from the Admin SDK customer resource. Private apps can also use the customers/my_customer alias to create the space in the same Google Workspace organization as the app. This field isn't populated for direct messages (DMs) or when the space is created by non-Google Workspace users.

displayNamestring

Optional. The space's display name. Required when creating a space with a spaceType of SPACE. If you receive the error message ALREADY_EXISTS when creating a space or updating the displayName, try a different displayName. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.

externalUserAllowedboolean

Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.

importModeboolean

Optional. Whether this space is created in Import Mode as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in Import Moderequires user authentication.

importModeExpireTimestring google-datetime

Output only. The time when the space will be automatically deleted by the system if it remains in import mode. Each space created in import mode must exit this mode before this expire time using spaces.completeImport. This field is only populated for spaces that were created with import mode.

lastActiveTimestring google-datetime

Output only. Timestamp of the last message in the space.

namestring

Identifier. Resource name of the space. Format: spaces/{space} Where {space} represents the system-assigned ID for the space. You can obtain the space ID by calling the spaces.list() method or from the space URL. For example, if the space URL is https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA, the space ID is AAAAAAAAA.

predefinedPermissionSettings'PREDEFINED_PERMISSION_SETTINGS_UNSPECIFIED' | 'COLLABORATION_SPACE' | 'ANNOUNCEMENT_SPACE'

Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the PermissionSettings field. Setting predefined permission settings supports: - App authentication with administrator approval with the chat.app.spaces or chat.app.spaces.create scopes. - User authentication

singleUserBotDmboolean

Optional. Whether the space is a DM between a Chat app and a single human.

spaceHistoryState'HISTORY_STATE_UNSPECIFIED' | 'HISTORY_OFF' | 'HISTORY_ON'

Optional. The message history state for messages and threads in this space.

spaceThreadingState'SPACE_THREADING_STATE_UNSPECIFIED' | 'THREADED_MESSAGES' | 'GROUPED_MESSAGES' | 'UNTHREADED_MESSAGES'

Output only. The threading state in the Chat space.

spaceType'SPACE_TYPE_UNSPECIFIED' | 'SPACE' | 'GROUP_CHAT' | 'DIRECT_MESSAGE'

Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.

spaceUristring

Output only. The URI for a user to access the space.

threadedboolean

Output only. Deprecated: Use spaceThreadingState instead. Whether messages are threaded in this space.

type'TYPE_UNSPECIFIED' | 'ROOM' | 'DM'

Output only. Deprecated: Use space_type instead. The type of a space.

Response

Successful response

adminInstalledboolean

Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.

createTimestring google-datetime

Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when spaceType is GROUP_CHAT or SPACE.

customerstring

Optional. Immutable. The customer id of the domain of the space. Required only when creating a space with app authentication and SpaceType is SPACE, otherwise should not be set. In the format customers/{customer}, where customer is the id from the Admin SDK customer resource. Private apps can also use the customers/my_customer alias to create the space in the same Google Workspace organization as the app. This field isn't populated for direct messages (DMs) or when the space is created by non-Google Workspace users.

displayNamestring

Optional. The space's display name. Required when creating a space with a spaceType of SPACE. If you receive the error message ALREADY_EXISTS when creating a space or updating the displayName, try a different displayName. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.

externalUserAllowedboolean

Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.

importModeboolean

Optional. Whether this space is created in Import Mode as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in Import Moderequires user authentication.

importModeExpireTimestring google-datetime

Output only. The time when the space will be automatically deleted by the system if it remains in import mode. Each space created in import mode must exit this mode before this expire time using spaces.completeImport. This field is only populated for spaces that were created with import mode.

lastActiveTimestring google-datetime

Output only. Timestamp of the last message in the space.

namestring

Identifier. Resource name of the space. Format: spaces/{space} Where {space} represents the system-assigned ID for the space. You can obtain the space ID by calling the spaces.list() method or from the space URL. For example, if the space URL is https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA, the space ID is AAAAAAAAA.

predefinedPermissionSettings'PREDEFINED_PERMISSION_SETTINGS_UNSPECIFIED' | 'COLLABORATION_SPACE' | 'ANNOUNCEMENT_SPACE'

Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the PermissionSettings field. Setting predefined permission settings supports: - App authentication with administrator approval with the chat.app.spaces or chat.app.spaces.create scopes. - User authentication

singleUserBotDmboolean

Optional. Whether the space is a DM between a Chat app and a single human.

spaceHistoryState'HISTORY_STATE_UNSPECIFIED' | 'HISTORY_OFF' | 'HISTORY_ON'

Optional. The message history state for messages and threads in this space.

spaceThreadingState'SPACE_THREADING_STATE_UNSPECIFIED' | 'THREADED_MESSAGES' | 'GROUPED_MESSAGES' | 'UNTHREADED_MESSAGES'

Output only. The threading state in the Chat space.

spaceType'SPACE_TYPE_UNSPECIFIED' | 'SPACE' | 'GROUP_CHAT' | 'DIRECT_MESSAGE'

Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.

spaceUristring

Output only. The URI for a user to access the space.

threadedboolean

Output only. Deprecated: Use spaceThreadingState instead. Whether messages are threaded in this space.

type'TYPE_UNSPECIFIED' | 'ROOM' | 'DM'

Output only. Deprecated: Use space_type instead. The type of a space.

Changes

    • info

      the security scope https://www.googleapis.com/auth/chat.admin.spaces was added to the endpoint's security scheme Oauth2

    • info

      the security scope https://www.googleapis.com/auth/chat.admin.spaces was added to the endpoint's security scheme Oauth2c

    • info

      the security scope https://www.googleapis.com/auth/chat.spaces was removed from the endpoint's security scheme Oauth2

    • info

      the security scope https://www.googleapis.com/auth/chat.spaces was removed from the endpoint's security scheme Oauth2c