Use the REST API to interact with commit comments.
You can create, edit, and view commit comments using the REST API. A commit comment is a comment made on a specific commit. For more information, see Working with comments.
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 /repos/{owner}/{repo}/comments
Lists the commit comments for a specified repository. Comments are ordered by ascending ID.
This endpoint supports the following custom media types. For more information, see "Media types."
application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository without the .git extension. The name is not case sensitive.
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
Request:
curl -L \
-X GET \
https://api.github.com/repos/OWNER/REPO/comments
Response schema (Status: 200):
Array of Commit Comment:
html_url: required, string, format: uriurl: required, string, format: uriid: required, integernode_id: required, stringbody: required, stringpath: required, string or nullposition: required, integer or nullline: required, integer or nullcommit_id: required, stringuser: 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, OWNERreactions: Reaction Rollup:
url: required, string, format: uritotal_count: required, integer+1: required, integer-1: required, integerlaugh: required, integerconfused: required, integerheart: required, integerhooray: required, integereyes: required, integerrocket: required, integerGET /repos/{owner}/{repo}/comments/{comment_id}
Gets a specified commit comment.
This endpoint supports the following custom media types. For more information, see "Media types."
application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository without the .git extension. The name is not case sensitive.
comment_id (integer) (required)
The unique identifier of the comment.
200 - OK
404 - Resource not found
Request:
curl -L \
-X GET \
https://api.github.com/repos/OWNER/REPO/comments/COMMENT_ID
Response schema (Status: 200):
html_url: required, string, format: uriurl: required, string, format: uriid: required, integernode_id: required, stringbody: required, stringpath: required, string or nullposition: required, integer or nullline: required, integer or nullcommit_id: required, stringuser: 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, OWNERreactions: Reaction Rollup:
url: required, string, format: uritotal_count: required, integer+1: required, integer-1: required, integerlaugh: required, integerconfused: required, integerheart: required, integerhooray: required, integereyes: required, integerrocket: required, integerPATCH /repos/{owner}/{repo}/comments/{comment_id}
Updates the contents of a specified commit comment.
This endpoint supports the following custom media types. For more information, see "Media types."
application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository without the .git extension. The name is not case sensitive.
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/repos/OWNER/REPO/comments/COMMENT_ID \
-d '{
"body": "Nice change"
}'
Response schema (Status: 200):
Same response schema as Get a commit comment.
DELETE /repos/{owner}/{repo}/comments/{comment_id}
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository without the .git extension. The name is not case sensitive.
comment_id (integer) (required)
The unique identifier of the comment.
204 - No Content
404 - Resource not found
Request:
curl -L \
-X DELETE \
https://api.github.com/repos/OWNER/REPO/comments/COMMENT_ID
Response schema (Status: 204):
GET /repos/{owner}/{repo}/commits/{commit_sha}/comments
Lists the comments for a specified commit.
This endpoint supports the following custom media types. For more information, see "Media types."
application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository without the .git extension. The name is not case sensitive.
commit_sha (string) (required)
The SHA of the commit.
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
Request:
curl -L \
-X GET \
https://api.github.com/repos/OWNER/REPO/commits/COMMIT_SHA/comments
Response schema (Status: 200):
Same response schema as List commit comments for a repository.
POST /repos/{owner}/{repo}/commits/{commit_sha}/comments
Create a comment for a commit using its :commit_sha.
Access to commit comments can be controlled by organization owners. For more information, see "Managing commit comments for your organization".
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see "Rate limits for the API" and "Best practices for using the REST API."
This endpoint supports the following custom media types. For more information, see "Media types."
application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository without the .git extension. The name is not case sensitive.
commit_sha (string) (required)
The SHA of the commit.
body (string) (required)
The contents of the comment.
path (string)
Relative path of the file to comment on.
position (integer)
Line index in the diff to comment on.
line (integer)
Closing down notice. Use position parameter instead. Line number in the file to comment on.
201 - Created
403 - Forbidden
422 - Validation failed, or the endpoint has been spammed.
Request:
curl -L \
-X POST \
https://api.github.com/repos/OWNER/REPO/commits/COMMIT_SHA/comments \
-d '{
"body": "Great stuff",
"path": "file1.txt",
"position": 4,
"line": 1
}'
Response schema (Status: 201):
Same response schema as Get a commit comment.