Google Slides lets users collaborate by adding comments on slides and page elements.
This document shows how you can use the Google Slides API to programmatically read, create, reply to, update, or delete comments.
Read comments
When you use the
get method on the
presentations
resource to retrieve a presentation, comment threads and anchors are omitted by
default.
To include comments in the response, set the
commentsViewMode
query parameter to
COMMENTS_VIEW_MODE_INCLUDED.
Additionally, if the calling user has comments access on the file, then setting
the query parameter to COMMENTS_VIEW_MODE_DEFAULT_FOR_CURRENT_ACCESS also
returns comments.
Both the
comments
and
commentAnchors
fields are returned in the response.
The following code sample shows how to use a get request that retrieves
comment threads and their anchors from a presentation:
GET https://slides.googleapis.com/v1/presentations/PRESENTATION_ID?commentsViewMode=COMMENTS_VIEW_MODE_INCLUDED&fields=presentationId,comments,slides(objectId,commentAnchors)
In the response, comments are returned in two locations:
- The global
commentsarray containing theCommentThreadobjects. - The
commentAnchorsarray containingCommentAnchorobjects that map comment anchor IDs to page or page element locations (object anchors).
Read comments on a specific page
You can also retrieve comments and anchors for a specific page using the
pages.get method on the
presentations.pages resource.
Set the commentsViewMode query parameter to include comments for the specific page target:
GET https://slides.googleapis.com/v1/presentations/PRESENTATION_ID/pages/PAGE_ID?commentsViewMode=COMMENTS_VIEW_MODE_INCLUDED&fields=objectId,comments,commentAnchors
Sample response
The following JSON sample response shows a comment thread anchored to a text range within a shape on a slide page:
{
"presentationId": "PRESENTATION_ID",
"slides": [
{
"objectId": "SLIDE_PAGE_ID",
"commentAnchors": [
{
"anchorId": "ANCHOR_ID",
"objectAnchors": [
{
"objectId": "SHAPE_OBJECT_ID",
"shapeTextAnchors": {
"ranges": [
{
"startIndex": 0,
"endIndex": 12
}
]
}
}
]
}
]
}
],
"comments": [
{
"commentId": "COMMENT_ID",
"anchorId": "ANCHOR_ID",
"headPost": {
"postId": "POST_ID",
"content": "This is a comment thread head post.",
"contentHtml": "The content of the post as HTML.",
"author": {
"displayName": "DISPLAY_NAME",
"me": true,
"user": "users/USER"
},
"createTime": "2026-07-01T10:13:12Z",
"updateTime": "2026-07-01T10:13:12Z"
},
"replies": [
{
"postId": "REPLY_POST_ID",
"content": "This is a reply to the comment.",
"author": {
"displayName": "DISPLAY_NAME",
"me": false
},
"createTime": "2026-07-01T10:15:00Z",
"updateTime": "2026-07-01T10:15:00Z"
}
],
"status": "OPEN"
}
],
"commentsViewMode": "COMMENTS_VIEW_MODE_INCLUDED"
}
Create and manage comments
You can programmatically add, edit, and delete comments or replies using the
batchUpdate
method on the
presentations
resource.
When performing batch updates involving comments, you should monitor for potential partial failures. For more information, see Comment update status.
Insert a comment
To insert a comment thread into a presentation, use the
InsertCommentRequest
object. You must provide the comment text contents and the anchor location. The
anchor location must specify one of the following:
objectId: The object ID of a slide page or a page element (such as a shape or table) to anchor the comment to.shapeTextAnchor: Anchors a comment to a range of text in a shape.tableCellTextAnchor: Anchors a comment to a range of text in a table cell.tableAnchor: Anchors a comment to a range of cells in a table.
The following JSON sample shows how to add a comment thread anchored to a slide page:
{
"requests": [
{
"insertComment": {
"content": "This is a comment added using the API.",
"objectId": "SLIDE_PAGE_ID"
}
}
]
}
You can assign a comment to a specific user by providing their email in the
assigneeEmailAddress
field:
{
"requests": [
{
"insertComment": {
"content": "Please review this slide.",
"assigneeEmailAddress": "ASSIGNEE_EMAIL_ADDRESS",
"objectId": "SLIDE_PAGE_ID"
}
}
]
}
Add a reply or take action
To reply to a comment thread, resolve, or reopen a thread, use the
AddCommentReplyRequest
object.
You must provide the
commentId
and the
post
where the reply is represented by a
Post object.
The Post object contains the reply content and can optionally specify a
commentAction
(including the action to RESOLVE or REOPEN the comment thread). It's
represented by a
CommentActionType
object.
You can also re-assign a comment thread by specifying a new assigneeEmail in
the Post object.
The following JSON sample shows how to reply to an existing comment thread:
{
"requests": [
{
"addCommentReply": {
"commentId": "COMMENT_ID",
"post": {
"content": "Replying to the comment thread."
}
}
}
]
}
The following JSON sample shows how to resolve a comment thread:
{
"requests": [
{
"addCommentReply": {
"commentId": "COMMENT_ID",
"post": {
"commentAction": "RESOLVE"
}
}
}
]
}
Edit a post
To edit the text content of a post you authored, use the
UpdateCommentPostRequest
object. You must specify the commentId of the thread, the postId of the post
you want to edit, and the new plain text
content.
The following JSON sample shows how to edit a post:
{
"requests": [
{
"updateCommentPost": {
"commentId": "COMMENT_ID",
"postId": "POST_ID",
"content": "This is the updated comment text."
}
}
]
}
Delete comments and replies
To delete comments and replies, you have two options:
Delete a comment thread: To remove an entire
CommentThread, use theDeleteCommentRequestobject. You can only delete a comment thread if you're the author of the thread'sheadPostin theCommentThreadobject.Delete a reply: To delete a specific reply
Postfrom aCommentThread, use theDeleteCommentReplyRequestobject. You can only delete replies you authored. You cannot delete reply posts that contain acommentActionor anassigneeEmail.
The following JSON sample shows how to delete a comment thread:
{
"requests": [
{
"deleteComment": {
"commentId": "COMMENT_ID"
}
}
]
}
Comment update status
Requests that require saving comment threads (such as inserting comments or adding replies) might experience partial failures. In these cases, the presentation model changes (such as updating slide content or backgrounds) might be successfully committed, but the associated comments might fail to save.
You can verify whether comment updates were successfully applied by checking the
commentUpdateState
field in the response body of the presentations.batchUpdate method. The field
is represented by a
CommentUpdateState
object.
The following states are returned in CommentUpdateState:
NO_UPDATES_REQUESTED: No comment updates were requested in the batch operation.ALL_SAVED: All requested comment updates were successfully applied.ALL_FAILED_UNKNOWN_REASON: All requested comment updates failed to save, even though other presentation changes might have been committed.