Skip to main content

Create a review for a pull request

This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in secondary rate limiting. See "[Secondary rate limits](https://docs.github.com/[email protected]/rest/overview/resources-in-the-rest-api#secondary-rate-limits)" and "[Dealing with secondary rate limits](https://docs.github.com/[email protected]/rest/guides/best-practices-for-integrators#dealing-with-secondary-rate-limits)" for details. Pull request reviews created in the `PENDING` state do not include the `submitted_at` property in the response. **Note:** To comment on a specific line in a file, you need to first determine the _position_ of that line in the diff. The GitHub REST API v3 offers the `application/vnd.github.v3.diff` [media type](https://docs.github.com/[email protected]/rest/overview/media-types#commits-commit-comparison-and-pull-requests). To see a pull request diff, add this media type to the `Accept` header of a call to the [single pull request](https://docs.github.com/[email protected]/rest/reference/pulls#get-a-pull-request) endpoint. 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.

POST/repos/{owner}/{repo}/pulls/{pull_number}/reviews
Source
github-v3-rest.json
Revision
f5f067c1e6f6
Active snapshot
85e53e3d0d65

Request

Path Parameters
owner string
required
repo string
required
pull_number integer
required
Body Params
optional
application/jsonobject
body string
optional

**Required** when using `REQUEST_CHANGES` or `COMMENT` for the `event` parameter. The body text of the pull request review.

comments array[object]
optional

Use the following table to specify the location, destination, and contents of the draft review comment.

items object
body string
required

Text of the review comment.

line integer
optional

Example: 28

path string
required

The relative path to the file that necessitates a review comment.

position integer
optional

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. For help finding the position value, read the note below.

side string
optional

Example: RIGHT

start_line integer
optional

Example: 26

start_side string
optional

Example: LEFT

commit_id string
optional

The SHA of the commit that needs a review. Not using the latest commit SHA may render your review comment outdated if a subsequent commit modifies the line you specify as the `position`. Defaults to the most recent commit in the pull request when you do not specify a value.

event string
optional

The review action you want to perform. The review actions include: `APPROVE`, `REQUEST_CHANGES`, or `COMMENT`. By leaving this blank, you set the review action state to `PENDING`, which means you will need to [submit the pull request review](https://docs.github.com/[email protected]/rest/reference/pulls#submit-a-review-for-a-pull-request) when you are ready.

Responses

application/json Pull Request Review object

Response

_links object
required
html object
required
href string
required
pull_request object
required
href string
required
author_association
string< author_association >
required

How the author is associated with the repository.

Example: OWNER

body string
required

The text of the review.

Example: This looks great.

body_html string
optional
body_text string
optional
commit_id string
required

A commit SHA for the review.

Example: 54bb654c9e6025347f57900a4a5c2313a96b8035

html_url string<uri>
required

Example: https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80

id integer
required

Unique identifier of the review

Example: 42

node_id string
required

Example: MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=

pull_request_url string<uri>
required

Example: https://api.github.com/repos/octocat/Hello-World/pulls/12

state string
required

Example: CHANGES_REQUESTED

submitted_at string<date-time>
optional
user Simple User object
requirednullable

Simple User

avatar_url string<uri>
required

Example: https://github.com/images/error/octocat_happy.gif

email string
optionalnullable
events_url string
required

Example: https://api.github.com/users/octocat/events{/privacy}

followers_url string<uri>
required

Example: https://api.github.com/users/octocat/followers

following_url string
required

Example: https://api.github.com/users/octocat/following{/other_user}

gists_url string
required

Example: https://api.github.com/users/octocat/gists{/gist_id}

gravatar_id string
requirednullable

Example: 41d064eb2195891e12d0413f63227ea7

html_url string<uri>
required

Example: https://github.com/octocat

id integer
required

Example: 1

login string
required

Example: octocat

name string
optionalnullable
node_id string
required

Example: MDQ6VXNlcjE=

organizations_url string<uri>
required

Example: https://api.github.com/users/octocat/orgs

received_events_url string<uri>
required

Example: https://api.github.com/users/octocat/received_events

repos_url string<uri>
required

Example: https://api.github.com/users/octocat/repos

site_admin boolean
required
starred_at string
optional

Example: "2020-07-09T00:17:55Z"

starred_url string
required

Example: https://api.github.com/users/octocat/starred{/owner}{/repo}

subscriptions_url string<uri>
required

Example: https://api.github.com/users/octocat/subscriptions

type string
required

Example: User

url string<uri>
required

Example: https://api.github.com/users/octocat

application/json Basic Error object

Forbidden

documentation_url string
optional
message string
optional
status string
optional
url string
optional
application/json Validation Error Simple object

Validation failed

documentation_url string
required
errors array[string]
optional
message string
required