Use the REST API to view and modify comments on a gist.
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.
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.
accept (string)application/vnd.github+json is recommended.gist_id (string) (required)
The unique identifier of the gist.
per_page (integer)
The number of results per page (max 100). For more information, see "Using pagination in the REST API."
Default: 30
page (integer)
The page number of the results to fetch. For more information, see "Using pagination in the REST API."
Default: 1
200 - OK
304 - Not modified
403 - Forbidden
404 - Resource not found
Request:
curl -L \
-X GET \
https://api.github.com/gists/GIST_ID/comments
Response schema (Status: 200):
Array of Gist Comment:
id: required, integernode_id: required, stringurl: required, string, format: uribody: required, string, maxLength: 65535user: required, any of:
name: string or nullemail: string or nulllogin: required, stringid: required, integer, format: int64node_id: required, stringavatar_url: required, string, format: urigravatar_id: required, string or nullurl: required, string, format: urihtml_url: required, string, format: urifollowers_url: required, string, format: urifollowing_url: required, stringgists_url: required, stringstarred_url: required, stringsubscriptions_url: required, string, format: uriorganizations_url: required, string, format: urirepos_url: required, string, format: urievents_url: required, stringreceived_events_url: required, string, format: uritype: required, stringsite_admin: required, booleanstarred_at: stringuser_view_type: stringcreated_at: required, string, format: date-timeupdated_at: required, string, format: date-timeauthor_association: required, string, enum: COLLABORATOR, CONTRIBUTOR, FIRST_TIMER, FIRST_TIME_CONTRIBUTOR, MANNEQUIN, MEMBER, NONE, OWNERPOST /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.
accept (string)application/vnd.github+json is recommended.gist_id (string) (required)body (string) (required)201 - Created
304 - Not modified
403 - Forbidden
404 - Resource not found
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):
id: required, integernode_id: required, stringurl: required, string, format: uribody: required, string, maxLength: 65535user: required, any of:
name: string or nullemail: string or nulllogin: required, stringid: required, integer, format: int64node_id: required, stringavatar_url: required, string, format: urigravatar_id: required, string or nullurl: required, string, format: urihtml_url: required, string, format: urifollowers_url: required, string, format: urifollowing_url: required, stringgists_url: required, stringstarred_url: required, stringsubscriptions_url: required, string, format: uriorganizations_url: required, string, format: urirepos_url: required, string, format: urievents_url: required, stringreceived_events_url: required, string, format: uritype: required, stringsite_admin: required, booleanstarred_at: stringuser_view_type: stringcreated_at: required, string, format: date-timeupdated_at: required, string, format: date-timeauthor_association: required, string, enum: COLLABORATOR, CONTRIBUTOR, FIRST_TIMER, FIRST_TIME_CONTRIBUTOR, MANNEQUIN, MEMBER, NONE, OWNERGET /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.
accept (string)application/vnd.github+json is recommended.gist_id (string) (required)
The unique identifier of the gist.
comment_id (integer) (required)
The unique identifier of the comment.
200 - OK
304 - Not modified
403 - Forbidden Gist
404 - Resource not found
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.
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.
accept (string)application/vnd.github+json is recommended.gist_id (string) (required)
The unique identifier of the gist.
comment_id (integer) (required)
The unique identifier of the comment.
body (string) (required)200 - OK
404 - Resource not found
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 /gists/{gist_id}/comments/{comment_id}
accept (string)application/vnd.github+json is recommended.gist_id (string) (required)
The unique identifier of the gist.
comment_id (integer) (required)
The unique identifier of the comment.
204 - No Content
304 - Not modified
403 - Forbidden
404 - Resource not found
Request:
curl -L \
-X DELETE \
https://api.github.com/gists/GIST_ID/comments/COMMENT_ID
Response schema (Status: 204):