POST/repos/{owner}/{repo}/issues/{issue_number}/comments

Create a comment on an issue

Creates a comment on an issue or pull request in a repository. Provide the comment contents in body; creating a comment triggers notifications, and creating content too quickly may result in secondary rate limiting. The response can include raw Markdown, plain text, or rendered HTML according to the requested media type.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

3 parameters · 1 body field
ownerstringrequired
The account that owns the repository; the name is not case-sensitive.
repostringrequired
The repository name without the `.git` extension; the name is not case-sensitive.
issue_numberintegerrequired
The number that identifies the issue or pull request to comment on.

Comment content to add to the issue or pull request.

bodystringrequired
The contents of the comment.

5 status codes
201Returns the created issue comment object, including its contents, author, timestamps, and issue URL.
idintegerrequired
Unique identifier of the issue comment
node_idstringrequired
urlstringrequired
URL for the issue comment
bodystringoptional
Contents of the issue comment
body_textstringoptional
body_htmlstringoptional
html_urlstringrequired
userobjectrequired
A GitHub user.
created_atstringrequired
updated_atstringrequired
issue_urlstringrequired
author_associationstringoptional
How the author is associated with the repository.
Allowed:COLLABORATORCONTRIBUTORFIRST_TIMERFIRST_TIME_CONTRIBUTORMANNEQUINMEMBERNONEOWNER
performed_via_github_appobjectoptional
GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub.
reactionsobjectoptional
pinobjectoptional
Context around who pinned an issue comment and when it was pinned.
minimizedobjectoptional
Details about why an issue comment was minimized.
403Returned when the authenticated user is not permitted to create a comment.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Returned when the repository or issue cannot be found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
410Returned when the requested resource is no longer available.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when validation fails or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 403 is returned when the authenticated user is not permitted to comment, and a 404 is returned when the repository or issue cannot be found. A 410 indicates the requested resource is no longer available; a 422 indicates validation failure or that the endpoint has been spammed. The body field is required, and creating content too quickly may trigger secondary rate limiting.