REST API endpoints for gist comments

Use the REST API to view and modify comments on a gist.

About gist comments

You can use the REST API to view and modify comments on a gist. For more information about gists, see Editing and sharing content with gists.

Note

Most endpoints use Authorization: Bearer <YOUR-TOKEN> and Accept: application/vnd.github+json headers, plus X-GitHub-Api-Version: 2026-03-10. Curl examples below omit these standard headers for brevity.

List gist comments

GET /gists/{gist_id}/comments

Lists the comments on a gist.
This endpoint supports the following custom media types. For more information, see "Media types."

application/vnd.github.raw+json: Returns the raw markdown. This is the default if you do not pass any specific media type.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X GET \
  https://api.github.com/gists/GIST_ID/comments

Response schema (Status: 200):

Array of Gist Comment:

Create a gist comment

POST /gists/{gist_id}/comments

Creates a comment on a gist.
This endpoint supports the following custom media types. For more information, see "Media types."

application/vnd.github.raw+json: Returns the raw markdown. This is the default if you do not pass any specific media type.

Parameters

Headers

Path and query parameters

Body parameters

HTTP response status codes

Code examples

Creating a comment in a gist

Request:

curl -L \
  -X POST \
  https://api.github.com/gists/GIST_ID/comments \
  -d '{
  "body": "This is a comment to a gist"
}'

Response schema (Status: 201):

Get a gist comment

GET /gists/{gist_id}/comments/{comment_id}

Gets a comment on a gist.
This endpoint supports the following custom media types. For more information, see "Media types."

application/vnd.github.raw+json: Returns the raw markdown. This is the default if you do not pass any specific media type.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X GET \
  https://api.github.com/gists/GIST_ID/comments/COMMENT_ID

Response schema (Status: 200):

Same response schema as Create a gist comment.

Update a gist comment

PATCH /gists/{gist_id}/comments/{comment_id}

Updates a comment on a gist.
This endpoint supports the following custom media types. For more information, see "Media types."

application/vnd.github.raw+json: Returns the raw markdown. This is the default if you do not pass any specific media type.

Parameters

Headers

Path and query parameters

Body parameters

HTTP response status codes

Code examples

Updating a comment in a gist

Request:

curl -L \
  -X PATCH \
  https://api.github.com/gists/GIST_ID/comments/COMMENT_ID \
  -d '{
  "body": "This is an update to a comment in a gist"
}'

Response schema (Status: 200):

Same response schema as Create a gist comment.

Delete a gist comment

DELETE /gists/{gist_id}/comments/{comment_id}

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X DELETE \
  https://api.github.com/gists/GIST_ID/comments/COMMENT_ID

Response schema (Status: 204):