Skip to main content

This version of GitHub Enterprise was discontinued on 2022-06-03. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise. For help with the upgrade, contact GitHub Enterprise support.

Issue comments

The Issue comments API supports managing comments on issues and pull requests.

About the Issue comments API

The Issue comments API supports managing comments on issues and pull requests. Every pull request is an issue, but not every issue is a pull request. For this reason, "shared" actions for both features, like managing assignees, labels, and milestones, are provided within Issues API. To manage pull request review comments, use the Pull request review comments API instead.

Custom media types

These are the supported media types for this API:

application/vnd.github.VERSION.raw+json
application/vnd.github.VERSION.text+json
application/vnd.github.VERSION.html+json
application/vnd.github.VERSION.full+json

For more information about media types, see "Custom media types."

List issue comments for a repository

Works with GitHub Apps

By default, Issue Comments are ordered by ascending ID.

Parameters

Headers
Name, Type, Description
acceptstring

Setting to application/vnd.github.v3+json is recommended.

See preview notice
Path parameters
Name, Type, Description
ownerstringRequired

The account owner of the repository. The name is not case sensitive.

repostringRequired

The name of the repository. The name is not case sensitive.

Query parameters
Name, Type, Description
sortstring

The property to sort the results by. created means when the repository was starred. updated means when the repository was last pushed to.

Default: created

Can be one of: created, updated

directionstring

Either asc or desc. Ignored without the sort parameter.

Can be one of: asc, desc

sincestring

Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

per_pageinteger

The number of results per page (max 100).

Default: 30

pageinteger

Page number of the results to fetch.

Default: 1

HTTP response status codes

Status codeDescription
200

OK

404

Resource not found

422

Validation failed

Code samples

get/repos/{owner}/{repo}/issues/comments
curl \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/issues/comments

Response

Status: 200
[ { "id": 1, "node_id": "MDEyOklzc3VlQ29tbWVudDE=", "url": "https://api.github.com/repos/octocat/Hello-World/issues/comments/1", "html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1", "body": "Me too", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "created_at": "2011-04-14T16:00:49Z", "updated_at": "2011-04-14T16:00:49Z", "issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347", "author_association": "COLLABORATOR" } ]

Preview notice

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.

Get an issue comment

Works with GitHub Apps

Parameters

Headers
Name, Type, Description
acceptstring

Setting to application/vnd.github.v3+json is recommended.

See preview notices
Path parameters
Name, Type, Description
ownerstringRequired

The account owner of the repository. The name is not case sensitive.

repostringRequired

The name of the repository. The name is not case sensitive.

comment_idintegerRequired

The unique identifier of the comment.

HTTP response status codes

Status codeDescription
200

OK

404

Resource not found

Code samples

get/repos/{owner}/{repo}/issues/comments/{comment_id}
curl \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/issues/comments/COMMENT_ID

Response

Status: 200
{ "id": 1, "node_id": "MDEyOklzc3VlQ29tbWVudDE=", "url": "https://api.github.com/repos/octocat/Hello-World/issues/comments/1", "html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1", "body": "Me too", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "created_at": "2011-04-14T16:00:49Z", "updated_at": "2011-04-14T16:00:49Z", "issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347", "author_association": "COLLABORATOR" }

Preview notices

If an issue event is created via a GitHub App, the response will include the performed_via_github_app object with information about the GitHub App. For more information, see the related blog post. To receive the performed_via_github_app object in the response, you must provide a custom media type in the Accept header:

application/vnd.github.machine-man-preview

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.

Update an issue comment

Works with GitHub Apps

Parameters

Headers
Name, Type, Description
acceptstring

Setting to application/vnd.github.v3+json is recommended.

Path parameters
Name, Type, Description
ownerstringRequired

The account owner of the repository. The name is not case sensitive.

repostringRequired

The name of the repository. The name is not case sensitive.

comment_idintegerRequired

The unique identifier of the comment.

