https://www.googleapis.com/auth/chat.import (somente espaços do modo de importação)
Ao autenticar como um app, o campo space.customer precisa ser definido na solicitação.
Ao autenticar como um app, o app do Chat é adicionado como participante do espaço. No entanto, ao contrário da autenticação humana, o app do Chat não é adicionado como administrador do espaço. Por padrão, todos os participantes podem remover o app Chat do espaço. Para permitir que apenas os administradores do espaço removam o app, defina space.permission_settings.manage_apps como managersAllowed.
A assinatura do espaço no momento da criação depende de onde ele foi criado: Import mode:
Modo de importação:nenhum participante é criado.
Todos os outros modos:o usuário que faz a chamada é adicionado como participante. Isso é:
O próprio app ao usar a autenticação de app.
O usuário humano ao usar a autenticação de usuário.
Se você receber a mensagem de erro ALREADY_EXISTS ao criar um espaço, tente usar outro displayName. Um espaço na organização do Google Workspace já pode usar esse nome de exibição.
Solicitação HTTP
POST https://chat.googleapis.com/v1/spaces
Opcional. Um identificador exclusivo para esta solicitação. Recomendamos um UUID aleatório. Especificar um ID de solicitação existente retorna o espaço criado com esse ID em vez de criar um novo. Especificar um ID de solicitação existente do mesmo app do Chat com um usuário autenticado diferente retorna um erro.
Corpo da solicitação
O corpo da solicitação contém uma instância de Space.
Corpo da resposta
Se a solicitação for bem-sucedida, o corpo da resposta incluirá uma instância de Space.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Não contém as informações de que eu preciso","missingTheInformationINeed","thumb-down"],["Muito complicado / etapas demais","tooComplicatedTooManySteps","thumb-down"],["Desatualizado","outOfDate","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Problema com as amostras / o código","samplesCodeIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-07-29 UTC."],[[["\u003cp\u003eCreates a space in Google Chat, which can be a named space or a group chat, supporting app and user authentication.\u003c/p\u003e\n"],["\u003cp\u003eWhen using app authentication, the space.customer field is required and no members are added in Import mode; otherwise, the calling user becomes a member.\u003c/p\u003e\n"],["\u003cp\u003eUses the \u003ccode\u003ePOST https://chat.googleapis.com/v1/spaces\u003c/code\u003e HTTP request to create a space and requires specific OAuth scopes for authorization.\u003c/p\u003e\n"],["\u003cp\u003eThe request body should contain a Space object and the response, if successful, will contain the newly created Space object.\u003c/p\u003e\n"],["\u003cp\u003eIf the displayName already exists, an \u003ccode\u003eALREADY_EXISTS\u003c/code\u003e error will be returned, suggesting to try a different displayName.\u003c/p\u003e\n"]]],["This content outlines how to create a space using the Chat API. Key actions include sending a `POST` request to `https://chat.googleapis.com/v1/spaces`. The request may include a unique `requestId` and must contain a `Space` instance in the body. Authentication can be app-based or user-based, requiring specific OAuth scopes. Space membership varies by import mode; no members in import mode, otherwise the caller is added. Response will contain new space information.\n"],null,["# Method: spaces.create\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nCreates a space. Can be used to create a named space, or a group chat in `Import mode`. For an example, see [Create a space](https://developers.google.com/workspace/chat/create-spaces).\n\nSupports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize):\n\n- [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) and one of the following authorization scopes:\n\n - `https://www.googleapis.com/auth/chat.app.spaces.create`\n - `https://www.googleapis.com/auth/chat.app.spaces`\n- [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:\n\n - `https://www.googleapis.com/auth/chat.spaces.create`\n - `https://www.googleapis.com/auth/chat.spaces`\n - `https://www.googleapis.com/auth/chat.import` (import mode spaces only)\n\nWhen authenticating as an app, the `space.customer` field must be set in the request.\n\nWhen authenticating as an app, the Chat app is added as a member of the space. However, unlike human authentication, the Chat app is not added as a space manager. By default, the Chat app can be removed from the space by all space members. To allow only space managers to remove the app from a space, set `space.permission_settings.manage_apps` to `managersAllowed`.\n\nSpace membership upon creation depends on whether the space is created in `Import mode`:\n\n- **Import mode:** No members are created.\n- **All other modes:** The calling user is added as a member. This is:\n - The app itself when using app authentication.\n - The human user when using user authentication.\n\nIf you receive the error message `ALREADY_EXISTS` when creating a space, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name.\n\n### HTTP request\n\n`POST https://chat.googleapis.com/v1/spaces`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `requestId` | `string` Optional. A unique identifier for this request. A random UUID is recommended. Specifying an existing request ID returns the space created with that ID instead of creating a new space. Specifying an existing request ID from the same Chat app with a different authenticated user returns an error. |\n\n### Request body\n\nThe request body contains an instance of [Space](/workspace/chat/api/reference/rest/v1/spaces#Space).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Space](/workspace/chat/api/reference/rest/v1/spaces#Space).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/chat.app.spaces.create`\n- `https://www.googleapis.com/auth/chat.app.spaces`\n- `https://www.googleapis.com/auth/chat.import`\n- `https://www.googleapis.com/auth/chat.spaces`\n- `https://www.googleapis.com/auth/chat.spaces.create`\n\nFor more information, see the [Authorization guide](/workspace/chat/authenticate-authorize)."]]