GitHub v3 REST API

List pull requests

Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see GitHub’s products in the GitHub Help documentation.

get
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/pulls

Query Parameters

statestring

Either open, closed, or all to filter by state.

Allowed values:openclosedall

Default:open

headstring

Filter pulls by head user or head organization and branch name in the format of user:ref-name or organization:ref-name. For example: github:new-script-format or octocat:test-branch.

basestring

Filter pulls by base branch name. Example: gh-pages.

sortstring

What to sort results by. Can be either created, updated, popularity (comment count) or long-running (age, filtering by pulls updated in the last month).

Allowed values:createdupdatedpopularitylong-running

Default:created

directionstring

The direction of the sort. Can be either asc or desc. Default: desc when sort is created or sort is not specified, otherwise asc.

Allowed values:ascdesc

per_pageinteger

Results per page (max 100)

Default:30

pageinteger

Page number of the results to fetch.

Default:1

Path Parameters

ownerstringrequired
repostringrequired

Response

application/json

Response

Pull Request Simple

urlstring(uri)required

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

idintegerrequired

Example:1

node_idstringrequired

Example:MDExOlB1bGxSZXF1ZXN0MQ==

html_urlstring(uri)required

Example:https://github.com/octocat/Hello-World/pull/1347

diff_urlstring(uri)required

Example:https://github.com/octocat/Hello-World/pull/1347.diff

patch_urlstring(uri)required

Example:https://github.com/octocat/Hello-World/pull/1347.patch

issue_urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/issues/1347

commits_urlstring(uri)required

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

review_comments_urlstring(uri)required

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

review_comment_urlstringrequired

Example:https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}

comments_urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/issues/1347/comments

statuses_urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e

numberintegerrequired

Example:1347

statestringrequired

Example:open

lockedbooleanrequired

Example:true

titlestringrequired

Example:new-feature

userobject | nullrequired

Simple User

Show Child Parameters
bodystring | nullrequired

Example:Please pull these awesome changes

labelsarray[object]required
Show Child Parameters
milestoneobject | nullrequired

A collection of related issues and pull requests.

Show Child Parameters
active_lock_reasonstring | null

Example:too heated

created_atstring(date-time)required

Example:2011-01-26T19:01:12Z

updated_atstring(date-time)required

Example:2011-01-26T19:01:12Z

closed_atstring | null(date-time)required

Example:2011-01-26T19:01:12Z

merged_atstring | null(date-time)required

Example:2011-01-26T19:01:12Z

merge_commit_shastring | nullrequired

Example:e5bd3914e2e596debea16f433f57875b5b90bcd6

assigneeobject | nullrequired

Simple User

Show Child Parameters
assigneesarray | null[object]

Simple User

Show Child Parameters
requested_reviewersarray | null[object]

Simple User

Show Child Parameters
requested_teamsarray | null[object]

Groups of organization members that gives permissions on specified repositories.

Show Child Parameters
headobjectrequired
Show Child Parameters
baseobjectrequired
Show Child Parameters
_linksobjectrequired
Show Child Parameters
author_associationstringrequired

How the author is associated with the repository.

Allowed values:COLLABORATORCONTRIBUTORFIRST_TIMERFIRST_TIME_CONTRIBUTORMANNEQUINMEMBERNONEOWNER

Example:OWNER

draftboolean

Indicates whether or not the pull request is a draft.

Example:false

get/repos/{owner}/{repo}/pulls
 
application/json

Create a pull request

Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see GitHub’s products in the GitHub Help documentation.

To open or update a pull request in a public repository, you must have write access to the head or the source branch. For organization-owned repositories, you must be a member of the organization that owns the repository to open or update a pull request.

You can create a new pull request.

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. See “Secondary rate limits” and “Dealing with secondary rate limits” for details.

post
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/pulls

Path Parameters

ownerstringrequired
repostringrequired

Body

application/json
titlestring

The title of the new pull request.

headstringrequired

The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace head with a user like this: username:branch.

basestringrequired

The name of the branch you want the changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repository that requests a merge to a base of another repository.

bodystring

The contents of the pull request.

maintainer_can_modifyboolean

Indicates whether maintainers can modify the pull request.

draftboolean

Indicates whether the pull request is a draft. See “Draft Pull Requests” in the GitHub Help documentation to learn more.

issueinteger

Example:1

Response

application/json