Body parameters
Name, Type, Description
bodystringRequired

The contents of the comment.

HTTP response status codes

Status codeDescription
200

OK

422

Validation failed

Code samples

patch/repos/{owner}/{repo}/issues/comments/{comment_id}
curl \ -X PATCH \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/issues/comments/COMMENT_ID \ -d '{"body":"Me too"}'

Response

Status: 200
{ "id": 1, "node_id": "MDEyOklzc3VlQ29tbWVudDE=", "url": "https://api.github.com/repos/octocat/Hello-World/issues/comments/1", "html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1", "body": "Me too", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "created_at": "2011-04-14T16:00:49Z", "updated_at": "2011-04-14T16:00:49Z", "issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347", "author_association": "COLLABORATOR" }

Delete an issue comment

Works with GitHub Apps

Parameters

Headers
Name, Type, Description
acceptstring

Setting to application/vnd.github.v3+json is recommended.

Path parameters
Name, Type, Description
ownerstringRequired

The account owner of the repository. The name is not case sensitive.

repostringRequired

The name of the repository. The name is not case sensitive.

comment_idintegerRequired

The unique identifier of the comment.

HTTP response status codes

Status codeDescription
204

No Content

Code samples

delete/repos/{owner}/{repo}/issues/comments/{comment_id}
curl \ -X DELETE \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/issues/comments/COMMENT_ID

Response

Status: 204

List issue comments

Works with GitHub Apps

Issue Comments are ordered by ascending ID.

Parameters

Headers
Name, Type, Description
acceptstring

Setting to application/vnd.github.v3+json is recommended.

See preview notice
Path parameters
Name, Type, Description
ownerstringRequired

The account owner of the repository. The name is not case sensitive.

repostringRequired

The name of the repository. The name is not case sensitive.

issue_numberintegerRequired

The number that identifies the issue.

Query parameters
Name, Type, Description
sincestring

Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

per_pageinteger

The number of results per page (max 100).

Default: 30

pageinteger

Page number of the results to fetch.

Default: 1

HTTP response status codes

Status codeDescription
200

OK

404

Resource not found

410

Gone

Code samples

get/repos/{owner}/{repo}/issues/{issue_number}/comments
curl \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/issues/ISSUE_NUMBER/comments

Response

Status: 200
[ { "id": 1, "node_id": "MDEyOklzc3VlQ29tbWVudDE=", "url": "https://api.github.com/repos/octocat/Hello-World/issues/comments/1", "html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1", "body": "Me too", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "created_at": "2011-04-14T16:00:49Z", "updated_at": "2011-04-14T16:00:49Z", "issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347", "author_association": "COLLABORATOR" } ]

Preview notice

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.

Create an issue comment

Works with GitHub Apps

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. See "Secondary rate limits" and "Dealing with secondary rate limits" for details.

Parameters

Headers
Name, Type, Description
acceptstring

Setting to application/vnd.github.v3+json is recommended.

Path parameters
Name, Type, Description
ownerstringRequired

The account owner of the repository. The name is not case sensitive.

repostringRequired

The name of the repository. The name is not case sensitive.

issue_numberintegerRequired

The number that identifies the issue.

Body parameters
Name, Type, Description
bodystringRequired

The contents of the comment.

HTTP response status codes

Status codeDescription
201

Created

403

Forbidden

404

Resource not found

410

Gone

422

Validation failed

Code samples

post/repos/{owner}/{repo}/issues/{issue_number}/comments
curl \ -X POST \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/issues/ISSUE_NUMBER/comments \ -d '{"body":"Me too"}'

Response

Status: 201
{ "id": 1, "node_id": "MDEyOklzc3VlQ29tbWVudDE=", "url": "https://api.github.com/repos/octocat/Hello-World/issues/comments/1", "html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1", "body": "Me too", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "created_at": "2011-04-14T16:00:49Z", "updated_at": "2011-04-14T16:00:49Z", "issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347", "author_association": "COLLABORATOR" }