---
title: "Create a review comment for a pull request"
method: POST
path: "/repos/{owner}/{repo}/pulls/{pull_number}/comments"
tags: ["pulls"]
---

# Create a review comment for a pull request

`POST /repos/{owner}/{repo}/pulls/{pull_number}/comments`

Creates a review comment on the diff of a specified pull request. To add a regular comment to a pull request timeline, see "[Create an issue comment](https://docs.github.com/enterprise-cloud@latest/rest/issues/comments#create-an-issue-comment)."

If your comment applies to more than one line in the pull request diff, you should use the parameters `line`, `side`, and optionally `start_line` and `start_side` in your request.

The `position` parameter is closing down. If you use `position`, the `line`, `side`, `start_line`, and `start_side` parameters are not required.

This endpoint triggers [notifications](https://docs.github.com/enterprise-cloud@latest/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see "[Rate limits for the API](https://docs.github.com/enterprise-cloud@latest/rest/using-the-rest-api/rate-limits-for-the-rest-api#about-secondary-rate-limits)"
and "[Best practices for using the REST API](https://docs.github.com/enterprise-cloud@latest/rest/guides/best-practices-for-using-the-rest-api)."

This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/enterprise-cloud@latest/rest/using-the-rest-api/getting-started-with-the-rest-api#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`.

## Path parameters

- `owner` string, required
- `repo` string, required
- `pull_number` integer, required

## Request body

- object
  - `body` string, required — The text of the review comment.
  - `commit_id` string, required — The SHA of the commit needing a comment. Not using the latest commit SHA may render your comment outdated if a subsequent commit modifies the line you specify as the `position`.
  - `path` string, required — The relative path to the file that necessitates a comment.
  - `position` integer — **This parameter is closing down. Use `line` instead**. The position in the diff where you want to add a review comment. Note this value is not the same as the line number in the file. The position value equals the number of lines down from the first "@@" hunk header in the file you want to add a comment. The line just below the "@@" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file.
  - `side` 'LEFT' | 'RIGHT' — In a split diff view, the side of the diff that the pull request's changes appear on. Can be `LEFT` or `RIGHT`. Use `LEFT` for deletions that appear in red. Use `RIGHT` for additions that appear in green or unchanged lines that appear in white and are shown for context. For a multi-line comment, side represents whether the last line of the comment range is a deletion or addition. For more information, see "[Diff view options](https://docs.github.com/enterprise-cloud@latest/articles/about-comparing-branches-in-pull-requests#diff-view-options)" in the GitHub Help documentation.
  - `line` integer — **Required unless using `subject_type:file`**. The line of the blob in the pull request diff that the comment applies to. For a multi-line comment, the last line of the range that your comment applies to.
  - `start_line` integer — **Required when using multi-line comments unless using `in_reply_to`**. The `start_line` is the first line in the pull request diff that your multi-line comment applies to. To learn more about multi-line comments, see "[Commenting on a pull request](https://docs.github.com/enterprise-cloud@latest/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)" in the GitHub Help documentation.
  - `start_side` 'LEFT' | 'RIGHT' | 'side' — **Required when using multi-line comments unless using `in_reply_to`**. The `start_side` is the starting side of the diff that the comment applies to. Can be `LEFT` or `RIGHT`. To learn more about multi-line comments, see "[Commenting on a pull request](https://docs.github.com/enterprise-cloud@latest/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)" in the GitHub Help documentation. See `side` in this table for additional context.
  - `in_reply_to` integer — The ID of the review comment to reply to. To find the ID of a review comment with ["List review comments on a pull request"](#list-review-comments-on-a-pull-request). When specified, all parameters other than `body` in the request body are ignored.
  - `subject_type` 'line' | 'file' — The level at which the comment is targeted.

## Response `201`

Response

- PullRequestReviewComment — Pull Request Review Comments are comments on a portion of the Pull Request's diff.
  - `url` string, required — URL for the pull request review comment
  - `pull_request_review_id` integer, nullable, required — The ID of the pull request review to which the comment belongs.
  - `id` integer, required — The ID of the pull request review comment.
  - `node_id` string, required — The node ID of the pull request review comment.
  - `diff_hunk` string, required — The diff of the line that the comment refers to.
  - `path` string, required — The relative path of the file to which the comment applies.
  - `position` integer — The line index in the diff to which the comment applies. This field is closing down; use `line` instead.
  - `original_position` integer — The index of the original line in the diff to which the comment applies. This field is closing down; use `original_line` instead.
  - `commit_id` string, required — The SHA of the commit to which the comment applies.
  - `original_commit_id` string, required — The SHA of the original commit to which the comment applies.
  - `in_reply_to_id` integer — The comment ID to reply to.
  - `user` NullableSimpleUser, nullable, required — A GitHub user.
    - `name` string, nullable
    - `email` string, nullable
    - `login` string, required
    - `id` integer, required
    - `node_id` string, required
    - `avatar_url` string, uri, required
    - `gravatar_id` string, nullable, required
    - `url` string, uri, required
    - `html_url` string, uri, required
    - `followers_url` string, uri, required
    - `following_url` string, required
    - `gists_url` string, required
    - `starred_url` string, required
    - `subscriptions_url` string, uri, required
    - `organizations_url` string, uri, required
    - `repos_url` string, uri, required
    - `events_url` string, required
    - `received_events_url` string, uri, required
    - `type` string, required
    - `site_admin` boolean, required
    - `starred_at` string
    - `user_view_type` string
  - `body` string, required — The text of the comment.
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `html_url` string, uri, required — HTML URL for the pull request review comment.
  - `pull_request_url` string, uri, required — URL for the pull request that the review comment belongs to.
  - `author_association` 'COLLABORATOR' | 'CONTRIBUTOR' | 'FIRST_TIMER' | 'FIRST_TIME_CONTRIBUTOR' | 'MANNEQUIN' | 'MEMBER' | 'NONE' | 'OWNER', required — How the author is associated with the repository.
  - `_links` object, required
    - `self` object, required
      - `href` string, uri, required
    - `html` object, required
      - `href` string, uri, required
    - `pull_request` object, required
      - `href` string, uri, required
  - `start_line` integer, nullable — The first line of the range for a multi-line comment.
  - `original_start_line` integer, nullable — The first line of the range for a multi-line comment.
  - `start_side` 'LEFT' | 'RIGHT', nullable — The side of the first line of the range for a multi-line comment.
  - `line` integer — The line of the blob to which the comment applies. The last line of the range for a multi-line comment
  - `original_line` integer — The line of the blob to which the comment applies. The last line of the range for a multi-line comment
  - `side` 'LEFT' | 'RIGHT' — The side of the diff to which the comment applies. The side of the last line of the range for a multi-line comment
  - `subject_type` 'line' | 'file' — The level at which the comment is targeted, can be a diff line or a file.
  - `reactions` ReactionRollup
    - `url` string, uri, required
    - `total_count` integer, required
    - `+1` integer, required
    - `-1` integer, required
    - `laugh` integer, required
    - `confused` integer, required
    - `heart` integer, required
    - `hooray` integer, required
    - `eyes` integer, required
    - `rocket` integer, required
  - `body_html` string
  - `body_text` string

## Other responses

- `403` — Forbidden
- `422` — Validation failed, or the endpoint has been spammed.

---

[API](https://skmtc.net/github/apis/github-v3-rest-api-2.md) · [All operations](https://skmtc.net/github/apis/github-v3-rest-api-2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/github-v3-rest-api-2/versions/8ae6d0c8716e/schema)
