---
title: "POST /v1/spaces/{spacesId}/attachments:upload"
method: POST
path: "/v1/spaces/{spacesId}/attachments:upload"
tags: ["media"]
---

# POST /v1/spaces/{spacesId}/attachments:upload

`POST /v1/spaces/{spacesId}/attachments:upload`

## Request

- Base URL: `https://chat.googleapis.com`
- URL: `https://chat.googleapis.com/v1/spaces/{spacesId}/attachments:upload`
- Auth: one of:
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/chat.bot`
    - 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.bot`
  - 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`
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/chat.messages`
    - 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.messages`
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/chat.messages.create`
    - 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.messages.create`

Uploads an attachment. For an example, see [Upload media as a file attachment](https://developers.google.com/workspace/chat/upload-media-attachments). Requires user [authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following [authorization scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): - `https://www.googleapis.com/auth/chat.messages.create` - `https://www.googleapis.com/auth/chat.messages` - `https://www.googleapis.com/auth/chat.import` (import mode spaces only) You can upload attachments up to 200 MB. Certain file types aren't supported. For details, see [File types blocked by Google Chat](https://support.google.com/chat/answer/7651457?&co=GENIE.Platform%3DDesktop#File%20types%20blocked%20in%20Google%20Chat).

## Path parameters

- `spacesId` string, required

## Request body

- UploadAttachmentRequest: Request to upload an attachment.
  - `filename` string: Required. The filename of the attachment, including the file extension.

## Response `200`

Successful response

- UploadAttachmentResponse: Response of uploading an attachment.
  - `attachmentDataRef` AttachmentDataRef: A reference to the attachment data.
    - `attachmentUploadToken` string: Optional. Opaque token containing a reference to an uploaded attachment. Treated by clients as an opaque string and used to create or update Chat messages with attachments.
    - `resourceName` string: Optional. The resource name of the attachment data. This field is used with the media API to download the attachment data.

## Changes

- **2026-11-02** `ffee5784d4b1`: 4 info
  - the security scope `https://www.googleapis.com/auth/chat.bot` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/chat.bot` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/chat.messages.create` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/chat.messages.create` was removed from the endpoint's security scheme `Oauth2c`

[Operation history](https://skmtc.dev/google/apis/chat/changes/v1/spaces/:spacesId/attachments:upload/post.md)

---

[API](https://skmtc.dev/google/apis/chat.md) - [All operations](https://skmtc.dev/google/apis/chat/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/chat/revisions/ffee5784d4b1?raw)
