Comments

  • A comment resource in the YouTube API represents a single comment, which can be about a video or channel, and can be a top-level comment or a reply.

  • The API provides methods to list, insert (for replies), update, delete, and set the moderation status of comments, with top-level comment creation done via commentThreads.insert.

  • The comment resource's JSON structure includes properties like id, snippet, kind and etag, while the snippet object details the comment's text, author, ratings, and moderation status.

  • The textDisplay property provides the comment's text, potentially modified, while textOriginal offers the original text if the viewer is the author.

  • Certain properties such as moderationStatus are only returned if the API request is authorized by the channel or video owner, and the markAsSpam method is no longer supported.

A comment resource contains information about a single YouTube comment. A comment resource can represent a comment about either a video or a channel. In addition, the comment could be a top-level comment or a reply to a top-level comment.

Methods

The API supports the following methods for comments resources:

list
Returns a list of comments that match the API request parameters. Try it now.
insert
Creates a reply to an existing comment. Note: To create a top-level comment, use the commentThreads.insert method. Try it now.
update
Modifies a comment. Try it now.
delete
Deletes a comment. Try it now.
setModerationStatus
Sets the moderation status of one or more comments. The API request must be authorized by the owner of the channel or video associated with the comments. Try it now.

Resource representation

The following JSON structure shows the format of a comments resource:

{
  "kind": "youtube#comment",
  "etag": etag,
  "id": string,
  "snippet": {
    "authorDisplayName": string,
    "authorProfileImageUrl": string,
    "authorChannelUrl": string,
    "authorChannelId": {
      "value": string
    },
    "channelId": string,
    "textDisplay": string,
    "textOriginal": string,
    "parentId": string,
    "canRate": boolean,
    "viewerRating": string,
    "likeCount": unsigned integer,
    "moderationStatus": string,
    "publishedAt": datetime,
    "updatedAt": datetime
  }
}

Properties

The following table defines the properties that appear in this resource: