AI-generated Key Takeaways
- 
          Uploads an attachment to a Google Chat space, supporting files up to 200 MB. 
- 
          Uses an HTTP POST request to a specific URI with the space ID as a path parameter. 
- 
          Requires a JSON request body specifying the filename of the attachment. 
- 
          The response includes an attachmentDataRefobject referencing the uploaded file.
- 
          Requires specific authorization scopes for user authentication. 
Uploads an attachment. For an example, see Upload media as a file attachment.
Requires user authentication with one of the following authorization 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.
HTTP request
- Upload URI, for media upload requests:POST https://chat.googleapis.com/upload/v1/{parent=spaces/*}/attachments:upload
The URL uses gRPC Transcoding syntax.
Path parameters
| Parameters | |
|---|---|
| parent | 
 Required. Resource name of the Chat space in which the attachment is uploaded. Format "spaces/{space}". | 
Request body
The request body contains data with the following structure:
| JSON representation | 
|---|
| { "filename": string } | 
| Fields | |
|---|---|
| filename | 
 Required. The filename of the attachment, including the file extension. | 
Response body
Response of uploading an attachment.
If successful, the response body contains data with the following structure:
| JSON representation | 
|---|
| {
  "attachmentDataRef": {
    object ( | 
| Fields | |
|---|---|
| attachmentDataRef | 
 Reference to the uploaded attachment. | 
Authorization scopes
Requires one of the following OAuth scopes:
- https://www.googleapis.com/auth/chat.import
- https://www.googleapis.com/auth/chat.messages.create
- https://www.googleapis.com/auth/chat.messages
For more information, see the Authorization guide.