[null,null,["最后更新时间 (UTC):2025-08-29。"],[[["\u003cp\u003eGoogle Workspace admins can manage Chat spaces using the Admin console Space Management Tool or the Google Chat API.\u003c/p\u003e\n"],["\u003cp\u003eThe Chat API enables admins to automate tasks like adding/removing space members, updating spaces, and searching for spaces.\u003c/p\u003e\n"],["\u003cp\u003eAdmins can authenticate using administrator privileges or domain-wide delegation when using the Chat API for management.\u003c/p\u003e\n"],["\u003cp\u003eUse cases include onboarding/offboarding employees, promoting space managers, and auditing inactive spaces.\u003c/p\u003e\n"],["\u003cp\u003eDetailed API methods and scenarios are provided to help admins effectively manage Google Chat spaces within their organization.\u003c/p\u003e\n"]]],["Google Workspace administrators can use the Chat API to manage spaces and automate tasks. Key actions include: searching, creating, updating, and deleting spaces; listing, adding, and removing space members; and managing member roles. Authentication can occur via administrator privileges or domain-wide delegation. The API allows for auditing spaces, finding inactive spaces, exporting space lists based on criteria, finding space members and managers. The `spaces.search()`, `spaces.members.list()`, and other specific API methods are used to achieve these goals.\n"],null,["# Manage Google Chat spaces as a Google Workspace administrator\n\nThis page provides an overview of how Google Workspace administrators can use\nthe Google Chat API to manage Google Chat spaces across their organization.\n\nTo manage Chat spaces, Google Workspace administrators\ncan use the [Space Management Tool](https://support.google.com/a/answer/13979728?sjid=5354357030206378629-NC)\nin the Google Admin console or call the Google Chat API. By\nusing the Chat API, administrators can create Google Chat apps that\nmanage spaces at scale and automate their common or repeatable tasks.\n\nWhat administrators can do with the Chat API\n--------------------------------------------\n\nAn administrator can perform management tasks based on their\n[assigned administrator roles](https://support.google.com/a/answer/9807615).\n\nAs a Google Workspace administrator, you can perform a number of\nmanagement tasks with the Chat API, such as the following:\n\n- [Search](/workspace/chat/search-manage-admin) spaces based on specified criteria\n- [List members](/workspace/chat/list-members) of a space\n- [Add members](/workspace/chat/create-members) to and [remove members](/workspace/chat/delete-members) from a space\n- Get details about a [member](/workspace/chat/get-members) and a [space](/workspace/chat/get-spaces)\n- [Update](/workspace/chat/update-spaces) or [delete](/workspace/chat/delete-spaces) a space\n- [Update a user's membership](/workspace/chat/update-members)\n\nHow to authenticate and authorize as a Google Workspace adminstrator\n--------------------------------------------------------------------\n\nWhen using the\n[Chat API](/workspace/chat/api/reference/rest)\nfor management tasks, administrators can authenticate and authorize requests by\ninvoking [administrator privileges](/workspace/chat/authenticate-authorize-chat-user#admin-privileges)\nor configuring [domain-wide delegation](/workspace/chat/authenticate-authorize-chat-user#domain-wide-delegation)\nof authority for an application's service account.\n\nThe following table describes the ways administrators can authenticate when\nusing the Chat API.\n\n| User authentication | Who calls the API method | What users see in Chat |\n|---------------------------------------------------------------------------------------------------|------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Administrator privileges](/workspace/chat/authenticate-authorize-chat-user#admin-privileges) | Administrator with `useAdminAccess=true` | \"The organization's administrator performed \\[an action\\].\" For example, \"The organization's administrator changed Kiran B to space manager.\" It does not identify the administrator user's name or user ID or the name of the Chat app. |\n| [Domain-wide delegation](/workspace/chat/authenticate-authorize-chat-user#domain-wide-delegation) | Service account on behalf of a user | \"\\[User\\] performed \\[an action\\] via \\[app name\\].\" For example, \"Sasha T renamed the space to Release Project Discussion.\" The user who is being impersonated by the service is identified as having performed the action. |\n\n| **Note:** When a Chat user with administrator permissions authenticates using their [Chat user credentials](/workspace/chat/authenticate-authorize-chat-user) and does not set `useAdminAccess=true` for API requests, they *do not use their\n| administrator privileges*.\n\nUse the Chat API for your organization\n--------------------------------------\n\nThe examples in this section demonstrate how administrators use the\nChat API when managing their organization's spaces and members\nwith [administrator privileges](/workspace/chat/authenticate-authorize-chat-user#admin-privileges).\n\nThe following Chat API methods enable administrator privileges with\n`useAdminAccess=true`.\n\n- [`spaces.delete()`](/workspace/chat/api/reference/rest/v1/spaces/delete)\n- [`spaces.get()`](/workspace/chat/api/reference/rest/v1/spaces/get)\n- [`spaces.patch()`](/workspace/chat/api/reference/rest/v1/spaces/patch)\n- [`spaces.search()`](/workspace/chat/api/reference/rest/v1/spaces/search)\n- [`spaces.members.create()`](/workspace/chat/api/reference/rest/v1/spaces.members/create)\n- [`spaces.members.delete()`](/workspace/chat/api/reference/rest/v1/spaces.members/delete)\n- [`spaces.members.get()`](/workspace/chat/api/reference/rest/v1/spaces.members/get)\n- [`spaces.members.list()`](/workspace/chat/api/reference/rest/v1/spaces.members/list)\n- [`spaces.members.patch()`](/workspace/chat/api/reference/rest/v1/spaces.members/patch)\n\n### Manage users' space memberships\n\nThe following scenarios are ways that you, as a Google Workspace\nadministrator, can manage the space membership of users in your organization\nwith the Chat API.\n\n#### Add users to spaces\n\nUsing [`spaces.members.create()`](/workspace/chat/api/reference/rest/v1/spaces.members/create),\nadmins can add a user to any space in an organization.\n\nUsed in conjunction with [`spaces.search()`](/workspace/chat/api/reference/rest/v1/spaces/search),\nadmins can add a user to a set of spaces determined by their search query. This\ncan be useful when onboarding new employees to an organization; it allows\nadministrators to automate a routine process.\n\n#### Find users and remove them from spaces\n\nUsing [`spaces.members.get()`](/workspace/chat/api/reference/rest/v1/spaces.members/get),\nadmins can determine if a user (internal or external to the organization) is a\nmember of any space in the organization.\n\nUsed in conjunction with [`spaces.search()`](/workspace/chat/api/reference/rest/v1/spaces/search),\nadmins can find all spaces that the user is a member of and then remove them\nfrom the spaces with\n[`spaces.members.delete()`](/workspace/chat/api/reference/rest/v1/spaces.members/delete).\nThis can be useful when employees move teams within an organization or\noffboarding employees who are no longer with the organization; it allows\nadministrators to automate a routine process.\n\n#### Promote users to space manager\n\nUsing [`spaces.members.patch()`](/workspace/chat/api/reference/rest/v1/spaces.members/patch),\nadmins can promote members of a space from `ROLE_MEMBER` to `ROLE_MANAGER`.\nAdmins can also use `spaces.members.patch()` to move members from `ROLE_MANAGER`\nto `ROLE_MEMBER`.\n\nUsed in conjunction with [`spaces.search()`](/workspace/chat/api/reference/rest/v1/spaces/search),\nadmins can find spaces that don't have a manager and then promote an existing\nmember to `ROLE_MANAGER` with `spaces.members.patch()`.\n\n#### Find external members of a space\n\nUsing [`spaces.members.list()`](/workspace/chat/api/reference/rest/v1/spaces.members/list),\nadmins can retrieve a list of members in a space, retrieve the user profiles\nfrom the organization's People API or Directory API, and then filter\nthe results for those who are members of an external domain or organization.\nFor more information, see\n[How chat identifies users](/workspace/chat/identify-reference-users#how-chat-identifies).\n\n### Audit and manage spaces\n\nThe following scenarios are ways that you, as a Google Workspace\nadministrator, can audit and manage the spaces in your organization with the\nChat API.\n\n#### Find and delete inactive spaces\n\nUnused Chat spaces can take up valuable storage space and create\nclutter in the user interface. Admins can use\n[`spaces.search()`](/workspace/chat/api/reference/rest/v1/spaces/search)\nto find the inactive spaces and then\n[`spaces.delete()`](/workspace/chat/api/reference/rest/v1/spaces/delete)\nto delete them. For further guidance and a code sample, see\n[Find and delete inactive Chat spaces](/workspace/chat/search-manage-admin#find-and-delete-inactive-spaces).\n\n#### Audit spaces in the organization\n\nUsing [`spaces.search()`](/workspace/chat/api/reference/rest/v1/spaces/search),\nadmins can retrieve a list of all spaces in an organization with detailed\ninformation about each space's settings and metadata such as creation date,\nlast activity date, number of members, status of history setting, and ability\nto invite external guests.\n\n#### Export a list of spaces based on search criteria\n\nUsing [`spaces.search()`](/workspace/chat/api/reference/rest/v1/spaces/search),\nadmins can retrieve a list of spaces that meet criteria specified in the\n[`query`](/workspace/chat/api/reference/rest/v1/spaces/search#body.QUERY_PARAMETERS.query)\nand export the results to a CSV file for analysis.\n\n#### Find members of a space based on search criteria\n\nUsing [`spaces.members.list()`](/workspace/chat/api/reference/rest/v1/spaces.members/list),\nadmins can retrieve a list of members for any space in the organization and\nanalyze the results for specific criteria.\n\n#### Find managers of a space\n\nUsing [`spaces.members.list()`](/workspace/chat/api/reference/rest/v1/spaces.members/list),\nadmins can retrieve a list of members for a space that is filtered to\n`MembershipState=ROLE_MANAGER`.\n\nTo find all space managers in your organization, across all spaces, you can\nuse [`spaces.search()`](/workspace/chat/api/reference/rest/v1/spaces/search) to\nlist them all. Then for each space in the list, use `spaces.members.list` to\nretrieve the managers.\n\nRelated topics\n--------------\n\n- [Authenticate and authorize using administrator privileges](/workspace/chat/authenticate-authorize-chat-user#admin-privileges)\n- [Search and manage Google Chat spaces with the Google Chat API as a Google Workspace administrator](/workspace/chat/search-manage-admin)\n- [`spaces.search()` method](/workspace/chat/api/reference/rest/v1/spaces/search)"]]