Search + K

Command Palette

Search for a command to run...

Sign In

Create a commit comment

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

Create a comment for a commit using its :commit_sha.

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.

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
commit_sha required

The SHA of the commit.

string

Request Body

application/json required
{
body: string;
path?: string;
position?: number;
line?: number;
}

Responses

201 application/json

Response

interface CommitComment {
html_url: string;
url: string;
id: number;
node_id: string;
body: string;
path: string | null;
position: number | null;
line: number | null;
commit_id: 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;
author_association: AuthorAssociation

How the author is associated with the repository.

type AuthorAssociation = "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "MEMBER" | "NONE" | "OWNER"
;
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;
}
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;
}
[]
;
}