REST Resource: spaces

Resource: Space

A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.

JSON representation
{
  "name": string,
  "type": enum (Type),
  "spaceType": enum (SpaceType),
  "singleUserBotDm": boolean,
  "threaded": boolean,
  "displayName": string,
  "externalUserAllowed": boolean,
  "spaceThreadingState": enum (SpaceThreadingState),
  "spaceDetails": {
    object (SpaceDetails)
  },
  "spaceHistoryState": enum (HistoryState),
  "importMode": boolean,
  "createTime": string,
  "lastActiveTime": string,
  "adminInstalled": boolean,
  "membershipCount": {
    object (MembershipCount)
  },
  "accessSettings": {
    object (AccessSettings)
  },
  "spaceUri": string,

  // Union field space_permission_settings can be only one of the following:
  "predefinedPermissionSettings": enum (PredefinedPermissionSettings),
  "permissionSettings": {
    object (PermissionSettings)
  }
  // End of list of possible types for union field space_permission_settings.
}
Fields
name

string

Resource name of the space.

Format: spaces/{space}

type
(deprecated)

enum (Type)

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

spaceType

enum (SpaceType)

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

singleUserBotDm

boolean

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

threaded
(deprecated)

boolean

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

displayName

string

The space's display name. Required when creating a 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.

externalUserAllowed

boolean

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.

  • The space is used to import data to Google Chat because import mode spaces must only permit members from the same Google Workspace organization. However, as part of the Google Workspace Developer Preview Program, import mode spaces can permit any Google Chat user so this field can then be set for import mode spaces.

For existing spaces, this field is output only.

spaceThreadingState

enum (SpaceThreadingState)

Output only. The threading state in the Chat space.

spaceDetails

object (SpaceDetails)

Details about the space including description and rules.

spaceHistoryState

enum (HistoryState)

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

importMode

boolean

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.

createTime

string (Timestamp format)

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.

lastActiveTime

string (Timestamp format)

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

adminInstalled

boolean

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.

membershipCount

object (MembershipCount)

Output only. The count of joined memberships grouped by member type. Populated when the spaceType is SPACE, DIRECT_MESSAGE or GROUP_CHAT.

accessSettings

object (AccessSettings)

Optional. Specifies the access setting of the space. Only populated when the spaceType is SPACE.

spaceUri

string

Output only. The URI of the space.

Union field space_permission_settings. Represents the permission settings of a space. Only populated when the space_type is SPACE. space_permission_settings can be only one of the following:
predefinedPermissionSettings

enum (PredefinedPermissionSettings)

Optional. Input only. Space permission settings. Input for creating a space, a collaboration space is created if this field is not set. After you create the space, settings are populated in the PermissionSettings field.

permissionSettings

object (PermissionSettings)

Optional. Exact permission settings which can be set to update the space. Input for updating a space. Otherwise, output only. For space creation, use predefinedPermissionSettings instead.

Type

Deprecated: Use SpaceType instead.

Enums
TYPE_UNSPECIFIED Reserved.
ROOM Conversations between two or more humans.
DM 1:1 Direct Message between a human and a Chat app, where all messages are flat. Note that this doesn't include direct messages between two humans.

SpaceType

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

Enums
SPACE_TYPE_UNSPECIFIED Reserved.
SPACE A place where people send messages, share files, and collaborate. A SPACE can include Chat apps.
GROUP_CHAT Group conversations between 3 or more people. A GROUP_CHAT can include Chat apps.
DIRECT_MESSAGE 1:1 messages between two humans or a human and a Chat app.

SpaceThreadingState

Specifies the type of threading state in the Chat space.

Enums
SPACE_THREADING_STATE_UNSPECIFIED Reserved.
THREADED_MESSAGES Named spaces that support message threads. When users respond to a message, they can reply in-thread, which keeps their response in the context of the original message.
GROUPED_MESSAGES Named spaces where the conversation is organized by topic. Topics and their replies are grouped together.
UNTHREADED_MESSAGES Direct messages (DMs) between two people and group conversations between 3 or more people.

SpaceDetails

Details about the space including description and rules.

JSON representation
{
  "description": string,
  "guidelines": string
}
Fields
description

