Pull Request Review Comments API

Pull Request Review Comments are comments on a portion of the unified diff. These are separate from Commit Comments (which are applied directly to a commit, outside of the Pull Request view), and Issue Comments (which do not reference a portion of the unified diff).

Pull Request Review Comments use these custom media types. You can read more about the use of media types in the API here.

List comments on a pull request

GET /repos/:owner/:repo/pulls/:number/comments

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
  {
    "url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
    "id": 1,
    "body": "Great stuff",
    "path": "file1.txt",
    "position": 4,
    "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    "user": {
      "login": "octocat",
      "id": 1,
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "somehexcode",
      "url": "https://api.github.com/users/octocat"
    },
    "created_at": "2011-04-14T16:00:49Z",
    "updated_at": "2011-04-14T16:00:49Z",
    "_links": {
      "self": {
        "href": "https://api.github.com/octocat/Hello-World/pulls/comments/1"
      },
      "html": {
        "href": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1"
      },
      "pull_request": {
        "href": "https://api.github.com/octocat/Hello-World/pulls/1"
      }
    }
  }
]

List comments in a repository

GET /repos/:owner/:repo/pulls/comments

By default, Review Comments are ordered by ascending ID.

Parameters

sort
Optional String created or updated
direction
Optional String asc or desc. Ignored without sort parameter.
since
Optional String of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
  {
    "url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
    "id": 1,
    "body": "Great stuff",
    "path": "file1.txt",
    "position": 4,
    "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    "user": {
      "login": "octocat",
      "id": 1,
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "somehexcode",
      "url": "https://api.github.com/users/octocat"
    },
    "created_at": "2011-04-14T16:00:49Z",
    "updated_at": "2011-04-14T16:00:49Z",
    "_links": {
      "self": {
        "href": "https://api.github.com/octocat/Hello-World/pulls/comments/1"
      },
      "html": {
        "href": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1"
      },
      "pull_request": {
        "href": "https://api.github.com/octocat/Hello-World/pulls/1"
      }
    }
  }
]

Get a single comment

GET /repos/:owner/:repo/pulls/comments/:number

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
  "id": 1,
  "body": "Great stuff",
  "path": "file1.txt",
  "position": 4,
  "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
  "user": {
    "login": "octocat",
    "id": 1,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "somehexcode",
    "url": "https://api.github.com/users/octocat"
  },
  "created_at": "2011-04-14T16:00:49Z",
  "updated_at": "2011-04-14T16:00:49Z",
  "_links": {
    "self": {
      "href": "https://api.github.com/octocat/Hello-World/pulls/comments/1"
    },
    "html": {
      "href": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1"
    },
    "pull_request": {
      "href": "https://api.github.com/octocat/Hello-World/pulls/1"
    }
  }
}

Create a comment

POST /repos/:owner/:repo/pulls/:number/comments

Input

body
Required string
commit_id
Required string - Sha of the commit to comment on.
path
Required string - Relative path of the file to comment on.
position
Required number - Line index in the diff to comment on.

Example

{
  "body": "Nice change",
  "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
  "path": "file1.txt",
  "position": 4
}

Alternative Input

Instead of passing commit_id, path, and position you can reply to an existing Pull Request Comment like this:

body
Required string
in_reply_to
Required number - Comment id to reply to.

Example

{
  "body": "Nice change",
  "in_reply_to": 4
}

Response

Status: 201 Created
Location: https://api.github.com/repos/:owner/:repo/pulls/comments/1
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
  "id": 1,
  "body": "Great stuff",
  "path": "file1.txt",
  "position": 4,
  "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
  "user": {
    "login": "octocat",
    "id": 1,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "somehexcode",
    "url": "https://api.github.com/users/octocat"
  },
  "created_at": "2011-04-14T16:00:49Z",
  "updated_at": "2011-04-14T16:00:49Z",
  "_links": {
    "self": {
      "href": "https://api.github.com/octocat/Hello-World/pulls/comments/1"
    },
    "html": {
      "href": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1"
    },
    "pull_request": {
      "href": "https://api.github.com/octocat/Hello-World/pulls/1"
    }
  }
}

Edit a comment

PATCH /repos/:owner/:repo/pulls/comments/:number

Input

body
Required string

Example

{
  "body": "Nice change"
}

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
  "id": 1,
  "body": "Great stuff",
  "path": "file1.txt",
  "position": 4,
  "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
  "user": {
    "login": "octocat",
    "id": 1,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "somehexcode",
    "url": "https://api.github.com/users/octocat"
  },
  "created_at": "2011-04-14T16:00:49Z",
  "updated_at": "2011-04-14T16:00:49Z",
  "_links": {
    "self": {
      "href": "https://api.github.com/octocat/Hello-World/pulls/comments/1"
    },
    "html": {
      "href": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1"
    },
    "pull_request": {
      "href": "https://api.github.com/octocat/Hello-World/pulls/1"
    }
  }
}

Delete a comment

DELETE /repos/:owner/:repo/pulls/comments/:number

Response

Status: 204 No Content
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999