# Create a review for a pull request

From **GitHub v3 REST API**.

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

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/enterprise-server@3.0/rest/overview/resources-in-the-rest-api#secondary-rate-limits)" and "[Dealing with secondary rate limits](https://docs.github.com/enterprise-server@3.0/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/enterprise-server@3.0/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/enterprise-server@3.0/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.

## Parameters

### `owner`

- Location: path
- Required: true
- Type: `string`

### `repo`

- Location: path
- Required: true
- Type: `string`

### `pull_number`

- Location: path
- Required: true
- Type: `integer`

## Request body

- Required: false
### `application/json`

- Type: `object`

```json
{
  "body": "This is close to perfect! Please address the suggested inline change.",
  "comments": [
    {
      "body": "Please add more information here, and fix this typo.",
      "path": "file.md",
      "position": 6
    }
  ],
  "commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091",
  "event": "REQUEST_CHANGES"
}
```

```json
{"properties":{"body":{"description":"**Required** when using `REQUEST_CHANGES` or `COMMENT` for the `event` parameter. The body text of the pull request review.","type":"string"},"comments":{"description":"Use the following table to specify the location, destination, and contents of the draft review comment.","items":{"properties":{"body":{"description":"Text of the review comment.","type":"string"},"line":{"example":28,"type":"integer"},"path":{"description":"The relative path to the file that necessitates a review comment.","type":"string"},"position":{"description":"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.","type":"integer"},"side":{"example":"RIGHT","type":"string"},"start_line":{"example":26,"type":"integer"},"start_side":{"example":"LEFT","type":"string"}},"required":["path","body"],"type":"object"},"type":"array"},"commit_id":{"description":"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.","type":"string"},"event":{"description":"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/enterprise-server@3.0/rest/reference/pulls#submit-a-review-for-a-pull-request) when you are ready.","enum":["APPROVE","REQUEST_CHANGES","COMMENT"],"type":"string"}},"type":"object"}
```

## Responses

### `200`

Response

### `application/json`

- Type: `object`

Pull Request Reviews are reviews on pull requests.

```json
{
  "_links": {
    "html": {
      "href": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80"
    },
    "pull_request": {
      "href": "https://api.github.com/repos/octocat/Hello-World/pulls/12"
    }
  },
  "author_association": "COLLABORATOR",
  "body": "This is close to perfect! Please address the suggested inline change.",
  "commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091",
  "html_url": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80",
  "id": 80,
  "node_id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=",
  "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/12",
  "state": "CHANGES_REQUESTED",
  "submitted_at": "2019-11-17T17:43:43Z",
  "user": {
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "followers_url": "https://api.github.com/users/octocat/followers",
    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    "gravatar_id": "",
    "html_url": "https://github.com/octocat",
    "id": 1,
    "login": "octocat",
    "node_id": "MDQ6VXNlcjE=",
    "organizations_url": "https://api.github.com/users/octocat/orgs",
    "received_events_url": "https://api.github.com/users/octocat/received_events",
    "repos_url": "https://api.github.com/users/octocat/repos",
    "site_admin": false,
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    "type": "User",
    "url": "https://api.github.com/users/octocat"
  }
}
```

```json
{"description":"Pull Request Reviews are reviews on pull requests.","properties":{"_links":{"properties":{"html":{"properties":{"href":{"type":"string"}},"required":["href"],"type":"object"},"pull_request":{"properties":{"href":{"type":"string"}},"required":["href"],"type":"object"}},"required":["html","pull_request"],"type":"object"},"author_association":{"$ref":"#/components/schemas/author_association"},"body":{"description":"The text of the review.","example":"This looks great.","type":"string"},"body_html":{"type":"string"},"body_text":{"type":"string"},"commit_id":{"description":"A commit SHA for the review.","example":"54bb654c9e6025347f57900a4a5c2313a96b8035","type":"string"},"html_url":{"example":"https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80","format":"uri","type":"string"},"id":{"description":"Unique identifier of the review","example":42,"type":"integer"},"node_id":{"example":"MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=","type":"string"},"pull_request_url":{"example":"https://api.github.com/repos/octocat/Hello-World/pulls/12","format":"uri","type":"string"},"state":{"example":"CHANGES_REQUESTED","type":"string"},"submitted_at":{"format":"date-time","type":"string"},"user":{"$ref":"#/components/schemas/nullable-simple-user"}},"required":["id","node_id","user","body","state","commit_id","html_url","pull_request_url","_links","author_association"],"title":"Pull Request Review","type":"object"}
```

### `403`

Forbidden

### `application/json`

- Type: `object`

Basic Error

```json
{"description":"Basic Error","properties":{"documentation_url":{"type":"string"},"message":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"}},"title":"Basic Error","type":"object"}
```

### `422`

Validation failed

### `application/json`

- Type: `object`

Validation Error Simple

```json
{"description":"Validation Error Simple","properties":{"documentation_url":{"type":"string"},"errors":{"items":{"type":"string"},"type":"array"},"message":{"type":"string"}},"required":["message","documentation_url"],"title":"Validation Error Simple","type":"object"}
```

## Request examples

### cURL

```shell
curl --request POST \
  --url {protocol}://{hostname}/api/v3/repos/{owner}/{repo}/pulls/{pull_number}/reviews \
  --header 'content-type: application/json' \
  --data '{
  "body": "This is close to perfect! Please address the suggested inline change.",
  "comments": [
    {
      "body": "Please add more information here, and fix this typo.",
      "path": "file.md",
      "position": 6
    }
  ],
  "commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091",
  "event": "REQUEST_CHANGES"
}'
```
