Addon
Branch restrictions
Branching model
Commit statuses
Commits
Deployments
Downloads
Issue tracker
Pipelines
Projects
Pullrequests
Refs
Reports
Repositories
Snippets
Source
Ssh
Teams
Users
Webhooks
Workspaces
Other operations

Rate this page:

Pullrequests

Pull requests are a feature that makes it easier for developers to collaborate using Bitbucket. They provide a user-friendly web interface for discussing proposed changes before integrating them into the official project.

List pull requests for a user

GET /2.0/pullrequests/{selected_user}

Returns all pull requests authored by the specified user.

By default only open pull requests are returned. This can be controlled using the state query parameter. To retrieve pull requests that are in one of multiple states, repeat the state parameter for each individual state.

This endpoint also supports filtering and sorting of the results. See filtering and sorting for more details.

OAuth scopes required
pullrequest

Request

Path parameters
selected_user Required

string

This can either be the username of the pull request author, the author's UUID surrounded by curly-braces, for example: {account UUID}, or the author's Atlassian ID.

Query parameters
state

string

Only return pull requests that are in this state. This parameter can be repeated.

Valid values: MERGED, SUPERSEDED, OPEN, DECLINED

Example

1
2
3
4
curl --request GET \
  --url 'https://api.bitbucket.org/2.0/pullrequests/{selected_user}' \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Accept: application/json'

Responses

All pull requests authored by the specified user.

Content typeValue
application/json

Paginated Pull Requests

List pull requests that contain a commit

GET /2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/pullrequests

Returns a paginated list of all pull requests as part of which this commit was reviewed. Pull Request Commit Links app must be installed first before using this API; installation automatically occurs when 'Go to pull request' is clicked from the web interface for a commit's details.

OAuth scopes required
NONE

Request

Path parameters
workspace Required

string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces

repo_slug Required

string

The repository; either the UUID in curly braces, or the slug

commit Required

string

The SHA1 of the commit

Query parameters
page

integer

Which page to retrieve

Default: 1, Format: int32
pagelen

integer

How many pull requests to retrieve per page

Default: 30, Format: int32

Example

1
2
3
curl --request GET \
  --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/pullrequests' \
  --header 'Accept: application/json'

Responses

The paginated list of pull requests.

Content typeValue
application/json

Paginated Pull Requests

List default reviewers

GET /2.0/repositories/{workspace}/{repo_slug}/default-reviewers

Returns the repository's default reviewers. These are the users that are automatically added as reviewers on every new pull request that is created.

OAuth scopes required
pullrequest

Request

Path parameters
repo_slug Required

string

This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: {repository UUID}.

workspace Required

string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: {workspace UUID}.

Example

1
2
3
curl --request GET \
  --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/default-reviewers' \
  --header 'Authorization: Bearer <access_token>'

Responses

The paginated list of default reviewers

A schema has not been defined for this response code.

Get a default reviewer

GET /2.0/repositories/{workspace}/{repo_slug}/default-reviewers/{target_username}

Returns the specified reviewer. This can be used to test whether a user is among the repository's default reviewers list. A 404 indicates that that specified user is not a default reviewer.

OAuth scopes required
pullrequest

Request

Path parameters
repo_slug Required

string

This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: {repository UUID}.

target_username Required

string

This can either be the username or the UUID of the default reviewer, surrounded by curly-braces, for example: {account UUID}.

workspace Required

string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: {workspace UUID}.

Example

1
2
3
curl --request GET \
  --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/default-reviewers/{target_username}' \
  --header 'Authorization: Bearer <access_token>'

Responses

The specified user is a default reviewer

A schema has not been defined for this response code.

Add a user to the default reviewers

PUT /2.0/repositories/{workspace}/{repo_slug}/default-reviewers/{target_username}

Adds the specified user to the repository's list of default reviewers. This method is idempotent. Adding a user a second time has no effect.

OAuth scopes required
repository:admin

Request

Path parameters
repo_slug Required

string

This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: {repository UUID}.

target_username Required

string

This can either be the username or the UUID of the default reviewer, surrounded by curly-braces, for example: {account UUID}.

workspace Required

string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: {workspace UUID}.

Example

1
2
3
curl --request PUT \
  --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/default-reviewers/{target_username}' \
  --header 'Authorization: Bearer <access_token>'

Responses

The specified user was successfully added to the default reviewers

A schema has not been defined for this response code.

Remove a user from the default reviewers

DELETE /2.0/repositories/{workspace}/{repo_slug}/default-reviewers/{target_username}

Removes a default reviewer from the repository.

OAuth scopes required
repository:admin

Request

Path parameters
repo_slug Required

string

This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: {repository UUID}.

target_username Required

string

This can either be the username or the UUID of the default reviewer, surrounded by curly-braces, for example: {account UUID}.

workspace Required

string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: {workspace UUID}.

Example

1
2
3
curl --request DELETE \
  --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/default-reviewers/{target_username}' \
  --header 'Authorization: Bearer <access_token>'

Responses

The specified user successfully removed from the default reviewers

List pull requests

GET /2.0/repositories/{workspace}/{repo_slug}/pullrequests</