Response

Pull Request

Pull requests let you tell others about changes you’ve pushed to a repository on GitHub. Once a pull request is sent, interested parties can review the set of changes, discuss potential modifications, and even push follow-up commits if necessary.

urlstring(uri)required

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

idintegerrequired

Example:1

node_idstringrequired

Example:MDExOlB1bGxSZXF1ZXN0MQ==

html_urlstring(uri)required

Example:https://github.com/octocat/Hello-World/pull/1347

diff_urlstring(uri)required

Example:https://github.com/octocat/Hello-World/pull/1347.diff

patch_urlstring(uri)required

Example:https://github.com/octocat/Hello-World/pull/1347.patch

issue_urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/issues/1347

commits_urlstring(uri)required

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

review_comments_urlstring(uri)required

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

review_comment_urlstringrequired

Example:https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}

comments_urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/issues/1347/comments

statuses_urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e

numberintegerrequired

Number uniquely identifying the pull request within its repository.

Example:42

statestringrequired

State of this Pull Request. Either open or closed.

Allowed values:openclosed

Example:open

lockedbooleanrequired

Example:true

titlestringrequired

The title of the pull request.

Example:Amazing new feature

userobject | nullrequired

Simple User

Show Child Parameters
bodystring | nullrequired

Example:Please pull these awesome changes

labelsarray[object]required
Show Child Parameters
milestoneobject | nullrequired

A collection of related issues and pull requests.

Show Child Parameters
active_lock_reasonstring | null

Example:too heated

created_atstring(date-time)required

Example:2011-01-26T19:01:12Z

updated_atstring(date-time)required

Example:2011-01-26T19:01:12Z

closed_atstring | null(date-time)required

Example:2011-01-26T19:01:12Z

merged_atstring | null(date-time)required

Example:2011-01-26T19:01:12Z

merge_commit_shastring | nullrequired

Example:e5bd3914e2e596debea16f433f57875b5b90bcd6

assigneeobject | nullrequired

Simple User

Show Child Parameters
assigneesarray | null[object]

Simple User

Show Child Parameters
requested_reviewersarray | null[object]

Simple User

Show Child Parameters
requested_teamsarray | null[object]

Groups of organization members that gives permissions on specified repositories.

Show Child Parameters
headobjectrequired
Show Child Parameters
baseobjectrequired
Show Child Parameters
_linksobjectrequired
Show Child Parameters
author_associationstringrequired

How the author is associated with the repository.

Allowed values:COLLABORATORCONTRIBUTORFIRST_TIMERFIRST_TIME_CONTRIBUTORMANNEQUINMEMBERNONEOWNER

Example:OWNER

draftboolean

Indicates whether or not the pull request is a draft.

Example:false

mergedbooleanrequired
mergeableboolean | nullrequired

Example:true

rebaseableboolean | null

Example:true

mergeable_statestringrequired

Example:clean

merged_byobject | nullrequired

Simple User

Show Child Parameters
commentsintegerrequired

Example:10

review_commentsintegerrequired

Example:0

maintainer_can_modifybooleanrequired

Indicates whether maintainers can modify the pull request.

Example:true

commitsintegerrequired

Example:3

additionsintegerrequired

Example:100

deletionsintegerrequired

Example:3

changed_filesintegerrequired

Example:5

post/repos/{owner}/{repo}/pulls

Body

{ "title": "Amazing new feature", "body": "Please pull these awesome changes in!", "head": "octocat:new-feature", "base": "master" }
 
application/json

List review comments in a repository

Lists review comments for all pull requests in a repository. By default, review comments are in ascending order by ID.

get
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/pulls/comments

Query Parameters

sortstring

Allowed values:createdupdatedcreated_at

directionstring

Can be either asc or desc. Ignored without sort parameter.

Allowed values:ascdesc

sincestring(date-time)

Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

per_pageinteger

Results per page (max 100)

Default:30

pageinteger

Page number of the results to fetch.

Default:1

Path Parameters

ownerstringrequired
repostringrequired

Response

200 application/json

Response

Pull Request Review Comments are comments on a portion of the Pull Request’s diff.

urlstringrequired

URL for the pull request review comment

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

pull_request_review_idinteger | nullrequired

The ID of the pull request review to which the comment belongs.

Example:42

idintegerrequired

The ID of the pull request review comment.

Example:1

node_idstringrequired

