← All tags

Pulls API Reference

Interact with GitHub Pull Requests.

27 endpoints tagged pulls, each listing its parameters and possible responses. Search or scroll the index below to jump to a specific endpoint.

No endpoints match your search.

List pull requests

GET /repos/{owner}/{repo}/pulls

Lists pull requests in a specified repository.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
statequerynoEither open, closed, or all to filter by state.
headquerynoFilter 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.
basequerynoFilter pulls by base branch name. Example: gh-pages.
sortquerynoWhat to sort results by. popularity will sort by the number of comments. long-running will sort by date created and will limit the results to pull requests that have been open for more than a month and have had activity within the past month.
directionquerynoThe direction of the sort. Default: desc when sort is created or sort is not specified, otherwise asc.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
422Validation failed, or the endpoint has been spammed.yes

Create a pull request

POST /repos/{owner}/{repo}/pulls

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.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
201Responseyes
403Forbiddenyes
422Validation failed, or the endpoint has been spammed.yes

List review comments in a repository

GET /repos/{owner}/{repo}/pulls/comments

Lists review comments for all pull requests in a repository. By default,

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
sortqueryno
directionquerynoThe direction to sort results. Ignored without sort parameter.
sincequerynoOnly show results that were last updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes

Get a review comment for a pull request

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

Provides details for a specified review comment.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
comment_idpathyesThe unique identifier of the comment.

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes

Update a review comment for a pull request

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

Edits the content of a specified review comment.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
comment_idpathyesThe unique identifier of the comment.

Responses

StatusDescriptionHas JSON body
200Responseyes

Delete a review comment for a pull request

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

Deletes a review comment.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
comment_idpathyesThe unique identifier of the comment.

Responses

StatusDescriptionHas JSON body
204Responseno
404Resource not foundyes

Get a pull request

GET /repos/{owner}/{repo}/pulls/{pull_number}

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.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.

Responses

StatusDescriptionHas JSON body
200Pass the appropriate media type to fetch diff and patch formats.yes
304Not modifiedno
404Resource not foundyes
406Unacceptableyes
500Internal Erroryes
503Service unavailableyes

Update a pull request

PATCH /repos/{owner}/{repo}/pulls/{pull_number}

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.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.

Responses

StatusDescriptionHas JSON body
200Responseyes
422Validation failed, or the endpoint has been spammed.yes
403Forbiddenyes

List review comments on a pull request

GET /repos/{owner}/{repo}/pulls/{pull_number}/comments

Lists all review comments for a specified pull request. By default, review comments

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.
sortquerynoThe property to sort the results by.
directionquerynoThe direction to sort results. Ignored without sort parameter.
sincequerynoOnly show results that were last updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes

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."

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.

Responses

StatusDescriptionHas JSON body
201Responseyes
422Validation failed, or the endpoint has been spammed.yes
403Forbiddenyes

Create a reply for a review comment

POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies

Creates a reply to a review comment for a pull request. For the comment_id, provide the ID of the review comment you are replying to. This must be the ID of a _top-level review comment_, not a reply to that comment. Replies to replies are not supported.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.
comment_idpathyesThe unique identifier of the comment.

Responses

StatusDescriptionHas JSON body
201Responseyes
404Resource not foundyes

List commits on a pull request

GET /repos/{owner}/{repo}/pulls/{pull_number}/commits

Lists a maximum of 250 commits for a pull request. To receive a complete

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes

List pull requests files

GET /repos/{owner}/{repo}/pulls/{pull_number}/files

Lists the files in a specified pull request.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
422Validation failed, or the endpoint has been spammed.yes
500Internal Erroryes
503Service unavailableyes

Check if a pull request has been merged

GET /repos/{owner}/{repo}/pulls/{pull_number}/merge

Checks if a pull request has been merged into the base branch. The HTTP status of the response indicates whether or not the pull request has been merged; the response body is empty.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.

Responses

StatusDescriptionHas JSON body
204Response if pull request has been mergedno
404Not Found if pull request has not been mergedno

Merge a pull request

PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge

Merges a pull request into the base branch.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.

Responses

StatusDescriptionHas JSON body
200if merge was successfulyes
405Method Not Allowed if merge cannot be performedyes
409Conflict if sha was provided and pull request head did not matchyes
422Validation failed, or the endpoint has been spammed.yes
403Forbiddenyes
404Resource not foundyes

Get all requested reviewers for a pull request

GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers

Gets the users or teams whose review is requested for a pull request. Once a requested reviewer submits a review, they are no longer considered a requested reviewer. Their review will instead be returned by the List reviews for a pull request operation.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.

Responses

StatusDescriptionHas JSON body
200Responseyes

Request reviewers for a pull request

POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers

Requests reviews for a pull request from a given set of users and/or teams.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.

Responses

StatusDescriptionHas JSON body
201Responseyes
422Unprocessable Entity if user is not a collaboratorno
403Forbiddenyes

Remove requested reviewers from a pull request

DELETE /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers

Removes review requests from a pull request for a given set of users and/or teams.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.

Responses

StatusDescriptionHas JSON body
200Responseyes
422Validation failed, or the endpoint has been spammed.yes

List reviews for a pull request

GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews

Lists all reviews for a specified pull request. The list of reviews returns in chronological order.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200The list of reviews returns in chronological order.yes

Create a review for a pull request

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

Creates a review on a specified pull request.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.

Responses

StatusDescriptionHas JSON body
200Responseyes
422Validation failed, or the endpoint has been spammed.yes
403Forbiddenyes

Get a review for a pull request

GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}

Retrieves a pull request review by its ID.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.
review_idpathyesThe unique identifier of the review.

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes

Update a review for a pull request

PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}

Updates the contents of a specified review summary comment.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.
review_idpathyesThe unique identifier of the review.

Responses

StatusDescriptionHas JSON body
200Responseyes
422Validation failed, or the endpoint has been spammed.yes

Delete a pending review for a pull request

DELETE /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}

Deletes a pull request review that has not been submitted. Submitted reviews cannot be deleted.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.
review_idpathyesThe unique identifier of the review.

Responses

StatusDescriptionHas JSON body
200Responseyes
422Validation failed, or the endpoint has been spammed.yes
404Resource not foundyes

List comments for a pull request review

GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments

Lists comments for a specific pull request review.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.
review_idpathyesThe unique identifier of the review.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes

Dismiss a review for a pull request

PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals

Dismisses a specified review on a pull request.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.
review_idpathyesThe unique identifier of the review.

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes
422Validation failed, or the endpoint has been spammed.yes

Submit a review for a pull request

POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events

Submits a pending review for a pull request. For more information about creating a pending review for a pull request, see "Create a review for a pull request."

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.
review_idpathyesThe unique identifier of the review.

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes
422Validation failed, or the endpoint has been spammed.yes
403Forbiddenyes

Update a pull request branch

PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch

Updates the pull request branch with the latest upstream changes by merging HEAD from the base branch into the pull request branch.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
pull_numberpathyesThe number that identifies the pull request.

Responses

StatusDescriptionHas JSON body
202Responseyes
422Validation failed, or the endpoint has been spammed.yes
403Forbiddenyes