Search + K

Command Palette

Search for a command to run...

Sign In

Create an issue comment

POST /repos/{owner}/{repo}/issues/{issue_number}/comments
Copy endpoint
https://api.github.com

You can use the REST API to create comments on issues and pull requests. Every pull request is an issue, but not every issue is a pull request.

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.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.text+json: Returns a text only representation of the markdown body. Response will include body_text.
  • application/vnd.github.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
  • application/vnd.github.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.

Parameters

path Path Parameters

Name Type
owner required

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

string
repo required

The name of the repository without the .git extension. The name is not case sensitive.

string
issue_number required

The number that identifies the issue.

number

Request Body

application/json required
{ body: string; }

Responses

201 application/json

Response

interface IssueComment {
id: number;
node_id: string;
url: string;
body?: string;
body_text?: string;
body_html?: string;
html_url: string;
user: SimpleUser

A GitHub user.

interface SimpleUser {
name?: string | null;
email?: string | null;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string;
user_view_type?: string;
}
| null
;
created_at: string;
updated_at: string;
issue_url: string;
author_association?: AuthorAssociation

How the author is associated with the repository.

type AuthorAssociation = "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "MEMBER" | "NONE" | "OWNER"
;
performed_via_github_app?: Integration

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.

type Integration = {
id: number;
slug?: string;
node_id: string;
client_id?: string;
owner: SimpleUser | Enterprise;
name: string;
description: string | null;
external_url: string;
html_url: string;
created_at: string;
updated_at: string;
permissions: {
issues?: string;
checks?: string;
metadata?: string;
contents?: string;
deployments?: string;
[key: string]: string;
}
;
events: string[];
installations_count?: number;
}
| null
| null
;
reactions?: ReactionRollup
interface ReactionRollup {
url: string;
total_count: number;
+1: number;
-1: number;
laugh: number;
confused: number;
heart: number;
hooray: number;
eyes: number;
rocket: number;
}
;
}

Client Errors

403 application/json

Forbidden

interface BasicError {
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
404 application/json

Resource not found

interface BasicError {
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
410 application/json

Gone

interface BasicError {
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
422 application/json

Validation failed, or the endpoint has been spammed.

interface ValidationError {
message: string;
documentation_url: string;
errors?: {
resource?: string;
field?: string;
message?: string;
code: string;
index?: number;
value?: string[] | string | number | null;
}
[]
;
}