The node ID of the pull request review comment.

Example:MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDEw

diff_hunkstringrequired

The diff of the line that the comment refers to.

Example:@@ -16,33 +16,40 @@ public class Connection : IConnection...

pathstringrequired

The relative path of the file to which the comment applies.

Example:config/database.yaml

positionintegerrequired

The line index in the diff to which the comment applies.

Example:1

original_positionintegerrequired

The index of the original line in the diff to which the comment applies.

Example:4

commit_idstringrequired

The SHA of the commit to which the comment applies.

Example:6dcb09b5b57875f334f61aebed695e2e4193db5e

original_commit_idstringrequired

The SHA of the original commit to which the comment applies.

Example:9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840

in_reply_to_idinteger

The comment ID to reply to.

Example:8

userobjectrequired

Simple User

Show Child Parameters
bodystringrequired

The text of the comment.

Example:We should probably include a check for null values here.

created_atstring(date-time)required

Example:2011-04-14T16:00:49Z

updated_atstring(date-time)required

Example:2011-04-14T16:00:49Z

html_urlstring(uri)required

HTML URL for the pull request review comment.

Example:https://github.com/octocat/Hello-World/pull/1#discussion-diff-1

pull_request_urlstring(uri)required

URL for the pull request that the review comment belongs to.

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

author_associationstringrequired

How the author is associated with the repository.

Allowed values:COLLABORATORCONTRIBUTORFIRST_TIMERFIRST_TIME_CONTRIBUTORMANNEQUINMEMBERNONEOWNER

Example:OWNER

_linksobjectrequired
Show Child Parameters
start_lineinteger | null

The first line of the range for a multi-line comment.

Example:2

original_start_lineinteger | null

The first line of the range for a multi-line comment.

Example:2

start_sidestring | null

The side of the first line of the range for a multi-line comment.

Allowed values:LEFTRIGHT

Default:RIGHT

lineinteger

The line of the blob to which the comment applies. The last line of the range for a multi-line comment

Example:2

original_lineinteger

The line of the blob to which the comment applies. The last line of the range for a multi-line comment

Example:2

sidestring

The side of the diff to which the comment applies. The side of the last line of the range for a multi-line comment

Allowed values:LEFTRIGHT

Default:RIGHT

reactionsobject
Show Child Parameters
body_htmlstring

Example:"<p>comment body</p>"

body_textstring

Example:"comment body"

get/repos/{owner}/{repo}/pulls/comments
 
200 application/json

Get a review comment for a pull request

Provides details for a review comment.

get
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/pulls/comments/{comment_id}

Path Parameters

ownerstringrequired
repostringrequired
comment_idintegerrequired

comment_id parameter

Response

application/json

Response

Pull Request Review Comment

Pull Request Review Comments are comments on a portion of the Pull Request’s diff.

urlstringrequired

URL for the pull request review comment

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

pull_request_review_idinteger | nullrequired

The ID of the pull request review to which the comment belongs.

Example:42

idintegerrequired

The ID of the pull request review comment.

Example:1

node_idstringrequired

The node ID of the pull request review comment.

Example:MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDEw

diff_hunkstringrequired

The diff of the line that the comment refers to.

Example:@@ -16,33 +16,40 @@ public class Connection : IConnection...

pathstringrequired

The relative path of the file to which the comment applies.

Example:config/database.yaml

positionintegerrequired

The line index in the diff to which the comment applies.

Example:1

original_positionintegerrequired

The index of the original line in the diff to which the comment applies.

Example:4

commit_idstringrequired

The SHA of the commit to which the comment applies.

Example:6dcb09b5b57875f334f61aebed695e2e4193db5e

original_commit_idstringrequired

The SHA of the original commit to which the comment applies.

Example:9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840

in_reply_to_idinteger

The comment ID to reply to.

Example:8

userobjectrequired

Simple User

Show Child Parameters
bodystringrequired

The text of the comment.

Example:We should probably include a check for null values here.

created_atstring(date-time)required

Example:2011-04-14T16:00:49Z

updated_atstring(date-time)required

Example:2011-04-14T16:00:49Z

html_urlstring(uri)required

HTML URL for the pull request review comment.

Example:https://github.com/octocat/Hello-World/pull/1#discussion-diff-1

pull_request_urlstring(uri)required

URL for the pull request that the review comment belongs to.

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

author_associationstringrequired