string

Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants.

Supports up to 150 characters.

guidelines

string

Optional. The space's rules, expectations, and etiquette.

Supports up to 5,000 characters.

HistoryState

The history state for messages and spaces. Specifies how long messages and conversation threads are kept after creation.

Enums
HISTORY_STATE_UNSPECIFIED Default value. Do not use.
HISTORY_OFF History off. Messages and threads are kept for 24 hours.
HISTORY_ON History on. The organization's Vault retention rules specify for how long messages and threads are kept.

MembershipCount

Represents the count of memberships of a space, grouped into categories.

JSON representation
{
  "joinedDirectHumanUserCount": integer,
  "joinedGroupCount": integer
}
Fields
joinedDirectHumanUserCount

integer

Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.

joinedGroupCount

integer

Count of all groups that have directly joined the space.

AccessSettings

Represents the access setting of the space.

JSON representation
{
  "accessState": enum (AccessState),
  "audience": string
}
Fields
accessState

enum (AccessState)

Output only. Indicates the access state of the space.

audience

string

Optional. The resource name of the target audience who can access the space. Set this field to a valid target audience ID to make the space discoverable or use the audiences/default alias to set the space with the default access setting in Admin Console, to learn more, see Make a space discoverable to a target audience. Unset this field to make the space restricted. Only populated when the space is discoverable. Format: audiences/{audience}, audiences/default can be used as the alias of the default Chat Sharing setting.

AccessState

Represents the access state of the Space.

Enums
ACCESS_STATE_UNSPECIFIED Access state is unknown or not supported in this API.
PRIVATE Space is discoverable by added or invited members or groups.
DISCOVERABLE Space is discoverable by the selected target audience, as well as added or invited members or groups.

PredefinedPermissionSettings

The space permission settings that you can specify when creating a named space. More settings might be added in the future. For details about permission settings for named spaces, see Learn about spaces.

Enums
PREDEFINED_PERMISSION_SETTINGS_UNSPECIFIED Unspecified. Don't use.
COLLABORATION_SPACE Setting to make the space a collaboration space where all members can post messages.
ANNOUNCEMENT_SPACE Setting to make the space an announcement space where only space managers can post messages.

PermissionSettings

Permission settings for a named space. To set permission settings when creating a space, specify the PredefinedPermissionSettings field in your request.

JSON representation
{
  "manageMembersAndGroups": {
    object (PermissionSetting)
  },
  "modifySpaceDetails": {
    object (PermissionSetting)
  },
  "toggleHistory": {
    object (PermissionSetting)
  },
  "useAtMentionAll": {
    object (PermissionSetting)
  },
  "manageApps": {
    object (PermissionSetting)
  },
  "manageWebhooks": {
    object (PermissionSetting)
  },
  "postMessages": {
    object (PermissionSetting)
  },
  "replyMessages": {
    object (PermissionSetting)
  }
}
Fields
manageMembersAndGroups

object (PermissionSetting)

Setting for managing members and groups in a space.

modifySpaceDetails

object (PermissionSetting)

Setting for updating space name, avatar, description and guidelines.

toggleHistory

object (PermissionSetting)

Setting for toggling space history on and off.

useAtMentionAll

object (PermissionSetting)

Setting for using @all in a space.

manageApps

object (PermissionSetting)

Setting for managing apps in a space.

manageWebhooks

object (PermissionSetting)

Setting for managing webhooks in a space.

postMessages

object (PermissionSetting)

Output only. Setting for posting messages in a space.

replyMessages

object (PermissionSetting)

Setting for replying to messages in a space.

PermissionSetting

Represents a space permission setting.

JSON representation
{
  "managersAllowed": boolean,
  "membersAllowed": boolean
}
Fields
managersAllowed

boolean

Whether spaces managers have this permission.

membersAllowed

boolean

Whether non-manager members have this permission.

Methods

completeImport

Completes the import process for the specified space and makes it visible to users.

create

Creates a named space.

delete

Deletes a named space.

findDirectMessage

Returns the existing direct message with the specified user.

get

Returns details about a space.

list

Lists spaces the caller is a member of.

patch

Updates a space.

setup

Creates a space and adds specified users to it.