How the author is associated with the repository.

Allowed values:COLLABORATORCONTRIBUTORFIRST_TIMERFIRST_TIME_CONTRIBUTORMANNEQUINMEMBERNONEOWNER

Example:OWNER

_linksobjectrequired
Show Child Parameters
start_lineinteger | null

The first line of the range for a multi-line comment.

Example:2

original_start_lineinteger | null

The first line of the range for a multi-line comment.

Example:2

start_sidestring | null

The side of the first line of the range for a multi-line comment.

Allowed values:LEFTRIGHT

Default:RIGHT

lineinteger

The line of the blob to which the comment applies. The last line of the range for a multi-line comment

Example:2

original_lineinteger

The line of the blob to which the comment applies. The last line of the range for a multi-line comment

Example:2

sidestring

The side of the diff to which the comment applies. The side of the last line of the range for a multi-line comment

Allowed values:LEFTRIGHT

Default:RIGHT

reactionsobject
Show Child Parameters
body_htmlstring

Example:"<p>comment body</p>"

body_textstring

Example:"comment body"

get/repos/{owner}/{repo}/pulls/comments/{comment_id}
 
application/json

Update a review comment for a pull request

Enables you to edit a review comment.

patch
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/pulls/comments/{comment_id}

Path Parameters

ownerstringrequired
repostringrequired
comment_idintegerrequired

comment_id parameter

Body

application/json
bodystringrequired

The text of the reply to the review comment.

Response

200 application/json

Response

Pull Request Review Comment

Pull Request Review Comments are comments on a portion of the Pull Request’s diff.

urlstringrequired

URL for the pull request review comment

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

pull_request_review_idinteger | nullrequired

The ID of the pull request review to which the comment belongs.

Example:42

idintegerrequired

The ID of the pull request review comment.

Example:1

node_idstringrequired

The node ID of the pull request review comment.

Example:MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDEw

diff_hunkstringrequired

The diff of the line that the comment refers to.

Example:@@ -16,33 +16,40 @@ public class Connection : IConnection...

pathstringrequired

The relative path of the file to which the comment applies.

Example:config/database.yaml

positionintegerrequired

The line index in the diff to which the comment applies.

Example:1

original_positionintegerrequired

The index of the original line in the diff to which the comment applies.

Example:4

commit_idstringrequired

The SHA of the commit to which the comment applies.

Example:6dcb09b5b57875f334f61aebed695e2e4193db5e

original_commit_idstringrequired

The SHA of the original commit to which the comment applies.

Example:9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840

in_reply_to_idinteger

The comment ID to reply to.

Example:8

userobjectrequired

Simple User

Show Child Parameters
bodystringrequired

The text of the comment.

Example:We should probably include a check for null values here.

created_atstring(date-time)required

Example:2011-04-14T16:00:49Z

updated_atstring(date-time)required

Example:2011-04-14T16:00:49Z

html_urlstring(uri)required

HTML URL for the pull request review comment.

Example:https://github.com/octocat/Hello-World/pull/1#discussion-diff-1

pull_request_urlstring(uri)required

URL for the pull request that the review comment belongs to.

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

author_associationstringrequired

How the author is associated with the repository.

Allowed values:COLLABORATORCONTRIBUTORFIRST_TIMERFIRST_TIME_CONTRIBUTORMANNEQUINMEMBERNONEOWNER

Example:OWNER

_linksobjectrequired
Show Child Parameters
start_lineinteger | null

The first line of the range for a multi-line comment.

Example:2

original_start_lineinteger | null

The first line of the range for a multi-line comment.

Example:2

start_sidestring | null

The side of the first line of the range for a multi-line comment.

Allowed values:LEFTRIGHT

Default:RIGHT

lineinteger

The line of the blob to which the comment applies. The last line of the range for a multi-line comment

Example:2

original_lineinteger

The line of the blob to which the comment applies. The last line of the range for a multi-line comment

Example:2

sidestring

The side of the diff to which the comment applies. The side of the last line of the range for a multi-line comment

Allowed values:LEFTRIGHT

Default:RIGHT

reactionsobject
Show Child Parameters
body_htmlstring

Example:"<p>comment body</p>"

body_textstring

Example:"comment body"

patch/repos/{owner}/{repo}/pulls/comments/{comment_id}

Body

{ "body": "I like this too!" }
 
200 application/json